Add opt-in support for remote build cache and pushing to it from CI
This commit provides opt-in enablement of Gradle's remote build cache. When the GRADLE_ENTERPRISE_URL environment variable is set, its build cache node will be used as a source of cached output. If both GRADLE_ENTERPRISE_CACHE_USERNAME and GRADLE_ENTERPRISE_CACHE_PASSWORD are also set, task output produced by the build will be pushed to the build cache node for use by subsequent builds. Closes gh-23883
This commit is contained in:
parent
0cea49fdc0
commit
1a54b83ae1
|
@ -2,7 +2,19 @@ buildCache {
|
||||||
local {
|
local {
|
||||||
enabled = true
|
enabled = true
|
||||||
}
|
}
|
||||||
|
if (System.getenv('GRADLE_ENTERPRISE_URL')) {
|
||||||
remote(HttpBuildCache) {
|
remote(HttpBuildCache) {
|
||||||
enabled = false
|
enabled = true
|
||||||
|
url = "${System.getenv('GRADLE_ENTERPRISE_URL')}/cache/"
|
||||||
|
def cacheUsername = System.getenv('GRADLE_ENTERPRISE_CACHE_USERNAME')
|
||||||
|
def cachePassword = System.getenv('GRADLE_ENTERPRISE_CACHE_PASSWORD')
|
||||||
|
if (cacheUsername && cachePassword) {
|
||||||
|
push = true
|
||||||
|
credentials {
|
||||||
|
username = cacheUsername
|
||||||
|
password = cachePassword
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue