Skip to content

Commit

Permalink
build(gradle): Enable the Gradle Build Cache
Browse files Browse the repository at this point in the history
  • Loading branch information
CLOVIS-AI committed Apr 1, 2023
1 parent 52b2e49 commit 91a251e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,23 @@ include(
"fake",
"test",
)

buildCache {
val username = System.getenv("GRADLE_BUILD_CACHE_CREDENTIALS")?.split(':')?.get(0)
val password = System.getenv("GRADLE_BUILD_CACHE_CREDENTIALS")?.split(':')?.get(1)

val mainBranch: String? = System.getenv("CI_DEFAULT_BRANCH")
val currentBranch: String? = System.getenv("CI_COMMIT_REF_NAME")
val runningForTag = System.getenv().containsKey("CI_COMMIT_TAG")

remote<HttpBuildCache> {
url = uri("https://gradle.opensavvy.dev/cache/")

if (username != null && password != null) credentials {
this.username = username
this.password = password
}

isPush = (mainBranch != null && currentBranch != null && mainBranch == currentBranch) || runningForTag
}
}

0 comments on commit 91a251e

Please sign in to comment.