Skip to content

Commit 16d70cb

Browse files
committed
Use full compiler classpath as cache input of bootstrapped compilation
1 parent 3f3a19a commit 16d70cb

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

project/Build.scala

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import ScaladocGeneration._
66
import com.jsuereth.sbtpgp.PgpKeys
77
import sbt.Keys.*
88
import sbt.*
9+
import sbt.nio.FileStamper
10+
import sbt.nio.Keys.*
911
import complete.DefaultParsers._
1012
import pl.project13.scala.sbt.JmhPlugin
1113
import pl.project13.scala.sbt.JmhPlugin.JmhKeys.Jmh
@@ -279,6 +281,8 @@ object Build {
279281

280282
val fetchScalaJSSource = taskKey[File]("Fetch the sources of Scala.js")
281283

284+
val extraDevelocityCacheInputFiles = taskKey[Seq[Path]]("Extra input files for caching")
285+
282286
lazy val SourceDeps = config("sourcedeps")
283287

284288
// Settings shared by the build (scoped in ThisBuild). Used in build.sbt
@@ -362,6 +366,8 @@ object Build {
362366
// Deactivate Develocity's test caching because it caches all tests or nothing.
363367
// Also at the moment, it does not take compilation files as inputs.
364368
Test / develocityBuildCacheClient := None,
369+
extraDevelocityCacheInputFiles := Seq.empty,
370+
extraDevelocityCacheInputFiles / outputFileStamper := FileStamper.Hash,
365371
)
366372

367373
// Settings shared globally (scoped in Global). Used in build.sbt
@@ -442,7 +448,17 @@ object Build {
442448
Compile / packageBin / packageOptions +=
443449
Package.ManifestAttributes(
444450
"Automatic-Module-Name" -> s"${dottyOrganization.replaceAll("-",".")}.${moduleName.value.replaceAll("-",".")}"
445-
)
451+
),
452+
453+
// add extraDevelocityCacheInputFiles in cache key components
454+
Compile / compile / buildcache.develocityTaskCacheKeyComponents +=
455+
(Compile / extraDevelocityCacheInputFiles / outputFileStamps).taskValue,
456+
Test / test / buildcache.develocityTaskCacheKeyComponents +=
457+
(Test / extraDevelocityCacheInputFiles / outputFileStamps).taskValue,
458+
Test / testOnly / buildcache.develocityInputTaskCacheKeyComponents +=
459+
(Test / extraDevelocityCacheInputFiles / outputFileStamps).taskValue,
460+
Test / testQuick / buildcache.develocityInputTaskCacheKeyComponents +=
461+
(Test / extraDevelocityCacheInputFiles / outputFileStamps).taskValue
446462
)
447463

448464
// Settings used for projects compiled only with Java
@@ -611,8 +627,8 @@ object Build {
611627
},
612628
Compile / doc / scalacOptions ++= scalacOptionsDocSettings(),
613629
// force recompilation of bootstrapped modules when the compiler changes
614-
Compile / compile / buildcache.develocityTaskCacheKeyComponents +=
615-
(`scala3-compiler` / Compile / compile / buildcache.develocityTaskCacheKey).taskValue
630+
Compile / extraDevelocityCacheInputFiles ++=
631+
(`scala3-compiler` / Compile / fullClasspathAsJars).value.map(_.data.toPath)
616632
)
617633

618634
lazy val commonBenchmarkSettings = Seq(

0 commit comments

Comments
 (0)