diff options
author | md_5 <git@md-5.net> | 2015-03-01 10:23:32 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2015-03-01 10:23:32 +1100 |
commit | 5068da3ba101ec77ce5465894f2fd79489fc94fa (patch) | |
tree | 45a4f58326012d35d9b5cb9640a3a46dfbf390dc | |
parent | 54f85d1937def6312e9220852f2ef5656c2b2a4b (diff) | |
download | buildtools-5068da3ba101ec77ce5465894f2fd79489fc94fa.tar buildtools-5068da3ba101ec77ce5465894f2fd79489fc94fa.tar.gz buildtools-5068da3ba101ec77ce5465894f2fd79489fc94fa.tar.lz buildtools-5068da3ba101ec77ce5465894f2fd79489fc94fa.tar.xz buildtools-5068da3ba101ec77ce5465894f2fd79489fc94fa.zip |
Add --rev flag to build specific versions.
-rw-r--r-- | src/main/java/org/spigotmc/builder/Builder.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/org/spigotmc/builder/Builder.java b/src/main/java/org/spigotmc/builder/Builder.java index 42c792d..3aa7a76 100644 --- a/src/main/java/org/spigotmc/builder/Builder.java +++ b/src/main/java/org/spigotmc/builder/Builder.java @@ -96,6 +96,7 @@ public class Builder OptionSpec<Void> generateSourceFlag = parser.accepts( "generate-source" ); OptionSpec<Void> generateDocsFlag = parser.accepts( "generate-docs" ); OptionSpec<Void> devFlag = parser.accepts( "dev" ); + OptionSpec<String> jenkinsVersion = parser.accepts( "rev" ).withRequiredArg().defaultsTo( "latest" ); OptionSet options = parser.parse( args ); @@ -195,19 +196,20 @@ public class Builder { if ( !dev ) { - System.out.println( "Checking for latest version:" ); + String askedVersion = options.valueOf( jenkinsVersion ); + System.out.println( "Attempting to build version: '" + askedVersion + "' use --rev <version> to override" ); String verInfo; try { - verInfo = get( "https://hub.spigotmc.org/versions/latest.json" ); + verInfo = get( "https://hub.spigotmc.org/versions/" + askedVersion + ".json" ); } catch ( IOException ex ) { - System.err.println( "Could not get latest version" ); + System.err.println( "Could not get version " + askedVersion + " does it exist? Try another version or use 'latest'" ); ex.printStackTrace(); return; } - System.out.println( "Found latest version" ); + System.out.println( "Found version" ); System.out.println( verInfo ); buildInfo = new Gson().fromJson( verInfo, BuildInfo.class ); |