More fixups for new launcher model

This commit is contained in:
Christian 2013-06-14 20:45:52 -04:00
parent 07a5efe612
commit 30d836fa36
18 changed files with 85 additions and 67 deletions

View file

@ -132,7 +132,7 @@
<target name="merge-source" depends="buildenvsetup,merge-client,merge-common" />
<target name="build-universal" depends="buildenvsetup,merge-client,merge-common,reobfuscate,makeversion">
<target name="build-universal" depends="buildenvsetup,merge-client,merge-common,reobfuscate,makeversion,makebinpatches">
<condition property="universal.jarname" value="${modname}-universal-${version.minecraft}-${version}" else="${modname}-universal-${version.minecraft}-${version}-${version.branch}">
<equals arg1="${version.branch}" arg2="master" />
</condition>
@ -143,11 +143,12 @@
<attribute name="Main-Class" value="cpw.mods.fml.relauncher.ServerLaunchWrapper" />
<attribute name="Class-Path" value="minecraft_server.jar:lib/guava-14.0-rc3.jar:lib/bcprov-jdk15on-148-src.zip:lib/asm-debug-all-4.1.jar:lib/scala-library.jar:lib/argo-3.2-src.jar" />
</manifest>
<fileset dir="${client.mcp.obfoutput}" includes="**/*.class" excludes="*.class" />
<fileset dir="${client.mcp.obfoutput}" includes="**/*.class" excludes="*.class,net/minecraft/**/*.class" />
</jar>
<antcall target="signjar" />
<zip update="true" destfile="${basedir}/target/${universal.jarname}.zip">
<fileset dir="${client.mcp.obfoutput}" includes="*.class" />
<zipfileset dir="${basedir}/binpatch" prefix="binpatch" includes="**/*.binpatch"/>
<!-- <fileset dir="${client.mcp.obfoutput}" includes="*.class" />-->
<zipfileset dir="${basedir}" includes="fmlversion.properties" />
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt" />
<zipfileset dir="${common.src.dir}" includes="mcpmod.info" />
@ -367,17 +368,28 @@
<echo>${env.JENKINS_HOME} ${universal.jarname} ${sign.KEYPASS}</echo>
<signjar alias="FML" jar="${basedir}/target/${universal.jarname}.zip" keypass="${sign.KEYPASS}" keystore="${env.JENKINS_HOME}/${sign.KEYSTORE}" storepass="${sign.STOREPASS}" verbose="true" />
</target>
<target name="makebinpatches">
<java classname="cpw.mods.fml.patcher.GenDiffSet">
<target name="makebinpatches" depends="buildenvsetup,makeversion">
<java classname="cpw.mods.fml.common.patcher.GenDiffSet">
<classpath>
<fileset dir="${mcp.home}/lib" includes="guava-14.0-rc3.jar"/>
<dirset dir="${mcp.obfoutput}"/>
<pathelement path="${mcp.obfoutput}/minecraft"/>
<fileset dir="${mcp.home}/lib" includes="guava-14.0-rc3.jar,asm-debug-all-4.1.jar"/>
</classpath>
<arg path="${mcp.home}/jars/bin/minecraft.jar.backup"/>
<arg path="${mcp.home}/jars/bin/minecraft.jar.backup"/>
<arg path="${mcp.obfoutput}"/>
<arg path="${mcp.obfoutput}/minecraft"/>
<arg path="${basedir}/deobfuscation_data_${version.minecraft}.zip"/>
<arg path="${basedir}/binpatch/client"/>
</java>
<java classname="cpw.mods.fml.common.patcher.GenDiffSet">
<classpath>
<pathelement path="${mcp.obfoutput}/minecraft"/>
<fileset dir="${mcp.home}/lib" includes="guava-14.0-rc3.jar,asm-debug-all-4.1.jar"/>
</classpath>
<arg path="${mcp.home}/jars/bin/minecraft.jar.backup"/>
<arg path="${mcp.home}/jars/minecraft_server.jar.backup"/>
<arg path="${mcp.obfoutput}/minecraft"/>
<arg path="${basedir}/deobfuscation_data_${version.minecraft}.zip"/>
<arg path="${basedir}/binpatch/server"/>
</java>
</target>
</project>

View file

@ -12,6 +12,8 @@
package cpw.mods.fml.common.asm;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes;
@ -19,7 +21,6 @@ import org.objectweb.asm.Type;
import org.objectweb.asm.tree.ClassNode;
import cpw.mods.fml.common.registry.BlockProxy;
import cpw.mods.fml.relauncher.IClassTransformer;
public class ASMTransformer implements IClassTransformer
{

View file

@ -145,7 +145,7 @@ public class FMLSanityChecker implements IFMLCallHook
File mcDir = (File)data.get("mcLocation");
FMLDeobfuscatingRemapper.INSTANCE.setup(mcDir, cl, (String) data.get("deobfuscationFileName"));
File binpatches = new File(mcDir,"binpatch");
ClassPatchManager.INSTANCE.setup(FMLLaunchHandler.side(), getClass().getProtectionDomain().getCodeSource());
ClassPatchManager.INSTANCE.setup(FMLLaunchHandler.side());
}
}

