[ci skip] Add remote build cache configuration through Gradle properties (#12797)

This commit is contained in:
Jason Penilla
2025-07-04 13:12:45 -07:00
committed by GitHub
parent 6e598f8527
commit f7d5a0a017
4 changed files with 36 additions and 8 deletions
+24 -2
View File
@@ -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
}
}
}
}
}