Update README and build.xml for Eclair
git-svn-id: https://connectbot.googlecode.com/svn/trunk/connectbot@446 df292f66-193f-0410-a5fc-6d59da041ff2master
parent
f258841d5a
commit
bada2a32d3
|
@ -2,7 +2,7 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.connectbot"
|
package="org.connectbot"
|
||||||
android:versionName="1.6-dev"
|
android:versionName="1.6-dev"
|
||||||
android:versionCode="223">
|
android:versionCode="224">
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:icon="@drawable/icon"
|
android:icon="@drawable/icon"
|
||||||
|
|
15
README
15
README
|
@ -3,20 +3,7 @@ Compiling
|
||||||
|
|
||||||
To compile ConnectBot using Ant, you must specify where your Android SDK is via the local.properties file. Insert a line similar to the following with the full path to your SDK:
|
To compile ConnectBot using Ant, you must specify where your Android SDK is via the local.properties file. Insert a line similar to the following with the full path to your SDK:
|
||||||
|
|
||||||
sdk-location=/usr/local/android
|
sdk.dir=/usr/local/android
|
||||||
|
|
||||||
|
|
||||||
Localization
|
|
||||||
------------
|
|
||||||
|
|
||||||
To use only a specific localization or localizations in your ConnectBot build using Ant, simply insert lines into default.properties similar to these:
|
|
||||||
|
|
||||||
apk-configurations=english,europe,asia
|
|
||||||
apk-config-english=en
|
|
||||||
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
|
ProGuard Support
|
||||||
|
|
523
build.xml
523
build.xml
|
@ -11,12 +11,12 @@
|
||||||
used by the Ant rules.
|
used by the Ant rules.
|
||||||
Here are some properties you may want to change/update:
|
Here are some properties you may want to change/update:
|
||||||
|
|
||||||
application-package
|
application.package
|
||||||
the name of your application package as defined in the manifest. Used by the
|
the name of your application package as defined in the manifest. Used by the
|
||||||
'uninstall' rule.
|
'uninstall' rule.
|
||||||
source-folder
|
source.dir
|
||||||
the name of the source folder. Default is 'src'.
|
the name of the source folder. Default is 'src'.
|
||||||
out-folder
|
out.dir
|
||||||
the name of the output folder. Default is 'bin'.
|
the name of the output folder. Default is 'bin'.
|
||||||
|
|
||||||
Properties related to the SDK location or the project target should be updated
|
Properties related to the SDK location or the project target should be updated
|
||||||
|
@ -37,16 +37,16 @@
|
||||||
<!-- Custom Android task to deal with the project target, and import the proper rules.
|
<!-- Custom Android task to deal with the project target, and import the proper rules.
|
||||||
This requires ant 1.6.0 or above. -->
|
This requires ant 1.6.0 or above. -->
|
||||||
<path id="android.antlibs">
|
<path id="android.antlibs">
|
||||||
<pathelement path="${sdk-location}/tools/lib/anttasks.jar" />
|
<pathelement path="${sdk.dir}/tools/lib/anttasks.jar" />
|
||||||
<pathelement path="${sdk-location}/tools/lib/sdklib.jar" />
|
<pathelement path="${sdk.dir}/tools/lib/sdklib.jar" />
|
||||||
<pathelement path="${sdk-location}/tools/lib/androidprefs.jar" />
|
<pathelement path="${sdk.dir}/tools/lib/androidprefs.jar" />
|
||||||
<pathelement path="${sdk-location}/tools/lib/apkbuilder.jar" />
|
<pathelement path="${sdk.dir}/tools/lib/apkbuilder.jar" />
|
||||||
<pathelement path="${sdk-location}/tools/lib/jarutils.jar" />
|
<pathelement path="${sdk.dir}/tools/lib/jarutils.jar" />
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
<taskdef name="setup"
|
<taskdef name="setup"
|
||||||
classname="com.android.ant.SetupTask"
|
classname="com.android.ant.SetupTask"
|
||||||
classpathref="android.antlibs"/>
|
classpathref="android.antlibs" />
|
||||||
|
|
||||||
<!-- Execute the Android Setup task that will setup some properties specific to the target,
|
<!-- Execute the Android Setup task that will setup some properties specific to the target,
|
||||||
and import the rules files.
|
and import the rules files.
|
||||||
|
@ -62,109 +62,240 @@
|
||||||
<!-- Custom tasks -->
|
<!-- Custom tasks -->
|
||||||
<taskdef name="aaptexec"
|
<taskdef name="aaptexec"
|
||||||
classname="com.android.ant.AaptExecLoopTask"
|
classname="com.android.ant.AaptExecLoopTask"
|
||||||
classpathref="android.antlibs"/>
|
classpathref="android.antlibs" />
|
||||||
|
|
||||||
<taskdef name="apkbuilder"
|
<taskdef name="apkbuilder"
|
||||||
classname="com.android.ant.ApkBuilderTask"
|
classname="com.android.ant.ApkBuilderTask"
|
||||||
|
classpathref="android.antlibs" />
|
||||||
|
|
||||||
|
<taskdef name="xpath"
|
||||||
|
classname="com.android.ant.XPathTask"
|
||||||
classpathref="android.antlibs"/>
|
classpathref="android.antlibs"/>
|
||||||
|
|
||||||
<!-- Properties -->
|
<!-- Properties -->
|
||||||
|
|
||||||
<property name="android-tools" value="${sdk-location}/tools" />
|
<!-- Tells adb which device to target. You can change this from the command line
|
||||||
|
by invoking "ant -Dadb.device.arg=-d" for device "ant -Dadb.device.arg=-e" for
|
||||||
|
the emulator. -->
|
||||||
|
<property name="adb.device.arg" value="" />
|
||||||
|
|
||||||
|
<property name="android.tools.dir" location="${sdk.dir}/tools" />
|
||||||
|
<!-- Name of the application package extracted from manifest file -->
|
||||||
|
<xpath input="AndroidManifest.xml" expression="/manifest/@package"
|
||||||
|
output="manifest.package" />
|
||||||
|
|
||||||
<!-- Input directories -->
|
<!-- Input directories -->
|
||||||
<property name="source-folder" value="src" />
|
<property name="source.dir" value="src" />
|
||||||
<property name="gen-folder" value="gen" />
|
<property name="source.absolute.dir" location="${source.dir}" />
|
||||||
<property name="resource-folder" value="res" />
|
<property name="gen.dir" value="gen" />
|
||||||
<property name="asset-folder" value="assets" />
|
<property name="gen.absolute.dir" location="${gen.dir}" />
|
||||||
<property name="source-location" value="${basedir}/${source-folder}" />
|
<property name="resource.dir" value="res" />
|
||||||
|
<property name="resource.absolute.dir" location="${resource.dir}" />
|
||||||
|
<property name="asset.dir" value="assets" />
|
||||||
|
<property name="asset.absolute.dir" location="${asset.dir}" />
|
||||||
|
|
||||||
<!-- folder for the 3rd party java libraries -->
|
<!-- Directory for the third party java libraries -->
|
||||||
<property name="external-libs-folder" value="libs" />
|
<property name="external.libs.dir" value="libs" />
|
||||||
|
<property name="external.libs.absolute.dir" location="${external.libs.dir}" />
|
||||||
|
|
||||||
<!-- folder for the native libraries -->
|
<!-- Directory for the native libraries -->
|
||||||
<property name="native-libs-folder" value="libs" />
|
<property name="native.libs.dir" value="libs" />
|
||||||
|
<property name="native.libs.absolute.dir" location="${native.libs.dir}" />
|
||||||
|
|
||||||
<!-- Output directories -->
|
<!-- Output directories -->
|
||||||
<property name="gen-folder" value="gen" />
|
<property name="out.dir" value="bin" />
|
||||||
<property name="out-folder" value="bin" />
|
<property name="out.absolute.dir" location="${out.dir}" />
|
||||||
<property name="out-classes" value="${out-folder}/classes" />
|
<property name="out.classes.dir" value="${out.absolute.dir}/classes" />
|
||||||
<property name="out-classes-location" value="${basedir}/${out-classes}"/>
|
<property name="out.classes.absolute.dir" location="${out.classes.dir}" />
|
||||||
<!-- out folders for a parent project if this project is an instrumentation project -->
|
|
||||||
<property name="main-out-folder" value="../${out-folder}" />
|
|
||||||
<property name="main-out-classes" value="${main-out-folder}/classes"/>
|
|
||||||
|
|
||||||
<!-- Intermediate files -->
|
<!-- Intermediate files -->
|
||||||
<property name="dex-file" value="classes.dex" />
|
<property name="dex.file.name" value="classes.dex" />
|
||||||
<property name="intermediate-dex" value="${out-folder}/${dex-file}" />
|
<property name="intermediate.dex.file" location="${out.absolute.dir}/${dex.file.name}" />
|
||||||
<!-- dx does not properly support incorrect / or \ based on the platform
|
|
||||||
and Ant cannot convert them because the parameter is not a valid path.
|
|
||||||
Because of this we have to compute different paths depending on the platform. -->
|
|
||||||
<condition property="intermediate-dex-location"
|
|
||||||
value="${basedir}\${intermediate-dex}"
|
|
||||||
else="${basedir}/${intermediate-dex}" >
|
|
||||||
<os family="windows"/>
|
|
||||||
</condition>
|
|
||||||
|
|
||||||
<!-- The final package file to generate -->
|
<!-- The final package file to generate -->
|
||||||
<property name="out-debug-package" value="${out-folder}/${ant.project.name}-debug.apk"/>
|
<property name="out.debug.unaligned.package"
|
||||||
|
location="${out.absolute.dir}/${ant.project.name}-debug-unaligned.apk" />
|
||||||
|
<property name="out.debug.package"
|
||||||
|
location="${out.absolute.dir}/${ant.project.name}-debug.apk" />
|
||||||
|
<property name="out.unsigned.package"
|
||||||
|
location="${out.absolute.dir}/${ant.project.name}-unsigned.apk" />
|
||||||
|
<property name="out.unaligned.package"
|
||||||
|
location="${out.absolute.dir}/${ant.project.name}-unaligned.apk" />
|
||||||
|
<property name="out.release.package"
|
||||||
|
location="${out.absolute.dir}/${ant.project.name}-release.apk" />
|
||||||
|
|
||||||
|
<!-- Verbosity -->
|
||||||
|
<property name="verbose" value="false" />
|
||||||
|
<!-- This is needed by emma as it uses multilevel verbosity instead of simple 'true' or 'false'
|
||||||
|
The property 'verbosity' is not user configurable and depends exclusively on 'verbose'
|
||||||
|
value.-->
|
||||||
|
<condition property="verbosity" value="verbose" else="quiet">
|
||||||
|
<istrue value="${verbose}" />
|
||||||
|
</condition>
|
||||||
|
<!-- This is needed to switch verbosity of zipalign and aapt. Depends exclusively on 'verbose'
|
||||||
|
-->
|
||||||
|
<condition property="v.option" value="-v" else="">
|
||||||
|
<istrue value="${verbose}" />
|
||||||
|
</condition>
|
||||||
|
<!-- This is needed to switch verbosity of dx. Depends exclusively on 'verbose' -->
|
||||||
|
<condition property="verbose.option" value="--verbose" else="">
|
||||||
|
<istrue value="${verbose}" />
|
||||||
|
</condition>
|
||||||
|
|
||||||
<!-- Tools -->
|
<!-- Tools -->
|
||||||
<condition property="exe" value=".exe" else=""><os family="windows"/></condition>
|
<condition property="exe" value=".exe" else=""><os family="windows" /></condition>
|
||||||
<property name="adb" value="${android-tools}/adb${exe}"/>
|
<property name="adb" location="${android.tools.dir}/adb${exe}" />
|
||||||
|
<property name="zipalign" location="${android.tools.dir}/zipalign${exe}" />
|
||||||
|
|
||||||
<!-- rules -->
|
<!-- Emma configuration -->
|
||||||
|
<property name="emma.dir" value="${sdk.dir}/tools/lib" />
|
||||||
|
<path id="emma.lib">
|
||||||
|
<pathelement location="${emma.dir}/emma.jar" />
|
||||||
|
<pathelement location="${emma.dir}/emma_ant.jar" />
|
||||||
|
</path>
|
||||||
|
<taskdef resource="emma_ant.properties" classpathref="emma.lib" />
|
||||||
|
<!-- End of emma configuration -->
|
||||||
|
|
||||||
<!-- Create the output directories if they don't exist yet. -->
|
<!-- Macros -->
|
||||||
<target name="dirs">
|
|
||||||
|
<!-- Configurable macro, which allows to pass as parameters output directory,
|
||||||
|
output dex filename and external libraries to dex (optional) -->
|
||||||
|
<macrodef name="dex-helper">
|
||||||
|
<element name="external-libs" optional="yes" />
|
||||||
|
<element name="extra-parameters" optional="yes" />
|
||||||
|
<sequential>
|
||||||
|
<echo>Converting compiled files and external libraries into ${intermediate.dex.file}...
|
||||||
|
</echo>
|
||||||
|
<apply executable="${dx}" failonerror="true" parallel="true">
|
||||||
|
<arg value="--dex" />
|
||||||
|
<arg value="--output=${intermediate.dex.file}" />
|
||||||
|
<extra-parameters />
|
||||||
|
<arg line="${verbose.option}" />
|
||||||
|
<arg path="${out.classes.absolute.dir}" />
|
||||||
|
<fileset dir="${external.libs.absolute.dir}" includes="*.jar" />
|
||||||
|
<external-libs />
|
||||||
|
</apply>
|
||||||
|
</sequential>
|
||||||
|
</macrodef>
|
||||||
|
|
||||||
|
<!-- This is macro that enable passing variable list of external jar files to ApkBuilder
|
||||||
|
Example of use:
|
||||||
|
<package-helper>
|
||||||
|
<extra-jars>
|
||||||
|
<jarfolder path="my_jars" />
|
||||||
|
<jarfile path="foo/bar.jar" />
|
||||||
|
<jarfolder path="your_jars" />
|
||||||
|
</extra-jars>
|
||||||
|
</package-helper> -->
|
||||||
|
<macrodef name="package-helper">
|
||||||
|
<attribute name="sign.package" />
|
||||||
|
<element name="extra-jars" optional="yes" />
|
||||||
|
<sequential>
|
||||||
|
<apkbuilder
|
||||||
|
outfolder="${out.absolute.dir}"
|
||||||
|
basename="${ant.project.name}"
|
||||||
|
signed="@{sign.package}"
|
||||||
|
verbose="${verbose}">
|
||||||
|
<file path="${intermediate.dex.file}" />
|
||||||
|
<sourcefolder path="${source.absolute.dir}" />
|
||||||
|
<nativefolder path="${native.libs.absolute.dir}" />
|
||||||
|
<jarfolder path="${external.libs.absolute.dir}" />
|
||||||
|
<extra-jars/>
|
||||||
|
</apkbuilder>
|
||||||
|
</sequential>
|
||||||
|
</macrodef>
|
||||||
|
|
||||||
|
<!-- This is macro which zipaligns in.package and outputs it to out.package. Used by targets
|
||||||
|
debug, -debug-with-emma and release.-->
|
||||||
|
<macrodef name="zipalign-helper">
|
||||||
|
<attribute name="in.package" />
|
||||||
|
<attribute name="out.package" />
|
||||||
|
<sequential>
|
||||||
|
<echo>Running zip align on final apk...</echo>
|
||||||
|
<exec executable="${zipalign}" failonerror="true">
|
||||||
|
<arg line="${v.option}" />
|
||||||
|
<arg value="-f" />
|
||||||
|
<arg value="4" />
|
||||||
|
<arg path="@{in.package}" />
|
||||||
|
<arg path="@{out.package}" />
|
||||||
|
</exec>
|
||||||
|
</sequential>
|
||||||
|
</macrodef>
|
||||||
|
|
||||||
|
<!-- This is macro used only for sharing code among two targets, -install and
|
||||||
|
-install-with-emma which do exactly the same but differ in dependencies -->
|
||||||
|
<macrodef name="install-helper">
|
||||||
|
<sequential>
|
||||||
|
<echo>Installing ${out.debug.package} onto default emulator or device...</echo>
|
||||||
|
<exec executable="${adb}" failonerror="true">
|
||||||
|
<arg line="${adb.device.arg}" />
|
||||||
|
<arg value="install" />
|
||||||
|
<arg value="-r" />
|
||||||
|
<arg path="${out.debug.package}" />
|
||||||
|
</exec>
|
||||||
|
</sequential>
|
||||||
|
</macrodef>
|
||||||
|
|
||||||
|
<!-- Rules -->
|
||||||
|
|
||||||
|
<!-- Creates the output directories if they don't exist yet. -->
|
||||||
|
<target name="-dirs">
|
||||||
<echo>Creating output directories if needed...</echo>
|
<echo>Creating output directories if needed...</echo>
|
||||||
<mkdir dir="${resource-folder}" />
|
<mkdir dir="${resource.absolute.dir}" />
|
||||||
<mkdir dir="${external-libs-folder}" />
|
<mkdir dir="${external.libs.absolute.dir}" />
|
||||||
<mkdir dir="${gen-folder}" />
|
<mkdir dir="${gen.absolute.dir}" />
|
||||||
<mkdir dir="${out-folder}" />
|
<mkdir dir="${out.absolute.dir}" />
|
||||||
<mkdir dir="${out-classes}" />
|
<mkdir dir="${out.classes.absolute.dir}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Generate the R.java file for this project's resources. -->
|
<!-- Generates the R.java file for this project's resources. -->
|
||||||
<target name="resource-src" depends="dirs, update-version">
|
<target name="-resource-src" depends="-dirs, update-version">
|
||||||
<echo>Generating R.java / Manifest.java from the resources...</echo>
|
<echo>Generating R.java / Manifest.java from the resources...</echo>
|
||||||
<exec executable="${aapt}" failonerror="true">
|
<exec executable="${aapt}" failonerror="true">
|
||||||
<arg value="package" />
|
<arg value="package" />
|
||||||
|
<arg line="${v.option}" />
|
||||||
<arg value="-m" />
|
<arg value="-m" />
|
||||||
<arg value="-J" />
|
<arg value="-J" />
|
||||||
<arg path="${gen-folder}" />
|
<arg path="${gen.absolute.dir}" />
|
||||||
<arg value="-M" />
|
<arg value="-M" />
|
||||||
<arg path="AndroidManifest.xml" />
|
<arg path="AndroidManifest.xml" />
|
||||||
<arg value="-S" />
|
<arg value="-S" />
|
||||||
<arg path="${resource-folder}" />
|
<arg path="${resource.absolute.dir}" />
|
||||||
<arg value="-I" />
|
<arg value="-I" />
|
||||||
<arg path="${android-jar}" />
|
<arg path="${android.jar}" />
|
||||||
</exec>
|
</exec>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Generate java classes from .aidl files. -->
|
<!-- Generates java classes from .aidl files. -->
|
||||||
<target name="aidl" depends="dirs">
|
<target name="-aidl" depends="-dirs">
|
||||||
<echo>Compiling aidl files into Java classes...</echo>
|
<echo>Compiling aidl files into Java classes...</echo>
|
||||||
<apply executable="${aidl}" failonerror="true">
|
<apply executable="${aidl}" failonerror="true">
|
||||||
<arg value="-p${android-aidl}" />
|
<arg value="-p${android.aidl}" />
|
||||||
<arg value="-I${source-folder}" />
|
<arg value="-I${source.absolute.dir}" />
|
||||||
<arg value="-o${gen-folder}" />
|
<arg value="-o${gen.absolute.dir}" />
|
||||||
<fileset dir="${source-folder}">
|
<fileset dir="${source.absolute.dir}">
|
||||||
<include name="**/*.aidl"/>
|
<include name="**/*.aidl" />
|
||||||
</fileset>
|
</fileset>
|
||||||
</apply>
|
</apply>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Compile this project's .java files into .class files. -->
|
<!-- Compiles this project's .java files into .class files. -->
|
||||||
<target name="compile" depends="resource-src, aidl">
|
<target name="compile" depends="-resource-src, -aidl"
|
||||||
|
description="Compiles project's .java files into .class files">
|
||||||
|
<!-- If android rules are used for a test project, its classpath should include
|
||||||
|
tested project's location -->
|
||||||
|
<condition property="extensible.classpath"
|
||||||
|
value="${tested.project.absolute.dir}/bin/classes" else=".">
|
||||||
|
<isset property="tested.project.absolute.dir" />
|
||||||
|
</condition>
|
||||||
<javac encoding="utf8" target="1.5" debug="true" extdirs=""
|
<javac encoding="utf8" target="1.5" debug="true" extdirs=""
|
||||||
destdir="${out-classes}"
|
destdir="${out.classes.absolute.dir}"
|
||||||
bootclasspathref="android.target.classpath">
|
bootclasspathref="android.target.classpath"
|
||||||
<src path="${source-folder}" />
|
verbose="${verbose}" classpath="${extensible.classpath}">
|
||||||
<src path="${gen-folder}" />
|
<src path="${source.absolute.dir}" />
|
||||||
|
<src path="${gen.absolute.dir}" />
|
||||||
<classpath>
|
<classpath>
|
||||||
<fileset dir="${external-libs-folder}" includes="*.jar"/>
|
<fileset dir="${external.libs.dir}" includes="*.jar"/>
|
||||||
<pathelement path="${main-out-classes}"/>
|
|
||||||
</classpath>
|
</classpath>
|
||||||
</javac>
|
</javac>
|
||||||
</target>
|
</target>
|
||||||
|
@ -181,13 +312,13 @@
|
||||||
<taskdef resource="proguard/ant/task.properties"
|
<taskdef resource="proguard/ant/task.properties"
|
||||||
classpath="tools/proguard.jar" />
|
classpath="tools/proguard.jar" />
|
||||||
<proguard>
|
<proguard>
|
||||||
-injars ${out-classes}
|
-injars ${out.classes.dir}
|
||||||
-outjars ${out-folder}/classes.min.jar
|
-outjars ${out.dir}/classes.min.jar
|
||||||
-libraryjars ${android-jar}
|
-libraryjars ${android.jar}
|
||||||
-dontskipnonpubliclibraryclasses
|
-dontskipnonpubliclibraryclasses
|
||||||
-dontobfuscate
|
-dontobfuscate
|
||||||
-dontoptimize
|
-dontoptimize
|
||||||
-printusage ${out-folder}/proguard.usage
|
-printusage ${out.dir}/proguard.usage
|
||||||
|
|
||||||
-keep public class * extends android.app.Activity
|
-keep public class * extends android.app.Activity
|
||||||
-keep public class * extends android.app.Service
|
-keep public class * extends android.app.Service
|
||||||
|
@ -199,118 +330,205 @@
|
||||||
|
|
||||||
<!-- Convert this project's .class files into .dex files. -->
|
<!-- Convert this project's .class files into .dex files. -->
|
||||||
<target name="dex.proguard" depends="proguard.execute" if="have.proguard">
|
<target name="dex.proguard" depends="proguard.execute" if="have.proguard">
|
||||||
<echo>Converting compiled files and external libraries into ${out-folder}/${dex-file}...</echo>
|
<echo>Converting compiled files and external libraries into ${out.dir}/${dex.file.name}...</echo>
|
||||||
<apply executable="${dx}" failonerror="true" parallel="true">
|
<apply executable="${dx}" failonerror="true" parallel="true">
|
||||||
<arg value="--dex" />
|
<arg value="--dex" />
|
||||||
<arg value="--output=${intermediate-dex-location}" />
|
<arg value="--output=${intermediate.dex.file}" />
|
||||||
<fileset dir="${out-folder}" includes="*.min.jar" />
|
<fileset dir="${out.classes.absolute.dir}" includes="*.min.jar" />
|
||||||
<fileset dir="${external-libs-folder}" includes="*.jar"/>
|
<fileset dir="${external.libs.absolute.dir}" includes="*.jar"/>
|
||||||
</apply>
|
</apply>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Convert this project's .class files into .dex files. -->
|
<!-- Convert this project's .class files into .dex files. -->
|
||||||
<target name="dex.vanilla" depends="compile" unless="have.proguard">
|
<target name="dex.vanilla" depends="compile" unless="have.proguard">
|
||||||
<echo>Converting compiled files and external libraries into ${out-folder}/${dex-file}...</echo>
|
<echo>Converting compiled files and external libraries into ${out.dir}/${dex.file.name}...</echo>
|
||||||
<apply executable="${dx}" failonerror="true" parallel="true">
|
<apply executable="${dx}" failonerror="true" parallel="true">
|
||||||
<arg value="--dex" />
|
<arg value="--dex" />
|
||||||
<arg value="--output=${intermediate-dex-location}" />
|
<arg value="--output=${intermediate.dex.file}" />
|
||||||
<arg path="${out-classes-location}" />
|
<arg path="${out.classes.absolute.dir}" />
|
||||||
<fileset dir="${external-libs-folder}" includes="*.jar"/>
|
<fileset dir="${external.libs.absolute.dir}" includes="*.jar"/>
|
||||||
</apply>
|
</apply>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="dex" depends="dex.vanilla, dex.proguard" />
|
<target name="-dex" depends="dex.vanilla, dex.proguard" />
|
||||||
|
|
||||||
<!-- Put the project's resources into the output package file
|
<!-- Put the project's resources into the output package file
|
||||||
This actually can create multiple resource package in case
|
This actually can create multiple resource package in case
|
||||||
Some custom apk with specific configuration have been
|
Some custom apk with specific configuration have been
|
||||||
declared in default.properties.
|
declared in default.properties.
|
||||||
-->
|
-->
|
||||||
<target name="package-resources">
|
<target name="-package-resources">
|
||||||
<echo>Packaging resources</echo>
|
<echo>Packaging resources</echo>
|
||||||
<aaptexec executable="${aapt}"
|
<aaptexec executable="${aapt}"
|
||||||
command="package"
|
command="package"
|
||||||
manifest="AndroidManifest.xml"
|
manifest="AndroidManifest.xml"
|
||||||
resources="${resource-folder}"
|
resources="${resource.absolute.dir}"
|
||||||
assets="${asset-folder}"
|
assets="${asset.absolute.dir}"
|
||||||
androidjar="${android-jar}"
|
androidjar="${android.jar}"
|
||||||
outfolder="${out-folder}"
|
outfolder="${out.absolute.dir}"
|
||||||
basename="${ant.project.name}" />
|
basename="${ant.project.name}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Package the application and sign it with a debug key.
|
<!-- Packages the application and sign it with a debug key. -->
|
||||||
This is the default target when building. It is used for debug. -->
|
<target name="-package-debug-sign" depends="-dex, -package-resources">
|
||||||
<target name="debug" depends="dex, package-resources">
|
<package-helper sign.package="true" />
|
||||||
<apkbuilder
|
|
||||||
outfolder="${out-folder}"
|
|
||||||
basename="${ant.project.name}"
|
|
||||||
signed="true"
|
|
||||||
verbose="false">
|
|
||||||
<file path="${intermediate-dex}" />
|
|
||||||
<sourcefolder path="${source-folder}" />
|
|
||||||
<jarfolder path="${external-libs-folder}" />
|
|
||||||
<nativefolder path="${native-libs-folder}" />
|
|
||||||
</apkbuilder>
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Package the application without signing it.
|
<!-- Packages the application without signing it. -->
|
||||||
This allows for the application to be signed later with an official publishing key. -->
|
<target name="-package-no-sign" depends="-dex, -package-resources">
|
||||||
<target name="release" depends="dex, package-resources">
|
<package-helper sign.package="false" />
|
||||||
<apkbuilder
|
|
||||||
outfolder="${out-folder}"
|
|
||||||
basename="${ant.project.name}"
|
|
||||||
signed="false"
|
|
||||||
verbose="false">
|
|
||||||
<file path="${intermediate-dex}" />
|
|
||||||
<sourcefolder path="${source-folder}" />
|
|
||||||
<jarfolder path="${external-libs-folder}" />
|
|
||||||
<nativefolder path="${native-libs-folder}" />
|
|
||||||
</apkbuilder>
|
|
||||||
<echo>All generated packages need to be signed with jarsigner before they are published.</echo>
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Install the package on the default emulator -->
|
<target name="-compile-tested-if-test" if="tested.project.dir" unless="do.not.compile.again">
|
||||||
<target name="install" depends="debug">
|
<subant target="compile">
|
||||||
<echo>Installing ${out-debug-package} onto default emulator...</echo>
|
<fileset dir="${tested.project.absolute.dir}" includes="build.xml" />
|
||||||
<exec executable="${adb}" failonerror="true">
|
</subant>
|
||||||
<arg value="install" />
|
</target>
|
||||||
<arg path="${out-debug-package}" />
|
|
||||||
</exec>
|
<!-- Builds debug output package, provided all the necessary files are already dexed -->
|
||||||
</target>
|
<target name="debug" depends="-compile-tested-if-test, -package-debug-sign"
|
||||||
|
description="Builds the application and signs it with a debug key.">
|
||||||
<target name="reinstall" depends="debug">
|
<zipalign-helper in.package="${out.debug.unaligned.package}"
|
||||||
<echo>Installing ${out-debug-package} onto default emulator...</echo>
|
out.package="${out.debug.package}" />
|
||||||
<exec executable="${adb}" failonerror="true">
|
<echo>Debug Package: ${out.debug.package}</echo>
|
||||||
<arg value="install" />
|
</target>
|
||||||
<arg value="-r" />
|
|
||||||
<arg path="${out-debug-package}" />
|
<target name="-release-check">
|
||||||
</exec>
|
<condition property="release.sign">
|
||||||
</target>
|
<and>
|
||||||
|
<isset property="key.store" />
|
||||||
<!-- Uinstall the package from the default emulator -->
|
<isset property="key.alias" />
|
||||||
<target name="uninstall">
|
</and>
|
||||||
<echo>Uninstalling ${application-package} from the default emulator...</echo>
|
</condition>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="-release-nosign" depends="-release-check" unless="release.sign">
|
||||||
|
<echo>No key.store and key.alias properties found in build.properties.</echo>
|
||||||
|
<echo>Please sign ${out.unsigned.package} manually</echo>
|
||||||
|
<echo>and run zipalign from the Android SDK tools.</echo>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="release" depends="-package-no-sign, -release-nosign" if="release.sign"
|
||||||
|
description="Builds the application. The generated apk file must be signed before
|
||||||
|
it is published.">
|
||||||
|
<!-- Gets passwords -->
|
||||||
|
<input
|
||||||
|
message="Please enter keystore password (store:${key.store}):"
|
||||||
|
addproperty="key.store.password" />
|
||||||
|
<input
|
||||||
|
message="Please enter password for alias '${key.alias}':"
|
||||||
|
addproperty="key.alias.password" />
|
||||||
|
|
||||||
|
<!-- Signs the APK -->
|
||||||
|
<echo>Signing final apk...</echo>
|
||||||
|
<signjar
|
||||||
|
jar="${out.unsigned.package}"
|
||||||
|
signedjar="${out.unaligned.package}"
|
||||||
|
keystore="${key.store}"
|
||||||
|
storepass="${key.store.password}"
|
||||||
|
alias="${key.alias}"
|
||||||
|
keypass="${key.alias.password}"
|
||||||
|
verbose="${verbose}" />
|
||||||
|
|
||||||
|
<!-- Zip aligns the APK -->
|
||||||
|
<zipalign-helper in.package="${out.unaligned.package}"
|
||||||
|
out.package="${out.release.package}" />
|
||||||
|
<echo>Release Package: ${out.release.package}</echo>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="install" depends="debug"
|
||||||
|
description="Installs/reinstalls the debug package onto a running
|
||||||
|
emulator or device. If the application was previously installed,
|
||||||
|
the signatures must match." >
|
||||||
|
<install-helper />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="-uninstall-check">
|
||||||
|
<condition property="uninstall.run">
|
||||||
|
<isset property="manifest.package" />
|
||||||
|
</condition>
|
||||||
|
</target>
|
||||||
|
<target name="-uninstall-error" depends="-uninstall-check" unless="uninstall.run">
|
||||||
|
<echo>Unable to run 'ant uninstall', manifest.package property is not defined.
|
||||||
|
</echo>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- Uninstalls the package from the default emulator/device -->
|
||||||
|
<target name="uninstall" depends="-uninstall-error" if="uninstall.run"
|
||||||
|
description="Uninstalls the application from a running emulator or device.">
|
||||||
|
<echo>Uninstalling ${manifest.package} from the default emulator or device...</echo>
|
||||||
<exec executable="${adb}" failonerror="true">
|
<exec executable="${adb}" failonerror="true">
|
||||||
|
<arg line="${adb.device.arg}" />
|
||||||
<arg value="uninstall" />
|
<arg value="uninstall" />
|
||||||
<arg path="${application-package}" />
|
<arg value="${manifest.package}" />
|
||||||
</exec>
|
</exec>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<!-- Targets for code-coverage measurement purposes, invoked from external file -->
|
||||||
|
|
||||||
|
<!-- Emma-instruments tested project classes (compiles the tested project if necessary)
|
||||||
|
and writes instrumented classes to ${instrumentation.absolute.dir}/classes -->
|
||||||
|
<target name="-emma-instrument" depends="compile">
|
||||||
|
<echo>Instrumenting classes from ${out.absolute.dir}/classes...</echo>
|
||||||
|
<!-- It only instruments class files, not any external libs -->
|
||||||
|
<emma enabled="true">
|
||||||
|
<instr verbosity="${verbosity}"
|
||||||
|
mode="overwrite"
|
||||||
|
instrpath="${out.absolute.dir}/classes"
|
||||||
|
outdir="${out.absolute.dir}/classes">
|
||||||
|
</instr>
|
||||||
|
<!-- TODO: exclusion filters on R*.class and allowing custom exclusion from
|
||||||
|
user defined file -->
|
||||||
|
</emma>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="-dex-instrumented" depends="-emma-instrument">
|
||||||
|
<dex-helper>
|
||||||
|
<extra-parameters>
|
||||||
|
<arg value="--no-locals" />
|
||||||
|
</extra-parameters>
|
||||||
|
<external-libs>
|
||||||
|
<fileset file="${emma.dir}/emma_device.jar" />
|
||||||
|
</external-libs>
|
||||||
|
</dex-helper>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- Invoked from external files for code coverage purposes -->
|
||||||
|
<target name="-package-with-emma" depends="-dex-instrumented, -package-resources">
|
||||||
|
<package-helper sign.package="true">
|
||||||
|
<extra-jars>
|
||||||
|
<!-- Injected from external file -->
|
||||||
|
<jarfile path="${emma.dir}/emma_device.jar" />
|
||||||
|
</extra-jars>
|
||||||
|
</package-helper>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="-debug-with-emma" depends="-package-with-emma">
|
||||||
|
<zipalign-helper in.package="${out.debug.unaligned.package}"
|
||||||
|
out.package="${out.debug.package}" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="-install-with-emma" depends="-debug-with-emma">
|
||||||
|
<install-helper />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- End of targets for code-coverage measurement purposes -->
|
||||||
|
|
||||||
<target name="help">
|
<target name="help">
|
||||||
<!-- displays starts at col 13
|
<!-- displays starts at col 13
|
||||||
|13 80| -->
|
|13 80| -->
|
||||||
<echo>Android Ant Build. Available targets:</echo>
|
<echo>Android Ant Build. Available targets:</echo>
|
||||||
<echo> help: Displays this help.</echo>
|
<echo> help: Displays this help.</echo>
|
||||||
<echo> debug: Builds the application and sign it with a debug key.</echo>
|
<echo> clean: Removes output files created by other targets.</echo>
|
||||||
|
<echo> compile: Compiles project's .java files into .class files.</echo>
|
||||||
|
<echo> debug: Builds the application and signs it with a debug key.</echo>
|
||||||
<echo> release: Builds the application. The generated apk file must be</echo>
|
<echo> release: Builds the application. The generated apk file must be</echo>
|
||||||
<echo> signed before it is published.</echo>
|
<echo> signed before it is published.</echo>
|
||||||
<echo> install: Installs the debug package onto a running emulator or</echo>
|
<echo> install: Installs/reinstalls the debug package onto a running</echo>
|
||||||
<echo> device. This can only be used if the application has </echo>
|
<echo> emulator or device.</echo>
|
||||||
<echo> not yet been installed.</echo>
|
<echo> If the application was previously installed, the</echo>
|
||||||
<echo> reinstall: Installs the debug package on a running emulator or</echo>
|
<echo> signatures must match.</echo>
|
||||||
<echo> device that already has the application.</echo>
|
<echo> uninstall: Uninstalls the application from a running emulator or</echo>
|
||||||
<echo> The signatures must match.</echo>
|
|
||||||
<echo> uninstall: uninstall the application from a running emulator or</echo>
|
|
||||||
<echo> device.</echo>
|
<echo> device.</echo>
|
||||||
<echo> proguard: use before build statements like "debug" and "release"</echo>
|
<echo> proguard: use before build statements like "debug" and "release"</echo>
|
||||||
<echo> to enable proguard dead code removal. NOTE: You must</echo>
|
<echo> to enable proguard dead code removal. NOTE: You must</echo>
|
||||||
|
@ -325,7 +543,8 @@
|
||||||
</tstamp>
|
</tstamp>
|
||||||
|
|
||||||
<!-- Get the version name from the android manifest, will en up in property ${manifest.android:versionName} -->
|
<!-- Get the version name from the android manifest, will en up in property ${manifest.android:versionName} -->
|
||||||
<xmlproperty file="${basedir}/AndroidManifest.xml" collapseAttributes="true"/>
|
<xpath input="AndroidManifest.xml" expression="/manifest/@android:versionName"
|
||||||
|
output="manifest.version.name" />
|
||||||
|
|
||||||
<!-- find out svn.revision of HEAD, need svn.exe installed on local machine will en up in property ${Revision} -->
|
<!-- find out svn.revision of HEAD, need svn.exe installed on local machine will en up in property ${Revision} -->
|
||||||
<exec executable="svn" output="svnlog.out">
|
<exec executable="svn" output="svnlog.out">
|
||||||
|
@ -342,16 +561,16 @@
|
||||||
|
|
||||||
<delete file="svnlog.out"/>
|
<delete file="svnlog.out"/>
|
||||||
|
|
||||||
<replaceregexp file="${resource-folder}/values/notrans.xml" encoding="utf8" match='(\x3Cstring name="msg_version">)[^\x3C]*(\x3C/string>)'
|
<replaceregexp file="${resource.absolute.dir}/values/notrans.xml" encoding="utf8" match='(\x3Cstring name="msg_version">)[^\x3C]*(\x3C/string>)'
|
||||||
replace='\1${ant.project.name} ${manifest.android:versionName} (r${Revision} ${build.date})\2' />
|
replace='\1${ant.project.name} ${manifest.version.name} (r${Revision} ${build.date})\2' />
|
||||||
|
|
||||||
<echo>Updated "msg_version" to: ${ant.project.name} ${manifest.android:versionName} (r${Revision} ${build.date})</echo>
|
<echo>Updated "msg_version" to: ${ant.project.name} ${manifest.version.name} (r${Revision} ${build.date})</echo>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="clean"
|
<target name="clean"
|
||||||
description="Clean up the result of the build process">
|
description="Clean up the result of the build process">
|
||||||
<delete dir="${out-folder}"/>
|
<delete dir="${out.absolute.dir}"/>
|
||||||
<delete dir="${gen-folder}"/>
|
<delete dir="${gen.absolute.dir}"/>
|
||||||
<exec executable="ant" failonerror="true">
|
<exec executable="ant" failonerror="true">
|
||||||
<arg value="-f" />
|
<arg value="-f" />
|
||||||
<arg value="tests/build.xml" />
|
<arg value="tests/build.xml" />
|
||||||
|
@ -359,12 +578,12 @@
|
||||||
</exec>
|
</exec>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="tests" depends="reinstall">
|
<target name="tests" depends="install">
|
||||||
<echo>Building and installing tests...</echo>
|
<echo>Building and installing tests...</echo>
|
||||||
<exec executable="ant" failonerror="true">
|
<exec executable="ant" failonerror="true">
|
||||||
<arg value="-f" />
|
<arg value="-f" />
|
||||||
<arg value="tests/build.xml" />
|
<arg value="tests/build.xml" />
|
||||||
<arg value="reinstall"/>
|
<arg value="install"/>
|
||||||
</exec>
|
</exec>
|
||||||
<echo>Running test cases...</echo>
|
<echo>Running test cases...</echo>
|
||||||
<exec executable="${adb}">
|
<exec executable="${adb}">
|
||||||
|
|
Loading…
Reference in New Issue