aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2011-08-23 15:19:33 -0700
committerXavier Ducrohet <xav@android.com>2011-08-23 15:19:33 -0700
commit3b5a006ce53d82ab324af836c3abeacc0a77acc1 (patch)
tree01d8da50d22483f3b6d83428404b18fd34b453cf
parent98778375c01b7d3d15c775d2c978173a6241aa9e (diff)
downloadsdk-3b5a006ce53d82ab324af836c3abeacc0a77acc1.zip
sdk-3b5a006ce53d82ab324af836c3abeacc0a77acc1.tar.gz
sdk-3b5a006ce53d82ab324af836c3abeacc0a77acc1.tar.bz2
Prevent running debug and release targets at the same time.
This is not possible since they rely on the same properties which cannot be updated after they are set. Change-Id: I2fbc0f53b656f5906c2b026d8fd41d78a4461803
-rw-r--r--anttasks/src/com/android/ant/NewSetupTask.java1
-rw-r--r--files/ant/build.xml38
2 files changed, 26 insertions, 13 deletions
diff --git a/anttasks/src/com/android/ant/NewSetupTask.java b/anttasks/src/com/android/ant/NewSetupTask.java
index 50dcdab..49e8595 100644
--- a/anttasks/src/com/android/ant/NewSetupTask.java
+++ b/anttasks/src/com/android/ant/NewSetupTask.java
@@ -496,7 +496,6 @@ public class NewSetupTask extends Task {
// the rest is done only if there's a library.
if (jarsPath.list().length > 0) {
- System.out.println("DEBUG: " + rootPath.toString());
antProject.addReference(mProjectLibrariesRootOut, rootPath);
antProject.addReference(mProjectLibrariesResOut, resPath);
antProject.setProperty(mProjectLibrariesPackageOut, packageStrBuilder.toString());
diff --git a/files/ant/build.xml b/files/ant/build.xml
index 86529d8..e128ad8 100644
--- a/files/ant/build.xml
+++ b/files/ant/build.xml
@@ -766,7 +766,7 @@
-->
<target name="-package-resources" depends="-crunch">
<!-- only package resources if *not* a library project -->
- <do-only-if-not-library elseText="Library project: do not package apk..." >
+ <do-only-if-not-library elseText="Library project: do not package resources..." >
<aapt executable="${aapt}"
command="package"
versioncode="${version.code}"
@@ -811,17 +811,21 @@
</do-only-if-not-library>
</target>
+ <target name="-set-mode-check">
+ <fail if="out.final.file"
+ 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>
+
<!-- ********** Debug specific targets ********** -->
- <target name="-debug-obfuscation-check">
- <!-- proguard is never enabled in debug mode -->
- <property name="proguard.enabled" value="false"/>
- </target>
+ <target name="-set-debug-files" depends="-set-mode-check">
- <target name="-set-debug-mode" depends="-debug-obfuscation-check">
<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" />
+ </target>
+
+ <target name="-set-debug-mode">
<!-- record the current build target -->
<property name="build.target" value="debug" />
@@ -835,9 +839,13 @@
</target>
+ <target name="-debug-obfuscation-check">
+ <!-- proguard is never enabled in debug mode -->
+ <property name="proguard.enabled" value="false"/>
+ </target>
+
<!-- Builds debug output package -->
- <target name="debug" depends="-set-debug-mode, -package"
- description="Builds the application and signs it with a debug key.">
+ <target name="-do-debug" depends="-set-debug-mode, -debug-obfuscation-check, -package">
<!-- only create apk if *not* a library project -->
<do-only-if-not-library elseText="Library project: do not create apk..." >
<sequential>
@@ -845,10 +853,16 @@
<echo>Debug Package: ${out.final.file}</echo>
</sequential>
</do-only-if-not-library>
+ </target>
+
+ <!-- Builds debug output package -->
+ <target name="debug" depends="-set-debug-files, -do-debug"
+ description="Builds the application and signs it with a debug key.">
<record-build-info key="build.last.target" value="${build.target}" />
<record-build-info key="build.last.is.instrumented" value="${build.is.instrumented}" />
</target>
+
<!-- ********** Release specific targets ********** -->
<!-- called through target 'release'. Only executed if the keystore and
@@ -894,7 +908,7 @@
</if>
</target>
- <target name="-set-release-mode">
+ <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" />
@@ -968,7 +982,7 @@
gets compiled by the test projects in a way that will make it
support emma code coverage -->
- <target name="-set-instrumented-mode">
+ <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" />
@@ -977,7 +991,7 @@
</target>
<!-- Builds instrumented output package -->
- <target name="instrument" depends="-set-instrumented-mode, debug"
+ <target name="instrument" depends="-set-instrumented-mode, -do-debug"
description="Builds an instrumented packaged.">
<!-- only create apk if *not* a library project -->
<do-only-if-not-library elseText="Library project: do not create apk..." >
@@ -1134,7 +1148,7 @@
</do-only-if-not-library>
</target>
- <target name="installd" depends="-set-debug-mode, install"
+ <target name="installd" depends="-set-debug-files, install"
description="Installs (only) the debug package." />
<target name="installr" depends="-set-release-mode, install"
description="Installs (only) the release package." />