java-decompiler: post-import cleanup (readme and build file updated)

master
Roman Shevchenko 10 years ago
parent f5431c3bb1
commit 8ef7bcb2ad
  1. 148
      build.xml
  2. 20
      readme.txt

@ -1,122 +1,30 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8"?>
<project name="Fernflower" default="dist" basedir=".">
<project name="Fernflower" default="buildAll" basedir=".">
<target name="init">
<taskdef resource="proguard/ant/task.properties" classpath="${basedir}/lib/proguard_4_11.jar" /> <property name="src" value="${basedir}/src"/>
<property name="out" value="${basedir}/out"/>
<taskdef name="javancss" classname="javancss.JavancssAntTask"> <property name="dist" value="${basedir}/fernflower.jar"/>
<classpath> </target>
<pathelement location="${basedir}/lib/ncss/javancss.jar"/>
<pathelement location="${basedir}/lib/ncss/javacc.jar"/> <target name="clean" depends="init">
<pathelement location="${basedir}/lib/ncss/ccl.jar"/> <delete includeemptydirs="true" failonerror="false">
</classpath> <fileset dir="${out}"/>
</taskdef> <fileset file="${dist}"/>
</delete>
<target name="init" description="initialization"> </target>
<property name="jar.file" value="fernflower.jar" />
<property name="timer.jar.file" value="timer.jar" /> <target name="compile" depends="init,clean">
<property name="src" value="${basedir}/src" /> <mkdir dir="${out}"/>
<property name="bin" value="${basedir}/bin" /> <javac srcdir="${src}" destdir="${out}" source="1.6" target="1.6" encoding="UTF-8" debug="true" includeantruntime="false"/>
<property name="lib" value="${basedir}/lib" /> </target>
<property name="fulldist" value="${basedir}/dist/full" />
<property name="obfuscateddist" value="${basedir}/dist/obfuscated" /> <target name="dist" depends="init,compile">
</target> <jar jarfile="${dist}" compress="true" basedir="${out}" includes="**/*.class">
<manifest>
<target name="buildAll" depends="jar, obfuscate" description="build full distribution packet"/> <attribute name="Main-Class" value="org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler"/>
</manifest>
<target name="clean" depends="init"> </jar>
<delete includeemptydirs="true" failonerror="false"> </target>
<fileset dir="${bin}"/>
<fileset dir="${fulldist}"/>
<fileset dir="${obfuscateddist}"/>
</delete>
</target>
<target name="compile" depends="clean" description="compile sources (main module only)">
<mkdir dir="${bin}"/>
<javac srcdir="${src}" destdir="${bin}" source="1.6" target="1.6" encoding="UTF-8" debug="true" includeantruntime="false"/>
</target>
<target name="jar" depends="compile" description="generate jar file">
<jar jarfile="${fulldist}/${jar.file}" compress="true" basedir="${bin}" includes="**/*.class" excludes="test/**/*.*,com/**/*.*,*.class">
<manifest>
<attribute name="Main-Class" value="de.fernflower.main.decompiler.ConsoleDecompiler"/>
</manifest>
</jar>
</target>
<target name="obfuscate" depends="init" description="Call Proguard on Fernflower">
<condition property="rt_jar" value="${java.home}/../Classes/classes.jar" else="${java.home}/lib/rt.jar">
<contains string="${java.vendor}" substring="Apple"/>
</condition>
<proguard>
-injars "${fulldist}/${jar.file}"
-outjars "${obfuscateddist}/${jar.file}"
-libraryjars "${rt_jar}"
-forceprocessing
-repackageclasses d.ff
-optimizationpasses 5
-keep public class de.fernflower.main.decompiler.ConsoleDecompiler {
public protected *;
}
-keep public class de.fernflower.main.decompiler.IdeDecompiler {
public protected *;
}
-keep public class de.fernflower.main.extern.* {
public protected *;
}
</proguard>
</target>
<!-- Helper targets -->
<target name="timer" depends="init" description="generate timer jar file">
<jar jarfile="${lib}/timer/${timer.jar.file}" compress="true" basedir="${bin}" includes="com/**/*.class,*.class"/>
</target>
<target name="deploy" depends="jar" description="deploy generated jar file to Tomcat">
<property name="tomcat" value="C:/revjava/apache-tomcat-5.5.27/shared/lib/" />
<property name="webwrapper" value="D:/Nonbku/workspace/webwrapper/lib/" />
<copy todir="${webwrapper}" file="${fulldist}/${jar.file}" overwrite="true"/>
<copy todir="${tomcat}" file="${fulldist}/${jar.file}" overwrite="true"/>
</target>
<target name="loc" description="count lines of code">
<javancss srcdir="${basedir}/src"
generateReport="true"
functionMetrics="false"
classMetrics="false"
includes="**/*.java"
excludes="**/test/**,**/de/fernflower/code/instructions/**,**/timer/**"
/>
</target>
<target name="printunused" depends="init" description="Print unused code">
<proguard>
-injars ${fulldist}/${jar.file}
-libraryjars ${java.home}/lib/rt.jar
-dontoptimize
-dontobfuscate
-dontpreverify
-printusage
-keep public class de.fernflower.main.decompiler.ConsoleDecompiler {
public protected *;
}
-keep public class de.fernflower.main.decompiler.IdeDecompiler {
public protected *;
}
-keep public class de.fernflower.main.extern.* {
public protected *;
}
</proguard>
</target>
</project> </project>

