From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Kyle Wood Date: Thu, 10 Dec 2020 20:50:33 -0800 Subject: [PATCH] Convert project to Gradle The pom.xml file is deleted in this patch so the patch will fail to apply if there are changes made to it from upstream - thus notifying us that changes were made. diff --git a/.gitignore b/.gitignore index e431e3435737e28394d81b56568a08b3c3148b9b..b23bde3b5e881f146539a307d0a59f2177b6a036 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.gradle/ + # Eclipse stuff /.classpath /.project @@ -30,3 +32,7 @@ *.ipr *.iws .idea/ + +# vs code +/.vscode +/.factorypath diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000000000000000000000000000000000000..d6b99d37c960a7d8de1852dbc74c3ce671101b14 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,80 @@ +plugins { + `java-library` + `maven-publish` +} + +java { + withSourcesJar() + withJavadocJar() +} + +dependencies { + // api dependencies are listed transitively to API consumers + api("commons-lang:commons-lang:2.6") + api("com.google.guava:guava:31.0.1-jre") + api("com.google.code.gson:gson:2.8.9") + api("net.md-5:bungeecord-chat:1.16-R0.4") + api("org.yaml:snakeyaml:1.30") + + compileOnly("org.apache.maven:maven-resolver-provider:3.8.4") + compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.2") + compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.2") + + val annotations = "org.jetbrains:annotations-java5:23.0.0" + compileOnly(annotations) + testCompileOnly(annotations) + + testImplementation("junit:junit:4.13.2") + testImplementation("org.hamcrest:hamcrest-library:1.3") + testImplementation("org.ow2.asm:asm-tree:9.2") +} + +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.isDocFilesSubDirs = true + options.links( + "https://guava.dev/releases/31.0.1-jre/api/docs/", + "https://javadoc.io/doc/org.yaml/snakeyaml/1.30/", + "https://javadoc.io/doc/org.jetbrains/annotations-java5/23.0.0/", + "https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/", + ) + + // 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") + } + } +} diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 7a34ef5514a30bcb61e657970bf087bdf9c2db90..0000000000000000000000000000000000000000 --- a/pom.xml +++ /dev/null @@ -1,263 +0,0 @@ - - - 4.0.0 - - org.spigotmc - spigot-api - 1.18.2-R0.1-SNAPSHOT - jar - - Spigot-API - https://www.spigotmc.org/ - An enhanced plugin API for Minecraft servers. - - - true - 1.8 - 1.8 - UTF-8 - - - - - spigotmc-releases - https://hub.spigotmc.org/nexus/content/repositories/releases/ - - - spigotmc-snapshots - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - - - - - - commons-lang - commons-lang - 2.6 - compile - - - - com.google.guava - guava - 31.0.1-jre - compile - - - - com.google.code.gson - gson - 2.8.9 - compile - - - net.md-5 - bungeecord-chat - 1.16-R0.4 - jar - compile - - - org.yaml - snakeyaml - 1.30 - compile - - - - org.apache.maven - maven-resolver-provider - 3.8.4 - provided - - - org.apache.maven.resolver - maven-resolver-connector-basic - 1.7.2 - provided - - - org.apache.maven.resolver - maven-resolver-transport-http - 1.7.2 - provided - - - - org.jetbrains - annotations-java5 - 23.0.0 - provided - - - - junit - junit - 4.13.2 - test - - - org.hamcrest - hamcrest-library - 1.3 - test - - - org.ow2.asm - asm-tree - 9.2 - test - - - - - - - net.md-5 - scriptus - 0.4.1 - - - initialize - - describe - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - - eclipse - - - - org.codehaus.plexus - plexus-compiler-eclipse - 2.8.8 - - - org.eclipse.jdt - ecj - 3.28.0 - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.2.0 - - - - false - - - org.bukkit - - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.4 - - - package - - shade - - - - - - - *:* - - META-INF/MANIFEST.MF - - - - - true - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.3.1 - - - https://guava.dev/releases/31.0.1-jre/api/docs/ - https://javadoc.io/doc/org.yaml/snakeyaml/1.30/ - https://javadoc.io/doc/org.jetbrains/annotations-java5/23.0.0/ - https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/ - - - - - - - - - development - - false - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.1.2 - - - process-classes - - check - - - - - checkstyle.xml - checkstyle-suppressions.xml - true - - - - com.puppycrawl.tools - checkstyle - 8.45.1 - - - - - org.codehaus.mojo - animal-sniffer-maven-plugin - 1.20 - - - process-classes - - check - - - - - - org.codehaus.mojo.signature - java18 - 1.0 - - - - - - - -