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
46 the replacestring filterchain task.
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}"/>
55 <loadresource property="project.library.packages">
56 <propertyresource name="ADDITIONAL_RES_PACKAGES"/>
58 <replacestring from=" " to=";"/>
61 <!-- Set to empty if not set by the loadresource above -->
62 <property name="project.library.packages" value=""/>
64 <path id="project.library.manifest.file.path">
65 <filelist files="${LIBRARY_MANIFEST_PATHS}"/>
68 <!-- manifest merger default value -->
69 <condition property="manifestmerger.enabled"
72 <equals arg1="${LIBRARY_MANIFEST_PATHS}" arg2="" />
75 <property name="resource.absolute.dir" value="${RESOURCE_DIR}"/>
77 <property name="manifest.file" value="${ANDROID_MANIFEST}" />
78 <property name="manifest.abs.file" location="${manifest.file}" />
80 <!-- Intermediate files -->
81 <property name="resource.package.file.name" value="${APK_NAME}.ap_" />
83 <property name="aapt.ignore.assets" value="" />
85 <target name="-mergemanifest">
87 appManifest="${manifest.abs.file}"
88 outManifest="${out.manifest.abs.file}"
89 enabled="${manifestmerger.enabled}">
90 <library refid="project.library.manifest.file.path" />
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}" />
100 <aapt executable="${aapt}"
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}" />
117 <touch file="${STAMP}" />