Skip to content

Commit 08acbca

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

File tree

2 files changed

+14
-21
lines changed

2 files changed

+14
-21
lines changed

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ bin
5454

5555
.gitpod.yml
5656

57-
# Gradle build scans
58-
build-scan.txt
59-
6057
# Node
6158
node_modules
59+
60+
build-scan.txt

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)