mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-10 05:39:15 +01:00
Update version handling for our new build system
CC GH-19
This commit is contained in:
parent
cb4c48c343
commit
134dc373d2
@ -15,16 +15,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- if (version.startsWith("git-Spigot-")) {
|
- if (version.startsWith("git-Spigot-")) {
|
||||||
+ // PaperSpigot start
|
+ // PaperSpigot start
|
||||||
+ if (version.startsWith("git-PaperSpigot-")) {
|
+ if (version.startsWith("git-PaperSpigot-")) {
|
||||||
+ String[] parts = version.substring("git-PaperSpigot-".length()).split("-");
|
+ String[] parts = version.substring("git-PaperSpigot-".length()).split("[-\\s]");
|
||||||
+ int cbVersions = getDistance("craftbukkit", parts[1].substring(0, parts[1].indexOf(' ')));
|
|
||||||
+ int paperSpigotVersions = getDistance("paperspigot", parts[0]);
|
+ int paperSpigotVersions = getDistance("paperspigot", parts[0]);
|
||||||
+ if (cbVersions == -1 || paperSpigotVersions == -1) {
|
+ if (paperSpigotVersions == -1) {
|
||||||
+ setVersionMessage("Error obtaining version information");
|
+ setVersionMessage("Error obtaining version information");
|
||||||
+ } else {
|
+ } else {
|
||||||
+ if (cbVersions == 0 && paperSpigotVersions == 0) {
|
+ if (paperSpigotVersions == 0) {
|
||||||
+ setVersionMessage("You are running the latest version");
|
+ setVersionMessage("You are running the latest version");
|
||||||
+ } else {
|
+ } else {
|
||||||
+ setVersionMessage("You are " + (cbVersions + paperSpigotVersions) + " version(s) behind");
|
+ setVersionMessage("You are " + paperSpigotVersions + " version(s) behind");
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ } else if (version.startsWith("git-Spigot-")) {
|
+ } else if (version.startsWith("git-Spigot-")) {
|
||||||
@ -33,14 +32,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
int cbVersions = getDistance("craftbukkit", parts[1].substring(0, parts[1].indexOf(' ')));
|
int cbVersions = getDistance("craftbukkit", parts[1].substring(0, parts[1].indexOf(' ')));
|
||||||
int spigotVersions = getDistance("spigot", parts[0]);
|
int spigotVersions = getDistance("spigot", parts[0]);
|
||||||
@@ -0,0 +0,0 @@ public class VersionCommand extends BukkitCommand {
|
@@ -0,0 +0,0 @@ public class VersionCommand extends BukkitCommand {
|
||||||
private static int getDistance(String repo, String hash) {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- private static int getDistance(String repo, String hash) {
|
||||||
|
+ private static int getDistance(String repo, String currentVerInt) { // PaperSpigot
|
||||||
try {
|
try {
|
||||||
BufferedReader reader = Resources.asCharSource(
|
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/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
|
Charsets.UTF_8
|
||||||
).openBufferedStream();
|
).openBufferedStream();
|
||||||
try {
|
try {
|
||||||
--
|
- JSONObject obj = (JSONObject) new JSONParser().parse(reader);
|
||||||
1.9.5.msysgit.0
|
- 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 {
|
||||||
|
--
|
@ -56,26 +56,75 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
@@ -0,0 +0,0 @@
|
@@ -0,0 +0,0 @@
|
||||||
<version>0.2</version>
|
<id>spigotmc-public</id>
|
||||||
<executions>
|
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||||
<execution>
|
</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 -->
|
||||||
|
@@ -0,0 +0,0 @@
|
||||||
|
<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-spigot</id>
|
||||||
+ <id>ex-paperspigot</id>
|
- <configuration>
|
||||||
<configuration>
|
|
||||||
- <format>git-Spigot-%s</format>
|
- <format>git-Spigot-%s</format>
|
||||||
+ <format>git-PaperSpigot-%s</format>
|
- <scmDirectory>../</scmDirectory>
|
||||||
<scmDirectory>../</scmDirectory>
|
|
||||||
- <descriptionProperty>spigot.desc</descriptionProperty>
|
- <descriptionProperty>spigot.desc</descriptionProperty>
|
||||||
+ <descriptionProperty>paperspigot.desc</descriptionProperty>
|
- </configuration>
|
||||||
</configuration>
|
- <phase>initialize</phase>
|
||||||
<phase>initialize</phase>
|
- <goals>
|
||||||
<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>
|
||||||
@@ -0,0 +0,0 @@
|
@@ -0,0 +0,0 @@
|
||||||
<manifestEntries>
|
<manifestEntries>
|
||||||
<Main-Class>org.bukkit.craftbukkit.Main</Main-Class>
|
<Main-Class>org.bukkit.craftbukkit.Main</Main-Class>
|
||||||
<Implementation-Title>CraftBukkit</Implementation-Title>
|
<Implementation-Title>CraftBukkit</Implementation-Title>
|
||||||
- <Implementation-Version>${spigot.desc}${craftbukkit.desc}</Implementation-Version>
|
- <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>
|
<Implementation-Vendor>Bukkit Team</Implementation-Vendor>
|
||||||
<Specification-Title>Bukkit</Specification-Title>
|
<Specification-Title>Bukkit</Specification-Title>
|
||||||
<Specification-Version>${api.version}</Specification-Version>
|
<Specification-Version>${api.version}</Specification-Version>
|
||||||
|
Loading…
Reference in New Issue
Block a user