diff --git a/fml/build.xml b/fml/build.xml index a7858e5cd..a2383a9bb 100644 --- a/fml/build.xml +++ b/fml/build.xml @@ -132,7 +132,7 @@ - + @@ -143,11 +143,12 @@ - + - + + @@ -367,17 +368,28 @@ ${env.JENKINS_HOME} ${universal.jarname} ${sign.KEYPASS} - - + + - - + + - + + + + + + + + + + + + diff --git a/fml/common/cpw/mods/fml/common/asm/ASMTransformer.java b/fml/common/cpw/mods/fml/common/asm/ASMTransformer.java index b09d00131..054a911a8 100644 --- a/fml/common/cpw/mods/fml/common/asm/ASMTransformer.java +++ b/fml/common/cpw/mods/fml/common/asm/ASMTransformer.java @@ -5,13 +5,15 @@ * 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.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 { diff --git a/fml/common/cpw/mods/fml/common/asm/FMLSanityChecker.java b/fml/common/cpw/mods/fml/common/asm/FMLSanityChecker.java index 9b2527459..b9abcea04 100644 --- a/fml/common/cpw/mods/fml/common/asm/FMLSanityChecker.java +++ b/fml/common/cpw/mods/fml/common/asm/FMLSanityChecker.java @@ -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()); } } diff --git a/fml/common/cpw/mods/fml/common/asm/transformers/AccessTransformer.java b/fml/common/cpw/mods/fml/common/asm/transformers/AccessTransformer.java index 7e4e09ac5..2f507c3a8 100644 --- a/fml/common/cpw/mods/fml/common/asm/transformers/AccessTransformer.java +++ b/fml/common/cpw/mods/fml/common/asm/transformers/AccessTransformer.java @@ -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; } diff --git a/fml/common/cpw/mods/fml/common/asm/transformers/DeobfuscationTransformer.java b/fml/common/cpw/mods/fml/common/asm/transformers/DeobfuscationTransformer.java index 4789157ac..833f5ef7f 100644 --- a/fml/common/cpw/mods/fml/common/asm/transformers/DeobfuscationTransformer.java +++ b/fml/common/cpw/mods/fml/common/asm/transformers/DeobfuscationTransformer.java @@ -5,13 +5,16 @@ * 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.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 { diff --git a/fml/common/cpw/mods/fml/common/asm/transformers/MarkerTransformer.java b/fml/common/cpw/mods/fml/common/asm/transformers/MarkerTransformer.java index 518b5180b..72194a02a 100644 --- a/fml/common/cpw/mods/fml/common/asm/transformers/MarkerTransformer.java +++ b/fml/common/cpw/mods/fml/common/asm/transformers/MarkerTransformer.java @@ -5,7 +5,7 @@ * 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 */ @@ -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 markers = ArrayListMultimap.create(); diff --git a/fml/common/cpw/mods/fml/common/asm/transformers/PatchingTransformer.java b/fml/common/cpw/mods/fml/common/asm/transformers/PatchingTransformer.java index cf1f365ea..5b44e7c20 100644 --- a/fml/common/cpw/mods/fml/common/asm/transformers/PatchingTransformer.java +++ b/fml/common/cpw/mods/fml/common/asm/transformers/PatchingTransformer.java @@ -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 diff --git a/fml/common/cpw/mods/fml/common/asm/transformers/SideTransformer.java b/fml/common/cpw/mods/fml/common/asm/transformers/SideTransformer.java index feecf88da..def030e7f 100644 --- a/fml/common/cpw/mods/fml/common/asm/transformers/SideTransformer.java +++ b/fml/common/cpw/mods/fml/common/asm/transformers/SideTransformer.java @@ -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 diff --git a/fml/common/cpw/mods/fml/common/asm/transformers/deobf/FMLDeobfuscatingRemapper.java b/fml/common/cpw/mods/fml/common/asm/transformers/deobf/FMLDeobfuscatingRemapper.java index 30ce85cf3..bf3c58072 100644 --- a/fml/common/cpw/mods/fml/common/asm/transformers/deobf/FMLDeobfuscatingRemapper.java +++ b/fml/common/cpw/mods/fml/common/asm/transformers/deobf/FMLDeobfuscatingRemapper.java @@ -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()); diff --git a/fml/common/cpw/mods/fml/common/launcher/FMLTweaker.java b/fml/common/cpw/mods/fml/common/launcher/FMLTweaker.java index a536680c4..aa38215c0 100644 --- a/fml/common/cpw/mods/fml/common/launcher/FMLTweaker.java +++ b/fml/common/cpw/mods/fml/common/launcher/FMLTweaker.java @@ -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 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; + } + } diff --git a/fml/common/cpw/mods/fml/common/patcher/ClassPatchManager.java b/fml/common/cpw/mods/fml/common/patcher/ClassPatchManager.java index b8f15bcbf..9cc4e03a8 100644 --- a/fml/common/cpw/mods/fml/common/patcher/ClassPatchManager.java +++ b/fml/common/cpw/mods/fml/common/patcher/ClassPatchManager.java @@ -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) diff --git a/fml/common/cpw/mods/fml/common/patcher/GenDiffSet.java b/fml/common/cpw/mods/fml/common/patcher/GenDiffSet.java index 87dd7a12e..b5e6cd3a7 100644 --- a/fml/common/cpw/mods/fml/common/patcher/GenDiffSet.java +++ b/fml/common/cpw/mods/fml/common/patcher/GenDiffSet.java @@ -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); diff --git a/fml/common/cpw/mods/fml/relauncher/CoreModManager.java b/fml/common/cpw/mods/fml/relauncher/CoreModManager.java index 87ec97b79..3cfb15092 100644 --- a/fml/common/cpw/mods/fml/relauncher/CoreModManager.java +++ b/fml/common/cpw/mods/fml/relauncher/CoreModManager.java @@ -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(); for (ILibrarySet lib : libraries) { for (int i=0; i