View file

@ -32,6 +32,8 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.ClassNode;
@ -48,11 +50,11 @@ import com.google.common.io.LineProcessor;
import com.google.common.io.Resources;
import cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
import cpw.mods.fml.relauncher.IClassTransformer;
import cpw.mods.fml.relauncher.FMLRelaunchLog;
public class AccessTransformer implements IClassTransformer
{
private static final boolean DEBUG = false;
private static final boolean DEBUG = true;
private class Modifier
{
public String name = "";
@ -152,6 +154,7 @@ public class AccessTransformer implements IClassTransformer
return true;
}
});
FMLRelaunchLog.fine("Loaded %d rules from AccessTransformer config file %s", modifiers.size(), rulesFile);
}
@SuppressWarnings("unchecked")
@ -163,7 +166,7 @@ public class AccessTransformer implements IClassTransformer
if (DEBUG)
{
System.out.printf("Considering all methods and fields on %s (%s): %b\n", name, transformedName, makeAllPublic);
FMLRelaunchLog.fine("Considering all methods and fields on %s (%s): %b\n", name, transformedName, makeAllPublic);
}
if (!makeAllPublic && !modifiers.containsKey(name)) { return bytes; }

View file

@ -12,6 +12,9 @@
package cpw.mods.fml.common.asm.transformers;
import net.minecraft.launchwrapper.IClassNameTransformer;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes;
@ -20,8 +23,6 @@ import org.objectweb.asm.tree.ClassNode;
import cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
import cpw.mods.fml.common.asm.transformers.deobf.FMLRemappingAdapter;
import cpw.mods.fml.relauncher.IClassNameTransformer;
import cpw.mods.fml.relauncher.IClassTransformer;
public class DeobfuscationTransformer implements IClassTransformer, IClassNameTransformer {

View file

@ -26,6 +26,8 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.ClassNode;
@ -39,8 +41,6 @@ import com.google.common.collect.Lists;
import com.google.common.io.LineProcessor;
import com.google.common.io.Resources;
import cpw.mods.fml.relauncher.IClassTransformer;
public class MarkerTransformer implements IClassTransformer
{
private ListMultimap<String, String> markers = ArrayListMultimap.create();

View file

@ -1,7 +1,7 @@
package cpw.mods.fml.common.asm.transformers;
import net.minecraft.launchwrapper.IClassTransformer;
import cpw.mods.fml.common.patcher.ClassPatchManager;
import cpw.mods.fml.relauncher.IClassTransformer;
public class PatchingTransformer implements IClassTransformer {
@Override

View file

@ -15,6 +15,8 @@ package cpw.mods.fml.common.asm.transformers;
import java.util.Iterator;
import java.util.List;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Type;
@ -24,7 +26,6 @@ import org.objectweb.asm.tree.FieldNode;
import org.objectweb.asm.tree.MethodNode;
import cpw.mods.fml.relauncher.FMLLaunchHandler;
import cpw.mods.fml.relauncher.IClassTransformer;
import cpw.mods.fml.relauncher.SideOnly;
public class SideTransformer implements IClassTransformer

View file

@ -23,6 +23,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@ -119,7 +120,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
}
catch (IOException ioe)
{
FMLRelaunchLog.log(Level.SEVERE, ioe, "An error occurred loading the deobfuscation map data");
Logger.getLogger("FML").log(Level.SEVERE, "An error occurred loading the deobfuscation map data", ioe);
}
methodNameMaps = Maps.newHashMapWithExpectedSize(rawMethodMaps.size());
fieldNameMaps = Maps.newHashMapWithExpectedSize(rawFieldMaps.size());

View file

@ -1,7 +1,13 @@
package cpw.mods.fml.common.launcher;
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.google.common.base.Throwables;
import cpw.mods.fml.relauncher.FMLLaunchHandler;
@ -13,6 +19,7 @@ public class FMLTweaker implements ITweaker {
private File gameDir;
private File assetsDir;
private String profile;
private static URI jarLocation;
@Override
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile)
@ -21,11 +28,23 @@ public class FMLTweaker implements ITweaker {
this.gameDir = gameDir;
this.assetsDir = assetsDir;
this.profile = profile;
try
{
jarLocation = getClass().getProtectionDomain().getCodeSource().getLocation().toURI();
}
catch (URISyntaxException e)
{
Logger.getLogger("FMLTWEAK").log(Level.SEVERE, "Missing URI information for FML tweak");
throw Throwables.propagate(e);
}
}
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader)
{
classLoader.addTransformerExclusion("cpw.mods.fml.repackage.");
classLoader.addTransformerExclusion("cpw.mods.fml.relauncher.");
classLoader.addTransformerExclusion("cpw.mods.fml.common.asm.transformers.");
FMLLaunchHandler.configureForClientLaunch(classLoader, this);
}
@ -46,4 +65,9 @@ public class FMLTweaker implements ITweaker {
return gameDir;
}
public static URI getJarLocation()
{
return jarLocation;
}
}

