mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-04 14:12:20 -07:00
[ci skip] Add remote build cache configuration through Gradle properties (#12797)
This commit is contained in:
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@@ -16,6 +16,12 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
env:
|
||||||
|
ORG_GRADLE_PROJECT_paperBuildCacheEnabled: true
|
||||||
|
ORG_GRADLE_PROJECT_paperBuildCacheUsername: ${{ secrets.PAPER_BUILD_CACHE_USERNAME }}
|
||||||
|
ORG_GRADLE_PROJECT_paperBuildCachePassword: ${{ secrets.PAPER_BUILD_CACHE_PASSWORD }}
|
||||||
|
ORG_GRADLE_PROJECT_paperBuildCachePush: true
|
||||||
|
|
||||||
# The goal of the build workflow is split into multiple requirements.
|
# The goal of the build workflow is split into multiple requirements.
|
||||||
# 1. Run on pushes to same repo.
|
# 1. Run on pushes to same repo.
|
||||||
# 2. Run on PR open/reopen/syncs from repos that are not the same (PRs from the same repo are covered by 1)
|
# 2. Run on PR open/reopen/syncs from repos that are not the same (PRs from the same repo are covered by 1)
|
||||||
|
@@ -2,7 +2,7 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
|||||||
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("io.papermc.paperweight.core") version "2.0.0-beta.17" apply false
|
id("io.papermc.paperweight.core") version "2.0.0-beta.18" apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
@@ -24,19 +24,19 @@ subprojects {
|
|||||||
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
|
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
tasks.withType<JavaCompile> {
|
tasks.withType<JavaCompile>().configureEach {
|
||||||
options.encoding = Charsets.UTF_8.name()
|
options.encoding = Charsets.UTF_8.name()
|
||||||
options.release = 21
|
options.release = 21
|
||||||
options.isFork = true
|
options.isFork = true
|
||||||
options.compilerArgs.addAll(listOf("-Xlint:-deprecation", "-Xlint:-removal"))
|
options.compilerArgs.addAll(listOf("-Xlint:-deprecation", "-Xlint:-removal"))
|
||||||
}
|
}
|
||||||
tasks.withType<Javadoc> {
|
tasks.withType<Javadoc>().configureEach {
|
||||||
options.encoding = Charsets.UTF_8.name()
|
options.encoding = Charsets.UTF_8.name()
|
||||||
}
|
}
|
||||||
tasks.withType<ProcessResources> {
|
tasks.withType<ProcessResources>().configureEach {
|
||||||
filteringCharset = Charsets.UTF_8.name()
|
filteringCharset = Charsets.UTF_8.name()
|
||||||
}
|
}
|
||||||
tasks.withType<Test> {
|
tasks.withType<Test>().configureEach {
|
||||||
testLogging {
|
testLogging {
|
||||||
showStackTraces = true
|
showStackTraces = true
|
||||||
exceptionFormat = TestExceptionFormat.FULL
|
exceptionFormat = TestExceptionFormat.FULL
|
||||||
|
@@ -164,7 +164,7 @@ abstract class Services {
|
|||||||
}
|
}
|
||||||
val services = objects.newInstance<Services>()
|
val services = objects.newInstance<Services>()
|
||||||
|
|
||||||
tasks.withType<Javadoc> {
|
tasks.withType<Javadoc>().configureEach {
|
||||||
val options = options as StandardJavadocDocletOptions
|
val options = options as StandardJavadocDocletOptions
|
||||||
options.overview = "src/main/javadoc/overview.html"
|
options.overview = "src/main/javadoc/overview.html"
|
||||||
options.use()
|
options.use()
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
import java.util.Locale
|
|
||||||
|
|
||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
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