diff options
author | md_5 <git@md-5.net> | 2018-12-13 11:00:00 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-12-13 11:00:00 +1100 |
commit | f254dfa94052d748adf6ea693a4b504906b516b2 (patch) | |
tree | 300efdd241626756ccfd2b2690e6abd66689a3f6 | |
parent | 484ac46a8783ea32c06184d956b771fd6f7bdc37 (diff) | |
download | buildtools-f254dfa94052d748adf6ea693a4b504906b516b2.tar buildtools-f254dfa94052d748adf6ea693a4b504906b516b2.tar.gz buildtools-f254dfa94052d748adf6ea693a4b504906b516b2.tar.lz buildtools-f254dfa94052d748adf6ea693a4b504906b516b2.tar.xz buildtools-f254dfa94052d748adf6ea693a4b504906b516b2.zip |
Allow specifying decompile commands and tools version in BuildData/info.json
-rw-r--r-- | src/main/java/org/spigotmc/builder/Builder.java | 29 | ||||
-rw-r--r-- | src/main/java/org/spigotmc/builder/VersionInfo.java | 6 |
2 files changed, 30 insertions, 5 deletions
diff --git a/src/main/java/org/spigotmc/builder/Builder.java b/src/main/java/org/spigotmc/builder/Builder.java index 88552bb..8a5953e 100644 --- a/src/main/java/org/spigotmc/builder/Builder.java +++ b/src/main/java/org/spigotmc/builder/Builder.java @@ -333,6 +333,13 @@ public class Builder } System.out.println( "Attempting to build Minecraft with details: " + versionInfo ); + if ( buildNumber != -1 && versionInfo.getToolsVersion() != -1 && buildNumber < versionInfo.getToolsVersion() ) + { + System.err.println( "" ); + System.err.println( "**** Your BuildTools is out of date and will not build the requested version. Please grab a new copy from https://www.spigotmc.org/go/buildtools-dl" ); + System.exit( 1 ); + } + File vanillaJar = new File( workDir, "minecraft_server." + versionInfo.getMinecraftVersion() + ".jar" ); if ( !vanillaJar.exists() || !checkHash( vanillaJar, versionInfo ) ) { @@ -379,13 +386,25 @@ public class Builder File clMappedJar = new File( finalMappedJar + "-cl" ); File mMappedJar = new File( finalMappedJar + "-m" ); - runProcess( CWD, "java", "-jar", "BuildData/bin/SpecialSource-2.jar", "map", "-i", vanillaJar.getPath(), "-m", "BuildData/mappings/" + versionInfo.getClassMappings(), "-o", clMappedJar.getPath() ); + if ( versionInfo.getClassMapCommand() == null ) + { + versionInfo.setClassMapCommand( "java -jar BuildData/bin/SpecialSource-2.jar map -i {0} -m {1} -o {2}" ); + } + runProcess( CWD, MessageFormat.format( versionInfo.getClassMapCommand(), vanillaJar.getPath(), "BuildData/mappings/" + versionInfo.getClassMappings(), clMappedJar.getPath() ).split( " " ) ); - runProcess( CWD, "java", "-jar", "BuildData/bin/SpecialSource-2.jar", "map", "-i", clMappedJar.getPath(), - "-m", "BuildData/mappings/" + versionInfo.getMemberMappings(), "-o", mMappedJar.getPath() ); + if ( versionInfo.getMemberMapCommand() == null ) + { + versionInfo.setMemberMapCommand( "java -jar BuildData/bin/SpecialSource-2.jar map -i {0} -m {1} -o {2}" ); + } + runProcess( CWD, MessageFormat.format( versionInfo.getMemberMapCommand(), clMappedJar.getPath(), + "BuildData/mappings/" + versionInfo.getMemberMappings(), mMappedJar.getPath() ).split( " " ) ); - runProcess( CWD, "java", "-jar", "BuildData/bin/SpecialSource.jar", "--kill-lvt", "-i", mMappedJar.getPath(), "--access-transformer", "BuildData/mappings/" + versionInfo.getAccessTransforms(), - "-m", "BuildData/mappings/" + versionInfo.getPackageMappings(), "-o", finalMappedJar.getPath() ); + if ( versionInfo.getFinalMapCommand() == null ) + { + versionInfo.setFinalMapCommand( "java -jar BuildData/bin/SpecialSource.jar --kill-lvt -i {0} --access-transformer {1} -m {2} -o {3}" ); + } + runProcess( CWD, MessageFormat.format( versionInfo.getFinalMapCommand(), mMappedJar.getPath(), "BuildData/mappings/" + versionInfo.getAccessTransforms(), + "BuildData/mappings/" + versionInfo.getPackageMappings(), finalMappedJar.getPath() ).split( " " ) ); } runProcess( CWD, "sh", mvn, "install:install-file", "-Dfile=" + finalMappedJar, "-Dpackaging=jar", "-DgroupId=org.spigotmc", diff --git a/src/main/java/org/spigotmc/builder/VersionInfo.java b/src/main/java/org/spigotmc/builder/VersionInfo.java index b143403..e4d09ff 100644 --- a/src/main/java/org/spigotmc/builder/VersionInfo.java +++ b/src/main/java/org/spigotmc/builder/VersionInfo.java @@ -1,8 +1,10 @@ package org.spigotmc.builder; +import lombok.AllArgsConstructor; import lombok.Data; @Data +@AllArgsConstructor public class VersionInfo { @@ -12,8 +14,12 @@ public class VersionInfo private String memberMappings; private String packageMappings; private String minecraftHash; + private String classMapCommand; + private String memberMapCommand; + private String finalMapCommand; private String decompileCommand; private String serverUrl; + private int toolsVersion = -1; public VersionInfo(String minecraftVersion, String accessTransforms, String classMappings, String memberMappings, String packageMappings, String minecraftHash) { |