summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2017-02-10 18:35:39 +1100
committermd_5 <git@md-5.net>2017-02-10 18:35:39 +1100
commit8aa3a224c30cbb9223aac5456c12ec22ff64fa5b (patch)
tree99f1f61f9d99f74a4affb37eda12046e09cece3b
parent8ce56d03de485c4e588dd757ed47b6d4459a4577 (diff)
downloadbuildtools-8aa3a224c30cbb9223aac5456c12ec22ff64fa5b.tar
buildtools-8aa3a224c30cbb9223aac5456c12ec22ff64fa5b.tar.gz
buildtools-8aa3a224c30cbb9223aac5456c12ec22ff64fa5b.tar.lz
buildtools-8aa3a224c30cbb9223aac5456c12ec22ff64fa5b.tar.xz
buildtools-8aa3a224c30cbb9223aac5456c12ec22ff64fa5b.zip
Add server URL reading and correct building outdated versions per BUILDTOOLS-305
-rw-r--r--src/main/java/org/spigotmc/builder/Builder.java20
-rw-r--r--src/main/java/org/spigotmc/builder/VersionInfo.java12
2 files changed, 29 insertions, 3 deletions
diff --git a/src/main/java/org/spigotmc/builder/Builder.java b/src/main/java/org/spigotmc/builder/Builder.java
index 1ff6d78..a8eb0aa 100644
--- a/src/main/java/org/spigotmc/builder/Builder.java
+++ b/src/main/java/org/spigotmc/builder/Builder.java
@@ -74,6 +74,7 @@ public class Builder
private static boolean generateSource;
private static boolean generateDocs;
private static boolean dev;
+ private static String applyPatchesShell = "sh";
public static void main(String[] args) throws Exception
{
@@ -259,7 +260,7 @@ public class Builder
}
VersionInfo versionInfo = new Gson().fromJson(
- Resources.toString( new File( "BuildData/info.json" ).toURI().toURL(), Charsets.UTF_8 ),
+ Files.toString( new File( "BuildData/info.json" ), Charsets.UTF_8 ),
VersionInfo.class
);
// Default to 1.8 builds.
@@ -272,7 +273,20 @@ public class Builder
File vanillaJar = new File( workDir, "minecraft_server." + versionInfo.getMinecraftVersion() + ".jar" );
if ( !vanillaJar.exists() || !checkHash( vanillaJar, versionInfo ) )
{
- download( String.format( "https://s3.amazonaws.com/Minecraft.Download/versions/%1$s/minecraft_server.%1$s.jar", versionInfo.getMinecraftVersion() ), vanillaJar );
+ if ( versionInfo.getServerUrl() != null )
+ {
+ download( versionInfo.getServerUrl(), vanillaJar );
+ } else
+ {
+ download( String.format( "https://s3.amazonaws.com/Minecraft.Download/versions/%1$s/minecraft_server.%1$s.jar", versionInfo.getMinecraftVersion() ), vanillaJar );
+
+ // Legacy versions can also specify a specific shell to build with which has to be bash-compatible
+ applyPatchesShell = System.getenv().get( "SHELL" );
+ if ( applyPatchesShell == null || applyPatchesShell.trim().isEmpty() )
+ {
+ applyPatchesShell = "bash";
+ }
+ }
}
if ( !checkHash( vanillaJar, versionInfo ) )
{
@@ -426,7 +440,7 @@ public class Builder
try
{
- runProcess( spigot, "sh", "applyPatches.sh" );
+ runProcess( spigot, applyPatchesShell, "applyPatches.sh" );
System.out.println( "*** Spigot patches applied!" );
if ( !skipCompile )
diff --git a/src/main/java/org/spigotmc/builder/VersionInfo.java b/src/main/java/org/spigotmc/builder/VersionInfo.java
index 65caace..b143403 100644
--- a/src/main/java/org/spigotmc/builder/VersionInfo.java
+++ b/src/main/java/org/spigotmc/builder/VersionInfo.java
@@ -13,6 +13,7 @@ public class VersionInfo
private String packageMappings;
private String minecraftHash;
private String decompileCommand;
+ private String serverUrl;
public VersionInfo(String minecraftVersion, String accessTransforms, String classMappings, String memberMappings, String packageMappings, String minecraftHash)
{
@@ -23,4 +24,15 @@ public class VersionInfo
this.packageMappings = packageMappings;
this.minecraftHash = minecraftHash;
}
+
+ public VersionInfo(String minecraftVersion, String accessTransforms, String classMappings, String memberMappings, String packageMappings, String minecraftHash, String decompileCommand)
+ {
+ this.minecraftVersion = minecraftVersion;
+ this.accessTransforms = accessTransforms;
+ this.classMappings = classMappings;
+ this.memberMappings = memberMappings;
+ this.packageMappings = packageMappings;
+ this.minecraftHash = minecraftHash;
+ this.decompileCommand = decompileCommand;
+ }
}