-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gradle init script for enabling remote build cache
- Loading branch information
1 parent
5892cf4
commit 96ac3e6
Showing
1 changed file
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} |