-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy path0003-Setup-Gradle-project.patch
301 lines (299 loc) · 10.6 KB
/
0003-Setup-Gradle-project.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: hpfxd <[email protected]>
Date: Wed, 27 Oct 2021 01:44:46 -0400
Subject: [PATCH] Setup Gradle project
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000000000000000000000000000000000000..a739f2e6736456b3b03eee79771bac58e081e564
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,122 @@
+plugins {
+ id("pandaspigot.conventions")
+ `maven-publish`
+}
+
+java {
+ withSourcesJar()
+ withJavadocJar()
+}
+
+dependencies {
+ api("commons-lang:commons-lang:2.6")
+ api("org.avaje:ebean:2.8.1")
+ api("com.googlecode.json-simple:json-simple:1.1.1")
+ api("org.yaml:snakeyaml:1.15")
+ api("net.md-5:bungeecord-chat:1.8-SNAPSHOT")
+ compileOnlyApi("net.sf.trove4j:trove4j:3.0.3") // provided by server
+
+ // bundled with Minecraft, should be kept in sync
+ api("com.google.guava:guava:17.0")
+ api("com.google.code.gson:gson:2.2.4")
+
+ // testing
+ testImplementation("junit:junit:4.12")
+ testImplementation("org.hamcrest:hamcrest-library:1.3")
+ testImplementation("net.sf.trove4j:trove4j:3.0.3") // required by tests
+}
+
+tasks {
+ val generateApiVersioningFile by registering {
+ inputs.property("version", project.version)
+ val pomProps = layout.buildDirectory.file("pom.properties")
+ outputs.file(pomProps)
+ doLast {
+ pomProps.get().asFile.writeText("version=${project.version}")
+ }
+ }
+
+ jar {
+ from(generateApiVersioningFile.map { it.outputs.files.singleFile }) {
+ into("META-INF/maven/${project.group}/${project.name.toLowerCase()}")
+ }
+
+ manifest {
+ attributes(
+ "Automatic-Module-Name" to "org.bukkit"
+ )
+ }
+ }
+
+ withType<Javadoc> {
+ (options as StandardJavadocDocletOptions).let {
+ // hide warnings
+ it.addBooleanOption("Xdoclint:none", true)
+ it.addStringOption("Xmaxwarns", "1")
+
+ it.links(
+ "https://guava.dev/releases/17.0/api/docs/",
+ "https://javadoc.io/doc/org.yaml/snakeyaml/1.15/",
+ "https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/",
+ )
+ }
+ }
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("mavenJava") {
+ from(components["java"])
+ versionMapping {
+ usage("java-api") {
+ fromResolutionOf("runtimeClasspath")
+ }
+ }
+
+ pom {
+ url.set("https://github.com/hpfxd/PandaSpigot")
+ description.set(project.description)
+ name.set(project.name)
+ // if this is a CI build, set version as the run id
+ System.getenv("GITHUB_RUN_NUMBER").let { if (it != null) version = it }
+
+ developers {
+ developer {
+ id.set("hpfxd")
+ name.set("Nate")
+ email.set("[email protected]")
+ }
+ }
+
+ scm {
+ connection.set("scm:git:git://github.com/hpfxd/PandaSpigot.git")
+ developerConnection.set("scm:git:git://github.com/hpfxd/PandaSpigot.git")
+ url.set("https://github.com/hpfxd/PandaSpigot")
+ }
+
+ licenses {
+ license {
+ name.set("GPL-v3.0")
+ url.set("https://www.gnu.org/licenses/gpl-3.0.txt")
+ }
+ }
+ }
+ }
+ }
+
+ (System.getenv("REPO_USERNAME") ?: findProperty("repository.hpfxd.username")).let { repoUsername ->
+ if (repoUsername == null) return@let // don't declare repository if username not declared
+
+ repositories {
+ maven {
+ name = "hpfxd-repo"
+ url = uri("https://repo.hpfxd.com/releases/")
+
+ credentials {
+ username = repoUsername as String
+ password = System.getenv("REPO_PASSWORD") ?: findProperty("repository.hpfxd.password") as String
+ }
+ }
+ }
+ }
+}
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index fe9d6d265b686ae1c373e4fdcd202b16673366f1..0000000000000000000000000000000000000000
--- a/pom.xml
+++ /dev/null
@@ -1,161 +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>
-
- <parent>
- <groupId>org.github.paperspigot</groupId>
- <artifactId>paperspigot-parent</artifactId>
- <version>dev-SNAPSHOT</version>
- </parent>
-
- <groupId>org.github.paperspigot</groupId>
- <artifactId>paperspigot-api</artifactId>
- <version>1.8.8-R0.1-SNAPSHOT</version>
- <packaging>jar</packaging>
-
- <name>PaperSpigot-API</name>
- <url>https://hub.spigotmc.org/stash/projects/PAPER/</url>
- <description>An enhanced plugin API for Minecraft servers.</description>
-
- <properties>
- <!--PaperSpigot - Bump to 1.8 - This will haunt me -->
- <additionalparam>-Xdoclint:none</additionalparam>
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
- <!-- just until we get deployment to central approved -->
- <distributionManagement>
- <repository>
- <id>destroystokyo-releases</id>
- <url>https://repo.destroystokyo.com/content/repositories/releases/</url>
- </repository>
- <snapshotRepository>
- <id>destroystokyo-snapshots</id>
- <url>https://repo.destroystokyo.com/content/repositories/snapshots/</url>
- </snapshotRepository>
- </distributionManagement>
-
- <!-- required until fixed plexus-compiler-eclipse is deployed -->
- <pluginRepositories>
- <pluginRepository>
- <id>spigotmc-public</id>
- <url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
- </pluginRepository>
- </pluginRepositories>
-
- <dependencies>
- <dependency>
- <groupId>net.sf.trove4j</groupId>
- <artifactId>trove4j</artifactId>
- <version>3.0.3</version>
- <!-- Trove Provided by CraftBukkit -->
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.6</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>com.googlecode.json-simple</groupId>
- <artifactId>json-simple</artifactId>
- <version>1.1.1</version>
- <type>jar</type>
- <scope>compile</scope>
- </dependency>
- <!-- bundled with Minecraft, should be kept in sync -->
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>17.0</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.2.4</version>
- </dependency>
- <dependency>
- <groupId>org.avaje</groupId>
- <artifactId>ebean</artifactId>
- <version>2.8.1</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- <version>1.15</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>net.md-5</groupId>
- <artifactId>bungeecord-chat</artifactId>
- <version>1.8-SNAPSHOT</version>
- <type>jar</type>
- <scope>compile</scope>
- </dependency>
-
- <!-- testing -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-library</artifactId>
- <version>1.3</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <!-- versions after this appear to be broken -->
- <version>3.1</version>
- <configuration>
- <!-- we use the Eclipse compiler as it doesn't need a JDK -->
- <compilerId>eclipse</compilerId>
- <!-- source and target are ignored if this isn't true -->
- <optimize>true</optimize>
- </configuration>
- <dependencies>
- <!-- we need our custom version as it fixes some bugs on case sensitive file systems -->
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-compiler-eclipse</artifactId>
- <version>2.5.0-spigotmc</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>2.3</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <!-- utterly useless artifact from shade 2.x -->
- <createDependencyReducedPom>false</createDependencyReducedPom>
- <!-- when downloading via Maven we can pull depends individually -->
- <shadedArtifactAttached>true</shadedArtifactAttached>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>