diff options
author | Thinkofdeath <thinkofdeath@spigotmc.org> | 2015-02-27 16:27:23 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2015-02-27 16:27:23 +1100 |
commit | 47c51288b2d609975f5a3ee07a8ddebf0bcc6ba9 (patch) | |
tree | d80a4bd2e30a46f93bc3024756ea444040da6cac /src | |
parent | 76c6f0b6f90cb55019a35e816d6cf60df36742e7 (diff) | |
download | buildtools-47c51288b2d609975f5a3ee07a8ddebf0bcc6ba9.tar buildtools-47c51288b2d609975f5a3ee07a8ddebf0bcc6ba9.tar.gz buildtools-47c51288b2d609975f5a3ee07a8ddebf0bcc6ba9.tar.lz buildtools-47c51288b2d609975f5a3ee07a8ddebf0bcc6ba9.tar.xz buildtools-47c51288b2d609975f5a3ee07a8ddebf0bcc6ba9.zip |
Support multiple minecraft versions
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/spigotmc/builder/Builder.java | 38 | ||||
-rw-r--r-- | src/main/java/org/spigotmc/builder/VersionInfo.java | 16 |
2 files changed, 40 insertions, 14 deletions
diff --git a/src/main/java/org/spigotmc/builder/Builder.java b/src/main/java/org/spigotmc/builder/Builder.java index 20637f4..42c792d 100644 --- a/src/main/java/org/spigotmc/builder/Builder.java +++ b/src/main/java/org/spigotmc/builder/Builder.java @@ -63,7 +63,6 @@ public class Builder public static final String LOG_FILE = "BuildTools.log.txt"; public static final boolean IS_WINDOWS = System.getProperty( "os.name" ).startsWith( "Windows" ); public static final File CWD = new File( "." ); - public static final String MC_VERSION = "1.8"; private static boolean dontUpdate; private static boolean skipCompile; private static boolean generateSource; @@ -226,17 +225,28 @@ public class Builder pull( spigotGit, buildInfo.getRefs().getSpigot() ); } - File vanillaJar = new File( workDir, "minecraft_server." + MC_VERSION + ".jar" ); + VersionInfo versionInfo = new Gson().fromJson( + Resources.toString( new File( "BuildData/info.json" ).toURI().toURL(), Charsets.UTF_8 ), + VersionInfo.class + ); + // Default to 1.8 builds. + if ( versionInfo == null ) + { + versionInfo = new VersionInfo( "1.8", "bukkit-1.8.at", "bukkit-1.8-cl.csrg", "bukkit-1.8-members.csrg", "package.srg" ); + } + System.out.println( "Attempting to build Minecraft with details: " + versionInfo ); + + File vanillaJar = new File( workDir, "minecraft_server." + versionInfo.getMinecraftVersion() + ".jar" ); if ( !vanillaJar.exists() ) { - download( String.format( "https://s3.amazonaws.com/Minecraft.Download/versions/%1$s/minecraft_server.%1$s.jar", MC_VERSION ), vanillaJar ); + download( String.format( "https://s3.amazonaws.com/Minecraft.Download/versions/%1$s/minecraft_server.%1$s.jar", versionInfo.getMinecraftVersion() ), vanillaJar ); } Iterable<RevCommit> mappings = buildGit.log() - .addPath( "mappings/bukkit-1.8.at" ) - .addPath( "mappings/bukkit-1.8-cl.csrg" ) - .addPath( "mappings/bukkit-1.8-members.csrg" ) - .addPath( "mappings/package.srg" ) + .addPath( "mappings/" + versionInfo.getAccessTransforms() ) + .addPath( "mappings/" + versionInfo.getClassMappings() ) + .addPath( "mappings/" + versionInfo.getMemberMappings() ) + .addPath( "mappings/" + versionInfo.getPackageMappings() ) .setMaxCount( 1 ).call(); Hasher mappingsHash = Hashing.md5().newHasher(); @@ -254,17 +264,17 @@ 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/bukkit-1.8-cl.csrg", "-o", clMappedJar.getPath() ); + runProcess( CWD, "java", "-jar", "BuildData/bin/SpecialSource-2.jar", "map", "-i", vanillaJar.getPath(), "-m", "BuildData/mappings/" + versionInfo.getClassMappings(), "-o", clMappedJar.getPath() ); runProcess( CWD, "java", "-jar", "BuildData/bin/SpecialSource-2.jar", "map", "-i", clMappedJar.getPath(), - "-m", "BuildData/mappings/bukkit-1.8-members.csrg", "-o", mMappedJar.getPath() ); + "-m", "BuildData/mappings/" + versionInfo.getMemberMappings(), "-o", mMappedJar.getPath() ); - runProcess( CWD, "java", "-jar", "BuildData/bin/SpecialSource.jar", "-i", mMappedJar.getPath(), "--access-transformer", "BuildData/mappings/bukkit-1.8.at", - "-m", "BuildData/mappings/package.srg", "-o", finalMappedJar.getPath() ); + runProcess( CWD, "java", "-jar", "BuildData/bin/SpecialSource.jar", "-i", mMappedJar.getPath(), "--access-transformer", "BuildData/mappings/" + versionInfo.getAccessTransforms(), + "-m", "BuildData/mappings/" + versionInfo.getPackageMappings(), "-o", finalMappedJar.getPath() ); } runProcess( CWD, "sh", mvn, "install:install-file", "-Dfile=" + finalMappedJar, "-Dpackaging=jar", "-DgroupId=org.spigotmc", - "-DartifactId=minecraft-server", "-Dversion=1.8-SNAPSHOT" ); + "-DartifactId=minecraft-server", "-Dversion=" + versionInfo.getMinecraftVersion() + "-SNAPSHOT" ); File decompileDir = new File( workDir, "decompile-" + mappingsVersion ); if ( !decompileDir.exists() ) @@ -394,8 +404,8 @@ public class Builder System.out.println( " " ); } System.out.println( "Success! Everything compiled successfully. Copying final .jar files now." ); - copyJar( "CraftBukkit/target", "craftbukkit", "craftbukkit-" + MC_VERSION + ".jar" ); - copyJar( "Spigot/Spigot-Server/target", "spigot", "spigot-" + MC_VERSION + ".jar" ); + copyJar( "CraftBukkit/target", "craftbukkit", "craftbukkit-" + versionInfo.getMinecraftVersion() + ".jar" ); + copyJar( "Spigot/Spigot-Server/target", "spigot", "spigot-" + versionInfo.getMinecraftVersion() + ".jar" ); } public static final String get(String url) throws IOException diff --git a/src/main/java/org/spigotmc/builder/VersionInfo.java b/src/main/java/org/spigotmc/builder/VersionInfo.java new file mode 100644 index 0000000..9ab97f2 --- /dev/null +++ b/src/main/java/org/spigotmc/builder/VersionInfo.java @@ -0,0 +1,16 @@ +package org.spigotmc.builder; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class VersionInfo +{ + + private String minecraftVersion; + private String accessTransforms; + private String classMappings; + private String memberMappings; + private String packageMappings; +} |