Commit Graph

28 Commits

Author SHA1 Message Date
Agaricus
03a418d4b3 Expose individual class remapping in JarRemapper
The JarRemapper constructor is now public; you can create a remapper
with a JarMapping and list of IInheritanceProviders, and then use it
to remap an entire jar with remapJar(), or individual classes using
remapClassFile().
2013-01-23 19:32:21 -08:00
md_5
d6619b5d19 [maven-release-plugin] prepare for next development iteration 2013-01-23 20:11:49 +11:00
md_5
0355845dde [maven-release-plugin] prepare release SpecialSource-1.1 2013-01-23 20:06:54 +11:00
md_5
b839f98de2 Formattng + a few nitpicks of previous patches. 2013-01-23 20:05:24 +11:00
Agaricus
297b9f5a33 Add runtime class inheritance remapping
If -l is specified, will now traverse the runtime class hierarchy in
tryClimb to determine the method/symbol from the parent to remap, in
addition to the classes in the jar.

This can be used to remap plugins that call into external classes.
For example, with a Bukkit plugin:

 java -cp ../jars/craftbukkit-1.4.7-R0.1.jar:target/SpecialSource-1.1-SNAPSHOT.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 ../IncompatiblePlugin/IncompatiblePlugin-01.jar --out /tmp/bp/out.jar

using:
 https://bitbucket.org/agaricusb/incompatibleplugin/downloads/IncompatiblePlugin-01.jar
 6d75d94496

agaricus/plugins/IncompatiblePlugin/SamplePosCommand.java will be remapped:

  worldServer.q(...)

from worldServer.getTileEntity(). World provides getTileEntity and is remapped in cb2obf;
but WorldServer subclasses World and overrides getTileEntiy.. this information is not
available in the plugin itself and would not be remapped alone. By adding the CB jar to
the classpath and enabling runtime inheritance, the call is correctly remapped.
2013-01-23 00:23:38 -08:00
Agaricus
fa2089271a Abstract inheritance lookup into IInheritanceProvider 2013-01-22 23:21:08 -08:00
Agaricus
06adbcdb63 Fix shading of method descriptors 2013-01-22 22:31:16 -08:00
Agaricus
3ff134311d 13x performance increase in jar comparison by parsing method signatures
New class to parse and replace method signatures, instead of iterating over
each class. On my machine, old technique takes 6.8 to compare Minecraft 1.4.7,
new technique: 0.5 seconds, with identical results.
2013-01-22 22:18:08 -08:00
Agaricus
97d8e80769 Add maven-shade-plugin relocation simulation on input mapping
The --shade-relocation/-R option causes the --srg-in mapping old class
names to be transformed with the pattern. Multiple patterns can be given,
though currently only exact prefix matches are supported.

Example:

--shade-relocation net.minecraft.server=net.minecraft.server.v1_4_R1
--shade-relocation org.bouncycastle=net.minecraft.v1_4_R1.org.bouncycastle

The mapping will be 'shaded' before being applied to the jar.

You can use these options with --srg-in 1.4.7/cb2obf.csrg to remap plugins
which depend on the version-shaded class names (aka 'vcb').
2013-01-22 20:53:05 -08:00
Agaricus
01edc9471c Add package remapping
Package remaps are not generated by the jar compare, but can be added
programmatically by adding to JarMapping#packages, or in a .csrg as a
class remap but with a trailing slash, for example:

com/google/ guava10/com/google

will remap all classes in com/google/ to classes in guava10/com/google
2013-01-22 12:17:09 -08:00
Agaricus
5437eb4c9e Add remapping from csrg input file 2013-01-22 00:17:48 -08:00
Agaricus
642612e1c3 Allow remapping jars without Main-Class attribute (ex: Bukkit plugins) 2013-01-22 00:17:01 -08:00
Agaricus
1b15d3b29f Add 'compact srg' output format
This is a simpler mapping format, somewhat easier to parse, and without
the redundant information in the original .srg file format.
2013-01-21 20:58:55 -08:00
Agaricus
a11c2c4698 Move .srg writing into SrgWriter 2013-01-21 20:33:44 -08:00
Agaricus
b20840a65e Add -q option to suppress verbose output 2013-01-21 20:21:33 -08:00
Agaricus
ce4b890f87 Option parsing with joptsimple
Allow optionally writing srg to a file, or to stdout if unspecified.
2013-01-21 20:12:31 -08:00
Agaricus
84e39beee1 Fix missing main class 2013-01-21 19:21:02 -08:00
Agaricus
8e0a4debad Move srg writing and symbol comparison into JarMapping 2013-01-21 19:18:54 -08:00
Agaricus
b004ebf919 Make jar renaming optional (only generate mappings if no 3rd argument given) 2012-12-26 23:34:32 -08:00
Agaricus
9fdbdedf3c Remove 1.4.5 check 2012-12-26 23:24:16 -08:00
md_5
59c6e563c0 Its perfect! 2012-12-19 14:21:32 +11:00
md_5
c2ff5b8f02 Cleanup output of fields srg. Still need to do something about methods, maybe a simple string replace before comparing the descriptor. 2012-12-10 12:38:11 +11:00
md_5
03ae5d07c9 Java 6 support. 2012-12-09 10:29:04 +11:00
md_5
ac9cccdf8e Clean up / ignore unchecked cast 2012-12-09 10:19:52 +11:00
md_5
cb27511800 Fix license formatting. 2012-12-09 10:15:58 +11:00
md_5
045ff4221b [maven-release-plugin] prepare for next development iteration 2012-12-08 09:02:09 +11:00
md_5
a393ec13bc [maven-release-plugin] prepare release SpecialSource-1.0 2012-12-08 09:01:58 +11:00
md_5
e5af484c54 Initial commit. 2012-12-08 08:52:58 +11:00