aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJason Penilla <[email protected]>2024-12-09 12:50:30 -0700
committerNassim Jahnke <[email protected]>2024-12-12 11:36:57 +0100
commitff75689b0802180538e6dba36d113e7529e43139 (patch)
tree26af9ebf89567b951de91bae3b15595f0d103fac
parent8da8d2991fad93aacdd3adcdf9ba0942cdf05616 (diff)
downloadPaper-ff75689b0802180538e6dba36d113e7529e43139.tar.gz
Paper-ff75689b0802180538e6dba36d113e7529e43139.zip
Adjust build for config cache compatdev/hard-fork-base
-rw-r--r--gradle.properties1
-rw-r--r--paper-api/build.gradle.kts12
-rw-r--r--paper-server/build.gradle.kts20
3 files changed, 23 insertions, 10 deletions
diff --git a/gradle.properties b/gradle.properties
index 192e0e5f62..8989546485 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -7,6 +7,7 @@ updatingMinecraft=false
#cleanPaperRepo=F:\\Projects\\Paper121\\Paper-Server\\src\\main\\java
updateTaskListIssue=https://github.com/PaperMC/testing/issues/2
+org.gradle.configuration-cache=true
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.vfs.watch=false
diff --git a/paper-api/build.gradle.kts b/paper-api/build.gradle.kts
index 571534b42c..832a2b3e86 100644
--- a/paper-api/build.gradle.kts
+++ b/paper-api/build.gradle.kts
@@ -161,6 +161,12 @@ tasks.jar {
}
}
+abstract class Services {
+ @get:Inject
+ abstract val fileSystemOperations: FileSystemOperations
+}
+val services = objects.newInstance<Services>()
+
tasks.withType<Javadoc> {
val options = options as StandardJavadocDocletOptions
options.overview = "src/main/javadoc/overview.html"
@@ -192,17 +198,19 @@ tasks.withType<Javadoc> {
options.tags("apiNote:a:API Note:")
inputs.files(apiAndDocs).ignoreEmptyDirectories().withPropertyName(apiAndDocs.name + "-configuration")
+ val apiAndDocsElements = apiAndDocs.elements
doFirst {
options.addStringOption(
"sourcepath",
- apiAndDocs.elements.get().map { it.asFile }.joinToString(separator = File.pathSeparator, transform = File::getPath)
+ apiAndDocsElements.get().map { it.asFile }.joinToString(separator = File.pathSeparator, transform = File::getPath)
)
}
// workaround for https://github.com/gradle/gradle/issues/4046
inputs.dir("src/main/javadoc").withPropertyName("javadoc-sourceset")
+ val fsOps = services.fileSystemOperations
doLast {
- copy {
+ fsOps.copy {
from("src/main/javadoc") {
include("**/doc-files/**")
}
diff --git a/paper-server/build.gradle.kts b/paper-server/build.gradle.kts
index 43be6233eb..7a8c6d0fbf 100644
--- a/paper-server/build.gradle.kts
+++ b/paper-server/build.gradle.kts
@@ -49,15 +49,18 @@ tasks.generateDevelopmentBundle {
)
}
-abstract class SoftwareComponentFactoryProvider {
+abstract class Services {
@get:Inject
- abstract val factory: SoftwareComponentFactory
+ abstract val softwareComponentFactory: SoftwareComponentFactory
+
+ @get:Inject
+ abstract val archiveOperations: ArchiveOperations
}
-val provider = objects.newInstance<SoftwareComponentFactoryProvider>()
+val services = objects.newInstance<Services>()
publishing {
if (project.providers.gradleProperty("publishDevBundle").isPresent) {
- val devBundleComponent = provider.factory.adhoc("devBundle")
+ val devBundleComponent = services.softwareComponentFactory.adhoc("devBundle")
components.add(devBundleComponent)
val devBundle = configurations.consumable("devBundle") {
@@ -179,10 +182,10 @@ tasks.jar {
val git = Git(rootProject.layout.projectDirectory.path)
val mcVersion = rootProject.providers.gradleProperty("mcVersion").get()
val build = System.getenv("BUILD_NUMBER") ?: null
- val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
+ val gitHash = git.exec(providers, "rev-parse", "--short=7", "HEAD").get().trim()
val implementationVersion = "$mcVersion-${build ?: "DEV"}-$gitHash"
- val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper
- val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
+ val date = git.exec(providers, "show", "-s", "--format=%ci", gitHash).get().trim() // Paper
+ val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim() // Paper
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "Paper",
@@ -222,10 +225,11 @@ tasks.check {
// Paper end
// Paper start - use TCA for console improvements
tasks.jar {
+ val archiveOperations = services.archiveOperations
from(alsoShade.elements.map {
it.map { f ->
if (f.asFile.isFile) {
- zipTree(f.asFile)
+ archiveOperations.zipTree(f.asFile)
} else {
f.asFile
}