Skip to content

Commit 82942c2

Browse files
authored
Use develocity build cache in PRs and local builds (#15579)
1 parent 4271fe9 commit 82942c2

File tree

2 files changed

+14
-22
lines changed

2 files changed

+14
-22
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,4 @@ replay_pid*
6161
.telemetry*
6262
.lycheecache
6363

64-
!java-agent/benchmark/releases/*.jar
65-
64+
build-scan.txt

settings.gradle.kts

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,30 +52,24 @@ val develocityServer = "https://develocity.opentelemetry.io"
5252
val isCI = System.getenv("CI") != null
5353
val develocityAccessKey = System.getenv("DEVELOCITY_ACCESS_KEY") ?: ""
5454

55-
// if develocity access key is not given and we are in CI, then we publish to scans.gradle.com
56-
val useScansGradleCom = isCI && develocityAccessKey.isEmpty()
57-
5855
develocity {
59-
if (useScansGradleCom) {
60-
buildScan {
61-
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
62-
termsOfUseAgree = "yes"
63-
}
64-
} else {
56+
if (develocityAccessKey.isNotEmpty()) {
6557
server = develocityServer
66-
buildScan {
67-
publishing.onlyIf { it.isAuthenticated }
58+
}
6859

60+
buildScan {
61+
if (develocityAccessKey.isNotEmpty()) {
6962
gradle.startParameter.projectProperties["testJavaVersion"]?.let { tag(it) }
7063
gradle.startParameter.projectProperties["testJavaVM"]?.let { tag(it) }
7164
gradle.startParameter.projectProperties["smokeTestSuite"]?.let {
7265
value("Smoke test suite", it)
7366
}
67+
} else if (isCI) {
68+
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
69+
termsOfUseAgree = "yes"
70+
} else {
71+
publishing.onlyIf { false }
7472
}
75-
}
76-
77-
buildScan {
78-
uploadInBackground = !isCI
7973

8074
capture {
8175
fileFingerprints = true
@@ -93,11 +87,10 @@ develocity {
9387
}
9488
}
9589

96-
if (!useScansGradleCom) {
97-
buildCache {
98-
remote(develocity.buildCache) {
99-
isPush = isCI && develocityAccessKey.isNotEmpty()
100-
}
90+
buildCache {
91+
remote(HttpBuildCache::class) {
92+
url = uri("$develocityServer/cache/")
93+
isPush = isCI && develocityAccessKey.isNotEmpty()
10194
}
10295
}
10396

0 commit comments

Comments
 (0)