[ci skip] Add remote build cache configuration through Gradle properties (#12797)
This commit is contained in:
+24
-2
@@ -1,5 +1,3 @@
|
||||
import java.util.Locale
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
@@ -56,3 +54,27 @@ fun optionalInclude(name: String, op: (ProjectDescriptor.() -> Unit)? = null) {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (providers.gradleProperty("paperBuildCacheEnabled").orNull.toBoolean()) {
|
||||
val buildCacheUsername = providers.gradleProperty("paperBuildCacheUsername").orElse("").get()
|
||||
val buildCachePassword = providers.gradleProperty("paperBuildCachePassword").orElse("").get()
|
||||
if (buildCacheUsername.isBlank() || buildCachePassword.isBlank()) {
|
||||
println("The Paper remote build cache is enabled, but no credentials were provided. Remote build cache will not be used.")
|
||||
} else {
|
||||
val buildCacheUrl = providers.gradleProperty("paperBuildCacheUrl")
|
||||
.orElse("https://gradle-build-cache.papermc.io/")
|
||||
.get()
|
||||
val buildCachePush = providers.gradleProperty("paperBuildCachePush").orNull?.toBoolean()
|
||||
?: System.getProperty("CI").toBoolean()
|
||||
buildCache {
|
||||
remote<HttpBuildCache> {
|
||||
url = uri(buildCacheUrl)
|
||||
isPush = buildCachePush
|
||||
credentials {
|
||||
username = buildCacheUsername
|
||||
password = buildCachePassword
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user