OpenSearch/.ci/build-cache.gradle

18 lines
851 B
Groovy
Raw Normal View History

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")
}