From 2cf460f29ed4c844c4e85795fed922dc9d95bcdb Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 15 Feb 2016 06:02:47 -0600 Subject: [PATCH] Update version handling for our new build system CC GH-19 --- .../0008-Check-PaperSpigot-versions.patch | 39 ++++++--- Spigot-Server-Patches/0001-POM-Changes.patch | 85 +++++++++++++++---- ...-Fix-jar-being-shaded-multiple-times.patch | 8 +- 3 files changed, 98 insertions(+), 34 deletions(-) diff --git a/Spigot-API-Patches/0008-Check-PaperSpigot-versions.patch b/Spigot-API-Patches/0008-Check-PaperSpigot-versions.patch index 3ec7cdbee3..30c2b8f6a7 100644 --- a/Spigot-API-Patches/0008-Check-PaperSpigot-versions.patch +++ b/Spigot-API-Patches/0008-Check-PaperSpigot-versions.patch @@ -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 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 diff --git a/Spigot-Server-Patches/0001-POM-Changes.patch b/Spigot-Server-Patches/0001-POM-Changes.patch index 14252c1e7e..7778f227d2 100644 --- a/Spigot-Server-Patches/0001-POM-Changes.patch +++ b/Spigot-Server-Patches/0001-POM-Changes.patch @@ -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 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 ${project.version} jar compile -@@ -108,11 +109,11 @@ - 0.2 - - +@@ -96,6 +97,11 @@ + spigotmc-public + https://hub.spigotmc.org/nexus/content/groups/public/ + ++ ++ ++ destroystokyo ++ https://ci.destroystokyo.com/plugin/repository/everything/ ++ + + + +@@ -103,36 +109,21 @@ + install + + +- net.md-5 +- scriptus +- 0.2 +- +- - ex-spigot -+ ex-paperspigot - +- - git-Spigot-%s -+ git-PaperSpigot-%s - ../ +- ../ - spigot.desc -+ paperspigot.desc - - initialize - -@@ -142,7 +143,7 @@ +- +- initialize +- +- describe +- +- +- +- ex-craftbukkit +- +- -%s +- ../../CraftBukkit +- craftbukkit.desc +- +- initialize +- +- describe +- +- +- +- ++ com.lukegb.mojo ++ gitdescribe-maven-plugin ++ 3.1-SNAPSHOT ++ ++ git-PaperSpigot- ++ ++ ++ ++ compile ++ ++ gitdescribe ++ ++ ++ ++ + + org.apache.maven.plugins + maven-jar-plugin +@@ -142,7 +133,7 @@ org.bukkit.craftbukkit.Main CraftBukkit - ${spigot.desc}${craftbukkit.desc} -+ ${paperspigot.desc}${craftbukkit.desc} ++ ${describe} Bukkit Team Bukkit ${api.version} -@@ -172,26 +173,6 @@ +@@ -172,26 +163,6 @@ @@ -133,5 +182,5 @@ index 9304637..3a4b142 100644 if (stream != null) { -- -2.7.0 +2.7.1 diff --git a/Spigot-Server-Patches/0042-Fix-jar-being-shaded-multiple-times.patch b/Spigot-Server-Patches/0042-Fix-jar-being-shaded-multiple-times.patch index c40990ffc9..d4c7e10eff 100644 --- a/Spigot-Server-Patches/0042-Fix-jar-being-shaded-multiple-times.patch +++ b/Spigot-Server-Patches/0042-Fix-jar-being-shaded-multiple-times.patch @@ -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 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 @@ maven-jar-plugin 2.5 @@ -17,5 +17,5 @@ index cdbb1ca..b4ead1d 100644 org.bukkit.craftbukkit.Main -- -2.7.0 +2.7.1