[tor-commits] [orbot/master] added ant build script and proguard opt
n8fr8 at torproject.org
n8fr8 at torproject.org
Fri Jan 27 16:02:24 UTC 2012
commit e91e34ede24515c00deb2aadfbfc35431cc7db2d
Author: Nathan Freitas <nathan at freitas.net>
Date: Fri Jan 27 11:00:07 2012 -0500
added ant build script and proguard opt
---
add-proguard-release.xml | 46 ++++++++++++++++++++++++
build.xml | 88 ++++++++++++++++++++++++++++++++++++++++++++++
procfg.txt | 31 ++++++++++++++++
3 files changed, 165 insertions(+), 0 deletions(-)
diff --git a/add-proguard-release.xml b/add-proguard-release.xml
new file mode 100644
index 0000000..aaf2ffb
--- /dev/null
+++ b/add-proguard-release.xml
@@ -0,0 +1,46 @@
+<!-- Proguard Properties -->
+<property name="obfuscate.dir" value="obf" />
+<property name="obfuscate.absolute.dir" location="${obfuscate.dir}" />
+<property name="android-jar-preobfuscate" value="${obfuscate.absolute.dir}/original.jar" />
+<property name="android-jar-postobfuscate" value="${obfuscate.absolute.dir}/postobf.jar" />
+<property name="out.dex.input.absolute.dir" value="${android-jar-postobfuscate}" />
+
+<!-- replaces the post-compile step from ant_rules_r3 -->
+<target name="-post-compile" depends="-dex-obfuscate,-dex-no-obfuscate">
+</target>
+
+<target name="-dex-no-obfuscate" unless="build.mode.release">
+ <mkdir dir="${obfuscate.absolute.dir}" />
+ <jar basedir="${out.dir}/classes" destfile="${android-jar-postobfuscate}" />
+</target>
+
+<!-- Converts this project's .class files into .dex files -->
+<target name="-dex-obfuscate" if="build.mode.release">
+ <property name="proguard-jar" value="${proguard.dir}/proguard.jar" />
+ <property name="proguard-conf.dir" value="" />
+ <property name="proguard-conf.absolute.dir" location="${proguard-conf.dir}" />
+ <property name="proguard-conf" value="${proguard-conf.absolute.dir}/procfg.txt" />
+ <path id="fullclasspath">
+ <path refid="android.target.classpath"/>
+ <pathelement path="${external.libs.dir}"/>
+ </path>
+ <property name="libraryjarpath" refid="fullclasspath"/>
+ <!-- Add Proguard Task -->
+ <taskdef resource="proguard/ant/task.properties" classpath="${proguard-jar}" />
+
+ <mkdir dir="${obfuscate.absolute.dir}" />
+ <delete file="${android-jar-preobfuscate}"/>
+ <delete file="${android-jar-postobfuscate}"/>
+ <jar basedir="${out.classes.dir}" destfile="${android-jar-preobfuscate}" />
+ <proguard>
+ @${proguard-conf}
+ -injars ${android-jar-preobfuscate}
+ -outjars ${android-jar-postobfuscate}
+ -libraryjars ${libraryjarpath}
+ -dump ${obfuscate.absolute.dir}/dump.txt
+ -printseeds ${obfuscate.absolute.dir}/seeds.txt
+ -printusage ${obfuscate.absolute.dir}/usage.txt
+ -printmapping ${obfuscate.absolute.dir}/mapping.txt
+ </proguard>
+</target>
+
diff --git a/build.xml b/build.xml
new file mode 100644
index 0000000..27a1ea4
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project [
+ <!ENTITY add-proguard-release SYSTEM "add-proguard-release.xml">
+]>
+<project name="Orbot" default="help">
+ <!-- The local.properties file is created and updated by the 'android' tool.
+ It contains the path to the SDK. It should *NOT* be checked into
+ Version Control Systems. -->
+ <loadproperties srcFile="local.properties" />
+
+ <!-- The ant.properties file can be created by you. It is only edited by the
+ 'android' tool to add properties to it.
+ This is the place to change some Ant specific build properties.
+ Here are some properties you may want to change/update:
+
+ source.dir
+ The name of the source directory. Default is 'src'.
+ out.dir
+ The name of the output directory. Default is 'bin'.
+
+ For other overridable properties, look at the beginning of the rules
+ files in the SDK, at tools/ant/build.xml
+
+ Properties related to the SDK location or the project target should
+ be updated using the 'android' tool with the 'update' action.
+
+ This file is an integral part of the build system for your
+ application and should be checked into Version Control Systems.
+
+ -->
+ <property file="ant.properties" />
+
+ <!-- The project.properties file is created and updated by the 'android'
+ tool, as well as ADT.
+
+ This contains project specific properties such as project target, and library
+ dependencies. Lower level build properties are stored in ant.properties
+ (or in .classpath for Eclipse projects).
+
+ This file is an integral part of the build system for your
+ application and should be checked into Version Control Systems. -->
+ <loadproperties srcFile="project.properties" />
+
+ <!-- quick check on sdk.dir -->
+ <fail
+ message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
+ unless="sdk.dir"
+ />
+
+
+<!-- extension targets. Uncomment the ones where you want to do custom work
+ in between standard targets -->
+<!--
+ <target name="-pre-build">
+ </target>
+ <target name="-pre-compile">
+ </target>
+
+ /* This is typically used for code obfuscation.
+ Compiled code location: ${out.classes.absolute.dir}
+ If this is not done in place, override ${out.dex.input.absolute.dir} */
+ <target name="-post-compile">
+ </target>
+-->
+
+ <!-- Import the actual build file.
+
+ To customize existing targets, there are two options:
+ - Customize only one target:
+ - copy/paste the target into this file, *before* the
+ <import> task.
+ - customize it to your needs.
+ - Customize the whole content of build.xml
+ - copy/paste the content of the rules files (minus the top node)
+ into this file, replacing the <import> task.
+ - customize to your needs.
+
+ ***********************
+ ****** IMPORTANT ******
+ ***********************
+ In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
+ in order to avoid having your file be overridden by tools such as "android update project"
+ -->
+ <!-- version-tag: 1 -->
+ <import file="${sdk.dir}/tools/ant/build.xml" />
+
+&add-proguard-release;
+</project>
diff --git a/procfg.txt b/procfg.txt
new file mode 100644
index 0000000..b9dab40
--- /dev/null
+++ b/procfg.txt
@@ -0,0 +1,31 @@
+-optimizationpasses 5
+-dontusemixedcaseclassnames
+-dontskipnonpubliclibraryclasses
+-dontpreverify
+-verbose
+-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
+
+-keep public class * extends android.app.Activity
+-keep public class * extends android.app.Application
+-keep public class * extends android.app.Service
+-keep public class * extends android.content.BroadcastReceiver
+-keep public class * extends android.content.ContentProvider
+-keep public class com.android.vending.licensing.ILicensingService
+
+-keepclasseswithmembernames class * {
+ native <methods>;
+}
+
+-keepclasseswithmembernames class * {
+ public <init>(android.content.Context, android.util.AttributeSet);
+}
+
+-keepclasseswithmembernames class * {
+ public <init>(android.content.Context, android.util.AttributeSet, int);
+}
+
+-keepclassmembers enum * {
+ public static **[] values();
+ public static ** valueOf(java.lang.String);
+}
+
More information about the tor-commits
mailing list