mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 07:48:53 +01:00
Update version handling for our new build system
CC GH-19
This commit is contained in:
parent
7022e9325f
commit
2cf460f29e
3 changed files with 98 additions and 34 deletions
|
@ -1,30 +1,29 @@
|
|||
From 17906168cc148f5e0159b13415a6c6be73e07475 Mon Sep 17 00:00:00 2001
|
||||
From 9515fddcb7392076601abb157235deb36daaaafe Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <Zbob750@live.com>
|
||||
Date: Sun, 28 Dec 2014 16:28:21 -0600
|
||||
Subject: [PATCH] Check PaperSpigot versions
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
index b55abdb..61f7443 100644
|
||||
index b55abdb..cf651fc 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
@@ -185,7 +185,22 @@ public class VersionCommand extends BukkitCommand {
|
||||
@@ -185,7 +185,21 @@ public class VersionCommand extends BukkitCommand {
|
||||
private void obtainVersion() {
|
||||
String version = Bukkit.getVersion();
|
||||
if (version == null) version = "Custom";
|
||||
- if (version.startsWith("git-Spigot-")) {
|
||||
+ // PaperSpigot start
|
||||
+ if (version.startsWith("git-PaperSpigot-")) {
|
||||
+ String[] parts = version.substring("git-PaperSpigot-".length()).split("-");
|
||||
+ int cbVersions = getDistance("craftbukkit", parts[1].substring(0, parts[1].indexOf(' ')));
|
||||
+ String[] parts = version.substring("git-PaperSpigot-".length()).split("[-\\s]");
|
||||
+ int paperSpigotVersions = getDistance("paperspigot", parts[0]);
|
||||
+ if (cbVersions == -1 || paperSpigotVersions == -1) {
|
||||
+ if (paperSpigotVersions == -1) {
|
||||
+ setVersionMessage("Error obtaining version information");
|
||||
+ } else {
|
||||
+ if (cbVersions == 0 && paperSpigotVersions == 0) {
|
||||
+ if (paperSpigotVersions == 0) {
|
||||
+ setVersionMessage("You are running the latest version");
|
||||
+ } else {
|
||||
+ setVersionMessage("You are " + (cbVersions + paperSpigotVersions) + " version(s) behind");
|
||||
+ setVersionMessage("You are " + paperSpigotVersions + " version(s) behind");
|
||||
+ }
|
||||
+ }
|
||||
+ } else if (version.startsWith("git-Spigot-")) {
|
||||
|
@ -32,15 +31,31 @@ index b55abdb..61f7443 100644
|
|||
String[] parts = version.substring("git-Spigot-".length()).split("-");
|
||||
int cbVersions = getDistance("craftbukkit", parts[1].substring(0, parts[1].indexOf(' ')));
|
||||
int spigotVersions = getDistance("spigot", parts[0]);
|
||||
@@ -235,7 +250,7 @@ public class VersionCommand extends BukkitCommand {
|
||||
private static int getDistance(String repo, String hash) {
|
||||
@@ -232,16 +246,19 @@ public class VersionCommand extends BukkitCommand {
|
||||
}
|
||||
}
|
||||
|
||||
- private static int getDistance(String repo, String hash) {
|
||||
+ private static int getDistance(String repo, String currentVerInt) { // PaperSpigot
|
||||
try {
|
||||
BufferedReader reader = Resources.asCharSource(
|
||||
- new URL("https://hub.spigotmc.org/stash/rest/api/1.0/projects/SPIGOT/repos/" + repo + "/commits?since=" + URLEncoder.encode(hash, "UTF-8") + "&withCounts=true"),
|
||||
+ new URL("https://hub.spigotmc.org/stash/rest/api/1.0/projects/PAPER/repos/" + repo + "/commits?since=" + URLEncoder.encode(hash, "UTF-8") + "&withCounts=true"), // PaperSpigot
|
||||
+ new URL("https://ci.destroystokyo.com/job/PaperSpigot/lastSuccessfulBuild/buildNumber"), // PaperSpigot
|
||||
Charsets.UTF_8
|
||||
).openBufferedStream();
|
||||
try {
|
||||
- JSONObject obj = (JSONObject) new JSONParser().parse(reader);
|
||||
- return ((Number) obj.get("totalCount")).intValue();
|
||||
- } catch (ParseException ex) {
|
||||
+ // PaperSpigot start
|
||||
+ int newVer = Integer.decode(reader.readLine());
|
||||
+ int currentVer = Integer.decode(currentVerInt);
|
||||
+ return newVer - currentVer;
|
||||
+ } catch (NumberFormatException ex) {
|
||||
+ // PaperSpigot end
|
||||
ex.printStackTrace();
|
||||
return -1;
|
||||
} finally {
|
||||
--
|
||||
1.9.5.msysgit.0
|
||||
2.7.1
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
From 109279a4b9b86578f35995e8b7b5024fd422a56d Mon Sep 17 00:00:00 2001
|
||||
From e060c4c376a9d7a27eb43d52817182e12281cf00 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Thu, 19 Mar 2015 19:41:15 -0500
|
||||
Subject: [PATCH] POM Changes
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 91627ff..cdbb1ca 100644
|
||||
index 91627ff..85dff6f 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -1,12 +1,12 @@
|
||||
|
@ -55,31 +55,80 @@ index 91627ff..cdbb1ca 100644
|
|||
<version>${project.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
@@ -108,11 +109,11 @@
|
||||
<version>0.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
@@ -96,6 +97,11 @@
|
||||
<id>spigotmc-public</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||
</pluginRepository>
|
||||
+ <!-- PaperSpigot - Repo for gitdescribe -->
|
||||
+ <pluginRepository>
|
||||
+ <id>destroystokyo</id>
|
||||
+ <url>https://ci.destroystokyo.com/plugin/repository/everything/</url>
|
||||
+ </pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
|
||||
@@ -103,36 +109,21 @@
|
||||
<defaultGoal>install</defaultGoal>
|
||||
<plugins>
|
||||
<plugin>
|
||||
- <groupId>net.md-5</groupId>
|
||||
- <artifactId>scriptus</artifactId>
|
||||
- <version>0.2</version>
|
||||
- <executions>
|
||||
- <execution>
|
||||
- <id>ex-spigot</id>
|
||||
+ <id>ex-paperspigot</id>
|
||||
<configuration>
|
||||
- <configuration>
|
||||
- <format>git-Spigot-%s</format>
|
||||
+ <format>git-PaperSpigot-%s</format>
|
||||
<scmDirectory>../</scmDirectory>
|
||||
- <scmDirectory>../</scmDirectory>
|
||||
- <descriptionProperty>spigot.desc</descriptionProperty>
|
||||
+ <descriptionProperty>paperspigot.desc</descriptionProperty>
|
||||
</configuration>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
@@ -142,7 +143,7 @@
|
||||
- </configuration>
|
||||
- <phase>initialize</phase>
|
||||
- <goals>
|
||||
- <goal>describe</goal>
|
||||
- </goals>
|
||||
- </execution>
|
||||
- <execution>
|
||||
- <id>ex-craftbukkit</id>
|
||||
- <configuration>
|
||||
- <format>-%s</format>
|
||||
- <scmDirectory>../../CraftBukkit</scmDirectory>
|
||||
- <descriptionProperty>craftbukkit.desc</descriptionProperty>
|
||||
- </configuration>
|
||||
- <phase>initialize</phase>
|
||||
- <goals>
|
||||
- <goal>describe</goal>
|
||||
- </goals>
|
||||
- </execution>
|
||||
- </executions>
|
||||
- </plugin>
|
||||
+ <groupId>com.lukegb.mojo</groupId>
|
||||
+ <artifactId>gitdescribe-maven-plugin</artifactId>
|
||||
+ <version>3.1-SNAPSHOT</version>
|
||||
+ <configuration>
|
||||
+ <outputPrefix>git-PaperSpigot-</outputPrefix>
|
||||
+ </configuration>
|
||||
+ <executions>
|
||||
+ <execution>
|
||||
+ <phase>compile</phase>
|
||||
+ <goals>
|
||||
+ <goal>gitdescribe</goal>
|
||||
+ </goals>
|
||||
+ </execution>
|
||||
+ </executions>
|
||||
+ </plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
@@ -142,7 +133,7 @@
|
||||
<manifestEntries>
|
||||
<Main-Class>org.bukkit.craftbukkit.Main</Main-Class>
|
||||
<Implementation-Title>CraftBukkit</Implementation-Title>
|
||||
- <Implementation-Version>${spigot.desc}${craftbukkit.desc}</Implementation-Version>
|
||||
+ <Implementation-Version>${paperspigot.desc}${craftbukkit.desc}</Implementation-Version>
|
||||
+ <Implementation-Version>${describe}</Implementation-Version>
|
||||
<Implementation-Vendor>Bukkit Team</Implementation-Vendor>
|
||||
<Specification-Title>Bukkit</Specification-Title>
|
||||
<Specification-Version>${api.version}</Specification-Version>
|
||||
@@ -172,26 +173,6 @@
|
||||
@@ -172,26 +163,6 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -133,5 +182,5 @@ index 9304637..3a4b142 100644
|
|||
|
||||
if (stream != null) {
|
||||
--
|
||||
2.7.0
|
||||
2.7.1
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
From cdb68182791c146d28e7a9f18651f907ef7343d3 Mon Sep 17 00:00:00 2001
|
||||
From 0f95432dde26db7643e8ca3c7e0f04de6e18e51f Mon Sep 17 00:00:00 2001
|
||||
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||
Date: Thu, 30 Apr 2015 22:42:34 -0400
|
||||
Subject: [PATCH] Fix jar being shaded multiple times
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index cdbb1ca..b4ead1d 100644
|
||||
index 85dff6f..d0468a9 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -139,6 +139,7 @@
|
||||
@@ -129,6 +129,7 @@
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<configuration>
|
||||
|
@ -17,5 +17,5 @@ index cdbb1ca..b4ead1d 100644
|
|||
<manifestEntries>
|
||||
<Main-Class>org.bukkit.craftbukkit.Main</Main-Class>
|
||||
--
|
||||
2.7.0
|
||||
2.7.1
|
||||
|
||||
|
|
Loading…
Reference in a new issue