Paper/patches/api/0001-Convert-project-to-Gradle.patch
Jake Potrebic bd38e0318a
Updated Upstream (Bukkit/CraftBukkit) (#10379)
Updated Upstream (Bukkit/CraftBukkit)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
f02baa38 PR-988: Add World#getIntersectingChunks(BoundingBox)
9321d665 Move getItemInUse up to LivingEntity
819eef73 PR-959: Add access to current item's remaining ticks
c4fdadb0 SPIGOT-7601: Add AbstractArrow#getItem
be8261ca Add support for Java 22
26119676 PR-979: Add more translation keys
66753362 PR-985: Correct book maximum pages and characters per page documentation
c8be92fa PR-980: Improve getArmorContents() documentation
f1120ee2 PR-983: Expose riptide velocity to PlayerRiptideEvent

CraftBukkit Changes:
dfaa89bbe PR-1369: Add World#getIntersectingChunks(BoundingBox)
51bbab2b9 Move getItemInUse up to LivingEntity
668e09602 PR-1331: Add access to current item's remaining ticks
a639406d1 SPIGOT-7601: Add AbstractArrow#getItem
0398930fc SPIGOT-7602: Allow opening in-world horse and related inventories
ffd15611c SPIGOT-7608: Allow empty lists to morph to any PDT list
2188dcfa9 Add support for Java 22
45d6a609f SPIGOT-7604: Revert "SPIGOT-7365: DamageCause blocked by shield should trigger invulnerableTime"
06d915943 SPIGOT-7365: DamageCause blocked by shield should trigger invulnerableTime
ca3bc3707 PR-1361: Add more translation keys
366c3ca80 SPIGOT-7600: EntityChangeBlockEvent is not fired for frog eggs
06d0f9ba8 SPIGOT-7593: Fix sapling growth physics / client-side updates
45c2608e4 PR-1366: Expose riptide velocity to PlayerRiptideEvent
29b6bb79b SPIGOT-7587: Remove fixes for now-resolved MC-142590 and MC-109346
2024-04-06 12:53:39 -07:00

408 lines
15 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kyle Wood <kyle@denwav.dev>
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 5dd700a956e915c00b25d91dea8d6f285ddab72b..97e78e27ee0eea2c8b24886eeb19164d552323fe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+.gradle/
+
# Eclipse stuff
/.classpath
/.project
@@ -32,3 +34,7 @@
*.ipr
*.iws
.idea/
+
+# vs code
+/.vscode
+/.factorypath
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000000000000000000000000000000000000..4756a5aa04f8a8f0a8f9ff2c7aa6776b5a6892a5
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,91 @@
+plugins {
+ `java-library`
+ `maven-publish`
+}
+
+java {
+ withSourcesJar()
+ withJavadocJar()
+}
+
+val annotationsVersion = "24.0.1"
+val bungeeCordChatVersion = "1.20-R0.2"
+
+dependencies {
+ // api dependencies are listed transitively to API consumers
+ api("com.google.guava:guava:32.1.2-jre")
+ api("com.google.code.gson:gson:2.10.1")
+ api("net.md-5:bungeecord-chat:$bungeeCordChatVersion")
+ api("org.yaml:snakeyaml:2.2")
+ api("org.joml:joml:1.10.5")
+
+ 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.0")
+ testImplementation("org.hamcrest:hamcrest:2.2")
+ testImplementation("org.mockito:mockito-core:5.11.0")
+ testImplementation("org.ow2.asm:asm-tree:9.7")
+}
+
+configure<PublishingExtension> {
+ publications.create<MavenPublication>("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<Javadoc> {
+ val options = options as StandardJavadocDocletOptions
+ options.overview = "src/main/javadoc/overview.html"
+ options.use()
+ options.isDocFilesSubDirs = true
+ options.links(
+ "https://guava.dev/releases/32.1.2-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/pom.xml b/pom.xml
deleted file mode 100644
index 931d1a0215f54a4ff172b1b6db2ab06c41cd0c39..0000000000000000000000000000000000000000
--- a/pom.xml
+++ /dev/null
@@ -1,277 +0,0 @@
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.spigotmc</groupId>
- <artifactId>spigot-api</artifactId>
- <version>1.20.4-R0.1-SNAPSHOT</version>
- <packaging>jar</packaging>
-
- <name>Spigot-API</name>
- <url>https://www.spigotmc.org/</url>
- <description>An enhanced plugin API for Minecraft servers.</description>
-
- <properties>
- <skipTests>true</skipTests>
- <maven.compiler.source>17</maven.compiler.source>
- <maven.compiler.target>17</maven.compiler.target>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
- <distributionManagement>
- <repository>
- <id>spigotmc-releases</id>
- <url>https://hub.spigotmc.org/nexus/content/repositories/releases/</url>
- </repository>
- <snapshotRepository>
- <id>spigotmc-snapshots</id>
- <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
- </snapshotRepository>
- </distributionManagement>
-
- <dependencies>
- <!-- bundled with Minecraft, should be kept in sync -->
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>32.1.2-jre</version>
- <scope>compile</scope>
- </dependency>
- <!-- bundled with Minecraft, should be kept in sync -->
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>2.10.1</version>
- <scope>compile</scope>
- </dependency>
- <!-- bundled with Minecraft, should be kept in sync -->
- <dependency>
- <groupId>org.joml</groupId>
- <artifactId>joml</artifactId>
- <version>1.10.5</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>net.md-5</groupId>
- <artifactId>bungeecord-chat</artifactId>
- <version>1.20-R0.2</version>
- <type>jar</type>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- <version>2.2</version>
- <scope>compile</scope>
- </dependency>
- <!-- not part of the API proper -->
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-resolver-provider</artifactId>
- <version>3.9.6</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-connector-basic</artifactId>
- <version>1.9.18</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-transport-http</artifactId>
- <version>1.9.18</version>
- <scope>provided</scope>
- </dependency>
- <!-- annotations -->
- <dependency>
- <groupId>org.jetbrains</groupId>
- <artifactId>annotations-java5</artifactId>
- <version>24.0.1</version>
- <scope>provided</scope>
- </dependency>
- <!-- testing -->
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- <version>5.10.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>5.11.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-tree</artifactId>
- <version>9.7</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>net.md-5</groupId>
- <artifactId>scriptus</artifactId>
- <version>0.5.0</version>
- <executions>
- <execution>
- <phase>initialize</phase>
- <goals>
- <goal>describe</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.11.0</version>
- <configuration>
- <!-- we use the Eclipse compiler as it doesn't need a JDK -->
- <compilerId>eclipse</compilerId>
- <!-- default changed with version 3.11.0 -->
- <showWarnings>false</showWarnings>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-compiler-eclipse</artifactId>
- <version>2.13.0</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>3.3.0</version>
- <configuration>
- <archive>
- <manifest>
- <addDefaultEntries>false</addDefaultEntries>
- </manifest>
- <manifestEntries>
- <Automatic-Module-Name>org.bukkit</Automatic-Module-Name>
- </manifestEntries>
- </archive>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>3.5.0</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <filters>
- <filter>
- <artifact>*:*</artifact>
- <excludes>
- <exclude>META-INF/MANIFEST.MF</exclude>
- </excludes>
- </filter>
- </filters>
- <!-- when downloading via Maven we can pull depends individually -->
- <shadedArtifactAttached>true</shadedArtifactAttached>
- <!-- In 3.3.0 and later, shadedArtifactAttached causes dependant projects to use dependency reduced pom (bug?) -->
- <createDependencyReducedPom>false</createDependencyReducedPom>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>3.5.0</version>
- <configuration>
- <links>
- <link>https://guava.dev/releases/31.1-jre/api/docs/</link>
- </links>
- <tags>
- <tag>
- <name>apiNote</name>
- <placement>a</placement>
- <head>API Note:</head>
- </tag>
- </tags>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>3.1.0</version>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>development</id>
- <properties>
- <skipTests>false</skipTests>
- </properties>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>3.3.0</version>
- <executions>
- <execution>
- <phase>process-classes</phase>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <configLocation>checkstyle.xml</configLocation>
- <includeTestSourceDirectory>true</includeTestSourceDirectory>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>com.puppycrawl.tools</groupId>
- <artifactId>checkstyle</artifactId>
- <version>8.45.1</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>animal-sniffer-maven-plugin</artifactId>
- <version>1.23</version>
- <executions>
- <execution>
- <phase>process-classes</phase>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <signature>
- <groupId>org.codehaus.mojo.signature</groupId>
- <artifactId>java18</artifactId>
- <version>1.0</version>
- </signature>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>