1 <?xml version="1.0" encoding="UTF-8"?>
3 Copyright (C) 2005-2008 The Android Open Source Project
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
9 http://www.apache.org/licenses/LICENSE-2.0
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.
18 <project default="-code-gen">
19 <property name="verbose" value="false" />
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"/>
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}" />
33 <!-- jar file from where the tasks are loaded -->
34 <path id="android.antlibs">
35 <pathelement path="${sdk.dir}/tools/lib/ant-tasks.jar" />
39 <taskdef resource="anttasks.properties" classpathref="android.antlibs" />
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
48 <path id="project.library.res.folder.path">
49 <filelist files="${ADDITIONAL_RES_DIRS}"/>
51 <path id="project.library.bin.r.file.path">
52 <filelist files="${ADDITIONAL_R_TEXT_FILES}"/>
54 <script language="javascript">
55 var before = project.getProperty("ADDITIONAL_RES_PACKAGES");
56 project.setProperty("project.library.packages", before.replaceAll(" ", ";"));
59 <path id="project.library.manifest.file.path">
60 <filelist files="${LIBRARY_MANIFEST_PATHS}"/>
63 <!-- manifest merger default value -->
64 <condition property="manifestmerger.enabled"
67 <equals arg1="${LIBRARY_MANIFEST_PATHS}" arg2="" />
70 <property name="resource.absolute.dir" value="${RESOURCE_DIR}"/>
72 <property name="manifest.file" value="${ANDROID_MANIFEST}" />
73 <property name="manifest.abs.file" location="${manifest.file}" />
75 <!-- Intermediate files -->
76 <property name="resource.package.file.name" value="${APK_NAME}.ap_" />
78 <property name="aapt.ignore.assets" value="" />
80 <target name="-mergemanifest">
82 appManifest="${manifest.abs.file}"
83 outManifest="${out.manifest.abs.file}"
84 enabled="${manifestmerger.enabled}">
85 <library refid="project.library.manifest.file.path" />
89 <!-- Code Generation: compile resources (aapt -> R.java), aidl -->
90 <target name="-code-gen" depends="-mergemanifest">
91 <mkdir dir="${out.absolute.dir}" />
92 <mkdir dir="${out.res.absolute.dir}" />
93 <mkdir dir="${gen.absolute.dir}" />
95 <aapt executable="${aapt}"
98 manifest="${out.manifest.abs.file}"
99 androidjar="${project.target.android.jar}"
100 rfolder="${gen.absolute.dir}"
101 nonConstantId="false"
102 libraryResFolderPathRefid="project.library.res.folder.path"
103 libraryPackagesRefid="project.library.packages"
104 libraryRFileRefid="project.library.bin.r.file.path"
105 ignoreAssets="${aapt.ignore.assets}"
106 binFolder="${out.absolute.dir}"
107 proguardFile="${out.absolute.dir}/proguard.txt">
108 <res path="${out.res.absolute.dir}" />
109 <res path="${resource.absolute.dir}" />
112 <touch file="${STAMP}" />