aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README10
-rw-r--r--build.xml42
2 files changed, 51 insertions, 1 deletions
diff --git a/README b/README
index d61b991..b0c2f25 100644
--- a/README
+++ b/README
@@ -17,3 +17,13 @@ apk-config-europe=en,fr,it,de,es
apk-config-asia=en,zh_CN
You may also configure this via Eclipse via Project Properties -> Android -> Project APK Configurations
+
+
+ProGuard Support
+----------------
+
+Download the ProGuard distribution from its website at http://proguard.sourceforge.net/ and place the proguard.jar into the "tools" subdirectory in the ConnectBot root directory.
+
+When running ant to build ConnectBot and engage ProGuard, use:
+
+ant proguard release
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">