@ -8,7 +8,7 @@ fernflower.decompiler@gmail.com
2. License 2. License
See license_en.txt http://www.apache.org/licenses/LICENSE-2.0
3. Running from the command line 3. Running from the command line
@ -47,7 +47,6 @@ das (1): decompile assertions
hes (1): hide empty super invocation hes (1): hide empty super invocation
hdc (1): hide empty default constructor hdc (1): hide empty default constructor
dgs (0): decompile generic signatures dgs (0): decompile generic signatures
occ (0): ouput copyright comment
ner (1): assume return not throwing exceptions ner (1): assume return not throwing exceptions
den (1): decompile enumerations den (1): decompile enumerations
rgn (1): remove getClass() invocation, when it is part of a qualified new statement rgn (1): remove getClass() invocation, when it is part of a qualified new statement
@ -58,21 +57,18 @@ nns (1): allow for not set synthetic attribute (workaround to a compiler bug)
uto (1): consider nameless types as java.lang.Object (workaround to a compiler architecture flaw) uto (1): consider nameless types as java.lang.Object (workaround to a compiler architecture flaw)
udv (1): reconstruct variable names from debug information, if present udv (1): reconstruct variable names from debug information, if present
rer (1): remove empty exception ranges rer (1): remove empty exception ranges
fdi (1): deinline finally structures fdi (1): de-inline finally structures
asc (0): allow only ASCII characters in string literals. All other characters will be encoded using Unicode escapes (JLS 3.3). Default encoding is UTF8. mpm (0): maximum allowed processing time per decompiled method, in seconds. 0 means no upper limit
mpm (0): maximum allowed processing time per decompiled method, in seconds. 0 means no upper limit.
ren (0): rename ambiguous (resp. obfuscated) classes and class elements ren (0): rename ambiguous (resp. obfuscated) classes and class elements
urc : full name of user-supplied class implementing IIdentifierRenamer. It is used to determine which urc : full name of user-supplied class implementing IIdentifierRenamer. It is used to determine which class identifiers
class identifiers should be renamed and provides new identifier names. For more information should be renamed and provides new identifier names. For more information see section 5
s. section 5
inn (1): check for IntelliJ IDEA-specific @NotNull annotation and remove inserted code if found inn (1): check for IntelliJ IDEA-specific @NotNull annotation and remove inserted code if found
lac (0): decompile lambda expressions to anonymous classes lac (0): decompile lambda expressions to anonymous classes
nls (0): define new line character to be used for output. 0 - '\r\n' (Windows), 1 - '\n' (Linux) nls (0): define new line character to be used for output. 0 - '\r\n' (Windows), 1 - '\n' (Linux)
ind : indentation string (default is " " (3 spaces)) ind : indentation string (default is " " (3 spaces))
The default logging level is INFO. This value can be overwritten by setting the option 'log' as follows: The default logging level is INFO. This value can be overwritten by setting the option 'log' as follows:
log (INFO): possible values TRACE, INFO, WARN, ERROR
log (INFO): possible values TRACE, INFO, WARN, ERROR
5. Renaming identifiers 5. Renaming identifiers
@ -85,8 +81,8 @@ Option 'ren' (i.e. -ren=1) activates renaming functionality. Default renaming st
- rename an element if its name is a reserved word or is shorter than 3 characters - rename an element if its name is a reserved word or is shorter than 3 characters
- new names are built according to a simple pattern: (class|method|field)_<consecutive unique number> - new names are built according to a simple pattern: (class|method|field)_<consecutive unique number>
You can overwrite this rules by providing your own implementation of the 4 key methods invoked by the decompiler while renaming. Simply You can overwrite this rules by providing your own implementation of the 4 key methods invoked by the decompiler while renaming. Simply
pass a class that implements de.fernflower.main.extern.IIdentifierRenamer in the option 'urc' (e.g. -urc=com.mypackage.MyRenamer) to pass a class that implements org.jetbrains.java.decompiler.main.extern.IIdentifierRenamer in the option 'urc'
Fernflower. The class must be available on the application classpath. (e.g. -urc=com.mypackage.MyRenamer) to Fernflower. The class must be available on the application classpath.
The meaning of each method should be clear from naming: toBeRenamed determine whether the element will be renamed, while the other three The meaning of each method should be clear from naming: toBeRenamed determine whether the element will be renamed, while the other three
provide new names for classes, methods and fields respectively. provide new names for classes, methods and fields respectively.

Loading…
Cancel
Save