Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activate Develocity's Build Cache #22523

Merged
merged 7 commits into from
Mar 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions project/Build.scala
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ import complete.DefaultParsers._
import pl.project13.scala.sbt.JmhPlugin
import pl.project13.scala.sbt.JmhPlugin.JmhKeys.Jmh
import com.gradle.develocity.agent.sbt.DevelocityPlugin.autoImport._
import com.gradle.develocity.agent.sbt.api.experimental.buildcache
import com.typesafe.sbt.packager.Keys._
import com.typesafe.sbt.packager.MappingsHelper.directory
import com.typesafe.sbt.packager.universal.UniversalPlugin
@@ -339,24 +340,27 @@ object Build {
buildScan
.withPublishing(Publishing.onlyIf(_.authenticated))
.withBackgroundUpload(!isInsideCI)
.tag(if (isInsideCI) "CI" else "Local")
.withTag(if (isInsideCI) "CI" else "Local")
.withLinks(buildScan.links ++ GithubEnv.develocityLinks)
.withValues(buildScan.values ++ GithubEnv.develocityValues)
.withObfuscation(buildScan.obfuscation.withIpAddresses(_.map(_ => "0.0.0.0")))
)
.withBuildCache(
buildCache
.withLocal(buildCache.local.withEnabled(false))
.withRemote(buildCache.remote.withEnabled(false))
.withLocal(buildCache.local.withEnabled(true).withStoreEnabled(true))
.withRemote(buildCache.remote.withEnabled(true).withStoreEnabled(isInsideCI))
)
.withTestRetryConfiguration(
config.testRetryConfiguration
.withTestRetry(
config.testRetry
.withFlakyTestPolicy(FlakyTestPolicy.Fail)
.withMaxRetries(if (isInsideCI) 1 else 0)
.withMaxFailures(10)
.withClassesFilter((className, _) => !noRetryTestClasses.contains(className))
)
}
},
// 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,
)

// Settings shared globally (scoped in Global). Used in build.sbt
@@ -604,7 +608,10 @@ object Build {
assert(docScalaInstance.loaderCompilerOnly == base.loaderCompilerOnly)
docScalaInstance
},
Compile / doc / scalacOptions ++= scalacOptionsDocSettings()
Compile / doc / scalacOptions ++= scalacOptionsDocSettings(),
// force recompilation of bootstrapped modules when the compiler changes
Compile / compile / buildcache.develocityTaskCacheKeyComponents +=
(`scala3-compiler` / Compile / compile / buildcache.develocityTaskCacheKey).taskValue
)

lazy val commonBenchmarkSettings = Seq(
@@ -1015,10 +1022,6 @@ object Build {
sjsSources
} (Set(scalaJSIRSourcesJar)).toSeq
}.taskValue,

// Develocity's Build Cache does not work with our compilation tests
// at the moment: it does not take compilation files as inputs.
Test / develocityBuildCacheClient := None,
)

def insertClasspathInArgs(args: List[String], cp: String): List[String] = {
@@ -1117,7 +1120,7 @@ object Build {
libraryDependencies += "org.scala-lang" % "scala-library" % stdlibVersion,
(Compile / scalacOptions) ++= Seq(
// Needed so that the library sources are visible when `dotty.tools.dotc.core.Definitions#init` is called
"-sourcepath", (Compile / sourceDirectories).value.map(_.getAbsolutePath).distinct.mkString(File.pathSeparator),
"-sourcepath", (Compile / sourceDirectories).value.map(_.getCanonicalPath).distinct.mkString(File.pathSeparator),
"-Yexplicit-nulls",
),
(Compile / doc / scalacOptions) ++= ScaladocConfigs.DefaultGenerationSettings.value.settings,
7 changes: 6 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -22,4 +22,9 @@ addSbtPlugin("ch.epfl.scala" % "sbt-tasty-mima" % "1.0.0")

addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.10.0")

addSbtPlugin("com.gradle" % "sbt-develocity" % "1.1.1")
addSbtPlugin("com.gradle" % "sbt-develocity" % "1.1.2")

resolvers +=
"Develocity Artifactory" at "https://repo.grdev.net/artifactory/public/"

addSbtPlugin("com.gradle" % "sbt-develocity" % "1.2-rc-2")