diff options
author | md_5 <git@md-5.net> | 2015-02-27 16:22:46 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2015-02-27 16:22:46 +1100 |
commit | 76c6f0b6f90cb55019a35e816d6cf60df36742e7 (patch) | |
tree | 86d4f464e6c04507457952cf758b1e894f54b86e | |
parent | 9027b7f12abd366ecb3b6bf83247ff318ba8e9fa (diff) | |
download | buildtools-76c6f0b6f90cb55019a35e816d6cf60df36742e7.tar buildtools-76c6f0b6f90cb55019a35e816d6cf60df36742e7.tar.gz buildtools-76c6f0b6f90cb55019a35e816d6cf60df36742e7.tar.lz buildtools-76c6f0b6f90cb55019a35e816d6cf60df36742e7.tar.xz buildtools-76c6f0b6f90cb55019a35e816d6cf60df36742e7.zip |
Check for required BuildTools version when building specific versions.
-rw-r--r-- | src/main/java/org/spigotmc/builder/BuildInfo.java | 1 | ||||
-rw-r--r-- | src/main/java/org/spigotmc/builder/Builder.java | 26 |
2 files changed, 26 insertions, 1 deletions
diff --git a/src/main/java/org/spigotmc/builder/BuildInfo.java b/src/main/java/org/spigotmc/builder/BuildInfo.java index 42fa7b3..e0500fc 100644 --- a/src/main/java/org/spigotmc/builder/BuildInfo.java +++ b/src/main/java/org/spigotmc/builder/BuildInfo.java @@ -10,6 +10,7 @@ public class BuildInfo private String name; private String description; + private int toolsVersion = -1; private Refs refs; @Data diff --git a/src/main/java/org/spigotmc/builder/Builder.java b/src/main/java/org/spigotmc/builder/Builder.java index 98042a6..20637f4 100644 --- a/src/main/java/org/spigotmc/builder/Builder.java +++ b/src/main/java/org/spigotmc/builder/Builder.java @@ -72,6 +72,24 @@ public class Builder public static void main(String[] args) throws Exception { + // May be null + String buildVersion = Builder.class.getPackage().getImplementationVersion(); + int buildNumber = -1; + if ( buildVersion != null ) + { + String[] split = buildVersion.split( "-" ); + if ( split.length == 4 ) + { + try + { + buildNumber = Integer.parseInt( split[3] ); + } catch ( NumberFormatException ex ) + { + } + } + } + System.out.println( "Loading BuildTools version: " + buildVersion + " (#" + buildNumber + ")" ); + OptionParser parser = new OptionParser(); OptionSpec<Void> disableCertFlag = parser.accepts( "disable-certificate-check" ); OptionSpec<Void> dontUpdateFlag = parser.accepts( "dont-update" ); @@ -172,7 +190,7 @@ public class Builder Git spigotGit = Git.open( spigot ); Git buildGit = Git.open( buildData ); - BuildInfo buildInfo = new BuildInfo( "Dev Build", "Development", new BuildInfo.Refs( "master", "master", "master", "master" ) ); + BuildInfo buildInfo = new BuildInfo( "Dev Build", "Development", 0, new BuildInfo.Refs( "master", "master", "master", "master" ) ); if ( !dontUpdate ) { @@ -194,6 +212,12 @@ public class Builder System.out.println( verInfo ); buildInfo = new Gson().fromJson( verInfo, BuildInfo.class ); + + if ( buildNumber != -1 && buildInfo.getToolsVersion() != -1 && buildNumber < buildInfo.getToolsVersion() ) + { + System.err.println( "**** Your BuildTools is out of date and will not build the requested version. Please grab a new copy from http://www.spigotmc.org/" ); + System.exit( 1 ); + } } pull( buildGit, buildInfo.getRefs().getBuildData() ); |