OLD | NEW |
| (Empty) |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 # This file is meant to be included into a target to provide a rule | |
6 # to build Android APKs in a consistent manner. | |
7 # | |
8 # To use this, create a gyp target with the following form: | |
9 # { | |
10 # 'target_name': 'my_package_apk', | |
11 # 'type': 'none', | |
12 # 'variables': { | |
13 # 'apk_name': 'MyPackage', | |
14 # 'java_in_dir': 'path/to/package/root', | |
15 # 'resource_dir': 'path/to/package/root/res', | |
16 # }, | |
17 # 'includes': ['path/to/this/gypi/file'], | |
18 # } | |
19 # | |
20 # Required variables: | |
21 # apk_name - The final apk will be named <apk_name>.apk | |
22 # java_in_dir - The top-level java directory. The src should be in | |
23 # <(java_in_dir)/src. | |
24 # Optional/automatic variables: | |
25 # additional_input_paths - These paths will be included in the 'inputs' list to | |
26 # ensure that this target is rebuilt when one of these paths changes. | |
27 # additional_res_packages - Package names of R.java files generated in addition | |
28 # to the default package name defined in AndroidManifest.xml. | |
29 # additional_src_dirs - Additional directories with .java files to be compiled | |
30 # and included in the output of this target. | |
31 # additional_bundled_libs - Additional libraries what will be stripped and | |
32 # bundled in the apk. | |
33 # asset_location - The directory where assets are located. | |
34 # create_density_splits - Whether to create density-based apk splits. Splits | |
35 # are supported only for minSdkVersion >= 21. | |
36 # generated_src_dirs - Same as additional_src_dirs except used for .java files | |
37 # that are generated at build time. This should be set automatically by a | |
38 # target's dependencies. The .java files in these directories are not | |
39 # included in the 'inputs' list (unlike additional_src_dirs). | |
40 # input_jars_paths - The path to jars to be included in the classpath. This | |
41 # should be filled automatically by depending on the appropriate targets. | |
42 # is_test_apk - Set to 1 if building a test apk. This prevents resources from | |
43 # dependencies from being re-included. | |
44 # native_lib_target - The target_name of the target which generates the final | |
45 # shared library to be included in this apk. A stripped copy of the | |
46 # library will be included in the apk. | |
47 # resource_dir - The directory for resources. | |
48 # shared_resources - Make a resource package that can be loaded by a different | |
49 # application at runtime to access the package's resources. | |
50 # R_package - A custom Java package to generate the resource file R.java in. | |
51 # By default, the package given in AndroidManifest.xml will be used. | |
52 # include_all_resources - Set to 1 to include all resource IDs in all generated | |
53 # R.java files. | |
54 # use_chromium_linker - Enable the content dynamic linker that allows sharing t
he | |
55 # RELRO section of the native libraries between the different processes. | |
56 # load_library_from_zip - When using the dynamic linker, load the library | |
57 # directly out of the zip file. | |
58 # use_relocation_packer - Enable relocation packing. Relies on the chromium | |
59 # linker, so use_chromium_linker must also be enabled. | |
60 # enable_chromium_linker_tests - Enable the content dynamic linker test support | |
61 # code. This allows a test APK to inject a Linker.TestRunner instance at | |
62 # runtime. Should only be used by the chromium_linker_test_apk target!! | |
63 # never_lint - Set to 1 to not run lint on this target. | |
64 # java_in_dir_suffix - To override the /src suffix on java_in_dir. | |
65 # app_manifest_version_name - set the apps 'human readable' version number. | |
66 # app_manifest_version_code - set the apps version number. | |
67 { | |
68 'variables': { | |
69 'tested_apk_obfuscated_jar_path%': '/', | |
70 'tested_apk_dex_path%': '/', | |
71 'additional_input_paths': [], | |
72 'create_density_splits%': 0, | |
73 'input_jars_paths': [], | |
74 'library_dexed_jars_paths': [], | |
75 'additional_src_dirs': [], | |
76 'generated_src_dirs': [], | |
77 'app_manifest_version_name%': '<(android_app_version_name)', | |
78 'app_manifest_version_code%': '<(android_app_version_code)', | |
79 # aapt generates this proguard.txt. | |
80 'generated_proguard_file': '<(intermediate_dir)/proguard.txt', | |
81 'proguard_enabled%': 'false', | |
82 'proguard_flags_paths': ['<(generated_proguard_file)'], | |
83 'jar_name': 'chromium_apk_<(_target_name).jar', | |
84 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res', | |
85 'R_package%':'', | |
86 'include_all_resources%': 0, | |
87 'additional_R_text_files': [], | |
88 'dependencies_res_zip_paths': [], | |
89 'additional_res_packages': [], | |
90 'additional_bundled_libs%': [], | |
91 'is_test_apk%': 0, | |
92 'extensions_to_not_compress%': '', | |
93 'resource_input_paths': [], | |
94 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)', | |
95 'asset_location%': '<(intermediate_dir)/assets', | |
96 'codegen_stamp': '<(intermediate_dir)/codegen.stamp', | |
97 'package_input_paths': [], | |
98 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json', | |
99 'additional_ordered_libraries_file': '<(intermediate_dir)/additional_native_
libraries.json', | |
100 'native_libraries_template': '<(DEPTH)/base/android/java/templates/NativeLib
raries.template', | |
101 'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/', | |
102 'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.
java', | |
103 'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.st
amp', | |
104 'native_libraries_template_data_dir': '<(intermediate_dir)/native_libraries/
', | |
105 'native_libraries_template_data_file': '<(native_libraries_template_data_dir
)/native_libraries_array.h', | |
106 'native_libraries_template_version_file': '<(native_libraries_template_data_
dir)/native_libraries_version.h', | |
107 'compile_stamp': '<(intermediate_dir)/compile.stamp', | |
108 'lint_stamp': '<(intermediate_dir)/lint.stamp', | |
109 'lint_result': '<(intermediate_dir)/lint_result.xml', | |
110 'lint_config': '<(intermediate_dir)/lint_config.xml', | |
111 'never_lint%': 0, | |
112 'findbugs_stamp': '<(intermediate_dir)/findbugs.stamp', | |
113 'run_findbugs%': 0, | |
114 'java_in_dir_suffix%': '/src', | |
115 'instr_stamp': '<(intermediate_dir)/instr.stamp', | |
116 'jar_stamp': '<(intermediate_dir)/jar.stamp', | |
117 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', | |
118 'pack_arm_relocations_stamp': '<(intermediate_dir)/pack_arm_relocations.stam
p', | |
119 'strip_stamp': '<(intermediate_dir)/strip.stamp', | |
120 'stripped_libraries_dir': '<(intermediate_dir)/stripped_libraries', | |
121 'strip_additional_stamp': '<(intermediate_dir)/strip_additional.stamp', | |
122 'version_stamp': '<(intermediate_dir)/version.stamp', | |
123 'javac_includes': [], | |
124 'jar_excluded_classes': [], | |
125 'javac_jar_path': '<(intermediate_dir)/<(_target_name).javac.jar', | |
126 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | |
127 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', | |
128 'test_jar_path': '<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar', | |
129 'dex_path': '<(intermediate_dir)/classes.dex', | |
130 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar', | |
131 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml', | |
132 'split_android_manifest_path': '<(intermediate_dir)/split-manifests/<(androi
d_app_abi)/AndroidManifest.xml', | |
133 'push_stamp': '<(intermediate_dir)/push.stamp', | |
134 'link_stamp': '<(intermediate_dir)/link.stamp', | |
135 'resource_zip_path': '<(intermediate_dir)/<(_target_name).resources.zip', | |
136 'shared_resources%': 0, | |
137 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', | |
138 'final_apk_path_no_extension%': '<(PRODUCT_DIR)/apks/<(apk_name)', | |
139 'final_abi_split_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name)-abi-<(android_
app_abi).apk', | |
140 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk', | |
141 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', | |
142 'device_intermediate_dir': '/data/data/org.chromium.gyp_managed_install/<(_t
arget_name)/<(CONFIGURATION_NAME)', | |
143 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh', | |
144 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh
', | |
145 'create_standalone_apk%': 1, | |
146 'res_v14_skip%': 0, | |
147 'variables': { | |
148 'variables': { | |
149 'native_lib_target%': '', | |
150 'native_lib_version_name%': '', | |
151 'use_chromium_linker%' : 0, | |
152 'use_relocation_packer%' : 0, | |
153 'enable_chromium_linker_tests%': 0, | |
154 'is_test_apk%': 0, | |
155 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk', | |
156 'unsigned_abi_split_apk_path': '<(intermediate_dir)/<(apk_name)-abi-<(an
droid_app_abi)-unsigned.apk', | |
157 'create_abi_split%': 0, | |
158 }, | |
159 'unsigned_apk_path': '<(unsigned_apk_path)', | |
160 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)', | |
161 'create_abi_split%': '<(create_abi_split)', | |
162 'conditions': [ | |
163 ['gyp_managed_install == 1 and native_lib_target != ""', { | |
164 'conditions': [ | |
165 ['create_abi_split == 0', { | |
166 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-s
tandalone-unsigned.apk', | |
167 }, { | |
168 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-a
bi-<(android_app_abi)-standalone-unsigned.apk', | |
169 }], | |
170 ], | |
171 }, { | |
172 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', | |
173 }], | |
174 ['gyp_managed_install == 1', { | |
175 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', | |
176 }, { | |
177 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', | |
178 }], | |
179 ['is_test_apk == 0 and emma_coverage != 0', { | |
180 'emma_instrument%': 1, | |
181 },{ | |
182 'emma_instrument%': 0, | |
183 }], | |
184 # When using abi splits, the abi split is modified by | |
185 # gyp_managed_install rather than the main .apk | |
186 ['create_abi_split == 1', { | |
187 'managed_input_apk_path': '<(unsigned_abi_split_apk_path)', | |
188 }, { | |
189 'managed_input_apk_path': '<(unsigned_apk_path)', | |
190 }], | |
191 ], | |
192 }, | |
193 'native_lib_target%': '', | |
194 'native_lib_version_name%': '', | |
195 'use_chromium_linker%' : 0, | |
196 'load_library_from_zip%' : 0, | |
197 'use_relocation_packer%' : 0, | |
198 'enable_chromium_linker_tests%': 0, | |
199 'emma_instrument%': '<(emma_instrument)', | |
200 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', | |
201 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', | |
202 'unsigned_apk_path': '<(unsigned_apk_path)', | |
203 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)', | |
204 'create_abi_split%': '<(create_abi_split)', | |
205 'managed_input_apk_path': '<(managed_input_apk_path)', | |
206 'libchromium_android_linker': 'libchromium_android_linker.>(android_product_
extension)', | |
207 'extra_native_libs': [], | |
208 'native_lib_placeholder_stamp': '<(apk_package_native_libs_dir)/<(android_ap
p_abi)/native_lib_placeholder.stamp', | |
209 'native_lib_placeholders': [], | |
210 'main_apk_name': '<(apk_name)', | |
211 }, | |
212 # Pass the jar path to the apk's "fake" jar target. This would be better as | |
213 # direct_dependent_settings, but a variable set by a direct_dependent_settings | |
214 # cannot be lifted in a dependent to all_dependent_settings. | |
215 'all_dependent_settings': { | |
216 'conditions': [ | |
217 ['proguard_enabled == "true"', { | |
218 'variables': { | |
219 'proguard_enabled': 'true', | |
220 } | |
221 }], | |
222 ], | |
223 'variables': { | |
224 'apk_output_jar_path': '<(jar_path)', | |
225 'tested_apk_obfuscated_jar_path': '<(obfuscated_jar_path)', | |
226 'tested_apk_dex_path': '<(dex_path)', | |
227 }, | |
228 }, | |
229 'conditions': [ | |
230 ['resource_dir!=""', { | |
231 'variables': { | |
232 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ] | |
233 }, | |
234 }], | |
235 ['R_package != ""', { | |
236 'variables': { | |
237 # We generate R.java in package R_package (in addition to the package | |
238 # listed in the AndroidManifest.xml, which is unavoidable). | |
239 'additional_res_packages': ['<(R_package)'], | |
240 'additional_R_text_files': ['<(intermediate_dir)/R.txt'], | |
241 }, | |
242 }], | |
243 ['native_lib_target != "" and component == "shared_library"', { | |
244 'dependencies': [ | |
245 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries', | |
246 ], | |
247 }], | |
248 ['use_chromium_linker == 1', { | |
249 'dependencies': [ | |
250 '<(DEPTH)/base/base.gyp:chromium_android_linker', | |
251 ], | |
252 }], | |
253 ['native_lib_target != ""', { | |
254 'variables': { | |
255 'conditions': [ | |
256 ['use_chromium_linker == 1', { | |
257 'variables': { | |
258 'chromium_linker_path': [ | |
259 '<(SHARED_LIB_DIR)/<(libchromium_android_linker)', | |
260 ], | |
261 } | |
262 }, { | |
263 'variables': { | |
264 'chromium_linker_path': [], | |
265 }, | |
266 }], | |
267 ], | |
268 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], | |
269 'native_libs_paths': [ | |
270 '<(SHARED_LIB_DIR)/<(native_lib_target).>(android_product_extension)', | |
271 '<@(chromium_linker_path)' | |
272 ], | |
273 'package_input_paths': [ | |
274 '<(apk_package_native_libs_dir)/<(android_app_abi)/gdbserver', | |
275 ], | |
276 }, | |
277 'copies': [ | |
278 { | |
279 # gdbserver is always copied into the APK's native libs dir. The ant | |
280 # build scripts (apkbuilder task) will only include it in a debug | |
281 # build. | |
282 'destination': '<(apk_package_native_libs_dir)/<(android_app_abi)', | |
283 'files': [ | |
284 '<(android_gdbserver)', | |
285 ], | |
286 }, | |
287 ], | |
288 'actions': [ | |
289 { | |
290 'variables': { | |
291 'input_libraries': [ | |
292 '<@(native_libs_paths)', | |
293 '<@(extra_native_libs)', | |
294 ], | |
295 }, | |
296 'includes': ['../build/android/write_ordered_libraries.gypi'], | |
297 }, | |
298 { | |
299 'action_name': 'native_libraries_<(_target_name)', | |
300 'variables': { | |
301 'conditions': [ | |
302 ['use_chromium_linker == 1', { | |
303 'variables': { | |
304 'linker_gcc_preprocess_defines': [ | |
305 '--defines', 'ENABLE_CHROMIUM_LINKER', | |
306 ], | |
307 } | |
308 }, { | |
309 'variables': { | |
310 'linker_gcc_preprocess_defines': [], | |
311 }, | |
312 }], | |
313 ['load_library_from_zip == 1', { | |
314 'variables': { | |
315 'linker_load_from_zip_file_preprocess_defines': [ | |
316 '--defines', 'ENABLE_CHROMIUM_LINKER_LIBRARY_IN_ZIP_FILE', | |
317 ], | |
318 } | |
319 }, { | |
320 'variables': { | |
321 'linker_load_from_zip_file_preprocess_defines': [], | |
322 }, | |
323 }], | |
324 ['enable_chromium_linker_tests == 1', { | |
325 'variables': { | |
326 'linker_tests_gcc_preprocess_defines': [ | |
327 '--defines', 'ENABLE_CHROMIUM_LINKER_TESTS', | |
328 ], | |
329 } | |
330 }, { | |
331 'variables': { | |
332 'linker_tests_gcc_preprocess_defines': [], | |
333 }, | |
334 }], | |
335 ], | |
336 'gcc_preprocess_defines': [ | |
337 '<@(linker_load_from_zip_file_preprocess_defines)', | |
338 '<@(linker_gcc_preprocess_defines)', | |
339 '<@(linker_tests_gcc_preprocess_defines)', | |
340 ], | |
341 }, | |
342 'message': 'Creating NativeLibraries.java for <(_target_name)', | |
343 'inputs': [ | |
344 '<(DEPTH)/build/android/gyp/util/build_utils.py', | |
345 '<(DEPTH)/build/android/gyp/gcc_preprocess.py', | |
346 '<(ordered_libraries_file)', | |
347 '<(native_libraries_template)', | |
348 ], | |
349 'outputs': [ | |
350 '<(native_libraries_java_stamp)', | |
351 ], | |
352 'action': [ | |
353 'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py', | |
354 '--include-path=', | |
355 '--output=<(native_libraries_java_file)', | |
356 '--template=<(native_libraries_template)', | |
357 '--stamp=<(native_libraries_java_stamp)', | |
358 '--defines', 'NATIVE_LIBRARIES_LIST=@FileArg(<(ordered_libraries_fil
e):java_libraries_list)', | |
359 '--defines', 'NATIVE_LIBRARIES_VERSION_NUMBER="<(native_lib_version_
name)"', | |
360 '<@(gcc_preprocess_defines)', | |
361 ], | |
362 }, | |
363 { | |
364 'action_name': 'strip_native_libraries', | |
365 'variables': { | |
366 'ordered_libraries_file%': '<(ordered_libraries_file)', | |
367 'stripped_libraries_dir%': '<(stripped_libraries_dir)', | |
368 'input_paths': [ | |
369 '<@(native_libs_paths)', | |
370 '<@(extra_native_libs)', | |
371 ], | |
372 'stamp': '<(strip_stamp)' | |
373 }, | |
374 'includes': ['../build/android/strip_native_libraries.gypi'], | |
375 }, | |
376 { | |
377 'action_name': 'insert_chromium_version', | |
378 'variables': { | |
379 'ordered_libraries_file%': '<(ordered_libraries_file)', | |
380 'stripped_libraries_dir%': '<(stripped_libraries_dir)', | |
381 'version_string': '<(native_lib_version_name)', | |
382 'input_paths': [ | |
383 '<(strip_stamp)', | |
384 ], | |
385 'stamp': '<(version_stamp)' | |
386 }, | |
387 'includes': ['../build/android/insert_chromium_version.gypi'], | |
388 }, | |
389 { | |
390 'action_name': 'pack_arm_relocations', | |
391 'variables': { | |
392 'conditions': [ | |
393 ['use_chromium_linker == 1 and use_relocation_packer == 1 and prof
iling != 1', { | |
394 'enable_packing': 1, | |
395 }, { | |
396 'enable_packing': 0, | |
397 }], | |
398 ], | |
399 'exclude_packing_list': [ | |
400 '<(libchromium_android_linker)', | |
401 ], | |
402 'ordered_libraries_file%': '<(ordered_libraries_file)', | |
403 'stripped_libraries_dir%': '<(stripped_libraries_dir)', | |
404 'packed_libraries_dir': '<(libraries_source_dir)', | |
405 'input_paths': [ | |
406 '<(version_stamp)' | |
407 ], | |
408 'stamp': '<(pack_arm_relocations_stamp)', | |
409 }, | |
410 'includes': ['../build/android/pack_arm_relocations.gypi'], | |
411 }, | |
412 { | |
413 'variables': { | |
414 'input_libraries': [ | |
415 '<@(additional_bundled_libs)', | |
416 ], | |
417 'ordered_libraries_file': '<(additional_ordered_libraries_file)', | |
418 'subtarget': '_additional_libraries', | |
419 }, | |
420 'includes': ['../build/android/write_ordered_libraries.gypi'], | |
421 }, | |
422 { | |
423 'action_name': 'strip_additional_libraries', | |
424 'variables': { | |
425 'ordered_libraries_file': '<(additional_ordered_libraries_file)', | |
426 'stripped_libraries_dir': '<(libraries_source_dir)', | |
427 'input_paths': [ | |
428 '<@(additional_bundled_libs)', | |
429 '<(strip_stamp)', | |
430 ], | |
431 'stamp': '<(strip_additional_stamp)' | |
432 }, | |
433 'includes': ['../build/android/strip_native_libraries.gypi'], | |
434 }, | |
435 { | |
436 'action_name': 'Create native lib placeholder files for previous relea
ses', | |
437 'variables': { | |
438 'placeholders': ['<@(native_lib_placeholders)'], | |
439 'conditions': [ | |
440 ['gyp_managed_install == 1', { | |
441 # This "library" just needs to be put in the .apk. It is not loa
ded | |
442 # at runtime. | |
443 'placeholders': ['libfix.crbug.384638.so'], | |
444 }] | |
445 ], | |
446 }, | |
447 'inputs': [ | |
448 '<(DEPTH)/build/android/gyp/create_placeholder_files.py', | |
449 ], | |
450 'outputs': [ | |
451 '<(native_lib_placeholder_stamp)', | |
452 ], | |
453 'action': [ | |
454 'python', '<(DEPTH)/build/android/gyp/create_placeholder_files.py', | |
455 '--dest-lib-dir=<(apk_package_native_libs_dir)/<(android_app_abi)/', | |
456 '--stamp=<(native_lib_placeholder_stamp)', | |
457 '<@(placeholders)', | |
458 ], | |
459 }, | |
460 ], | |
461 'conditions': [ | |
462 ['gyp_managed_install == 1', { | |
463 'variables': { | |
464 'libraries_top_dir': '<(intermediate_dir)/lib.stripped', | |
465 'libraries_source_dir': '<(libraries_top_dir)/lib/<(android_app_abi)
', | |
466 'device_library_dir': '<(device_intermediate_dir)/lib.stripped', | |
467 'configuration_name': '<(CONFIGURATION_NAME)', | |
468 }, | |
469 'dependencies': [ | |
470 '<(DEPTH)/build/android/setup.gyp:get_build_device_configurations', | |
471 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_
commands', | |
472 ], | |
473 'actions': [ | |
474 { | |
475 'includes': ['../build/android/push_libraries.gypi'], | |
476 }, | |
477 { | |
478 'action_name': 'create device library symlinks', | |
479 'message': 'Creating links on device for <(_target_name)', | |
480 'inputs': [ | |
481 '<(DEPTH)/build/android/gyp/util/build_utils.py', | |
482 '<(DEPTH)/build/android/gyp/create_device_library_links.py', | |
483 '<(apk_install_record)', | |
484 '<(build_device_config_path)', | |
485 '<(ordered_libraries_file)', | |
486 ], | |
487 'outputs': [ | |
488 '<(link_stamp)' | |
489 ], | |
490 'action': [ | |
491 'python', '<(DEPTH)/build/android/gyp/create_device_library_link
s.py', | |
492 '--build-device-configuration=<(build_device_config_path)', | |
493 '--libraries=@FileArg(<(ordered_libraries_file):libraries)', | |
494 '--script-host-path=<(symlink_script_host_path)', | |
495 '--script-device-path=<(symlink_script_device_path)', | |
496 '--target-dir=<(device_library_dir)', | |
497 '--apk=<(incomplete_apk_path)', | |
498 '--stamp=<(link_stamp)', | |
499 '--configuration-name=<(CONFIGURATION_NAME)', | |
500 ], | |
501 }, | |
502 ], | |
503 'conditions': [ | |
504 ['create_standalone_apk == 1', { | |
505 'actions': [ | |
506 { | |
507 'action_name': 'create standalone APK', | |
508 'variables': { | |
509 'inputs': [ | |
510 '<(ordered_libraries_file)', | |
511 '<(strip_additional_stamp)', | |
512 '<(pack_arm_relocations_stamp)', | |
513 ], | |
514 'output_apk_path': '<(unsigned_standalone_apk_path)', | |
515 'libraries_top_dir%': '<(libraries_top_dir)', | |
516 'input_apk_path': '<(managed_input_apk_path)', | |
517 }, | |
518 'includes': [ 'android/create_standalone_apk_action.gypi' ], | |
519 }, | |
520 ], | |
521 }], | |
522 ], | |
523 }, { | |
524 # gyp_managed_install != 1 | |
525 'variables': { | |
526 'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_ap
p_abi)', | |
527 'package_input_paths': [ | |
528 '<(strip_additional_stamp)', | |
529 '<(pack_arm_relocations_stamp)', | |
530 ], | |
531 }, | |
532 }], | |
533 ], | |
534 }], # native_lib_target != '' | |
535 ['gyp_managed_install == 0 or create_standalone_apk == 1 or create_abi_split
== 1', { | |
536 'dependencies': [ | |
537 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar', | |
538 ], | |
539 }], | |
540 ['create_abi_split == 1 or gyp_managed_install == 0 or create_standalone_apk
== 1', { | |
541 'actions': [ | |
542 { | |
543 'action_name': 'finalize_base', | |
544 'variables': { | |
545 'output_apk_path': '<(final_apk_path)', | |
546 'conditions': [ | |
547 ['create_abi_split == 0', { | |
548 'input_apk_path': '<(unsigned_standalone_apk_path)', | |
549 }, { | |
550 'input_apk_path': '<(unsigned_apk_path)', | |
551 'load_library_from_zip': 0, | |
552 }] | |
553 ], | |
554 }, | |
555 'includes': [ 'android/finalize_apk_action.gypi'] | |
556 }, | |
557 ], | |
558 }], | |
559 ['create_abi_split == 1', { | |
560 'actions': [ | |
561 { | |
562 'action_name': 'generate_split_manifest_<(_target_name)', | |
563 'inputs': [ | |
564 '<(DEPTH)/build/android/gyp/util/build_utils.py', | |
565 '<(DEPTH)/build/android/gyp/generate_split_manifest.py', | |
566 '<(android_manifest_path)', | |
567 ], | |
568 'outputs': [ | |
569 '<(split_android_manifest_path)', | |
570 ], | |
571 'action': [ | |
572 'python', '<(DEPTH)/build/android/gyp/generate_split_manifest.py', | |
573 '--main-manifest', '<(android_manifest_path)', | |
574 '--out-manifest', '<(split_android_manifest_path)', | |
575 '--split', 'abi_<(android_app_abi)', | |
576 ], | |
577 }, | |
578 { | |
579 'variables': { | |
580 'apk_name': '<(main_apk_name)-abi-<(android_app_abi)', | |
581 'asset_location': '', | |
582 'android_manifest_path': '<(split_android_manifest_path)', | |
583 'create_density_splits': 0, | |
584 }, | |
585 'includes': [ 'android/package_resources_action.gypi' ], | |
586 }, | |
587 { | |
588 'variables': { | |
589 'apk_name': '<(main_apk_name)-abi-<(android_app_abi)', | |
590 'apk_path': '<(unsigned_abi_split_apk_path)', | |
591 'has_code': 0, | |
592 'native_libs_dir': '<(apk_package_native_libs_dir)', | |
593 'extra_inputs': ['<(native_lib_placeholder_stamp)'], | |
594 }, | |
595 'includes': ['android/apkbuilder_action.gypi'], | |
596 }, | |
597 ], | |
598 }], | |
599 ['create_abi_split == 1 and (gyp_managed_install == 0 or create_standalone_a
pk == 1)', { | |
600 'actions': [ | |
601 { | |
602 'action_name': 'finalize_split', | |
603 'variables': { | |
604 'output_apk_path': '<(final_abi_split_apk_path)', | |
605 'conditions': [ | |
606 ['gyp_managed_install == 1', { | |
607 'input_apk_path': '<(unsigned_standalone_apk_path)', | |
608 }, { | |
609 'input_apk_path': '<(unsigned_abi_split_apk_path)', | |
610 }], | |
611 ], | |
612 }, | |
613 'includes': [ 'android/finalize_apk_action.gypi'] | |
614 }, | |
615 ], | |
616 }], | |
617 ['gyp_managed_install == 1', { | |
618 'actions': [ | |
619 { | |
620 'action_name': 'finalize incomplete apk', | |
621 'variables': { | |
622 'load_library_from_zip': 0, | |
623 'input_apk_path': '<(managed_input_apk_path)', | |
624 'output_apk_path': '<(incomplete_apk_path)', | |
625 }, | |
626 'includes': [ 'android/finalize_apk_action.gypi'] | |
627 }, | |
628 { | |
629 'action_name': 'apk_install_<(_target_name)', | |
630 'message': 'Installing <(apk_name).apk', | |
631 'inputs': [ | |
632 '<(DEPTH)/build/android/gyp/util/build_utils.py', | |
633 '<(DEPTH)/build/android/gyp/apk_install.py', | |
634 '<(build_device_config_path)', | |
635 '<(incomplete_apk_path)', | |
636 ], | |
637 'outputs': [ | |
638 '<(apk_install_record)', | |
639 ], | |
640 'action': [ | |
641 'python', '<(DEPTH)/build/android/gyp/apk_install.py', | |
642 '--build-device-configuration=<(build_device_config_path)', | |
643 '--install-record=<(apk_install_record)', | |
644 '--configuration-name=<(CONFIGURATION_NAME)', | |
645 '--android-sdk-tools', '<(android_sdk_tools)', | |
646 ], | |
647 'conditions': [ | |
648 ['create_abi_split == 1', { | |
649 'inputs': [ | |
650 '<(final_apk_path)', | |
651 ], | |
652 'action': [ | |
653 '--apk-path=<(final_apk_path)', | |
654 '--split-apk-path=<(incomplete_apk_path)', | |
655 ], | |
656 }, { | |
657 'action': [ | |
658 '--apk-path=<(incomplete_apk_path)', | |
659 ], | |
660 }], | |
661 ['create_density_splits == 1', { | |
662 'inputs': [ | |
663 '<(final_apk_path_no_extension)-density-hdpi.apk', | |
664 '<(final_apk_path_no_extension)-density-xhdpi.apk', | |
665 '<(final_apk_path_no_extension)-density-xxhdpi.apk', | |
666 '<(final_apk_path_no_extension)-density-tvdpi.apk', | |
667 ], | |
668 'action': [ | |
669 '--split-apk-path=<(final_apk_path_no_extension)-density-hdpi.ap
k', | |
670 '--split-apk-path=<(final_apk_path_no_extension)-density-xhdpi.a
pk', | |
671 '--split-apk-path=<(final_apk_path_no_extension)-density-xxhdpi.
apk', | |
672 '--split-apk-path=<(final_apk_path_no_extension)-density-tvdpi.a
pk', | |
673 ], | |
674 }], | |
675 ], | |
676 }, | |
677 ], | |
678 }], | |
679 ['create_density_splits == 1', { | |
680 'actions': [ | |
681 { | |
682 'action_name': 'finalize_density_splits', | |
683 'variables': { | |
684 'density_splits': 1, | |
685 }, | |
686 'includes': [ 'android/finalize_splits_action.gypi'] | |
687 }, | |
688 ], | |
689 }], | |
690 ['is_test_apk == 1', { | |
691 'dependencies': [ | |
692 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_comm
ands', | |
693 '<(DEPTH)/tools/android/android_tools.gyp:android_tools', | |
694 ] | |
695 }], | |
696 ['run_findbugs == 1', { | |
697 'actions': [ | |
698 { | |
699 'action_name': 'findbugs_<(_target_name)', | |
700 'message': 'Running findbugs on <(_target_name)', | |
701 'inputs': [ | |
702 '<(DEPTH)/build/android/findbugs_diff.py', | |
703 '<(DEPTH)/build/android/findbugs_filter/findbugs_exclude.xml', | |
704 '<(DEPTH)/build/android/pylib/utils/findbugs.py', | |
705 '>@(input_jars_paths)', | |
706 '<(jar_path)', | |
707 '<(compile_stamp)', | |
708 ], | |
709 'outputs': [ | |
710 '<(findbugs_stamp)', | |
711 ], | |
712 'action': [ | |
713 'python', '<(DEPTH)/build/android/findbugs_diff.py', | |
714 '--auxclasspath-gyp', '>(input_jars_paths)', | |
715 '--stamp', '<(findbugs_stamp)', | |
716 '<(jar_path)', | |
717 ], | |
718 }, | |
719 ], | |
720 }, | |
721 ] | |
722 ], | |
723 'dependencies': [ | |
724 '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum', | |
725 ], | |
726 'actions': [ | |
727 { | |
728 'action_name': 'process_resources', | |
729 'message': 'processing resources for <(_target_name)', | |
730 'variables': { | |
731 # Write the inputs list to a file, so that its mtime is updated when | |
732 # the list of inputs changes. | |
733 'inputs_list_file': '>|(apk_codegen.<(_target_name).gypcmd >@(additional
_input_paths) >@(resource_input_paths))', | |
734 'process_resources_options': [], | |
735 'conditions': [ | |
736 ['is_test_apk == 1', { | |
737 'dependencies_res_zip_paths=': [], | |
738 'additional_res_packages=': [], | |
739 }], | |
740 ['res_v14_skip == 1', { | |
741 'process_resources_options+': ['--v14-skip'] | |
742 }], | |
743 ['shared_resources == 1', { | |
744 'process_resources_options+': ['--shared-resources'] | |
745 }], | |
746 ['R_package != ""', { | |
747 'process_resources_options+': ['--custom-package', '<(R_package)'] | |
748 }], | |
749 ['include_all_resources == 1', { | |
750 'process_resources_options+': ['--include-all-resources'] | |
751 }] | |
752 ], | |
753 }, | |
754 'inputs': [ | |
755 '<(DEPTH)/build/android/gyp/util/build_utils.py', | |
756 '<(DEPTH)/build/android/gyp/process_resources.py', | |
757 '<(android_manifest_path)', | |
758 '>@(additional_input_paths)', | |
759 '>@(resource_input_paths)', | |
760 '>@(dependencies_res_zip_paths)', | |
761 '>(inputs_list_file)', | |
762 ], | |
763 'outputs': [ | |
764 '<(resource_zip_path)', | |
765 '<(generated_proguard_file)', | |
766 '<(codegen_stamp)', | |
767 ], | |
768 'action': [ | |
769 'python', '<(DEPTH)/build/android/gyp/process_resources.py', | |
770 '--android-sdk', '<(android_sdk)', | |
771 '--aapt-path', '<(android_aapt_path)', | |
772 | |
773 '--android-manifest', '<(android_manifest_path)', | |
774 '--dependencies-res-zips', '>(dependencies_res_zip_paths)', | |
775 | |
776 '--extra-res-packages', '>(additional_res_packages)', | |
777 '--extra-r-text-files', '>(additional_R_text_files)', | |
778 | |
779 '--proguard-file', '<(generated_proguard_file)', | |
780 | |
781 '--resource-dirs', '<(resource_dir)', | |
782 '--resource-zip-out', '<(resource_zip_path)', | |
783 | |
784 '--R-dir', '<(intermediate_dir)/gen', | |
785 | |
786 '--stamp', '<(codegen_stamp)', | |
787 | |
788 '<@(process_resources_options)', | |
789 ], | |
790 }, | |
791 { | |
792 'action_name': 'javac_<(_target_name)', | |
793 'message': 'Compiling java for <(_target_name)', | |
794 'variables': { | |
795 'gen_src_dirs': [ | |
796 '<(intermediate_dir)/gen', | |
797 '>@(generated_src_dirs)', | |
798 ], | |
799 # If there is a separate find for additional_src_dirs, it will find the | |
800 # wrong .java files when additional_src_dirs is empty. | |
801 # TODO(thakis): Gyp caches >! evaluation by command. Both java.gypi and | |
802 # java_apk.gypi evaluate the same command, and at the moment two targets | |
803 # set java_in_dir to "java". Add a dummy comment here to make sure | |
804 # that the two targets (one uses java.gypi, the other java_apk.gypi) | |
805 # get distinct source lists. Medium-term, make targets list all their | |
806 # Java files instead of using find. (As is, this will be broken if two | |
807 # targets use the same java_in_dir and both use java_apk.gypi or | |
808 # both use java.gypi.) | |
809 'java_sources': ['>!@(find >(java_in_dir)>(java_in_dir_suffix) >(additio
nal_src_dirs) -name "*.java" # apk)'], | |
810 | |
811 }, | |
812 'inputs': [ | |
813 '<(DEPTH)/build/android/gyp/util/build_utils.py', | |
814 '<(DEPTH)/build/android/gyp/javac.py', | |
815 '>@(java_sources)', | |
816 '>@(input_jars_paths)', | |
817 '<(codegen_stamp)', | |
818 ], | |
819 'conditions': [ | |
820 ['native_lib_target != ""', { | |
821 'inputs': [ '<(native_libraries_java_stamp)' ], | |
822 }], | |
823 ], | |
824 'outputs': [ | |
825 '<(compile_stamp)', | |
826 '<(javac_jar_path)', | |
827 ], | |
828 'action': [ | |
829 'python', '<(DEPTH)/build/android/gyp/javac.py', | |
830 '--classpath=>(input_jars_paths) <(android_sdk_jar)', | |
831 '--src-gendirs=>(gen_src_dirs)', | |
832 '--javac-includes=<(javac_includes)', | |
833 '--chromium-code=<(chromium_code)', | |
834 '--jar-path=<(javac_jar_path)', | |
835 '--jar-excluded-classes=<(jar_excluded_classes)', | |
836 '--stamp=<(compile_stamp)', | |
837 '>@(java_sources)', | |
838 ], | |
839 }, | |
840 { | |
841 'action_name': 'instr_jar_<(_target_name)', | |
842 'message': 'Instrumenting <(_target_name) jar', | |
843 'variables': { | |
844 'input_path': '<(javac_jar_path)', | |
845 'output_path': '<(jar_path)', | |
846 'stamp_path': '<(instr_stamp)', | |
847 'instr_type': 'jar', | |
848 }, | |
849 'outputs': [ | |
850 '<(instr_stamp)', | |
851 '<(jar_path)', | |
852 ], | |
853 'inputs': [ | |
854 '<(javac_jar_path)', | |
855 ], | |
856 'includes': [ 'android/instr_action.gypi' ], | |
857 }, | |
858 { | |
859 'variables': { | |
860 'src_dirs': [ | |
861 '<(java_in_dir)<(java_in_dir_suffix)', | |
862 '>@(additional_src_dirs)', | |
863 ], | |
864 'lint_jar_path': '<(jar_path)', | |
865 'stamp_path': '<(lint_stamp)', | |
866 'result_path': '<(lint_result)', | |
867 'config_path': '<(lint_config)', | |
868 }, | |
869 'outputs': [ | |
870 '<(lint_stamp)', | |
871 ], | |
872 'includes': [ 'android/lint_action.gypi' ], | |
873 }, | |
874 { | |
875 'action_name': 'obfuscate_<(_target_name)', | |
876 'message': 'Obfuscating <(_target_name)', | |
877 'variables': { | |
878 'additional_obfuscate_options': [], | |
879 'additional_obfuscate_input_paths': [], | |
880 'proguard_out_dir': '<(intermediate_dir)/proguard', | |
881 'proguard_input_jar_paths': [ | |
882 '>@(input_jars_paths)', | |
883 '<(jar_path)', | |
884 ], | |
885 'target_conditions': [ | |
886 ['is_test_apk == 1', { | |
887 'additional_obfuscate_options': [ | |
888 '--testapp', | |
889 ], | |
890 }], | |
891 ['is_test_apk == 1 and tested_apk_obfuscated_jar_path != "/"', { | |
892 'additional_obfuscate_options': [ | |
893 '--tested-apk-obfuscated-jar-path', '>(tested_apk_obfuscated_jar_p
ath)', | |
894 ], | |
895 'additional_obfuscate_input_paths': [ | |
896 '>(tested_apk_obfuscated_jar_path).info', | |
897 ], | |
898 }], | |
899 ['proguard_enabled == "true"', { | |
900 'additional_obfuscate_options': [ | |
901 '--proguard-enabled', | |
902 ], | |
903 }], | |
904 ], | |
905 'obfuscate_input_jars_paths': [ | |
906 '>@(input_jars_paths)', | |
907 '<(jar_path)', | |
908 ], | |
909 }, | |
910 'conditions': [ | |
911 ['is_test_apk == 1', { | |
912 'outputs': [ | |
913 '<(test_jar_path)', | |
914 ], | |
915 }], | |
916 ], | |
917 'inputs': [ | |
918 '<(DEPTH)/build/android/gyp/apk_obfuscate.py', | |
919 '<(DEPTH)/build/android/gyp/util/build_utils.py', | |
920 '>@(proguard_flags_paths)', | |
921 '>@(obfuscate_input_jars_paths)', | |
922 '>@(additional_obfuscate_input_paths)', | |
923 '<(instr_stamp)', | |
924 ], | |
925 'outputs': [ | |
926 '<(obfuscate_stamp)', | |
927 | |
928 # In non-Release builds, these paths will all be empty files. | |
929 '<(obfuscated_jar_path)', | |
930 '<(obfuscated_jar_path).info', | |
931 '<(obfuscated_jar_path).dump', | |
932 '<(obfuscated_jar_path).seeds', | |
933 '<(obfuscated_jar_path).mapping', | |
934 '<(obfuscated_jar_path).usage', | |
935 ], | |
936 'action': [ | |
937 'python', '<(DEPTH)/build/android/gyp/apk_obfuscate.py', | |
938 | |
939 '--configuration-name', '<(CONFIGURATION_NAME)', | |
940 | |
941 '--android-sdk', '<(android_sdk)', | |
942 '--android-sdk-tools', '<(android_sdk_tools)', | |
943 '--android-sdk-jar', '<(android_sdk_jar)', | |
944 | |
945 '--input-jars-paths=>(proguard_input_jar_paths)', | |
946 '--proguard-configs=>(proguard_flags_paths)', | |
947 | |
948 '--test-jar-path', '<(test_jar_path)', | |
949 '--obfuscated-jar-path', '<(obfuscated_jar_path)', | |
950 | |
951 '--proguard-jar-path', '<(android_sdk_root)/tools/proguard/lib/proguard.
jar', | |
952 | |
953 '--stamp', '<(obfuscate_stamp)', | |
954 | |
955 '>@(additional_obfuscate_options)', | |
956 ], | |
957 }, | |
958 { | |
959 'action_name': 'dex_<(_target_name)', | |
960 'variables': { | |
961 'dex_input_paths': [ | |
962 '>@(library_dexed_jars_paths)', | |
963 '<(jar_path)', | |
964 ], | |
965 'output_path': '<(dex_path)', | |
966 'proguard_enabled_input_path': '<(obfuscated_jar_path)', | |
967 }, | |
968 'target_conditions': [ | |
969 ['emma_instrument != 0', { | |
970 'variables': { | |
971 'dex_no_locals': 1, | |
972 'dex_input_paths': [ | |
973 '<(emma_device_jar)' | |
974 ], | |
975 }, | |
976 }], | |
977 ['is_test_apk == 1 and tested_apk_dex_path != "/"', { | |
978 'variables': { | |
979 'dex_additional_options': [ | |
980 '--excluded-paths', '@FileArg(>(tested_apk_dex_path).inputs)' | |
981 ], | |
982 }, | |
983 'inputs': [ | |
984 '>(tested_apk_dex_path).inputs', | |
985 ], | |
986 }], | |
987 ['proguard_enabled == "true"', { | |
988 'inputs': [ '<(obfuscate_stamp)' ] | |
989 }, { | |
990 'inputs': [ '<(instr_stamp)' ] | |
991 }], | |
992 ], | |
993 'includes': [ 'android/dex_action.gypi' ], | |
994 }, | |
995 { | |
996 'variables': { | |
997 'extra_inputs': ['<(codegen_stamp)'], | |
998 'resource_zips': [ | |
999 '<(resource_zip_path)', | |
1000 ], | |
1001 'conditions': [ | |
1002 ['is_test_apk == 0', { | |
1003 'resource_zips': [ | |
1004 '>@(dependencies_res_zip_paths)', | |
1005 ], | |
1006 }], | |
1007 ], | |
1008 }, | |
1009 'includes': [ 'android/package_resources_action.gypi' ], | |
1010 }, | |
1011 { | |
1012 'variables': { | |
1013 'apk_path': '<(unsigned_apk_path)', | |
1014 'conditions': [ | |
1015 ['native_lib_target != ""', { | |
1016 'extra_inputs': ['<(native_lib_placeholder_stamp)'], | |
1017 }], | |
1018 ['create_abi_split == 0', { | |
1019 'native_libs_dir': '<(apk_package_native_libs_dir)', | |
1020 }, { | |
1021 'native_libs_dir': '<(DEPTH)/build/android/ant/empty/res', | |
1022 }], | |
1023 ], | |
1024 }, | |
1025 'includes': ['android/apkbuilder_action.gypi'], | |
1026 }, | |
1027 ], | |
1028 } | |
OLD | NEW |