Skip to content

Commit 7f61f38

Browse files
wilkinsonasbrannen
authored andcommitted
Enable reading from the remote build cache for all
Previously, the remote build cache was only enabled if the GRADLE_ENTERPRISE_URL environment variable was configured. This meant that contributors would not benefit from the build time improvements of the caching without some additional setup. This commit updates the buildCache configuration so that reading from the remote build cache at https://ge.spring.io is enabled for all. Pushing to the cache continues to be disabled unless the required credentials are provided. Build scan configuration has also been updated in line with this change. While the server URL is now hardcoded, publishing is still opt-in via an environment variable. The exact mechanism by which someone can opt in will change in the future once some server-side changes have been made. At this point, only a change to publishAlwaysIf should be necessary. Closes gh-24105
1 parent 093323b commit 7f61f38

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed

build.gradle

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,14 @@ plugins {
1818
id "com.github.ben-manes.versions" version "0.24.0"
1919
}
2020

21-
if (System.getenv('GRADLE_ENTERPRISE_URL')) {
22-
apply from: "$rootDir/gradle/build-scan-user-data.gradle"
23-
buildScan {
24-
captureTaskInputFiles = true
25-
obfuscation {
26-
ipAddresses { addresses -> addresses.collect { address -> '0.0.0.0'} }
27-
}
28-
publishAlways()
29-
server = System.getenv('GRADLE_ENTERPRISE_URL')
21+
apply from: "$rootDir/gradle/build-scan-user-data.gradle"
22+
buildScan {
23+
captureTaskInputFiles = true
24+
obfuscation {
25+
ipAddresses { addresses -> addresses.collect { address -> '0.0.0.0'} }
3026
}
27+
publishAlwaysIf(System.getenv('GRADLE_ENTERPRISE_URL') != null)
28+
server = 'https://ge.spring.io'
3129
}
3230

3331
ext {

gradle/build-cache-settings.gradle

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@ buildCache {
22
local {
33
enabled = true
44
}
5-
if (System.getenv('GRADLE_ENTERPRISE_URL')) {
6-
remote(HttpBuildCache) {
7-
enabled = true
8-
url = "${System.getenv('GRADLE_ENTERPRISE_URL')}/cache/"
9-
def cacheUsername = System.getenv('GRADLE_ENTERPRISE_CACHE_USERNAME')
10-
def cachePassword = System.getenv('GRADLE_ENTERPRISE_CACHE_PASSWORD')
11-
if (cacheUsername && cachePassword) {
12-
push = true
13-
credentials {
14-
username = cacheUsername
15-
password = cachePassword
16-
}
5+
remote(HttpBuildCache) {
6+
enabled = true
7+
url = 'https://ge.spring.io/cache/'
8+
def cacheUsername = System.getenv('GRADLE_ENTERPRISE_CACHE_USERNAME')
9+
def cachePassword = System.getenv('GRADLE_ENTERPRISE_CACHE_PASSWORD')
10+
if (cacheUsername && cachePassword) {
11+
push = true
12+
credentials {
13+
username = cacheUsername
14+
password = cachePassword
1715
}
1816
}
1917
}

0 commit comments

Comments
 (0)