diff options
author | Xavier Ducrohet <xav@android.com> | 2012-04-23 17:47:06 -0700 |
---|---|---|
committer | android code review <noreply-gerritcodereview@google.com> | 2012-04-23 17:47:06 -0700 |
commit | 57dc74c376c4456eb669523b68e3af4309209a86 (patch) | |
tree | 3625c79d21a4efcbe99da9f35bd29202ca5965a1 /files/ant | |
parent | cf57e9d328bed8fb9d41f8b08ab247dd282d0056 (diff) | |
parent | e6ec57d99bfda23f18ec7ec27022c5321b7368e5 (diff) | |
download | sdk-57dc74c376c4456eb669523b68e3af4309209a86.zip sdk-57dc74c376c4456eb669523b68e3af4309209a86.tar.gz sdk-57dc74c376c4456eb669523b68e3af4309209a86.tar.bz2 |
Merge changes I4f89b469,I33b49c9f,I425e7b75
* changes:
Revert the disable flag of the manifest merger to be enable instead.
Minor fixes in Ant.
Manifest merger in Ant build.
Diffstat (limited to 'files/ant')
-rw-r--r-- | files/ant/build.xml | 170 |
1 files changed, 58 insertions, 112 deletions
diff --git a/files/ant/build.xml b/files/ant/build.xml index 601c8e9..0f9bb87 100644 --- a/files/ant/build.xml +++ b/files/ant/build.xml @@ -56,6 +56,9 @@ <property name="renderscript.debug.opt.level" value="O0" /> <property name="renderscript.release.opt.level" value="O3" /> + <!-- manifest merger default value --> + <property name="manifestmerger.enabled" value="false" /> + <!-- instrumentation options --> <property name="emma.filter" value="" /> @@ -72,77 +75,7 @@ </path> <!-- Custom tasks --> - <taskdef name="checkenv" - classname="com.android.ant.CheckEnvTask" - classpathref="android.antlibs" /> - - <taskdef name="gettype" - classname="com.android.ant.GetTypeTask" - classpathref="android.antlibs" /> - - <taskdef name="gettarget" - classname="com.android.ant.GetTargetTask" - classpathref="android.antlibs" /> - - <taskdef name="getlibs" - classname="com.android.ant.GetLibraryListTask" - classpathref="android.antlibs" /> - - <taskdef name="dependency" - classname="com.android.ant.ComputeDependencyTask" - classpathref="android.antlibs" /> - - <taskdef name="testedprojectclasspath" - classname="com.android.ant.ComputeProjectClasspathTask" - classpathref="android.antlibs" /> - - <taskdef name="getemmafilter" - classname="com.android.ant.GetEmmaFilterTask" - classpathref="android.antlibs" /> - - <taskdef name="aapt" - classname="com.android.ant.AaptExecTask" - classpathref="android.antlibs" /> - - <taskdef name="aidl" - classname="com.android.ant.AidlExecTask" - classpathref="android.antlibs" /> - - <taskdef name="renderscript" - classname="com.android.ant.RenderScriptTask" - classpathref="android.antlibs" /> - - <taskdef name="buildconfig" - classname="com.android.ant.BuildConfigTask" - classpathref="android.antlibs" /> - - <taskdef name="dex" - classname="com.android.ant.DexExecTask" - classpathref="android.antlibs" /> - - <taskdef name="apkbuilder" - classname="com.android.ant.ApkBuilderTask" - classpathref="android.antlibs" /> - - <taskdef name="signapk" - classname="com.android.ant.SignApkTask" - classpathref="android.antlibs" /> - - <taskdef name="zipalign" - classname="com.android.ant.ZipAlignTask" - classpathref="android.antlibs" /> - - <taskdef name="xpath" - classname="com.android.ant.XPathTask" - classpathref="android.antlibs" /> - - <taskdef name="if" - classname="com.android.ant.IfElseTask" - classpathref="android.antlibs" /> - - <taskdef name="propertybyreplace" - classname="com.android.ant.PropertyByReplaceTask" - classpathref="android.antlibs" /> + <taskdef resource="anttasks.properties" classpathref="android.antlibs" /> <!-- Emma configuration --> <property name="emma.dir" value="${sdk.dir}/tools/lib" /> @@ -171,11 +104,15 @@ <property name="jar.libs.absolute.dir" location="${jar.libs.dir}" /> <property name="native.libs.absolute.dir" location="libs" /> + <property name="manifest.file" value="AndroidManifest.xml" /> + <property name="manifest.abs.file" location="${manifest.file}" /> + <!-- Output directories --> <property name="out.dir" value="bin" /> <property name="out.absolute.dir" location="${out.dir}" /> <property name="out.classes.absolute.dir" location="${out.dir}/classes" /> <property name="out.res.absolute.dir" location="${out.dir}/res" /> + <property name="out.manifest.abs.file" location="${out.dir}/AndroidManifest.xml" /> <!-- tools location --> <property name="android.tools.dir" location="${sdk.dir}/tools" /> @@ -456,8 +393,44 @@ </then> </if> + <!-- If the "debug" build type changed, clear out the compiled code. + This is to make sure the new BuildConfig.DEBUG value is picked up + as javac can't deal with this type of change in its dependency computation. --> + <if> + <condition> + <and> + <length string="${build.last.is.packaging.debug}" trim="true" when="greater" length="0" /> + <not><equals + arg1="${build.is.packaging.debug}" + arg2="${build.last.is.packaging.debug}" /></not> + </and> + </condition> + <then> + <echo level="info">Switching between debug and non debug build: Deleting previous compilation output...</echo> + <delete dir="${out.classes.absolute.dir}" verbose="${verbose}" /> + </then> + <else> + <!-- Else, we may still need to clean the code, for another reason. + special case for instrumented: if the previous build was + instrumented but not this one, clear out the compiled code --> + <if> + <condition> + <and> + <istrue value="${build.last.is.instrumented}" /> + <isfalse value="${build.is.instrumented}" /> + </and> + </condition> + <then> + <echo level="info">Switching from instrumented to non-instrumented build: Deleting previous compilation output...</echo> + <delete dir="${out.classes.absolute.dir}" verbose="${verbose}" /> + </then> + </if> + </else> + </if> + + <!-- get the project manifest package --> - <xpath input="AndroidManifest.xml" + <xpath input="${manifest.abs.file}" expression="/manifest/@package" output="project.app.package" /> </target> @@ -532,7 +505,7 @@ minSdkVersionOut="project.minSdkVersion" /> <!-- Value of the hasCode attribute (Application node) extracted from manifest file --> - <xpath input="AndroidManifest.xml" expression="/manifest/application/@android:hasCode" + <xpath input="${manifest.abs.file}" expression="/manifest/application/@android:hasCode" output="manifest.hasCode" default="true"/> <echo level="info">----------</echo> @@ -551,6 +524,7 @@ <dependency libraryFolderPathOut="project.library.folder.path" libraryPackagesOut="project.library.packages" + libraryManifestFilePathOut="project.library.manifest.file.path" libraryResFolderPathOut="project.library.res.folder.path" libraryNativeFolderPathOut="project.library.native.folder.path" jarLibraryPathOut="project.all.jars.path" @@ -613,42 +587,6 @@ <path id="tested.project.classpath" /> </else> </if> - - - <!-- If the "debug" build type changed, clear out the compiled code. - This is to make sure the new BuildConfig.DEBUG value is picked up - as javac can't deal with this type of change in its dependency computation. --> - <if> - <condition> - <and> - <length string="${build.last.is.packaging.debug}" trim="true" when="greater" length="0" /> - <not><equals - arg1="${build.is.packaging.debug}" - arg2="${build.last.is.packaging.debug}" /></not> - </and> - </condition> - <then> - <echo level="info">Switching between debug and non debug build: Deleting previous compilation output...</echo> - <delete dir="${out.classes.absolute.dir}" verbose="${verbose}" /> - </then> - <else> - <!-- Else, we may still need to clean the code, for another reason. - special case for instrumented: if the previous build was - instrumented but not this one, clear out the compiled code --> - <if> - <condition> - <and> - <istrue value="${build.last.is.instrumented}" /> - <isfalse value="${build.is.instrumented}" /> - </and> - </condition> - <then> - <echo level="info">Switching from instrumented to non-instrumented build: Deleting previous compilation output...</echo> - <delete dir="${out.classes.absolute.dir}" verbose="${verbose}" /> - </then> - </if> - </else> - </if> </target> <!-- empty default pre-build target. Create a similar target in @@ -657,6 +595,14 @@ <!-- Code Generation: compile resources (aapt -> R.java), aidl, renderscript --> <target name="-code-gen"> + <!-- always merge manifest --> + <mergemanifest + appManifest="${manifest.abs.file}" + outManifest="${out.manifest.abs.file}" + enabled="${manifestmerger.enabled}"> + <library refid="project.library.manifest.file.path" /> + </mergemanifest> + <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping aidl/renderscript/R.java"> <echo level="info">Handling aidl files...</echo> @@ -684,7 +630,7 @@ <aapt executable="${aapt}" command="package" verbose="${verbose}" - manifest="AndroidManifest.xml" + manifest="${out.manifest.abs.file}" androidjar="${project.target.android.jar}" rfolder="${gen.absolute.dir}" nonConstantId="${android.library}" @@ -922,7 +868,7 @@ versioncode="${version.code}" versionname="${version.name}" debug="${build.is.packaging.debug}" - manifest="AndroidManifest.xml" + manifest="${out.manifest.abs.file}" assets="${asset.absolute.dir}" androidjar="${project.target.android.jar}" apkfolder="${out.absolute.dir}" @@ -1094,7 +1040,7 @@ <!-- release mode is only valid if the manifest does not explicitly set debuggable to true. default is false. --> - <xpath input="AndroidManifest.xml" expression="/manifest/application/@android:debuggable" + <xpath input="${manifest.abs.file}" expression="/manifest/application/@android:debuggable" output="build.is.packaging.debug" default="false"/> <!-- signing mode: release --> |