Re-add build cache configuration.

This commit is contained in:
Jose Coll 2023-12-19 09:20:31 +00:00
parent b47d5ec5c7
commit d049f8a6f3
2 changed files with 17 additions and 17 deletions

16
buildCacheSettings.gradle Normal file
View File

@ -0,0 +1,16 @@
// Gradle Build Cache configuration recommendation: https://docs.gradle.org/current/userguide/build_cache.html
ext {
isCiServer = System.getenv().containsKey("CORDA_CI")
gradleBuildCacheURL = System.getenv().containsKey("GRADLE_BUILD_CACHE_URL") ? System.getenv().get("GRADLE_BUILD_CACHE_URL") : 'http://localhost:5071/cache/'
}
buildCache {
local {
enabled = !isCiServer
}
remote(HttpBuildCache) {
enabled = isCiServer
url = gradleBuildCacheURL
push = isCiServer
}
}

View File

@ -122,24 +122,8 @@ include 'common-logging'
project(":common-logging").projectDir = new File("$settingsDir/common/logging")
// Common libraries - end
apply from: 'buildCacheSettings.gradle'
include 'detekt-plugins'
include 'tools:error-tool'
buildCache {
local { enabled = false }
remote(HttpBuildCache) {
url = "${gradleEnterpriseUrl}/cache/"
credentials {
username = settings.ext.find('BUILD_CACHE_CREDENTIALS_USR') ?: System.getenv('BUILD_CACHE_CREDENTIALS_USR')
password = settings.ext.find('BUILD_CACHE_CREDENTIALS_PSW') ?: System.getenv('BUILD_CACHE_CREDENTIALS_PSW')
}
if (System.getenv().containsKey("JENKINS_URL")) {
push = true
enabled = true
} else {
push = false
enabled = false
}
}
}