From 3f3a19aa8a71106f30e7d01f838863c5c555f55d Mon Sep 17 00:00:00 2001 From: Adrien Piquerez Date: Mon, 10 Mar 2025 11:29:33 +0100 Subject: [PATCH 1/2] Disable cache require clean on CI --- project/Build.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/project/Build.scala b/project/Build.scala index b61a0445753b..ab4d2960774c 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -349,6 +349,7 @@ object Build { buildCache .withLocal(buildCache.local.withEnabled(true).withStoreEnabled(true)) .withRemote(buildCache.remote.withEnabled(true).withStoreEnabled(isInsideCI)) + .withRequireClean(!isInsideCI) ) .withTestRetry( config.testRetry From 16d70cb2e9d221550f46af57c1a455f30504a9cd Mon Sep 17 00:00:00 2001 From: Adrien Piquerez Date: Tue, 11 Mar 2025 12:22:58 +0100 Subject: [PATCH 2/2] Use full compiler classpath as cache input of bootstrapped compilation --- project/Build.scala | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/project/Build.scala b/project/Build.scala index ab4d2960774c..4927fe131a74 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -6,6 +6,8 @@ import ScaladocGeneration._ import com.jsuereth.sbtpgp.PgpKeys import sbt.Keys.* import sbt.* +import sbt.nio.FileStamper +import sbt.nio.Keys.* import complete.DefaultParsers._ import pl.project13.scala.sbt.JmhPlugin import pl.project13.scala.sbt.JmhPlugin.JmhKeys.Jmh @@ -279,6 +281,8 @@ object Build { val fetchScalaJSSource = taskKey[File]("Fetch the sources of Scala.js") + val extraDevelocityCacheInputFiles = taskKey[Seq[Path]]("Extra input files for caching") + lazy val SourceDeps = config("sourcedeps") // Settings shared by the build (scoped in ThisBuild). Used in build.sbt @@ -362,6 +366,8 @@ object Build { // Deactivate Develocity's test caching because it caches all tests or nothing. // Also at the moment, it does not take compilation files as inputs. Test / develocityBuildCacheClient := None, + extraDevelocityCacheInputFiles := Seq.empty, + extraDevelocityCacheInputFiles / outputFileStamper := FileStamper.Hash, ) // Settings shared globally (scoped in Global). Used in build.sbt @@ -442,7 +448,17 @@ object Build { Compile / packageBin / packageOptions += Package.ManifestAttributes( "Automatic-Module-Name" -> s"${dottyOrganization.replaceAll("-",".")}.${moduleName.value.replaceAll("-",".")}" - ) + ), + + // add extraDevelocityCacheInputFiles in cache key components + Compile / compile / buildcache.develocityTaskCacheKeyComponents += + (Compile / extraDevelocityCacheInputFiles / outputFileStamps).taskValue, + Test / test / buildcache.develocityTaskCacheKeyComponents += + (Test / extraDevelocityCacheInputFiles / outputFileStamps).taskValue, + Test / testOnly / buildcache.develocityInputTaskCacheKeyComponents += + (Test / extraDevelocityCacheInputFiles / outputFileStamps).taskValue, + Test / testQuick / buildcache.develocityInputTaskCacheKeyComponents += + (Test / extraDevelocityCacheInputFiles / outputFileStamps).taskValue ) // Settings used for projects compiled only with Java @@ -611,8 +627,8 @@ object Build { }, Compile / doc / scalacOptions ++= scalacOptionsDocSettings(), // force recompilation of bootstrapped modules when the compiler changes - Compile / compile / buildcache.develocityTaskCacheKeyComponents += - (`scala3-compiler` / Compile / compile / buildcache.develocityTaskCacheKey).taskValue + Compile / extraDevelocityCacheInputFiles ++= + (`scala3-compiler` / Compile / fullClasspathAsJars).value.map(_.data.toPath) ) lazy val commonBenchmarkSettings = Seq(