Skip to content

Commit 00e8373

Browse files
committed
Use develocity build cache in PRs and local builds
Ported from open-telemetry/opentelemetry-java-instrumentation#15579
1 parent bb9bf63 commit 00e8373

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

settings.gradle.kts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,36 @@ val develocityServer = "https://develocity.opentelemetry.io"
1818
val isCI = System.getenv("CI") != null
1919
val develocityAccessKey = System.getenv("DEVELOCITY_ACCESS_KEY") ?: ""
2020

21-
// if develocity access key is not given and we are in CI, then we publish to scans.gradle.com
22-
val useScansGradleCom = isCI && develocityAccessKey.isEmpty()
23-
2421
develocity {
25-
if (useScansGradleCom) {
26-
buildScan {
27-
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
28-
termsOfUseAgree = "yes"
29-
}
30-
} else {
22+
if (develocityAccessKey.isNotEmpty()) {
3123
server = develocityServer
32-
buildScan {
33-
publishing.onlyIf { it.isAuthenticated }
34-
}
3524
}
3625

3726
buildScan {
38-
uploadInBackground = !isCI
27+
if (develocityAccessKey.isNotEmpty()) {
28+
} else if (isCI) {
29+
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
30+
termsOfUseAgree = "yes"
31+
} else {
32+
publishing.onlyIf { false }
33+
}
3934

4035
capture {
4136
fileFingerprints = true
4237
}
38+
39+
buildScanPublished {
40+
File("build-scan.txt").printWriter().use { writer ->
41+
writer.println(buildScanUri)
42+
}
43+
}
4344
}
4445
}
4546

46-
if (!useScansGradleCom) {
47-
buildCache {
48-
remote(develocity.buildCache) {
49-
isPush = isCI && develocityAccessKey.isNotEmpty()
50-
}
47+
buildCache {
48+
remote(HttpBuildCache::class) {
49+
url = uri("$develocityServer/cache/")
50+
isPush = isCI && develocityAccessKey.isNotEmpty()
5151
}
5252
}
5353

0 commit comments

Comments
 (0)