diff --git a/paper-api/.gitignore b/paper-api/.gitignore index 5dd700a956..97e78e27ee 100644 --- a/paper-api/.gitignore +++ b/paper-api/.gitignore @@ -1,3 +1,5 @@ +.gradle/ + # Eclipse stuff /.classpath /.project @@ -32,3 +34,7 @@ *.ipr *.iws .idea/ + +# vs code +/.vscode +/.factorypath diff --git a/paper-api/build.gradle.kts b/paper-api/build.gradle.kts new file mode 100644 index 0000000000..dfb490fe94 --- /dev/null +++ b/paper-api/build.gradle.kts @@ -0,0 +1,93 @@ +plugins { + `java-library` + `maven-publish` +} + +java { + withSourcesJar() + withJavadocJar() +} + +val annotationsVersion = "24.1.0" +val bungeeCordChatVersion = "1.20-R0.2" + +dependencies { + // api dependencies are listed transitively to API consumers + api("com.google.guava:guava:33.3.1-jre") + api("com.google.code.gson:gson:2.11.0") + api("net.md-5:bungeecord-chat:$bungeeCordChatVersion") + api("org.yaml:snakeyaml:2.2") + api("org.joml:joml:1.10.8") { + isTransitive = false // https://github.com/JOML-CI/JOML/issues/352 + } + + compileOnly("org.apache.maven:maven-resolver-provider:3.9.6") + compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18") + compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18") + + val annotations = "org.jetbrains:annotations-java5:$annotationsVersion" + compileOnly(annotations) + testCompileOnly(annotations) + + testImplementation("org.apache.commons:commons-lang3:3.12.0") + testImplementation("org.junit.jupiter:junit-jupiter:5.10.2") + testImplementation("org.hamcrest:hamcrest:2.2") + testImplementation("org.mockito:mockito-core:5.14.1") + testImplementation("org.ow2.asm:asm-tree:9.7.1") +} + +configure { + publications.create("maven") { + from(components["java"]) + } +} + +val generateApiVersioningFile by tasks.registering { + inputs.property("version", project.version) + val pomProps = layout.buildDirectory.file("pom.properties") + outputs.file(pomProps) + val projectVersion = project.version + doLast { + pomProps.get().asFile.writeText("version=$projectVersion") + } +} + +tasks.jar { + from(generateApiVersioningFile.map { it.outputs.files.singleFile }) { + into("META-INF/maven/${project.group}/${project.name}") + } + manifest { + attributes( + "Automatic-Module-Name" to "org.bukkit" + ) + } +} + +tasks.withType { + val options = options as StandardJavadocDocletOptions + options.overview = "src/main/javadoc/overview.html" + options.use() + options.isDocFilesSubDirs = true + options.links( + "https://guava.dev/releases/33.3.1-jre/api/docs/", + "https://javadoc.io/doc/org.yaml/snakeyaml/2.2/", + "https://javadoc.io/doc/org.jetbrains/annotations-java5/$annotationsVersion/", + "https://javadoc.io/doc/net.md-5/bungeecord-chat/$bungeeCordChatVersion/", + ) + options.tags("apiNote:a:API Note:") + + // workaround for https://github.com/gradle/gradle/issues/4046 + inputs.dir("src/main/javadoc").withPropertyName("javadoc-sourceset") + doLast { + copy { + from("src/main/javadoc") { + include("**/doc-files/**") + } + into("build/docs/javadoc") + } + } +} + +tasks.test { + useJUnitPlatform() +} diff --git a/paper-api/pom.xml b/paper-api/pom.xml deleted file mode 100644 index 25a8f7daaf..0000000000 --- a/paper-api/pom.xml +++ /dev/null @@ -1,267 +0,0 @@ - - - 4.0.0 - - org.spigotmc - spigot-api - 1.21.4-R0.1-SNAPSHOT - jar - - Spigot-API - https://www.spigotmc.org/ - An enhanced plugin API for Minecraft servers. - - - true - 17 - UTF-8 - - - - - spigotmc-releases - https://hub.spigotmc.org/nexus/content/repositories/releases/ - - - spigotmc-snapshots - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - - - - - - - com.google.guava - guava - 33.3.1-jre - compile - - - - com.google.code.gson - gson - 2.11.0 - compile - - - - org.joml - joml - 1.10.8 - compile - - - net.md-5 - bungeecord-chat - 1.20-R0.2 - jar - compile - - - org.yaml - snakeyaml - 2.2 - compile - - - - org.apache.maven - maven-resolver-provider - 3.9.6 - provided - - - org.apache.maven.resolver - maven-resolver-connector-basic - 1.9.18 - provided - - - org.apache.maven.resolver - maven-resolver-transport-http - 1.9.18 - provided - - - - org.jetbrains - annotations-java5 - 24.1.0 - provided - - - - org.junit.jupiter - junit-jupiter - 5.10.2 - test - - - org.hamcrest - hamcrest - 2.2 - test - - - org.mockito - mockito-core - 5.14.1 - test - - - org.ow2.asm - asm-tree - 9.7.1 - test - - - - - - - net.md-5 - scriptus - 0.5.0 - - - initialize - - describe - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.13.0 - - - false - - - - org.apache.maven.plugins - maven-jar-plugin - 3.4.1 - - - - false - - - org.bukkit - - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.5.3 - - - package - - shade - - - - - - - *:* - - META-INF/MANIFEST.MF - - - - - true - - false - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.6.3 - - - https://guava.dev/releases/32.1.2-jre/api/docs/ - - - - apiNote - a - API Note: - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 3.2.5 - - - - - - - development - - false - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.3.1 - - - process-classes - - check - - - - - checkstyle.xml - true - - - - com.puppycrawl.tools - checkstyle - 8.45.1 - - - - - org.codehaus.mojo - animal-sniffer-maven-plugin - 1.23 - - - process-classes - - check - - - - - - org.codehaus.mojo.signature - java18 - 1.0 - - - - - - - -