diff --git a/api/build.gradle.kts b/api/build.gradle.kts index 6a94d3951..542cc9da2 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -106,11 +106,11 @@ mappingCompression { } tasks { + assemble { + setDependsOn(dependsOn.filterNot { it == "shadowNoAdventure" }) + } + javadoc { - setDestinationDir(file("${project.layout.buildDirectory.asFile.get()}/docs/javadoc")) - options { - (this as CoreJavadocOptions).addBooleanOption("Xdoclint:none", true) - } mustRunAfter(generateVersionsFile) } diff --git a/build.gradle.kts b/build.gradle.kts index 582929bbe..c9705499e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -70,11 +70,5 @@ allprojects { withType { archiveVersion = rootProject.ext["versionNoHash"] as String } - - withType { - title = "packetevents-${project.name} v${rootProject.version}" - options.encoding = Charsets.UTF_8.name() - options.overview = rootProject.file("buildSrc/src/main/resources/javadoc-overview.html").toString() - } } } diff --git a/buildSrc/src/main/kotlin/packetevents.library-conventions.gradle.kts b/buildSrc/src/main/kotlin/packetevents.library-conventions.gradle.kts index 684a4aef3..fc97ce5d4 100644 --- a/buildSrc/src/main/kotlin/packetevents.library-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/packetevents.library-conventions.gradle.kts @@ -1,4 +1,3 @@ -import com.github.jengelman.gradle.plugins.shadow.ShadowExtension import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import groovy.util.Node @@ -36,6 +35,16 @@ tasks { options.release = 8 } + javadoc { + title = "packetevents-${project.name} v${rootProject.version}" + options.encoding = Charsets.UTF_8.name() + options.overview = rootProject.file("buildSrc/src/main/resources/javadoc-overview.html").toString() + setDestinationDir(file("${project.layout.buildDirectory.asFile.get()}/docs/javadoc")) + options { + (this as CoreJavadocOptions).addBooleanOption("Xdoclint:none", true) + } + } + processResources { inputs.property("version", project.version) filesMatching(listOf("plugin.yml", "bungee.yml", "velocity-plugin.json", "fabric.mod.json")) { diff --git a/buildSrc/src/main/kotlin/packetevents.shadow-conventions.gradle.kts b/buildSrc/src/main/kotlin/packetevents.shadow-conventions.gradle.kts index 890a25072..d1869a6a7 100644 --- a/buildSrc/src/main/kotlin/packetevents.shadow-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/packetevents.shadow-conventions.gradle.kts @@ -20,9 +20,45 @@ tasks { mergeServiceFiles() } + create("shadowNoAdventure") { + group = rootProject.name + description = "Create a combined JAR of project and runtime dependencies without Adventure dependencies." + archiveFileName = "packetevents-${project.name}-no-adv-${rootProject.ext["versionNoHash"]}.jar" + archiveClassifier = null + + val shadowJar = shadowJar.get() + val sourceSets = project.extensions.getByType() + + manifest.inheritFrom(shadowJar.manifest) + + from(sourceSets.main.get().output) + configurations = shadowJar.configurations + + relocate("net.kyori.adventure.text.serializer", "io.github.retrooper.packetevents.adventure.serializer") + relocate("net.kyori.option", "io.github.retrooper.packetevents.adventure.option") + + dependencies { + exclude(dependency("net.kyori:adventure-api:.*")) + exclude(dependency("net.kyori:adventure-key:.*")) + exclude(dependency("net.kyori:adventure-nbt:.*")) + exclude(dependency("net.kyori:examination-api:.*")) + exclude(dependency("net.kyori:examination-string:.*")) + exclude(dependency("com.google.code.gson:gson:.*")) + exclude("META-INF/INDEX.LIST", "META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA", "module-info.class") + } + + mergeServiceFiles() + } + assemble { dependsOn(shadowJar) } + + if (project.properties.contains("no-adv")) { + assemble { + dependsOn("shadowNoAdventure") + } + } } configurations.implementation.get().extendsFrom(configurations.shadow.get()) diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index d5f1fbc05..0567aa537 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -47,10 +47,12 @@ tasks { } } - sequenceOf(remapJar, remapSourcesJar).forEach { - it { - archiveBaseName = "${rootProject.name}-fabric" - archiveVersion = rootProject.ext["versionNoHash"] as String - } + remapJar { + archiveBaseName = "${rootProject.name}-fabric" + archiveVersion = rootProject.ext["versionNoHash"] as String + } + + remapSourcesJar { + archiveVersion = rootProject.ext["versionNoHash"] as String } }