-
Notifications
You must be signed in to change notification settings - Fork 238
ProGuard
ge0rg edited this page Sep 13, 2010
·
1 revision
You can squeeze Yaxim from really-really-huge to under 200KB!
Download ProGuard and copy proguard.jar
to yaxim/tools
.
Save the following to build.xml-proguard.diff
and run patch < build.xml-proguard.diff
--- build.xml.orig 2009-12-22 22:32:40.000000000 +0100
+++ build.xml 2009-12-22 22:36:08.000000000 +0100
@@ -63,4 +63,60 @@
build steps are used.
-->
<setup />
+
+ <target name="check-proguard">
+ <available file="tools/proguard.jar" property="have.proguard"/>
+ </target>
+
+ <target name="proguard" depends="check-proguard">
+ <fail unless="have.proguard">You requested ProGuard, but you don't have the JAR available!</fail>
+ </target>
+
+ <target name="proguard.execute" depends="compile" if="have.proguard">
+ <taskdef resource="proguard/ant/task.properties"
+ classpath="tools/proguard.jar" />
+ <proguard>
+ -injars ${out-classes}:libs
+ -outjars ${out-folder}/classes.min.jar
+ -libraryjars ${android-jar}
+ -dontskipnonpubliclibraryclasses
+ -dontobfuscate
+ -dontoptimize
+ -printusage ${out-folder}/proguard.usage
+
+ -dontwarn org.jivesoftware.**
+ -keep public class * extends android.app.Activity
+ -keep public class * extends android.app.Service
+ -keepclassmembers enum * {
+ public static **[] values();
+ public static ** valueOf(java.lang.String);
+ }
+
+ </proguard>
+ </target>
+
+ <!-- Convert this project's .class files into .dex files. -->
+ <target name="dex.proguard" depends="proguard.execute" if="have.proguard">
+ <echo>Converting compiled files and external libraries into ${out-folder}/${dex-file}...</echo>
+ <apply executable="${dx}" failonerror="true" parallel="true">
+ <arg value="--dex" />
+ <arg value="--output=${intermediate-dex-location}" />
+ <fileset dir="${out-folder}" includes="*.min.jar" />
+ <!--fileset dir="${external-libs-folder}" includes="*.jar"/-->
+ </apply>
+ </target>
+
+ <!-- Convert this project's .class files into .dex files. -->
+ <target name="dex.vanilla" depends="compile" unless="have.proguard">
+ <echo>Converting compiled files and external libraries into ${out-folder}/${dex-file}...</echo>
+ <apply executable="${dx}" failonerror="true" parallel="true">
+ <arg value="--dex" />
+ <arg value="--output=${intermediate-dex-location}" />
+ <arg path="${out-classes-location}" />
+ <fileset dir="${external-libs-folder}" includes="*.jar"/>
+ </apply>
+ </target>
+
+ <target name="dex" depends="dex.vanilla, dex.proguard" />
+
</project>
rm -rf bin gen ant proguard debug