Skip to content

Commit

Permalink
Gradle init script for enabling remote build cache (elastic#42484)
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-vieira authored and Gurkan Kaymak committed May 27, 2019
1 parent 0715cc2 commit 4b1db99
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .ci/build-cache.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
if (System.getenv('GRADLE_BUILD_CACHE_URL')) {
gradle.settingsEvaluated { settings ->
settings.buildCache {
remote(HttpBuildCache) {
url = System.getenv('GRADLE_BUILD_CACHE_URL')
push = Boolean.valueOf(System.getenv('GRADLE_BUILD_CACHE_PUSH') ?: 'false')
if (System.getenv('GRADLE_BUILD_CACHE_USERNAME') && System.getenv('GRADLE_BUILD_CACHE_PASSWORD')) {
credentials {
username = System.getenv('GRADLE_BUILD_CACHE_USERNAME')
password = System.getenv('GRADLE_BUILD_CACHE_PASSWORD')
}
}
}
}
}
} else {
throw new GradleException("You must supply a value for GRADLE_BUILD_CACHE_URL environment variable when applying build-cache.gradle init script")
}

0 comments on commit 4b1db99

Please sign in to comment.