OLD | NEW |
| (Empty) |
1 <?xml version="1.0" encoding="UTF-8"?> | |
2 <!-- | |
3 Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
4 Use of this source code is governed by a BSD-style license that can be | |
5 found in the LICENSE file. | |
6 --> | |
7 <project name="chrome_sdk_overrides" > | |
8 <!-- | |
9 Redefinition of targets used by SDK tools. | |
10 Supported version: SDK tools revision 20. | |
11 | |
12 SDK tools do not allow easy way of extending classpaths | |
13 for aidl and javac. This file defines targets which can be used to | |
14 override targets used by tools. | |
15 --> | |
16 <target name="-pre-compile"> | |
17 <!-- | |
18 Remove all .class files from the output directory. This prevents inclusion
of incorrect .class | |
19 files in the final apk. For example, if a .java file was deleted, the apk
should not contain | |
20 the .class files for that .java from previous builds. | |
21 --> | |
22 <delete> | |
23 <fileset dir="${out.classes.absolute.dir}" includes="**/*.class"/> | |
24 </delete> | |
25 </target> | |
26 | |
27 <!-- | |
28 Override the -compile target. | |
29 This target requires 'javac.custom.classpath' to be set to reference | |
30 of classpath to be used for javac. Also accepts custom path for | |
31 sources: 'javac.custom.sourcepath'. | |
32 --> | |
33 <target | |
34 name="-compile" | |
35 depends="-build-setup, -pre-build, -code-gen, -pre-compile"> | |
36 <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping..." > | |
37 <!-- If javac.srcdirs.additional isn't set, set it to an empty path. --> | |
38 <if> | |
39 <condition> | |
40 <not> | |
41 <isreference refid="javac.srcdirs.additional"/> | |
42 </not> | |
43 </condition> | |
44 <then> | |
45 <path id="javac.srcdirs.additional"/> | |
46 </then> | |
47 </if> | |
48 <javac | |
49 bootclasspathref="project.target.class.path" | |
50 classpathref="javac.custom.classpath" | |
51 debug="true" | |
52 destdir="${out.classes.absolute.dir}" | |
53 encoding="${java.encoding}" | |
54 extdirs="" | |
55 fork="${need.javac.fork}" | |
56 includeantruntime="false" | |
57 source="${java.source}" | |
58 target="${java.target}" | |
59 verbose="${verbose}"> | |
60 <src path="${source.absolute.dir}"/> | |
61 <src path="${gen.absolute.dir}"/> | |
62 <src> | |
63 <path refid="javac.srcdirs.additional"/> | |
64 </src> | |
65 <compilerarg value="-Xlint:unchecked"/> | |
66 <compilerarg line="${java.compilerargs}"/> | |
67 </javac> | |
68 <!-- | |
69 If the project is instrumented, then instrument the classes | |
70 TODO(shashishekhar): Add option to override emma filter. | |
71 --> | |
72 <if condition="${build.is.instrumented}"> | |
73 <then> | |
74 <echo level="info"> | |
75 Instrumenting classes from ${out.absolute.dir}/classes... | |
76 </echo> | |
77 <!-- build the default filter to remove R, Manifest, BuildConfig --> | |
78 <getemmafilter | |
79 appPackage="${project.app.package}" | |
80 filterOut="emma.default.filter" | |
81 libraryPackagesRefId="project.library.packages"/> | |
82 <!-- | |
83 Define where the .em file is output. | |
84 This may have been setup already if this is a library. | |
85 --> | |
86 <property name="emma.coverage.absolute.file" | |
87 location="${out.absolute.dir}/coverage.em"/> | |
88 <!-- It only instruments class files, not any external libs --> | |
89 | |
90 <emma enabled="true"> | |
91 <instr | |
92 instrpath="${out.absolute.dir}/classes" | |
93 metadatafile="${emma.coverage.absolute.file}" | |
94 mode="overwrite" | |
95 outdir="${out.absolute.dir}/classes" | |
96 verbosity="${verbosity}"> | |
97 <filter excludes="${emma.default.filter}"/> | |
98 <filter value="${emma.filter}"/> | |
99 </instr> | |
100 </emma> | |
101 </then> | |
102 </if> | |
103 <!-- | |
104 If the project needs a test jar then generate a jar containing | |
105 all compiled classes and referenced jars. | |
106 project.is.testapp is set by Android's ant build system based on the | |
107 target's manifest. It is true only for instrumentation apks. | |
108 --> | |
109 <if condition="${project.is.testapp}"> | |
110 <then> | |
111 <property-location name="create.test.jar.file" | |
112 location="${CHROMIUM_SRC}/build/android/ant/create-test-jar.js"/> | |
113 <script language="javascript" src="${create.test.jar.file}"/> | |
114 </then> | |
115 </if> | |
116 | |
117 </do-only-if-manifest-hasCode> | |
118 </target> | |
119 | |
120 <!-- | |
121 For debug builds, the Android SDK tools create a key in ~/.android and sign
the build with it. | |
122 This has caused all kinds of issues. Instead, the debug build should be sign
ed with a key in | |
123 build/android/ant. The SDK tools do not provide any support for overriding t
hat behavior and so | |
124 instead one must use the hack below. | |
125 --> | |
126 | |
127 <!-- Disables automatic signing. --> | |
128 <property name="build.is.signing.debug" value="false"/> | |
129 | |
130 <!-- TODO(cjhopman): Remove this property when all gyp files define the CHROMI
UM_SRC property. --> | |
131 <property name="CHROMIUM_SRC" value="${PRODUCT_DIR}/../.." /> | |
132 | |
133 <property name="key.store" value="${CHROMIUM_SRC}/build/android/ant/chromium-d
ebug.keystore"/> | |
134 <property name="key.store.password" value="chromium"/> | |
135 <property name="key.alias" value="chromiumdebugkey"/> | |
136 <property name="key.alias.password" value="chromium"/> | |
137 | |
138 <!-- SDK tools assume that out.packaged.file is signed and name it "...-unalig
ned" --> | |
139 <property name="out.packaged.file" | |
140 value="${apks.dir}/${ant.project.name}-unsigned.apk" /> | |
141 <property name="out.unaligned.file" | |
142 value="${apks.dir}/${ant.project.name}-unaligned.apk" /> | |
143 | |
144 <!-- By default, the SDK tools build only aligns the APK in the -do-debug targ
et. --> | |
145 <target name="-do-debug" | |
146 depends="-set-debug-mode, -debug-obfuscation-check, -package, -post-packag
e"> | |
147 <!-- only create apk if *not* a library project --> | |
148 <do-only-if-not-library elseText="Library project: do not create apk..." > | |
149 <sequential> | |
150 <!-- Signs the APK --> | |
151 <echo level="info">Signing final apk...</echo> | |
152 <signapk | |
153 input="${out.packaged.file}" | |
154 output="${out.unaligned.file}" | |
155 keystore="${key.store}" | |
156 storepass="${key.store.password}" | |
157 alias="${key.alias}" | |
158 keypass="${key.alias.password}"/> | |
159 | |
160 <!-- Zip aligns the APK --> | |
161 <zipalign-helper | |
162 in.package="${out.unaligned.file}" | |
163 out.package="${out.final.file}" /> | |
164 <echo level="info">Release Package: ${out.final.file}</echo> | |
165 </sequential> | |
166 </do-only-if-not-library> | |
167 <record-build-info /> | |
168 </target> | |
169 | |
170 <path id="native.libs.gdbserver"> | |
171 <fileset file="${android.gdbserver}"/> | |
172 </path> | |
173 | |
174 <target name="-post-compile"> | |
175 <!-- | |
176 Copy gdbserver to main libs directory if building a non-instrumentation de
bug apk. | |
177 --> | |
178 <if> | |
179 <condition> | |
180 <and> | |
181 <equals arg1="${build.target}" arg2="debug"/> | |
182 <isfalse value="${project.is.testapp}"/> | |
183 </and> | |
184 </condition> | |
185 <then> | |
186 <copy todir="${out.dir}/libs/${target.abi}"> | |
187 <path refid="native.libs.gdbserver"/> | |
188 </copy> | |
189 </then> | |
190 </if> | |
191 | |
192 <!-- Package all the compiled .class files into a .jar. --> | |
193 <jar | |
194 jarfile="${lib.java.dir}/${JAR_NAME}" | |
195 basedir="${out.classes.absolute.dir}" | |
196 /> | |
197 </target> | |
198 | |
199 <!-- | |
200 Override obfuscate target to pass javac.custom.classpath to Proguard. SDK to
ols do not provide | |
201 any way to pass custom class paths to Proguard. | |
202 --> | |
203 <target name="-obfuscate"> | |
204 <if condition="${proguard.enabled}"> | |
205 <then> | |
206 <property name="obfuscate.absolute.dir" location="${out.absolute.dir}/pr
oguard"/> | |
207 <property name="preobfuscate.jar.file" value="${obfuscate.absolute.dir}/
original.jar"/> | |
208 <property name="obfuscated.jar.file" value="${obfuscate.absolute.dir}/ob
fuscated.jar"/> | |
209 <!-- input for dex will be proguard's output --> | |
210 <property name="out.dex.input.absolute.dir" value="${obfuscated.jar.file
}"/> | |
211 | |
212 <!-- Add Proguard Tasks --> | |
213 <property name="proguard.jar" location="${android.tools.dir}/proguard/li
b/proguard.jar"/> | |
214 <taskdef name="proguard" classname="proguard.ant.ProGuardTask" classpath
="${proguard.jar}"/> | |
215 | |
216 <!-- Set the android classpath Path object into a single property. It'll
be | |
217 all the jar files separated by a platform path-separator. | |
218 Each path must be quoted if it contains spaces. | |
219 --> | |
220 <pathconvert property="project.target.classpath.value" refid="project.ta
rget.class.path"> | |
221 <firstmatchmapper> | |
222 <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/> | |
223 <identitymapper/> | |
224 </firstmatchmapper> | |
225 </pathconvert> | |
226 | |
227 <!-- Build a path object with all the jar files that must be obfuscated. | |
228 This include the project compiled source code and any 3rd party jar | |
229 files. --> | |
230 <path id="project.all.classes.path"> | |
231 <pathelement location="${preobfuscate.jar.file}"/> | |
232 <path refid="project.all.jars.path"/> | |
233 <!-- Pass javac.custom.classpath for apks. --> | |
234 <path refid="javac.custom.classpath"/> | |
235 </path> | |
236 <!-- Set the project jar files Path object into a single property. It'll
be | |
237 all the jar files separated by a platform path-separator. | |
238 Each path must be quoted if it contains spaces. | |
239 --> | |
240 <pathconvert property="project.all.classes.value" refid="project.all.cla
sses.path"> | |
241 <firstmatchmapper> | |
242 <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/> | |
243 <identitymapper/> | |
244 </firstmatchmapper> | |
245 </pathconvert> | |
246 | |
247 <!-- Turn the path property ${proguard.config} from an A:B:C property | |
248 into a series of includes: -include A -include B -include C | |
249 suitable for processing by the ProGuard task. Note - this does | |
250 not include the leading '-include "' or the closing '"'; those | |
251 are added under the <proguard> call below. | |
252 --> | |
253 <path id="proguard.configpath"> | |
254 <pathelement path="${proguard.config}"/> | |
255 </path> | |
256 <pathconvert pathsep='" -include "' property="proguard.configcmd" | |
257 refid="proguard.configpath"/> | |
258 | |
259 <mkdir dir="${obfuscate.absolute.dir}"/> | |
260 <delete file="${preobfuscate.jar.file}"/> | |
261 <delete file="${obfuscated.jar.file}"/> | |
262 <jar basedir="${out.classes.absolute.dir}" | |
263 destfile="${preobfuscate.jar.file}"/> | |
264 <proguard> | |
265 -include "${proguard.configcmd}" | |
266 -include "${out.absolute.dir}/proguard.txt" | |
267 -injars ${project.all.classes.value} | |
268 -outjars "${obfuscated.jar.file}" | |
269 -libraryjars ${project.target.classpath.value} | |
270 -dump "${obfuscate.absolute.dir}/dump.txt" | |
271 -printseeds "${obfuscate.absolute.dir}/seeds.txt" | |
272 -printusage "${obfuscate.absolute.dir}/usage.txt" | |
273 -printmapping "${obfuscate.absolute.dir}/mapping.txt" | |
274 </proguard> | |
275 </then> | |
276 </if> | |
277 </target> | |
278 </project> | |
OLD | NEW |