mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
Adjust build for config cache compat
This commit is contained in:
parent
8da8d2991f
commit
ff75689b08
3 changed files with 23 additions and 10 deletions
|
@ -7,6 +7,7 @@ updatingMinecraft=false
|
||||||
#cleanPaperRepo=F:\\Projects\\Paper121\\Paper-Server\\src\\main\\java
|
#cleanPaperRepo=F:\\Projects\\Paper121\\Paper-Server\\src\\main\\java
|
||||||
updateTaskListIssue=https://github.com/PaperMC/testing/issues/2
|
updateTaskListIssue=https://github.com/PaperMC/testing/issues/2
|
||||||
|
|
||||||
|
org.gradle.configuration-cache=true
|
||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.vfs.watch=false
|
org.gradle.vfs.watch=false
|
||||||
|
|
|
@ -161,6 +161,12 @@ tasks.jar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract class Services {
|
||||||
|
@get:Inject
|
||||||
|
abstract val fileSystemOperations: FileSystemOperations
|
||||||
|
}
|
||||||
|
val services = objects.newInstance<Services>()
|
||||||
|
|
||||||
tasks.withType<Javadoc> {
|
tasks.withType<Javadoc> {
|
||||||
val options = options as StandardJavadocDocletOptions
|
val options = options as StandardJavadocDocletOptions
|
||||||
options.overview = "src/main/javadoc/overview.html"
|
options.overview = "src/main/javadoc/overview.html"
|
||||||
|
@ -192,17 +198,19 @@ tasks.withType<Javadoc> {
|
||||||
options.tags("apiNote:a:API Note:")
|
options.tags("apiNote:a:API Note:")
|
||||||
|
|
||||||
inputs.files(apiAndDocs).ignoreEmptyDirectories().withPropertyName(apiAndDocs.name + "-configuration")
|
inputs.files(apiAndDocs).ignoreEmptyDirectories().withPropertyName(apiAndDocs.name + "-configuration")
|
||||||
|
val apiAndDocsElements = apiAndDocs.elements
|
||||||
doFirst {
|
doFirst {
|
||||||
options.addStringOption(
|
options.addStringOption(
|
||||||
"sourcepath",
|
"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
|
// workaround for https://github.com/gradle/gradle/issues/4046
|
||||||
inputs.dir("src/main/javadoc").withPropertyName("javadoc-sourceset")
|
inputs.dir("src/main/javadoc").withPropertyName("javadoc-sourceset")
|
||||||
|
val fsOps = services.fileSystemOperations
|
||||||
doLast {
|
doLast {
|
||||||
copy {
|
fsOps.copy {
|
||||||
from("src/main/javadoc") {
|
from("src/main/javadoc") {
|
||||||
include("**/doc-files/**")
|
include("**/doc-files/**")
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,15 +49,18 @@ tasks.generateDevelopmentBundle {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class SoftwareComponentFactoryProvider {
|
abstract class Services {
|
||||||
@get:Inject
|
@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 {
|
publishing {
|
||||||
if (project.providers.gradleProperty("publishDevBundle").isPresent) {
|
if (project.providers.gradleProperty("publishDevBundle").isPresent) {
|
||||||
val devBundleComponent = provider.factory.adhoc("devBundle")
|
val devBundleComponent = services.softwareComponentFactory.adhoc("devBundle")
|
||||||
components.add(devBundleComponent)
|
components.add(devBundleComponent)
|
||||||
|
|
||||||
val devBundle = configurations.consumable("devBundle") {
|
val devBundle = configurations.consumable("devBundle") {
|
||||||
|
@ -179,10 +182,10 @@ tasks.jar {
|
||||||
val git = Git(rootProject.layout.projectDirectory.path)
|
val git = Git(rootProject.layout.projectDirectory.path)
|
||||||
val mcVersion = rootProject.providers.gradleProperty("mcVersion").get()
|
val mcVersion = rootProject.providers.gradleProperty("mcVersion").get()
|
||||||
val build = System.getenv("BUILD_NUMBER") ?: null
|
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 implementationVersion = "$mcVersion-${build ?: "DEV"}-$gitHash"
|
||||||
val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper
|
val date = git.exec(providers, "show", "-s", "--format=%ci", gitHash).get().trim() // Paper
|
||||||
val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
|
val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim() // Paper
|
||||||
attributes(
|
attributes(
|
||||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||||
"Implementation-Title" to "Paper",
|
"Implementation-Title" to "Paper",
|
||||||
|
@ -222,10 +225,11 @@ tasks.check {
|
||||||
// Paper end
|
// Paper end
|
||||||
// Paper start - use TCA for console improvements
|
// Paper start - use TCA for console improvements
|
||||||
tasks.jar {
|
tasks.jar {
|
||||||
|
val archiveOperations = services.archiveOperations
|
||||||
from(alsoShade.elements.map {
|
from(alsoShade.elements.map {
|
||||||
it.map { f ->
|
it.map { f ->
|
||||||
if (f.asFile.isFile) {
|
if (f.asFile.isFile) {
|
||||||
zipTree(f.asFile)
|
archiveOperations.zipTree(f.asFile)
|
||||||
} else {
|
} else {
|
||||||
f.asFile
|
f.asFile
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue