Skip to content

Commit

Permalink
Gradle init script for enabling remote build cache
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-vieira committed May 24, 2019
1 parent 5892cf4 commit 96ac3e6
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 96ac3e6

Please sign in to comment.