diff options
author | Xavier Ducrohet <xav@android.com> | 2011-11-23 15:08:24 -0800 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2011-11-23 15:08:24 -0800 |
commit | e9fddda9eac133603d011265379fdceecebb4168 (patch) | |
tree | 75e5840cb75c5c72389eeaca547a0640d7710061 | |
parent | f3d29f8450d1546f7d8ab2d67d6d83be6232fbd8 (diff) | |
download | sdk-e9fddda9eac133603d011265379fdceecebb4168.zip sdk-e9fddda9eac133603d011265379fdceecebb4168.tar.gz sdk-e9fddda9eac133603d011265379fdceecebb4168.tar.bz2 |
Misc Ant build fixes
- project name on standard build rules
- allow override out.final.file
- allow passing custom javac parameters
- allow note having local.properties as long as sdk.dir is present anyway
- -pre-clean target allows custom clean build
Bug 21023, 21267, 21465, 21525
Change-Id: I4bee2f8c15fab664b1f4ff54d754920d2487f6c7
-rw-r--r-- | files/ant/build.xml | 16 | ||||
-rw-r--r-- | templates/build.template | 4 |
2 files changed, 15 insertions, 5 deletions
diff --git a/files/ant/build.xml b/files/ant/build.xml index 14192d8..7891176 100644 --- a/files/ant/build.xml +++ b/files/ant/build.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<project name="" default="debug"> +<project name="android_rules" default="debug"> <!-- This build file is imported by the project build file. It contains @@ -50,6 +50,7 @@ <property name="java.encoding" value="UTF-8" /> <property name="java.target" value="1.5" /> <property name="java.source" value="1.5" /> + <property name="java.compilerargs" value="" /> <!-- Verbosity --> <property name="verbose" value="false" /> @@ -376,8 +377,13 @@ to clean the main project as well as the libraries and tested project --> <target name="all" depends="-setup"/> + <!-- empty default pre-clean target. Create a similar target in + your build.xml and it'll be called instead of this one. --> + <target name="-pre-clean"/> + <!-- clean target --> - <target name="clean" description="Removes output files created by other targets."> + <target name="clean" depends="-pre-clean" + description="Removes output files created by other targets."> <delete dir="${out.absolute.dir}" verbose="${verbose}" /> <delete dir="${gen.absolute.dir}" verbose="${verbose}" /> @@ -654,6 +660,7 @@ <classpath> <fileset dir="${extensible.libs.classpath}" includes="*.jar" /> </classpath> + <compilerarg line="${java.compilerargs}" /> </javac> <!-- if the project is a library then we generate a jar file --> <if condition="${project.is.library}"> @@ -863,7 +870,7 @@ </target> <target name="-set-mode-check"> - <fail if="out.final.file" + <fail if="build.is.mode.set" message="Cannot run two different modes at the same time. If you are running more than one debug/release/instrument type targets, call them from different Ant calls." /> </target> @@ -875,6 +882,7 @@ <property name="out.packaged.file" location="${out.absolute.dir}/${ant.project.name}-debug-unaligned.apk" /> <property name="out.final.file" location="${out.absolute.dir}/${ant.project.name}-debug.apk" /> + <property name="build.is.mode.set" value="true" /> </target> @@ -964,6 +972,7 @@ <target name="-set-release-mode" depends="-set-mode-check"> <property name="out.packaged.file" location="${out.absolute.dir}/${ant.project.name}-release-unsigned.apk" /> <property name="out.final.file" location="${out.absolute.dir}/${ant.project.name}-release.apk" /> + <property name="build.is.mode.set" value="true" /> <!-- record the current build target --> <property name="build.target" value="release" /> @@ -1039,6 +1048,7 @@ <target name="-set-instrumented-mode" depends="-set-mode-check"> <property name="out.packaged.file" location="${out.absolute.dir}/${ant.project.name}-instrumented-unaligned.apk" /> <property name="out.final.file" location="${out.absolute.dir}/${ant.project.name}-instrumented.apk" /> + <property name="build.is.mode.set" value="true" /> <!-- whether the build is an instrumented build. --> <property name="build.is.instrumented" value="true" /> diff --git a/templates/build.template b/templates/build.template index 1ea1be9..df28fa2 100644 --- a/templates/build.template +++ b/templates/build.template @@ -4,7 +4,7 @@ <!-- 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" /> + <property file="local.properties" /> <!-- The ant.properties file can be created by you. It is only edited by the 'android' tool to add properties to it. @@ -41,7 +41,7 @@ <!-- quick check on sdk.dir --> <fail - message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'" + message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var" unless="sdk.dir" /> |