JarMappings loaded from disk are now transformed through a
JarMappingInputTransformer interface, which can arbitrarily
transform classes on loading. Currently only implemented
by ShadeRelocationSimulator.
You could always load multiple mappings by calling loadMapping()
multiple times (as in MCPC+), but now it is also supported for
command-line usage. --srg-in mapping1.srg --srg-in mapping2.srg...
equivalent to cat mapping1.srg mapping2.srg.
JarMapping now maintains an InheritanceMap, and will populate
from IInheritanceProvider, if given. This allows inheritance to
be cached either locally or globally (across different JarMappings).
setFallback() allows an IInheritanceProvider to be specified which
will be consulted when inheritance for a requested class is unavailable.
If it returns a value, the inheritance will be cached in the InheritanceMap.
Change data structure to a linked hash map, preserving insertion
order. This allows subpackages to be inserted into the package
map for remapping, before their parent package. For example,
A/B/C -> X and A/B -> Y. With the unordered HashMap data structure,
this was not possible (reliably). With LinkedHashMap, now it is.
Used to "preprocess" a class file, using the ASM tree API,
before remapping with JarRemapper. Right now it only
extracts the inheritance and adds to an InheritanceMap.
Code moved from MCPC+ PluginClassLoader.
JarMapping now contains the IInheritanceProvider and tryClimb()
instead of JarRemapper, to allow other remappers access to the
same inheritance traversal code.
The trailing slash was being remapped, causing incorrect package names.
Expected format is for example:
org/bukkit/craftbukkit/v1_4_6/ org/bukkit/craftbukkit/v1_4_R1
to replace org/bukkit/craftbukkit/v1_4_6 -> org/bukkit/craftbukkit/v1_4_R1
The trailing slash is only to disambiguate from class remaps in csrg.
Remap through only one inheritance provider, instead of a list of them.
The multiple inheritance provider lookup functionality (check each one,
in order, until one provider responds for the class name) is still
available, but refactored into a new InheritanceProviders class.
Simplifies the common case of only having one inheritance provider, and
also reduces the redundant looping code previously in JarMapper/InheritanceMap.
The inheritance map, as generated with --write-inheritance/-H, can now
be read using --read-inheritance/-H. It will be remapped through the
currently loaded inverse mapping before supplying the inheritance provider.
Example usage:
java -cp target/SpecialSource-1.3-SNAPSHOT-shaded.jar net.md_5.specialsource.SpecialSource --shade-relocation net.minecraft.server=net.minecraft.server.v1_4_R1 --shade-relocation org.bouncycastle=net.minecraft.v1_4_R1.org.bouncycastle --srg-in ../jars/1.4.7/cb2obf.csrg --in-jar ../IncompatiblePlugin/target/bukkit-sample-plugin-0.5.jar --out-jar /tmp/sp/out.jar -h /tmp/h
where the inheritance map was previously generated using:
java -cp target/SpecialSource-1.3-SNAPSHOT-shaded.jar:mcpc-plus-1.4.7-R0.2-SNAPSHOT.jar net.md_5.specialsource.SpecialSource --srg-in ~/minecraft/1.4.x/jars/1.4.7/cb2obf.csrg --live --write-inheritance /tmp/h
Only includes mapped classes in the parents, and only includes entries
for classes which have relevant parents (extends/implements classes).
Shrinks inheritance map on MCPC+ build 73 by 279 lines.
New --write-inheritance/-H command-line option, iterates all classes
in mapping and writes inheritance (interfaces and superclasses) to file.
Example usage, generating inheritance map from MCPC+:
java -cp target/SpecialSource-1.3-SNAPSHOT-shaded.jar:mcpc-plus-1.4.7-R0.2-SNAPSHOT.jar net.md_5.specialsource.SpecialSource --srg-in ~/minecraft/1.4.x/jars/1.4.7/cb2obf.csrg --live --write-inheritance /tmp/h
Used to lookup the inheritance if every single class - now will return
null and allow other inheritance providers to answer instead.
Consequentially mapTypeName() has been enhanced to accept a 'default' type name:
pass the same typeName to 'pass through' unmapped names, or null if you want to
distinguish between unmapped and mapped names, as RemappedRuntimeInheritanceProvider does.
Previously, the runtime inheritance providers would always use the
system classloader. Now you have to explicitly pass the classloader
to use. Also add a 'verbose' flag for debugging.
Although SpecialSource avoids generating unnecessary output where
methods/fields are not renamed, the _absence_ of a class rename is
arguably as important as a class rename, especially when comparing
jars where nearly all classes are renamed.
In the common case of generating Minecraft mappings from an obfuscated
jar and an internally-renamed deobfuscated mc-dev jar, all classes
are renamed, except for one -- the main class:
net/minecraft/server/MinecraftServer net/minecraft/server/MinecraftServer
When the mc-dev server jar is shaded into CraftBukkit, all classes are
relocated under a versioned package. However, the shading relocation
simulator misses MinecraftServer since it is not included in the mappings,
as it isn't renamed.
Always outputting class names, regardless of whether they are renamed,
only increases the mapping file by one line and removes the need to
special-case MinecraftServer.