diff --git a/gradle/build-cache-settings.gradle b/gradle/build-cache-settings.gradle index b143a54a09..d62ea57ebd 100644 --- a/gradle/build-cache-settings.gradle +++ b/gradle/build-cache-settings.gradle @@ -2,7 +2,19 @@ buildCache { local { enabled = true } - remote(HttpBuildCache) { - enabled = false + if (System.getenv('GRADLE_ENTERPRISE_URL')) { + remote(HttpBuildCache) { + 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 + } + } + } } }