Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a jar task to build without adventure dependencies #1018

Merged
merged 3 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
6 changes: 0 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,5 @@ allprojects {
withType<Jar> {
archiveVersion = rootProject.ext["versionNoHash"] as String
}

withType<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()
}
}
}
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,45 @@ tasks {
mergeServiceFiles()
}

create<ShadowJar>("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<SourceSetContainer>()

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")

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relocate("org.bstats", "io.github.retrooper.packetevents.bstats")

The bstats relocation is missing here

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been resolved?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, not yet

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be added after the merging of this pr to preserve a better commit history

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())
Expand Down
12 changes: 7 additions & 5 deletions fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}