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.
5 # This file is meant to be included into a target to provide a rule
6 # to build Android APKs in a consistent manner.
8 # To use this, create a gyp target with the following form:
10 # 'target_name': 'my_package_apk',
13 # 'apk_name': 'MyPackage',
14 # 'java_in_dir': 'path/to/package/root',
15 # 'resource_dir': 'path/to/package/root/res',
17 # 'includes': ['path/to/this/gypi/file'],
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
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
33 # asset_location - The directory where assets are located.
34 # create_abi_split - Whether to create abi-based spilts. Splits
35 # are supported only for minSdkVersion >= 21.
36 # create_density_splits - Whether to create density-based apk splits.
37 # language_splits - List of languages to create apk splits for.
38 # generated_src_dirs - Same as additional_src_dirs except used for .java files
39 # that are generated at build time. This should be set automatically by a
40 # target's dependencies. The .java files in these directories are not
41 # included in the 'inputs' list (unlike additional_src_dirs).
42 # input_jars_paths - The path to jars to be included in the classpath. This
43 # should be filled automatically by depending on the appropriate targets.
44 # is_test_apk - Set to 1 if building a test apk. This prevents resources from
45 # dependencies from being re-included.
46 # native_lib_target - The target_name of the target which generates the final
47 # shared library to be included in this apk. A stripped copy of the
48 # library will be included in the apk.
49 # resource_dir - The directory for resources.
50 # shared_resources - Make a resource package that can be loaded by a different
51 # application at runtime to access the package's resources.
52 # R_package - A custom Java package to generate the resource file R.java in.
53 # By default, the package given in AndroidManifest.xml will be used.
54 # include_all_resources - Set to 1 to include all resource IDs in all generated
56 # use_chromium_linker - Enable the content dynamic linker that allows sharing the
57 # RELRO section of the native libraries between the different processes.
58 # load_library_from_zip - When using the dynamic linker, load the library
59 # directly out of the zip file.
60 # use_relocation_packer - Enable relocation packing. Relies on the chromium
61 # linker, so use_chromium_linker must also be enabled.
62 # enable_chromium_linker_tests - Enable the content dynamic linker test support
63 # code. This allows a test APK to inject a Linker.TestRunner instance at
64 # runtime. Should only be used by the chromium_linker_test_apk target!!
65 # never_lint - Set to 1 to not run lint on this target.
66 # java_in_dir_suffix - To override the /src suffix on java_in_dir.
67 # app_manifest_version_name - set the apps 'human readable' version number.
68 # app_manifest_version_code - set the apps version number.
71 'tested_apk_obfuscated_jar_path%': '/',
72 'tested_apk_dex_path%': '/',
73 'additional_input_paths': [],
74 'create_density_splits%': 0,
75 'language_splits': [],
76 'input_jars_paths': [],
77 'library_dexed_jars_paths': [],
78 'additional_src_dirs': [],
79 'generated_src_dirs': [],
80 'app_manifest_version_name%': '<(android_app_version_name)',
81 'app_manifest_version_code%': '<(android_app_version_code)',
82 # aapt generates this proguard.txt.
83 'generated_proguard_file': '<(intermediate_dir)/proguard.txt',
84 'proguard_enabled%': 'false',
85 'proguard_flags_paths': ['<(generated_proguard_file)'],
86 'jar_name': 'chromium_apk_<(_target_name).jar',
87 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res',
89 'include_all_resources%': 0,
90 'additional_R_text_files': [],
91 'dependencies_res_zip_paths': [],
92 'additional_res_packages': [],
93 'additional_bundled_libs%': [],
95 # Allow icu data, v8 snapshots, and pak files to be loaded directly from the .apk.
96 # Note: These are actually suffix matches, not necessarily extensions.
97 'extensions_to_not_compress%': '.dat,.bin,.pak',
98 'resource_input_paths': [],
99 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)',
100 'asset_location%': '<(intermediate_dir)/assets',
101 'codegen_stamp': '<(intermediate_dir)/codegen.stamp',
102 'package_input_paths': [],
103 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json',
104 'additional_ordered_libraries_file': '<(intermediate_dir)/additional_native_libraries.json',
105 'native_libraries_template': '<(DEPTH)/base/android/java/templates/NativeLibraries.template',
106 'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/',
107 'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.java',
108 'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.stamp',
109 'native_libraries_template_data_dir': '<(intermediate_dir)/native_libraries/',
110 'native_libraries_template_data_file': '<(native_libraries_template_data_dir)/native_libraries_array.h',
111 'native_libraries_template_version_file': '<(native_libraries_template_data_dir)/native_libraries_version.h',
112 'compile_stamp': '<(intermediate_dir)/compile.stamp',
113 'lint_stamp': '<(intermediate_dir)/lint.stamp',
114 'lint_result': '<(intermediate_dir)/lint_result.xml',
115 'lint_config': '<(intermediate_dir)/lint_config.xml',
117 'findbugs_stamp': '<(intermediate_dir)/findbugs.stamp',
119 'java_in_dir_suffix%': '/src',
120 'instr_stamp': '<(intermediate_dir)/instr.stamp',
121 'jar_stamp': '<(intermediate_dir)/jar.stamp',
122 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp',
123 'pack_relocations_stamp': '<(intermediate_dir)/pack_relocations.stamp',
124 'strip_stamp': '<(intermediate_dir)/strip.stamp',
125 'stripped_libraries_dir': '<(intermediate_dir)/stripped_libraries',
126 'strip_additional_stamp': '<(intermediate_dir)/strip_additional.stamp',
127 'version_stamp': '<(intermediate_dir)/version.stamp',
128 'javac_includes': [],
129 'jar_excluded_classes': [],
130 'javac_jar_path': '<(intermediate_dir)/<(_target_name).javac.jar',
131 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)',
132 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar',
133 'test_jar_path': '<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar',
134 'dex_path': '<(intermediate_dir)/classes.dex',
135 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar',
136 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml',
137 'split_android_manifest_path': '<(intermediate_dir)/split-manifests/<(android_app_abi)/AndroidManifest.xml',
138 'push_stamp': '<(intermediate_dir)/push.stamp',
139 'link_stamp': '<(intermediate_dir)/link.stamp',
140 'resource_zip_path': '<(intermediate_dir)/<(_target_name).resources.zip',
141 'shared_resources%': 0,
142 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk',
143 'final_apk_path_no_extension%': '<(PRODUCT_DIR)/apks/<(apk_name)',
144 'final_abi_split_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name)-abi-<(android_app_abi).apk',
145 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk',
146 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp',
147 'device_intermediate_dir': '/data/data/org.chromium.gyp_managed_install/<(_target_name)/<(CONFIGURATION_NAME)',
148 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh',
149 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh',
150 'create_standalone_apk%': 1,
154 'native_lib_target%': '',
155 'native_lib_version_name%': '',
156 'use_chromium_linker%' : 0,
157 'use_relocation_packer%' : 0,
158 'enable_chromium_linker_tests%': 0,
160 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk',
161 'unsigned_abi_split_apk_path': '<(intermediate_dir)/<(apk_name)-abi-<(android_app_abi)-unsigned.apk',
162 'create_abi_split%': 0,
164 'unsigned_apk_path': '<(unsigned_apk_path)',
165 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)',
166 'create_abi_split%': '<(create_abi_split)',
168 ['gyp_managed_install == 1 and native_lib_target != ""', {
170 ['create_abi_split == 0', {
171 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-standalone-unsigned.apk',
173 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-abi-<(android_app_abi)-standalone-unsigned.apk',
177 'unsigned_standalone_apk_path': '<(unsigned_apk_path)',
179 ['gyp_managed_install == 1', {
180 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed',
182 'apk_package_native_libs_dir': '<(intermediate_dir)/libs',
184 ['is_test_apk == 0 and emma_coverage != 0', {
185 'emma_instrument%': 1,
187 'emma_instrument%': 0,
189 # When using abi splits, the abi split is modified by
190 # gyp_managed_install rather than the main .apk
191 ['create_abi_split == 1', {
192 'managed_input_apk_path': '<(unsigned_abi_split_apk_path)',
194 'managed_input_apk_path': '<(unsigned_apk_path)',
198 'native_lib_target%': '',
199 'native_lib_version_name%': '',
200 'use_chromium_linker%' : 0,
201 'load_library_from_zip%' : 0,
202 'use_relocation_packer%' : 0,
203 'enable_chromium_linker_tests%': 0,
204 'emma_instrument%': '<(emma_instrument)',
205 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)',
206 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)',
207 'unsigned_apk_path': '<(unsigned_apk_path)',
208 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)',
209 'create_abi_split%': '<(create_abi_split)',
210 'managed_input_apk_path': '<(managed_input_apk_path)',
211 'libchromium_android_linker': 'libchromium_android_linker.>(android_product_extension)',
212 'extra_native_libs': [],
213 'native_lib_placeholder_stamp': '<(apk_package_native_libs_dir)/<(android_app_abi)/native_lib_placeholder.stamp',
214 'native_lib_placeholders': [],
215 'main_apk_name': '<(apk_name)',
216 'enable_errorprone%': '0',
217 'errorprone_exe_path': '<(PRODUCT_DIR)/bin.java/chromium_errorprone',
219 # Pass the jar path to the apk's "fake" jar target. This would be better as
220 # direct_dependent_settings, but a variable set by a direct_dependent_settings
221 # cannot be lifted in a dependent to all_dependent_settings.
222 'all_dependent_settings': {
224 ['proguard_enabled == "true"', {
226 'proguard_enabled': 'true',
231 'apk_output_jar_path': '<(jar_path)',
232 'tested_apk_obfuscated_jar_path': '<(obfuscated_jar_path)',
233 'tested_apk_dex_path': '<(dex_path)',
237 ['resource_dir!=""', {
239 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ]
242 ['R_package != ""', {
244 # We generate R.java in package R_package (in addition to the package
245 # listed in the AndroidManifest.xml, which is unavoidable).
246 'additional_res_packages': ['<(R_package)'],
247 'additional_R_text_files': ['<(intermediate_dir)/R.txt'],
250 ['native_lib_target != "" and component == "shared_library"', {
252 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries',
255 ['use_chromium_linker == 1', {
257 '<(DEPTH)/base/base.gyp:chromium_android_linker',
260 ['enable_errorprone == 1', {
262 '<(DEPTH)/third_party/errorprone/errorprone.gyp:chromium_errorprone',
265 ['native_lib_target != ""', {
268 ['use_chromium_linker == 1', {
270 'chromium_linker_path': [
271 '<(SHARED_LIB_DIR)/<(libchromium_android_linker)',
276 'chromium_linker_path': [],
280 'generated_src_dirs': [ '<(native_libraries_java_dir)' ],
281 'native_libs_paths': [
282 '<(SHARED_LIB_DIR)/<(native_lib_target).>(android_product_extension)',
283 '<@(chromium_linker_path)'
285 'package_input_paths': [
286 '<(apk_package_native_libs_dir)/<(android_app_abi)/gdbserver',
291 # gdbserver is always copied into the APK's native libs dir. The ant
292 # build scripts (apkbuilder task) will only include it in a debug
294 'destination': '<(apk_package_native_libs_dir)/<(android_app_abi)',
296 '<(android_gdbserver)',
304 '<@(native_libs_paths)',
305 '<@(extra_native_libs)',
308 'includes': ['../build/android/write_ordered_libraries.gypi'],
311 'action_name': 'native_libraries_<(_target_name)',
314 ['use_chromium_linker == 1', {
316 'linker_gcc_preprocess_defines': [
317 '--defines', 'ENABLE_CHROMIUM_LINKER',
322 'linker_gcc_preprocess_defines': [],
325 ['load_library_from_zip == 1', {
327 'linker_load_from_zip_file_preprocess_defines': [
328 '--defines', 'ENABLE_CHROMIUM_LINKER_LIBRARY_IN_ZIP_FILE',
333 'linker_load_from_zip_file_preprocess_defines': [],
336 ['enable_chromium_linker_tests == 1', {
338 'linker_tests_gcc_preprocess_defines': [
339 '--defines', 'ENABLE_CHROMIUM_LINKER_TESTS',
344 'linker_tests_gcc_preprocess_defines': [],
348 'gcc_preprocess_defines': [
349 '<@(linker_load_from_zip_file_preprocess_defines)',
350 '<@(linker_gcc_preprocess_defines)',
351 '<@(linker_tests_gcc_preprocess_defines)',
354 'message': 'Creating NativeLibraries.java for <(_target_name)',
356 '<(DEPTH)/build/android/gyp/util/build_utils.py',
357 '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
358 '<(ordered_libraries_file)',
359 '<(native_libraries_template)',
362 '<(native_libraries_java_stamp)',
365 'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
367 '--output=<(native_libraries_java_file)',
368 '--template=<(native_libraries_template)',
369 '--stamp=<(native_libraries_java_stamp)',
370 '--defines', 'NATIVE_LIBRARIES_LIST=@FileArg(<(ordered_libraries_file):java_libraries_list)',
371 '--defines', 'NATIVE_LIBRARIES_VERSION_NUMBER="<(native_lib_version_name)"',
372 '<@(gcc_preprocess_defines)',
376 'action_name': 'strip_native_libraries',
378 'ordered_libraries_file%': '<(ordered_libraries_file)',
379 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
381 '<@(native_libs_paths)',
382 '<@(extra_native_libs)',
384 'stamp': '<(strip_stamp)'
386 'includes': ['../build/android/strip_native_libraries.gypi'],
389 'action_name': 'insert_chromium_version',
391 'ordered_libraries_file%': '<(ordered_libraries_file)',
392 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
393 'version_string': '<(native_lib_version_name)',
397 'stamp': '<(version_stamp)'
399 'includes': ['../build/android/insert_chromium_version.gypi'],
402 'action_name': 'pack_relocations',
405 ['use_chromium_linker == 1 and use_relocation_packer == 1 and profiling != 1', {
411 'exclude_packing_list': [
412 '<(libchromium_android_linker)',
414 'ordered_libraries_file%': '<(ordered_libraries_file)',
415 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
416 'packed_libraries_dir': '<(libraries_source_dir)',
420 'stamp': '<(pack_relocations_stamp)',
422 'includes': ['../build/android/pack_relocations.gypi'],
427 '<@(additional_bundled_libs)',
429 'ordered_libraries_file': '<(additional_ordered_libraries_file)',
430 'subtarget': '_additional_libraries',
432 'includes': ['../build/android/write_ordered_libraries.gypi'],
435 'action_name': 'strip_additional_libraries',
437 'ordered_libraries_file': '<(additional_ordered_libraries_file)',
438 'stripped_libraries_dir': '<(libraries_source_dir)',
440 '<@(additional_bundled_libs)',
443 'stamp': '<(strip_additional_stamp)'
445 'includes': ['../build/android/strip_native_libraries.gypi'],
448 'action_name': 'Create native lib placeholder files for previous releases',
450 'placeholders': ['<@(native_lib_placeholders)'],
452 ['gyp_managed_install == 1', {
453 # This "library" just needs to be put in the .apk. It is not loaded
455 'placeholders': ['libfix.crbug.384638.so'],
460 '<(DEPTH)/build/android/gyp/create_placeholder_files.py',
463 '<(native_lib_placeholder_stamp)',
466 'python', '<(DEPTH)/build/android/gyp/create_placeholder_files.py',
467 '--dest-lib-dir=<(apk_package_native_libs_dir)/<(android_app_abi)/',
468 '--stamp=<(native_lib_placeholder_stamp)',
474 ['gyp_managed_install == 1', {
476 'libraries_top_dir': '<(intermediate_dir)/lib.stripped',
477 'libraries_source_dir': '<(libraries_top_dir)/lib/<(android_app_abi)',
478 'device_library_dir': '<(device_intermediate_dir)/lib.stripped',
479 'configuration_name': '<(CONFIGURATION_NAME)',
482 '<(DEPTH)/build/android/setup.gyp:get_build_device_configurations',
483 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
487 'includes': ['../build/android/push_libraries.gypi'],
490 'action_name': 'create device library symlinks',
491 'message': 'Creating links on device for <(_target_name)',
493 '<(DEPTH)/build/android/gyp/util/build_utils.py',
494 '<(DEPTH)/build/android/gyp/create_device_library_links.py',
495 '<(apk_install_record)',
496 '<(build_device_config_path)',
497 '<(ordered_libraries_file)',
503 'python', '<(DEPTH)/build/android/gyp/create_device_library_links.py',
504 '--build-device-configuration=<(build_device_config_path)',
505 '--libraries=@FileArg(<(ordered_libraries_file):libraries)',
506 '--script-host-path=<(symlink_script_host_path)',
507 '--script-device-path=<(symlink_script_device_path)',
508 '--target-dir=<(device_library_dir)',
509 '--apk=<(incomplete_apk_path)',
510 '--stamp=<(link_stamp)',
511 '--configuration-name=<(CONFIGURATION_NAME)',
516 ['create_standalone_apk == 1', {
519 'action_name': 'create standalone APK',
522 '<(ordered_libraries_file)',
523 '<(strip_additional_stamp)',
524 '<(pack_relocations_stamp)',
526 'output_apk_path': '<(unsigned_standalone_apk_path)',
527 'libraries_top_dir%': '<(libraries_top_dir)',
528 'input_apk_path': '<(managed_input_apk_path)',
530 'includes': [ 'android/create_standalone_apk_action.gypi' ],
536 # gyp_managed_install != 1
538 'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_app_abi)',
539 'package_input_paths': [
540 '<(strip_additional_stamp)',
541 '<(pack_relocations_stamp)',
546 }], # native_lib_target != ''
547 ['gyp_managed_install == 0 or create_standalone_apk == 1 or create_abi_split == 1', {
549 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar',
552 ['create_abi_split == 1 or gyp_managed_install == 0 or create_standalone_apk == 1', {
555 'action_name': 'finalize_base',
557 'output_apk_path': '<(final_apk_path)',
559 ['create_abi_split == 0', {
560 'input_apk_path': '<(unsigned_standalone_apk_path)',
562 'input_apk_path': '<(unsigned_apk_path)',
563 'load_library_from_zip': 0,
567 'includes': [ 'android/finalize_apk_action.gypi']
571 ['create_abi_split == 1', {
574 'action_name': 'generate_split_manifest_<(_target_name)',
576 '<(DEPTH)/build/android/gyp/util/build_utils.py',
577 '<(DEPTH)/build/android/gyp/generate_split_manifest.py',
578 '<(android_manifest_path)',
581 '<(split_android_manifest_path)',
584 'python', '<(DEPTH)/build/android/gyp/generate_split_manifest.py',
585 '--main-manifest', '<(android_manifest_path)',
586 '--out-manifest', '<(split_android_manifest_path)',
587 '--split', 'abi_<(android_app_abi)',
592 'apk_name': '<(main_apk_name)-abi-<(android_app_abi)',
593 'asset_location': '',
594 'android_manifest_path': '<(split_android_manifest_path)',
595 'create_density_splits': 0,
596 'language_splits=': [],
598 'includes': [ 'android/package_resources_action.gypi' ],
602 'apk_name': '<(main_apk_name)-abi-<(android_app_abi)',
603 'apk_path': '<(unsigned_abi_split_apk_path)',
605 'native_libs_dir': '<(apk_package_native_libs_dir)',
606 'extra_inputs': ['<(native_lib_placeholder_stamp)'],
608 'includes': ['android/apkbuilder_action.gypi'],
612 ['create_abi_split == 1 and (gyp_managed_install == 0 or create_standalone_apk == 1)', {
615 'action_name': 'finalize_split',
617 'output_apk_path': '<(final_abi_split_apk_path)',
619 ['gyp_managed_install == 1', {
620 'input_apk_path': '<(unsigned_standalone_apk_path)',
622 'input_apk_path': '<(unsigned_abi_split_apk_path)',
626 'includes': [ 'android/finalize_apk_action.gypi']
630 ['gyp_managed_install == 1', {
633 'action_name': 'finalize incomplete apk',
635 'load_library_from_zip': 0,
636 'input_apk_path': '<(managed_input_apk_path)',
637 'output_apk_path': '<(incomplete_apk_path)',
639 'includes': [ 'android/finalize_apk_action.gypi']
642 'action_name': 'apk_install_<(_target_name)',
643 'message': 'Installing <(apk_name).apk',
645 '<(DEPTH)/build/android/gyp/util/build_utils.py',
646 '<(DEPTH)/build/android/gyp/apk_install.py',
647 '<(build_device_config_path)',
648 '<(incomplete_apk_path)',
651 '<(apk_install_record)',
654 'python', '<(DEPTH)/build/android/gyp/apk_install.py',
655 '--build-device-configuration=<(build_device_config_path)',
656 '--install-record=<(apk_install_record)',
657 '--configuration-name=<(CONFIGURATION_NAME)',
658 '--android-sdk-tools', '<(android_sdk_tools)',
661 ['create_abi_split == 1', {
666 '--apk-path=<(final_apk_path)',
667 '--split-apk-path=<(incomplete_apk_path)',
671 '--apk-path=<(incomplete_apk_path)',
674 ['create_density_splits == 1', {
676 '<(final_apk_path_no_extension)-density-hdpi.apk',
677 '<(final_apk_path_no_extension)-density-xhdpi.apk',
678 '<(final_apk_path_no_extension)-density-xxhdpi.apk',
679 '<(final_apk_path_no_extension)-density-xxxhdpi.apk',
680 '<(final_apk_path_no_extension)-density-tvdpi.apk',
683 '--split-apk-path=<(final_apk_path_no_extension)-density-hdpi.apk',
684 '--split-apk-path=<(final_apk_path_no_extension)-density-xhdpi.apk',
685 '--split-apk-path=<(final_apk_path_no_extension)-density-xxhdpi.apk',
686 '--split-apk-path=<(final_apk_path_no_extension)-density-xxxhdpi.apk',
687 '--split-apk-path=<(final_apk_path_no_extension)-density-tvdpi.apk',
690 ['language_splits != []', {
692 "<!@(python <(DEPTH)/build/apply_locales.py '<(final_apk_path_no_extension)-lang-ZZLOCALE.apk' <(language_splits))",
695 "<!@(python <(DEPTH)/build/apply_locales.py -- '--split-apk-path=<(final_apk_path_no_extension)-lang-ZZLOCALE.apk' <(language_splits))",
702 ['create_density_splits == 1', {
705 'action_name': 'finalize_density_splits',
709 'includes': [ 'android/finalize_splits_action.gypi']
713 ['is_test_apk == 1', {
715 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
716 '<(DEPTH)/tools/android/android_tools.gyp:android_tools',
719 ['run_findbugs == 1', {
722 'action_name': 'findbugs_<(_target_name)',
723 'message': 'Running findbugs on <(_target_name)',
725 '<(DEPTH)/build/android/findbugs_diff.py',
726 '<(DEPTH)/build/android/findbugs_filter/findbugs_exclude.xml',
727 '<(DEPTH)/build/android/pylib/utils/findbugs.py',
728 '>@(input_jars_paths)',
736 'python', '<(DEPTH)/build/android/findbugs_diff.py',
737 '--auxclasspath-gyp', '>(input_jars_paths)',
738 '--stamp', '<(findbugs_stamp)',
747 '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum',
751 'action_name': 'process_resources',
752 'message': 'processing resources for <(_target_name)',
754 # Write the inputs list to a file, so that its mtime is updated when
755 # the list of inputs changes.
756 'inputs_list_file': '>|(apk_codegen.<(_target_name).gypcmd >@(additional_input_paths) >@(resource_input_paths))',
757 'process_resources_options': [],
759 ['is_test_apk == 1', {
760 'dependencies_res_zip_paths=': [],
761 'additional_res_packages=': [],
763 ['res_v14_skip == 1', {
764 'process_resources_options+': ['--v14-skip']
766 ['shared_resources == 1', {
767 'process_resources_options+': ['--shared-resources']
769 ['R_package != ""', {
770 'process_resources_options+': ['--custom-package', '<(R_package)']
772 ['include_all_resources == 1', {
773 'process_resources_options+': ['--include-all-resources']
778 '<(DEPTH)/build/android/gyp/util/build_utils.py',
779 '<(DEPTH)/build/android/gyp/process_resources.py',
780 '<(android_manifest_path)',
781 '>@(additional_input_paths)',
782 '>@(resource_input_paths)',
783 '>@(dependencies_res_zip_paths)',
784 '>(inputs_list_file)',
787 '<(resource_zip_path)',
788 '<(generated_proguard_file)',
792 'python', '<(DEPTH)/build/android/gyp/process_resources.py',
793 '--android-sdk', '<(android_sdk)',
794 '--aapt-path', '<(android_aapt_path)',
796 '--android-manifest', '<(android_manifest_path)',
797 '--dependencies-res-zips', '>(dependencies_res_zip_paths)',
799 '--extra-res-packages', '>(additional_res_packages)',
800 '--extra-r-text-files', '>(additional_R_text_files)',
802 '--proguard-file', '<(generated_proguard_file)',
804 '--resource-dirs', '<(resource_dir)',
805 '--resource-zip-out', '<(resource_zip_path)',
807 '--R-dir', '<(intermediate_dir)/gen',
809 '--stamp', '<(codegen_stamp)',
811 '<@(process_resources_options)',
815 'action_name': 'javac_<(_target_name)',
816 'message': 'Compiling java for <(_target_name)',
821 '<(intermediate_dir)/gen',
822 '>@(generated_src_dirs)',
824 # If there is a separate find for additional_src_dirs, it will find the
825 # wrong .java files when additional_src_dirs is empty.
826 # TODO(thakis): Gyp caches >! evaluation by command. Both java.gypi and
827 # java_apk.gypi evaluate the same command, and at the moment two targets
828 # set java_in_dir to "java". Add a dummy comment here to make sure
829 # that the two targets (one uses java.gypi, the other java_apk.gypi)
830 # get distinct source lists. Medium-term, make targets list all their
831 # Java files instead of using find. (As is, this will be broken if two
832 # targets use the same java_in_dir and both use java_apk.gypi or
833 # both use java.gypi.)
834 'java_sources': ['>!@(find >(java_in_dir)>(java_in_dir_suffix) >(additional_src_dirs) -name "*.java" # apk)'],
836 ['enable_errorprone == 1', {
838 '<(errorprone_exe_path)',
840 'extra_args': [ '--use-errorprone-path=<(errorprone_exe_path)' ],
845 '<(DEPTH)/build/android/gyp/util/build_utils.py',
846 '<(DEPTH)/build/android/gyp/javac.py',
848 '>@(input_jars_paths)',
853 ['native_lib_target != ""', {
854 'inputs': [ '<(native_libraries_java_stamp)' ],
862 'python', '<(DEPTH)/build/android/gyp/javac.py',
863 '--bootclasspath=<(android_sdk_jar)',
864 '--classpath=>(input_jars_paths) <(android_sdk_jar)',
865 '--src-gendirs=>(gen_src_dirs)',
866 '--javac-includes=<(javac_includes)',
867 '--chromium-code=<(chromium_code)',
868 '--jar-path=<(javac_jar_path)',
869 '--jar-excluded-classes=<(jar_excluded_classes)',
870 '--stamp=<(compile_stamp)',
876 'action_name': 'instr_jar_<(_target_name)',
877 'message': 'Instrumenting <(_target_name) jar',
879 'input_path': '<(javac_jar_path)',
880 'output_path': '<(jar_path)',
881 'stamp_path': '<(instr_stamp)',
891 'includes': [ 'android/instr_action.gypi' ],
896 '<(java_in_dir)<(java_in_dir_suffix)',
897 '>@(additional_src_dirs)',
899 'lint_jar_path': '<(jar_path)',
900 'stamp_path': '<(lint_stamp)',
901 'result_path': '<(lint_result)',
902 'config_path': '<(lint_config)',
907 'includes': [ 'android/lint_action.gypi' ],
910 'action_name': 'obfuscate_<(_target_name)',
911 'message': 'Obfuscating <(_target_name)',
913 'additional_obfuscate_options': [],
914 'additional_obfuscate_input_paths': [],
915 'proguard_out_dir': '<(intermediate_dir)/proguard',
916 'proguard_input_jar_paths': [
917 '>@(input_jars_paths)',
920 'target_conditions': [
921 ['is_test_apk == 1', {
922 'additional_obfuscate_options': [
926 ['is_test_apk == 1 and tested_apk_obfuscated_jar_path != "/"', {
927 'additional_obfuscate_options': [
928 '--tested-apk-obfuscated-jar-path', '>(tested_apk_obfuscated_jar_path)',
930 'additional_obfuscate_input_paths': [
931 '>(tested_apk_obfuscated_jar_path).info',
934 ['proguard_enabled == "true"', {
935 'additional_obfuscate_options': [
936 '--proguard-enabled',
940 'obfuscate_input_jars_paths': [
941 '>@(input_jars_paths)',
946 ['is_test_apk == 1', {
953 '<(DEPTH)/build/android/gyp/apk_obfuscate.py',
954 '<(DEPTH)/build/android/gyp/util/build_utils.py',
955 '>@(proguard_flags_paths)',
956 '>@(obfuscate_input_jars_paths)',
957 '>@(additional_obfuscate_input_paths)',
961 '<(obfuscate_stamp)',
963 # In non-Release builds, these paths will all be empty files.
964 '<(obfuscated_jar_path)',
965 '<(obfuscated_jar_path).info',
966 '<(obfuscated_jar_path).dump',
967 '<(obfuscated_jar_path).seeds',
968 '<(obfuscated_jar_path).mapping',
969 '<(obfuscated_jar_path).usage',
972 'python', '<(DEPTH)/build/android/gyp/apk_obfuscate.py',
974 '--configuration-name', '<(CONFIGURATION_NAME)',
976 '--android-sdk', '<(android_sdk)',
977 '--android-sdk-tools', '<(android_sdk_tools)',
978 '--android-sdk-jar', '<(android_sdk_jar)',
980 '--input-jars-paths=>(proguard_input_jar_paths)',
981 '--proguard-configs=>(proguard_flags_paths)',
983 '--test-jar-path', '<(test_jar_path)',
984 '--obfuscated-jar-path', '<(obfuscated_jar_path)',
986 '--proguard-jar-path', '<(android_sdk_root)/tools/proguard/lib/proguard.jar',
988 '--stamp', '<(obfuscate_stamp)',
990 '>@(additional_obfuscate_options)',
994 'action_name': 'dex_<(_target_name)',
997 '>@(library_dexed_jars_paths)',
1000 'output_path': '<(dex_path)',
1001 'proguard_enabled_input_path': '<(obfuscated_jar_path)',
1003 'target_conditions': [
1004 ['emma_instrument != 0', {
1007 'dex_input_paths': [
1008 '<(emma_device_jar)'
1012 ['is_test_apk == 1 and tested_apk_dex_path != "/"', {
1014 'dex_additional_options': [
1015 '--excluded-paths', '@FileArg(>(tested_apk_dex_path).inputs)'
1019 '>(tested_apk_dex_path).inputs',
1022 ['proguard_enabled == "true"', {
1023 'inputs': [ '<(obfuscate_stamp)' ]
1025 'inputs': [ '<(instr_stamp)' ]
1028 'includes': [ 'android/dex_action.gypi' ],
1032 'extra_inputs': ['<(codegen_stamp)'],
1034 '<(resource_zip_path)',
1037 ['is_test_apk == 0', {
1039 '>@(dependencies_res_zip_paths)',
1044 'includes': [ 'android/package_resources_action.gypi' ],
1048 'apk_path': '<(unsigned_apk_path)',
1050 ['native_lib_target != ""', {
1051 'extra_inputs': ['<(native_lib_placeholder_stamp)'],
1053 ['create_abi_split == 0', {
1054 'native_libs_dir': '<(apk_package_native_libs_dir)',
1056 'native_libs_dir': '<(DEPTH)/build/android/ant/empty/res',
1060 'includes': ['android/apkbuilder_action.gypi'],