Skip to content

Commit 874d8a5

Browse files
committed
Use develocity build cache in PRs and local builds
Ported from open-telemetry/opentelemetry-java-instrumentation#15579
1 parent 6abef94 commit 874d8a5

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

settings.gradle.kts

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,19 @@ val develocityServer = "https://develocity.opentelemetry.io"
2929
val isCI = System.getenv("CI") != null
3030
val develocityAccessKey = System.getenv("DEVELOCITY_ACCESS_KEY") ?: ""
3131

32-
// if develocity access key is not given and we are in CI, then we publish to scans.gradle.com
33-
val useScansGradleCom = isCI && develocityAccessKey.isEmpty()
34-
3532
develocity {
36-
if (useScansGradleCom) {
37-
buildScan {
38-
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
39-
termsOfUseAgree = "yes"
40-
}
41-
} else {
33+
if (develocityAccessKey.isNotEmpty()) {
4234
server = develocityServer
43-
buildScan {
44-
publishing.onlyIf { it.isAuthenticated }
45-
}
4635
}
4736

4837
buildScan {
49-
uploadInBackground = !isCI
38+
if (develocityAccessKey.isNotEmpty()) {
39+
} else if (isCI) {
40+
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
41+
termsOfUseAgree = "yes"
42+
} else {
43+
publishing.onlyIf { false }
44+
}
5045

5146
capture {
5247
fileFingerprints = true
@@ -60,11 +55,10 @@ develocity {
6055
}
6156
}
6257

63-
if (!useScansGradleCom) {
64-
buildCache {
65-
remote(develocity.buildCache) {
66-
isPush = isCI && develocityAccessKey.isNotEmpty()
67-
}
58+
buildCache {
59+
remote(HttpBuildCache::class) {
60+
url = uri("$develocityServer/cache/")
61+
isPush = isCI && develocityAccessKey.isNotEmpty()
6862
}
6963
}
7064

0 commit comments

Comments
 (0)