aboutsummaryrefslogtreecommitdiffstats
path: root/build.xml
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2009-06-27 02:04:06 +0000
committerKenny Root <kenny@the-b.org>2009-06-27 02:04:06 +0000
commit2c91e296b9d6ceeba8bec39ec6e9419a39ae8a18 (patch)
tree06335cf1794d3e954a391886bdb969bbe2e7b22c /build.xml
parentabaf68d5d19b711d67ce2d6a4e6f27c4a3e081f7 (diff)
downloadconnectbot-2c91e296b9d6ceeba8bec39ec6e9419a39ae8a18.tar.gz
connectbot-2c91e296b9d6ceeba8bec39ec6e9419a39ae8a18.tar.bz2
connectbot-2c91e296b9d6ceeba8bec39ec6e9419a39ae8a18.zip
Add proguard to build.xml
git-svn-id: https://connectbot.googlecode.com/svn/trunk/connectbot@337 df292f66-193f-0410-a5fc-6d59da041ff2
Diffstat (limited to 'build.xml')
-rw-r--r--build.xml42
1 files changed, 41 insertions, 1 deletions
diff --git a/build.xml b/build.xml
index 00f81fd..1b709a7 100644
--- a/build.xml
+++ b/build.xml
@@ -169,8 +169,43 @@
</javac>
</target>
+ <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! See README</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}
+ -outjars ${out-folder}/classes.min.jar
+ -libraryjars ${android-jar}
+ -dontskipnonpubliclibraryclasses
+ -dontobfuscate
+ -dontoptimize
+
+ -keep public class * extends android.app.Activity
+ -keep public class * extends android.app.Service
+ </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" depends="compile">
+ <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" />
@@ -180,6 +215,8 @@
</apply>
</target>
+ <target name="dex" depends="dex.vanilla, dex.proguard" />
+
<!-- Put the project's resources into the output package file
This actually can create multiple resource package in case
Some custom apk with specific configuration have been
@@ -271,6 +308,9 @@
<echo> The signatures must match.</echo>
<echo> uninstall: uninstall the application from a running emulator or</echo>
<echo> device.</echo>
+ <echo> proguard: use before build statements like "debug" and "release"</echo>
+ <echo> to enable proguard dead code removal. NOTE: You must</echo>
+ <echo> have tools/proguard.jar available. See the README.</echo>
</target>
<target name="update-version" description="Updates the Version.java file with current SVN revision">