mirror of https://github.com/sbt/sbt.git
shorten default hash suffix for project ID
This commit is contained in:
parent
f7cb85d36e
commit
555b1c04a4
|
|
@ -29,7 +29,7 @@ trait Plugin
|
|||
object Build
|
||||
{
|
||||
val default: Build = new Build { override def projectDefinitions(base: File) = defaultProject(base) :: Nil }
|
||||
def defaultID(base: File): String = "default-" + Hash.halfHashString(base.getAbsolutePath)
|
||||
def defaultID(base: File): String = "default-" + Hash.trimHashString(base.getAbsolutePath, 6)
|
||||
def defaultProject(base: File): Project = Project(defaultID(base), base).settings(Keys.organization := "default")
|
||||
|
||||
def data[T](in: Seq[Attributed[T]]): Seq[T] = in.map(_.data)
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ object Hash
|
|||
array
|
||||
}
|
||||
def halve(s: String): String = if(s.length > 3) s.substring(0, s.length / 2) else s
|
||||
def trimHashString(s: String, i: Int): String = toHex(apply(s)).take(i)
|
||||
def halfHashString(s: String): String = halve(toHex(apply(s)))
|
||||
|
||||
/** Calculates the SHA-1 hash of the given String.*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue