1 <?xml version="1.0" encoding="UTF-8"?> 2 <!-- 3 Copyright (C) 2005-2008 The Android Open Source Project 4 5 Licensed under the Apache License, Version 2.0 (the "License"); 6 you may not use this file except in compliance with the License. 7 You may obtain a copy of the License at 8 9 http://www.apache.org/licenses/LICENSE-2.0 10 11 Unless required by applicable law or agreed to in writing, software 12 distributed under the License is distributed on an "AS IS" BASIS, 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 See the License for the specific language governing permissions and 15 limitations under the License. 16 --> 17 18 <project default="-code-gen"> 19 <property name="verbose" value="false" /> 20 21 <property name="out.dir" location="${OUT_DIR}" /> 22 <property name="out.absolute.dir" location="${out.dir}" /> 23 <property name="out.res.absolute.dir" location="${out.dir}/res" /> 24 <property name="out.manifest.abs.file" location="${out.dir}/AndroidManifest.xml" /> 25 <property name="gen.absolute.dir" value="${out.dir}/gen"/> 26 27 <!-- tools location --> 28 <property name="sdk.dir" location="${ANDROID_SDK_ROOT}"/> 29 <property name="android.sdk.tools.dir" location="${ANDROID_SDK_TOOLS}" /> 30 <property name="aapt" location="${android.sdk.tools.dir}/aapt" /> 31 <property name="project.target.android.jar" location="${ANDROID_SDK_JAR}" /> 32 33 <!-- jar file from where the tasks are loaded --> 34 <path id="android.antlibs"> 35 <pathelement path="${sdk.dir}/tools/lib/ant-tasks.jar" /> 36 </path> 37 38 <!-- Custom tasks --> 39 <taskdef resource="anttasks.properties" classpathref="android.antlibs" /> 40 41 <!-- 42 Include additional resource folders in the apk, e.g. content/.../res. We 43 list the res folders in project.library.res.folder.path and the 44 corresponding java packages in project.library.packages, which must be 45 semicolon-delimited while ADDITIONAL_RES_PACKAGES is space-delimited, hence 46 the replacestring filterchain task. 47 --> 48 <path id="project.library.res.folder.path"> 49 <filelist files="${ADDITIONAL_RES_DIRS}"/> 50 </path> 51 <path id="project.library.bin.r.file.path"> 52 <filelist files="${ADDITIONAL_R_TEXT_FILES}"/> 53 </path> 54 55 <loadresource property="project.library.packages"> 56 <propertyresource name="ADDITIONAL_RES_PACKAGES"/> 57 <filterchain> 58 <replacestring from=" " to=";"/> 59 </filterchain> 60 </loadresource> 61 <!-- Set to empty if not set by the loadresource above --> 62 <property name="project.library.packages" value=""/> 63 64 <path id="project.library.manifest.file.path"> 65 <filelist files="${LIBRARY_MANIFEST_PATHS}"/> 66 </path> 67 68 <!-- manifest merger default value --> 69 <condition property="manifestmerger.enabled" 70 value="false" 71 else="true"> 72 <equals arg1="${LIBRARY_MANIFEST_PATHS}" arg2="" /> 73 </condition> 74 75 <property name="resource.absolute.dir" value="${RESOURCE_DIR}"/> 76 77 <property name="manifest.file" value="${ANDROID_MANIFEST}" /> 78 <property name="manifest.abs.file" location="${manifest.file}" /> 79 80 <!-- Intermediate files --> 81 <property name="resource.package.file.name" value="${APK_NAME}.ap_" /> 82 83 <property name="aapt.ignore.assets" value="" /> 84 85 <target name="-mergemanifest"> 86 <mergemanifest 87 appManifest="${manifest.abs.file}" 88 outManifest="${out.manifest.abs.file}" 89 enabled="${manifestmerger.enabled}"> 90 <library refid="project.library.manifest.file.path" /> 91 </mergemanifest> 92 </target> 93 94 <!-- Code Generation: compile resources (aapt -> R.java), aidl --> 95 <target name="-code-gen" depends="-mergemanifest"> 96 <mkdir dir="${out.absolute.dir}" /> 97 <mkdir dir="${out.res.absolute.dir}" /> 98 <mkdir dir="${gen.absolute.dir}" /> 99 100 <aapt executable="${aapt}" 101 command="package" 102 verbose="${verbose}" 103 manifest="${out.manifest.abs.file}" 104 androidjar="${project.target.android.jar}" 105 rfolder="${gen.absolute.dir}" 106 nonConstantId="false" 107 libraryResFolderPathRefid="project.library.res.folder.path" 108 libraryPackagesRefid="project.library.packages" 109 libraryRFileRefid="project.library.bin.r.file.path" 110 ignoreAssets="${aapt.ignore.assets}" 111 binFolder="${out.absolute.dir}" 112 proguardFile="${out.absolute.dir}/proguard.txt"> 113 <res path="${out.res.absolute.dir}" /> 114 <res path="${resource.absolute.dir}" /> 115 </aapt> 116 117 <touch file="${STAMP}" /> 118 </target> 119 </project> 120