View file

@ -23,6 +23,7 @@ import com.google.common.io.ByteStreams;
import com.google.common.io.Files;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.launcher.FMLTweaker;
import cpw.mods.fml.relauncher.FMLRelaunchLog;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.repackage.com.nothome.delta.GDiffPatcher;
@ -79,13 +80,14 @@ public class ClassPatchManager {
return inputData;
}
public void setup(Side side, CodeSource fmlLib)
public void setup(Side side)
{
Pattern binpatchMatcher = Pattern.compile(String.format("binpatch/%s/*.binpatch", side.toString().toLowerCase(Locale.ENGLISH)));
Pattern binpatchMatcher = Pattern.compile(String.format("binpatch/%s/.*.binpatch", side.toString().toLowerCase(Locale.ENGLISH)));
JarFile fmlJar;
try
{
File fmlJarFile = new File(fmlLib.getLocation().toURI());
FMLRelaunchLog.fine("FML URI is %s", FMLTweaker.getJarLocation());
File fmlJarFile = new File(FMLTweaker.getJarLocation());
fmlJar = new JarFile(fmlJarFile);
}
catch (Exception e)

View file

@ -5,6 +5,7 @@ import java.io.IOException;
import java.util.Collections;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.omg.CORBA.REBIND;
@ -28,6 +29,7 @@ public class GenDiffSet {
String deobfFileName = args[3];
String binPatchOutputDir = args[4];
Logger.getLogger("GENDIFF").log(Level.INFO, String.format("Creating patches at %s for %s from %s", binPatchOutputDir, targetJar, reobfuscationOutputPath));
Delta delta = new Delta();
FMLDeobfuscatingRemapper remapper = FMLDeobfuscatingRemapper.INSTANCE;
remapper.setupLoadOnly(deobfFileName, false);

View file

@ -78,6 +78,7 @@ public class CoreModManager
{
try
{
FMLRelaunchLog.finest("Adding coremod for loading %s", s);
IFMLLoadingPlugin plugin = (IFMLLoadingPlugin) Class.forName(s, true, classLoader).newInstance();
loadPlugins.add(plugin);
}
@ -146,6 +147,7 @@ public class CoreModManager
return;
}
libraries = new ArrayList<ILibrarySet>();
for (ILibrarySet lib : libraries)
{
for (int i=0; i<lib.getLibraries().length; i++)
@ -265,6 +267,7 @@ public class CoreModManager
{
for (String xformClass : plug.getASMTransformerClass())
{
FMLRelaunchLog.finest("Registering transformer %s", xformClass);
classLoader.registerTransformer(xformClass);
}
}

View file

@ -12,6 +12,8 @@
package cpw.mods.fml.relauncher;
import java.util.logging.Level;
public class DummyDownloader implements IDownloadDisplay
{
@ -46,8 +48,7 @@ public class DummyDownloader implements IDownloadDisplay
@Override
public void updateProgressString(String string, Object... data)
{
// TODO Auto-generated method stub
FMLRelaunchLog.log(Level.FINE, string, data);
}
@Override

View file

@ -16,6 +16,7 @@ import java.applet.Applet;
import java.io.File;
import java.lang.reflect.Method;
import java.net.URLClassLoader;
import java.util.logging.Level;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
@ -104,7 +105,7 @@ public class FMLLaunchHandler
}
catch (Throwable t)
{
FMLRelaunchLog.severe("An error occurred trying to configure the minecraft home at %s for Forge Mod Loader", minecraftHome.getAbsolutePath());
FMLRelaunchLog.log(Level.SEVERE, t, "An error occurred trying to configure the minecraft home at %s for Forge Mod Loader", minecraftHome.getAbsolutePath());
throw Throwables.propagate(t);
}
}

View file

@ -28,6 +28,8 @@ import java.util.logging.LogManager;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import net.minecraft.launchwrapper.LogWrapper;
import com.google.common.base.Throwables;
public class FMLRelaunchLog
@ -163,6 +165,7 @@ public class FMLRelaunchLog
globalLogger.setLevel(Level.OFF);
log.myLog = Logger.getLogger("ForgeModLoader");
LogWrapper.retarget(log.myLog);
Logger stdOut = Logger.getLogger("STDOUT");
stdOut.setParent(log.myLog);

View file

@ -1,19 +0,0 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.relauncher;
public interface IClassNameTransformer {
public String remapClassName(String name);
public String unmapClassName(String name);
}

View file

@ -1,18 +0,0 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.relauncher;
public interface IClassTransformer
{
public byte[] transform(String name, String transformedName, byte[] bytes);
}