Unify calculation of remoteCacheId and remoteCacheIdCandidates

This commit is contained in:
Maksim Ochenashko 2020-06-16 09:15:42 +03:00
parent c07de68cf5
commit 3e8073151b
1 changed files with 3 additions and 2 deletions

View File

@ -26,16 +26,17 @@ import sbt.util.Logger
object RemoteCache { object RemoteCache {
final val cachedCompileClassifier = "cached-compile" final val cachedCompileClassifier = "cached-compile"
final val cachedTestClasifier = "cached-test" final val cachedTestClasifier = "cached-test"
final val commitLength = 10
def gitCommitId: String = def gitCommitId: String =
scala.sys.process.Process("git rev-parse --short HEAD").!!.trim scala.sys.process.Process("git rev-parse HEAD").!!.trim.take(commitLength)
def gitCommitIds(n: Int): List[String] = def gitCommitIds(n: Int): List[String] =
scala.sys.process scala.sys.process
.Process("git log -n " + n.toString + " --format=%H") .Process("git log -n " + n.toString + " --format=%H")
.!! .!!
.linesIterator .linesIterator
.toList .toList
.map(_.take(10)) .map(_.take(commitLength))
lazy val globalSettings: Seq[Def.Setting[_]] = Seq( lazy val globalSettings: Seq[Def.Setting[_]] = Seq(
remoteCacheId := gitCommitId, remoteCacheId := gitCommitId,