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 'tested_apk_is_multidex%': 0,
74 'additional_input_paths': [],
75 'create_density_splits%': 0,
76 'language_splits': [],
77 'input_jars_paths': [],
78 'library_dexed_jars_paths': [],
79 'main_dex_list_path': '<(intermediate_dir)/main_dex_list.txt',
80 'main_dex_list_paths': ['<(main_dex_list_path)'],
81 'additional_src_dirs': [],
82 'generated_src_dirs': [],
83 'app_manifest_version_name%': '<(android_app_version_name)',
84 'app_manifest_version_code%': '<(android_app_version_code)',
85 # aapt generates this proguard.txt.
86 'generated_proguard_file': '<(intermediate_dir)/proguard.txt',
87 'proguard_enabled%': 'false',
88 'proguard_flags_paths': ['<(generated_proguard_file)'],
89 'jar_name': 'chromium_apk_<(_target_name).jar',
90 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res',
92 'include_all_resources%': 0,
93 'additional_R_text_files': [],
94 'dependencies_res_zip_paths': [],
95 'additional_res_packages': [],
96 'additional_bundled_libs%': [],
98 # Allow icu data, v8 snapshots, and pak files to be loaded directly from the .apk.
99 # Note: These are actually suffix matches, not necessarily extensions.
100 'extensions_to_not_compress%': '.dat,.bin,.pak',
101 'resource_input_paths': [],
102 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)',
103 'asset_location%': '<(intermediate_dir)/assets',
104 'codegen_stamp': '<(intermediate_dir)/codegen.stamp',
105 'package_input_paths': [],
106 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json',
107 'additional_ordered_libraries_file': '<(intermediate_dir)/additional_native_libraries.json',
108 'native_libraries_template': '<(DEPTH)/base/android/java/templates/NativeLibraries.template',
109 'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/',
110 'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.java',
111 'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.stamp',
112 'native_libraries_template_data_dir': '<(intermediate_dir)/native_libraries/',
113 'native_libraries_template_data_file': '<(native_libraries_template_data_dir)/native_libraries_array.h',
114 'native_libraries_template_version_file': '<(native_libraries_template_data_dir)/native_libraries_version.h',
115 'compile_stamp': '<(intermediate_dir)/compile.stamp',
116 'lint_stamp': '<(intermediate_dir)/lint.stamp',
117 'lint_result': '<(intermediate_dir)/lint_result.xml',
118 'lint_config': '<(intermediate_dir)/lint_config.xml',
120 'findbugs_stamp': '<(intermediate_dir)/findbugs.stamp',
122 'java_in_dir_suffix%': '/src',
123 'instr_stamp': '<(intermediate_dir)/instr.stamp',
124 'jar_stamp': '<(intermediate_dir)/jar.stamp',
125 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp',
126 'pack_relocations_stamp': '<(intermediate_dir)/pack_relocations.stamp',
127 'strip_stamp': '<(intermediate_dir)/strip.stamp',
128 'stripped_libraries_dir': '<(intermediate_dir)/stripped_libraries',
129 'strip_additional_stamp': '<(intermediate_dir)/strip_additional.stamp',
130 'version_stamp': '<(intermediate_dir)/version.stamp',
131 'javac_includes': [],
132 'jar_excluded_classes': [],
133 'javac_jar_path': '<(intermediate_dir)/<(_target_name).javac.jar',
134 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)',
135 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar',
136 'test_jar_path': '<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar',
137 'enable_multidex%': 0,
138 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar',
139 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml',
140 'split_android_manifest_path': '<(intermediate_dir)/split-manifests/<(android_app_abi)/AndroidManifest.xml',
141 'push_stamp': '<(intermediate_dir)/push.stamp',
142 'link_stamp': '<(intermediate_dir)/link.stamp',
143 'resource_zip_path': '<(intermediate_dir)/<(_target_name).resources.zip',
144 'shared_resources%': 0,
145 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk',
146 'final_apk_path_no_extension%': '<(PRODUCT_DIR)/apks/<(apk_name)',
147 'final_abi_split_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name)-abi-<(android_app_abi).apk',
148 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk',
149 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp',
150 'device_intermediate_dir': '/data/data/org.chromium.gyp_managed_install/<(_target_name)/<(CONFIGURATION_NAME)',
151 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh',
152 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh',
153 'create_standalone_apk%': 1,
157 'native_lib_target%': '',
158 'native_lib_version_name%': '',
159 'use_chromium_linker%' : 0,
160 'use_relocation_packer%' : 0,
161 'enable_chromium_linker_tests%': 0,
163 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk',
164 'unsigned_abi_split_apk_path': '<(intermediate_dir)/<(apk_name)-abi-<(android_app_abi)-unsigned.apk',
165 'create_abi_split%': 0,
166 'enable_multidex%': 0,
168 'unsigned_apk_path': '<(unsigned_apk_path)',
169 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)',
170 'create_abi_split%': '<(create_abi_split)',
172 ['gyp_managed_install == 1 and native_lib_target != ""', {
174 ['create_abi_split == 0', {
175 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-standalone-unsigned.apk',
177 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-abi-<(android_app_abi)-standalone-unsigned.apk',
181 'unsigned_standalone_apk_path': '<(unsigned_apk_path)',
183 ['gyp_managed_install == 1', {
184 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed',
186 'apk_package_native_libs_dir': '<(intermediate_dir)/libs',
188 ['is_test_apk == 0 and emma_coverage != 0', {
189 'emma_instrument%': 1,
191 'emma_instrument%': 0,
193 # When using abi splits, the abi split is modified by
194 # gyp_managed_install rather than the main .apk
195 ['create_abi_split == 1', {
196 'managed_input_apk_path': '<(unsigned_abi_split_apk_path)',
198 'managed_input_apk_path': '<(unsigned_apk_path)',
200 ['enable_multidex == 1', {
201 'dex_path': '<(intermediate_dir)/classes.dex.zip',
203 'dex_path': '<(intermediate_dir)/classes.dex',
207 'native_lib_target%': '',
208 'native_lib_version_name%': '',
209 'use_chromium_linker%' : 0,
210 'load_library_from_zip%' : 0,
211 'use_relocation_packer%' : 0,
212 'enable_chromium_linker_tests%': 0,
213 'emma_instrument%': '<(emma_instrument)',
214 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)',
215 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)',
216 'unsigned_apk_path': '<(unsigned_apk_path)',
217 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)',
218 'create_abi_split%': '<(create_abi_split)',
219 'managed_input_apk_path': '<(managed_input_apk_path)',
220 'libchromium_android_linker': 'libchromium_android_linker.>(android_product_extension)',
221 'extra_native_libs': [],
222 'native_lib_placeholder_stamp': '<(apk_package_native_libs_dir)/<(android_app_abi)/native_lib_placeholder.stamp',
223 'native_lib_placeholders': [],
224 'main_apk_name': '<(apk_name)',
225 'dex_path': '<(dex_path)',
227 ['chromium_code == 0', {
228 'enable_errorprone': 0,
231 'enable_errorprone%': 0,
232 'errorprone_exe_path': '<(PRODUCT_DIR)/bin.java/chromium_errorprone',
234 # Pass the jar path to the apk's "fake" jar target. This would be better as
235 # direct_dependent_settings, but a variable set by a direct_dependent_settings
236 # cannot be lifted in a dependent to all_dependent_settings.
237 'all_dependent_settings': {
239 ['proguard_enabled == "true"', {
241 'proguard_enabled': 'true',
246 'apk_output_jar_path': '<(jar_path)',
247 'tested_apk_obfuscated_jar_path': '<(obfuscated_jar_path)',
248 'tested_apk_dex_path': '<(dex_path)',
249 'tested_apk_is_multidex': '<(enable_multidex)',
253 ['resource_dir!=""', {
255 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ]
258 ['R_package != ""', {
260 # We generate R.java in package R_package (in addition to the package
261 # listed in the AndroidManifest.xml, which is unavoidable).
262 'additional_res_packages': ['<(R_package)'],
263 'additional_R_text_files': ['<(intermediate_dir)/R.txt'],
266 ['native_lib_target != "" and android_must_copy_system_libraries == 1', {
268 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries',
271 ['use_chromium_linker == 1', {
273 '<(DEPTH)/base/base.gyp:chromium_android_linker',
276 ['enable_errorprone == 1', {
278 '<(DEPTH)/third_party/errorprone/errorprone.gyp:require_errorprone',
281 ['native_lib_target != ""', {
284 ['use_chromium_linker == 1', {
286 'chromium_linker_path': [
287 '<(SHARED_LIB_DIR)/<(libchromium_android_linker)',
292 'chromium_linker_path': [],
296 'generated_src_dirs': [ '<(native_libraries_java_dir)' ],
297 'native_libs_paths': [
298 '<(SHARED_LIB_DIR)/<(native_lib_target).>(android_product_extension)',
299 '<@(chromium_linker_path)'
301 'package_input_paths': [
302 '<(apk_package_native_libs_dir)/<(android_app_abi)/gdbserver',
307 # gdbserver is always copied into the APK's native libs dir. The ant
308 # build scripts (apkbuilder task) will only include it in a debug
310 'destination': '<(apk_package_native_libs_dir)/<(android_app_abi)',
312 '<(android_gdbserver)',
320 '<@(native_libs_paths)',
321 '<@(extra_native_libs)',
324 'includes': ['../build/android/write_ordered_libraries.gypi'],
327 'action_name': 'native_libraries_<(_target_name)',
330 ['use_chromium_linker == 1', {
332 'linker_gcc_preprocess_defines': [
333 '--defines', 'ENABLE_CHROMIUM_LINKER',
338 'linker_gcc_preprocess_defines': [],
341 ['load_library_from_zip == 1', {
343 'linker_load_from_zip_file_preprocess_defines': [
344 '--defines', 'ENABLE_CHROMIUM_LINKER_LIBRARY_IN_ZIP_FILE',
349 'linker_load_from_zip_file_preprocess_defines': [],
352 ['enable_chromium_linker_tests == 1', {
354 'linker_tests_gcc_preprocess_defines': [
355 '--defines', 'ENABLE_CHROMIUM_LINKER_TESTS',
360 'linker_tests_gcc_preprocess_defines': [],
364 'gcc_preprocess_defines': [
365 '<@(linker_load_from_zip_file_preprocess_defines)',
366 '<@(linker_gcc_preprocess_defines)',
367 '<@(linker_tests_gcc_preprocess_defines)',
370 'message': 'Creating NativeLibraries.java for <(_target_name)',
372 '<(DEPTH)/build/android/gyp/util/build_utils.py',
373 '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
374 '<(ordered_libraries_file)',
375 '<(native_libraries_template)',
378 '<(native_libraries_java_stamp)',
381 'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
383 '--output=<(native_libraries_java_file)',
384 '--template=<(native_libraries_template)',
385 '--stamp=<(native_libraries_java_stamp)',
386 '--defines', 'NATIVE_LIBRARIES_LIST=@FileArg(<(ordered_libraries_file):java_libraries_list)',
387 '--defines', 'NATIVE_LIBRARIES_VERSION_NUMBER="<(native_lib_version_name)"',
388 '<@(gcc_preprocess_defines)',
392 'action_name': 'strip_native_libraries',
394 'ordered_libraries_file%': '<(ordered_libraries_file)',
395 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
397 '<@(native_libs_paths)',
398 '<@(extra_native_libs)',
400 'stamp': '<(strip_stamp)'
402 'includes': ['../build/android/strip_native_libraries.gypi'],
405 'action_name': 'insert_chromium_version',
407 'ordered_libraries_file%': '<(ordered_libraries_file)',
408 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
409 'version_string': '<(native_lib_version_name)',
413 'stamp': '<(version_stamp)'
415 'includes': ['../build/android/insert_chromium_version.gypi'],
418 'action_name': 'pack_relocations',
421 ['use_chromium_linker == 1 and use_relocation_packer == 1 and profiling != 1', {
427 'exclude_packing_list': [
428 '<(libchromium_android_linker)',
430 'ordered_libraries_file%': '<(ordered_libraries_file)',
431 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
432 'packed_libraries_dir': '<(libraries_source_dir)',
436 'stamp': '<(pack_relocations_stamp)',
438 'includes': ['../build/android/pack_relocations.gypi'],
443 '<@(additional_bundled_libs)',
445 'ordered_libraries_file': '<(additional_ordered_libraries_file)',
446 'subtarget': '_additional_libraries',
448 'includes': ['../build/android/write_ordered_libraries.gypi'],
451 'action_name': 'strip_additional_libraries',
453 'ordered_libraries_file': '<(additional_ordered_libraries_file)',
454 'stripped_libraries_dir': '<(libraries_source_dir)',
456 '<@(additional_bundled_libs)',
459 'stamp': '<(strip_additional_stamp)'
461 'includes': ['../build/android/strip_native_libraries.gypi'],
464 'action_name': 'Create native lib placeholder files for previous releases',
466 'placeholders': ['<@(native_lib_placeholders)'],
468 ['gyp_managed_install == 1', {
469 # This "library" just needs to be put in the .apk. It is not loaded
471 'placeholders': ['libfix.crbug.384638.so'],
476 '<(DEPTH)/build/android/gyp/create_placeholder_files.py',
479 '<(native_lib_placeholder_stamp)',
482 'python', '<(DEPTH)/build/android/gyp/create_placeholder_files.py',
483 '--dest-lib-dir=<(apk_package_native_libs_dir)/<(android_app_abi)/',
484 '--stamp=<(native_lib_placeholder_stamp)',
490 ['gyp_managed_install == 1', {
492 'libraries_top_dir': '<(intermediate_dir)/lib.stripped',
493 'libraries_source_dir': '<(libraries_top_dir)/lib/<(android_app_abi)',
494 'device_library_dir': '<(device_intermediate_dir)/lib.stripped',
495 'configuration_name': '<(CONFIGURATION_NAME)',
498 '<(DEPTH)/build/android/setup.gyp:get_build_device_configurations',
499 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
503 'includes': ['../build/android/push_libraries.gypi'],
506 'action_name': 'create device library symlinks',
507 'message': 'Creating links on device for <(_target_name)',
509 '<(DEPTH)/build/android/gyp/util/build_utils.py',
510 '<(DEPTH)/build/android/gyp/create_device_library_links.py',
511 '<(apk_install_record)',
512 '<(build_device_config_path)',
513 '<(ordered_libraries_file)',
519 'python', '<(DEPTH)/build/android/gyp/create_device_library_links.py',
520 '--build-device-configuration=<(build_device_config_path)',
521 '--libraries=@FileArg(<(ordered_libraries_file):libraries)',
522 '--script-host-path=<(symlink_script_host_path)',
523 '--script-device-path=<(symlink_script_device_path)',
524 '--target-dir=<(device_library_dir)',
525 '--apk=<(incomplete_apk_path)',
526 '--stamp=<(link_stamp)',
527 '--configuration-name=<(CONFIGURATION_NAME)',
532 ['create_standalone_apk == 1', {
535 'action_name': 'create standalone APK',
538 '<(ordered_libraries_file)',
539 '<(strip_additional_stamp)',
540 '<(pack_relocations_stamp)',
542 'output_apk_path': '<(unsigned_standalone_apk_path)',
543 'libraries_top_dir%': '<(libraries_top_dir)',
544 'input_apk_path': '<(managed_input_apk_path)',
546 'includes': [ 'android/create_standalone_apk_action.gypi' ],
552 # gyp_managed_install != 1
554 'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_app_abi)',
555 'package_input_paths': [
556 '<(strip_additional_stamp)',
557 '<(pack_relocations_stamp)',
562 }], # native_lib_target != ''
563 ['gyp_managed_install == 0 or create_standalone_apk == 1 or create_abi_split == 1', {
565 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar',
568 ['create_abi_split == 1 or gyp_managed_install == 0 or create_standalone_apk == 1', {
571 'action_name': 'finalize_base',
573 'output_apk_path': '<(final_apk_path)',
575 ['create_abi_split == 0', {
576 'input_apk_path': '<(unsigned_standalone_apk_path)',
578 'input_apk_path': '<(unsigned_apk_path)',
579 'load_library_from_zip': 0,
583 'includes': [ 'android/finalize_apk_action.gypi']
587 ['create_abi_split == 1', {
590 'action_name': 'generate_split_manifest_<(_target_name)',
592 '<(DEPTH)/build/android/gyp/util/build_utils.py',
593 '<(DEPTH)/build/android/gyp/generate_split_manifest.py',
594 '<(android_manifest_path)',
597 '<(split_android_manifest_path)',
600 'python', '<(DEPTH)/build/android/gyp/generate_split_manifest.py',
601 '--main-manifest', '<(android_manifest_path)',
602 '--out-manifest', '<(split_android_manifest_path)',
603 '--split', 'abi_<(android_app_abi)',
608 'apk_name': '<(main_apk_name)-abi-<(android_app_abi)',
609 'asset_location': '',
610 'android_manifest_path': '<(split_android_manifest_path)',
611 'create_density_splits': 0,
612 'language_splits=': [],
614 'includes': [ 'android/package_resources_action.gypi' ],
618 'apk_name': '<(main_apk_name)-abi-<(android_app_abi)',
619 'apk_path': '<(unsigned_abi_split_apk_path)',
621 'native_libs_dir': '<(apk_package_native_libs_dir)',
622 'extra_inputs': ['<(native_lib_placeholder_stamp)'],
624 'includes': ['android/apkbuilder_action.gypi'],
628 ['create_abi_split == 1 and (gyp_managed_install == 0 or create_standalone_apk == 1)', {
631 'action_name': 'finalize_split',
633 'output_apk_path': '<(final_abi_split_apk_path)',
635 ['gyp_managed_install == 1', {
636 'input_apk_path': '<(unsigned_standalone_apk_path)',
638 'input_apk_path': '<(unsigned_abi_split_apk_path)',
642 'includes': [ 'android/finalize_apk_action.gypi']
646 ['gyp_managed_install == 1', {
649 'action_name': 'finalize incomplete apk',
651 'load_library_from_zip': 0,
652 'input_apk_path': '<(managed_input_apk_path)',
653 'output_apk_path': '<(incomplete_apk_path)',
655 'includes': [ 'android/finalize_apk_action.gypi']
658 'action_name': 'apk_install_<(_target_name)',
659 'message': 'Installing <(apk_name).apk',
661 '<(DEPTH)/build/android/gyp/util/build_utils.py',
662 '<(DEPTH)/build/android/gyp/apk_install.py',
663 '<(build_device_config_path)',
664 '<(incomplete_apk_path)',
667 '<(apk_install_record)',
670 'python', '<(DEPTH)/build/android/gyp/apk_install.py',
671 '--build-device-configuration=<(build_device_config_path)',
672 '--install-record=<(apk_install_record)',
673 '--configuration-name=<(CONFIGURATION_NAME)',
674 '--android-sdk-tools', '<(android_sdk_tools)',
677 ['create_abi_split == 1', {
682 '--apk-path=<(final_apk_path)',
683 '--split-apk-path=<(incomplete_apk_path)',
687 '--apk-path=<(incomplete_apk_path)',
690 ['create_density_splits == 1', {
692 '<(final_apk_path_no_extension)-density-hdpi.apk',
693 '<(final_apk_path_no_extension)-density-xhdpi.apk',
694 '<(final_apk_path_no_extension)-density-xxhdpi.apk',
695 '<(final_apk_path_no_extension)-density-xxxhdpi.apk',
696 '<(final_apk_path_no_extension)-density-tvdpi.apk',
699 '--split-apk-path=<(final_apk_path_no_extension)-density-hdpi.apk',
700 '--split-apk-path=<(final_apk_path_no_extension)-density-xhdpi.apk',
701 '--split-apk-path=<(final_apk_path_no_extension)-density-xxhdpi.apk',
702 '--split-apk-path=<(final_apk_path_no_extension)-density-xxxhdpi.apk',
703 '--split-apk-path=<(final_apk_path_no_extension)-density-tvdpi.apk',
706 ['language_splits != []', {
708 "<!@(python <(DEPTH)/build/apply_locales.py '<(final_apk_path_no_extension)-lang-ZZLOCALE.apk' <(language_splits))",
711 "<!@(python <(DEPTH)/build/apply_locales.py -- '--split-apk-path=<(final_apk_path_no_extension)-lang-ZZLOCALE.apk' <(language_splits))",
718 ['create_density_splits == 1', {
721 'action_name': 'finalize_density_splits',
725 'includes': [ 'android/finalize_splits_action.gypi']
729 ['is_test_apk == 1', {
731 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
732 '<(DEPTH)/tools/android/android_tools.gyp:android_tools',
735 ['run_findbugs == 1', {
738 'action_name': 'findbugs_<(_target_name)',
739 'message': 'Running findbugs on <(_target_name)',
741 'additional_findbugs_args': [],
742 'findbugs_verbose%': 0,
745 ['findbugs_verbose == 1', {
747 'additional_findbugs_args+': ['-vv'],
752 '<(DEPTH)/build/android/findbugs_diff.py',
753 '<(DEPTH)/build/android/findbugs_filter/findbugs_exclude.xml',
754 '<(DEPTH)/build/android/pylib/utils/findbugs.py',
755 '>@(input_jars_paths)',
763 'python', '<(DEPTH)/build/android/findbugs_diff.py',
764 '--auxclasspath-gyp', '>(input_jars_paths)',
765 '--stamp', '<(findbugs_stamp)',
766 '<@(additional_findbugs_args)',
774 '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum',
778 'action_name': 'process_resources',
779 'message': 'processing resources for <(_target_name)',
781 # Write the inputs list to a file, so that its mtime is updated when
782 # the list of inputs changes.
783 'inputs_list_file': '>|(apk_codegen.<(_target_name).gypcmd >@(additional_input_paths) >@(resource_input_paths))',
784 'process_resources_options': [],
786 ['is_test_apk == 1', {
787 'dependencies_res_zip_paths=': [],
788 'additional_res_packages=': [],
790 ['res_v14_skip == 1', {
791 'process_resources_options+': ['--v14-skip']
793 ['shared_resources == 1', {
794 'process_resources_options+': ['--shared-resources']
796 ['R_package != ""', {
797 'process_resources_options+': ['--custom-package', '<(R_package)']
799 ['include_all_resources == 1', {
800 'process_resources_options+': ['--include-all-resources']
805 '<(DEPTH)/build/android/gyp/util/build_utils.py',
806 '<(DEPTH)/build/android/gyp/process_resources.py',
807 '<(android_manifest_path)',
808 '>@(additional_input_paths)',
809 '>@(resource_input_paths)',
810 '>@(dependencies_res_zip_paths)',
811 '>(inputs_list_file)',
814 '<(resource_zip_path)',
815 '<(generated_proguard_file)',
819 'python', '<(DEPTH)/build/android/gyp/process_resources.py',
820 '--android-sdk', '<(android_sdk)',
821 '--aapt-path', '<(android_aapt_path)',
823 '--android-manifest', '<(android_manifest_path)',
824 '--dependencies-res-zips', '>(dependencies_res_zip_paths)',
826 '--extra-res-packages', '>(additional_res_packages)',
827 '--extra-r-text-files', '>(additional_R_text_files)',
829 '--proguard-file', '<(generated_proguard_file)',
831 '--resource-dirs', '<(resource_dir)',
832 '--resource-zip-out', '<(resource_zip_path)',
834 '--R-dir', '<(intermediate_dir)/gen',
836 '--stamp', '<(codegen_stamp)',
838 '<@(process_resources_options)',
842 'action_name': 'javac_<(_target_name)',
843 'message': 'Compiling java for <(_target_name)',
848 '<(intermediate_dir)/gen',
849 '>@(generated_src_dirs)',
851 # If there is a separate find for additional_src_dirs, it will find the
852 # wrong .java files when additional_src_dirs is empty.
853 # TODO(thakis): Gyp caches >! evaluation by command. Both java.gypi and
854 # java_apk.gypi evaluate the same command, and at the moment two targets
855 # set java_in_dir to "java". Add a dummy comment here to make sure
856 # that the two targets (one uses java.gypi, the other java_apk.gypi)
857 # get distinct source lists. Medium-term, make targets list all their
858 # Java files instead of using find. (As is, this will be broken if two
859 # targets use the same java_in_dir and both use java_apk.gypi or
860 # both use java.gypi.)
861 'java_sources': ['>!@(find >(java_in_dir)>(java_in_dir_suffix) >(additional_src_dirs) -name "*.java" # apk)'],
863 ['enable_errorprone == 1', {
865 '<(errorprone_exe_path)',
867 'extra_args': [ '--use-errorprone-path=<(errorprone_exe_path)' ],
872 '<(DEPTH)/build/android/gyp/util/build_utils.py',
873 '<(DEPTH)/build/android/gyp/javac.py',
875 '>@(input_jars_paths)',
880 ['native_lib_target != ""', {
881 'inputs': [ '<(native_libraries_java_stamp)' ],
889 'python', '<(DEPTH)/build/android/gyp/javac.py',
890 '--bootclasspath=<(android_sdk_jar)',
891 '--classpath=>(input_jars_paths) <(android_sdk_jar)',
892 '--src-gendirs=>(gen_src_dirs)',
893 '--javac-includes=<(javac_includes)',
894 '--chromium-code=<(chromium_code)',
895 '--jar-path=<(javac_jar_path)',
896 '--jar-excluded-classes=<(jar_excluded_classes)',
897 '--stamp=<(compile_stamp)',
903 'action_name': 'main_dex_list_for_<(_target_name)',
905 'jar_path': '<(javac_jar_path)',
906 'output_path': '<(main_dex_list_path)',
908 'includes': [ 'android/main_dex_action.gypi' ],
911 'action_name': 'instr_jar_<(_target_name)',
912 'message': 'Instrumenting <(_target_name) jar',
914 'input_path': '<(javac_jar_path)',
915 'output_path': '<(jar_path)',
916 'stamp_path': '<(instr_stamp)',
926 'includes': [ 'android/instr_action.gypi' ],
931 '<(java_in_dir)<(java_in_dir_suffix)',
932 '>@(additional_src_dirs)',
934 'lint_jar_path': '<(jar_path)',
935 'stamp_path': '<(lint_stamp)',
936 'result_path': '<(lint_result)',
937 'config_path': '<(lint_config)',
942 'includes': [ 'android/lint_action.gypi' ],
945 'action_name': 'obfuscate_<(_target_name)',
946 'message': 'Obfuscating <(_target_name)',
948 'additional_obfuscate_options': [],
949 'additional_obfuscate_input_paths': [],
950 'proguard_out_dir': '<(intermediate_dir)/proguard',
951 'proguard_input_jar_paths': [
952 '>@(input_jars_paths)',
955 'target_conditions': [
956 ['is_test_apk == 1', {
957 'additional_obfuscate_options': [
961 ['is_test_apk == 1 and tested_apk_obfuscated_jar_path != "/"', {
962 'additional_obfuscate_options': [
963 '--tested-apk-obfuscated-jar-path', '>(tested_apk_obfuscated_jar_path)',
965 'additional_obfuscate_input_paths': [
966 '>(tested_apk_obfuscated_jar_path).info',
969 ['proguard_enabled == "true"', {
970 'additional_obfuscate_options': [
971 '--proguard-enabled',
975 'obfuscate_input_jars_paths': [
976 '>@(input_jars_paths)',
981 ['is_test_apk == 1', {
988 '<(DEPTH)/build/android/gyp/apk_obfuscate.py',
989 '<(DEPTH)/build/android/gyp/util/build_utils.py',
990 '>@(proguard_flags_paths)',
991 '>@(obfuscate_input_jars_paths)',
992 '>@(additional_obfuscate_input_paths)',
996 '<(obfuscate_stamp)',
998 # In non-Release builds, these paths will all be empty files.
999 '<(obfuscated_jar_path)',
1000 '<(obfuscated_jar_path).info',
1001 '<(obfuscated_jar_path).dump',
1002 '<(obfuscated_jar_path).seeds',
1003 '<(obfuscated_jar_path).mapping',
1004 '<(obfuscated_jar_path).usage',
1007 'python', '<(DEPTH)/build/android/gyp/apk_obfuscate.py',
1009 '--configuration-name', '<(CONFIGURATION_NAME)',
1011 '--android-sdk', '<(android_sdk)',
1012 '--android-sdk-tools', '<(android_sdk_tools)',
1013 '--android-sdk-jar', '<(android_sdk_jar)',
1015 '--input-jars-paths=>(proguard_input_jar_paths)',
1016 '--proguard-configs=>(proguard_flags_paths)',
1018 '--test-jar-path', '<(test_jar_path)',
1019 '--obfuscated-jar-path', '<(obfuscated_jar_path)',
1021 '--proguard-jar-path', '<(DEPTH)/third_party/proguard/lib/proguard.jar',
1023 '--stamp', '<(obfuscate_stamp)',
1025 '>@(additional_obfuscate_options)',
1029 'action_name': 'dex_<(_target_name)',
1031 'dex_additional_options': [],
1032 'dex_input_paths': [
1035 'output_path': '<(dex_path)',
1036 'proguard_enabled_input_path': '<(obfuscated_jar_path)',
1039 ['enable_multidex == 1', {
1041 'dex_additional_options': [
1043 '--main-dex-list-paths', '>@(main_dex_list_paths)',
1047 '>@(main_dex_list_paths)',
1051 'target_conditions': [
1052 ['enable_multidex == 1 or tested_apk_is_multidex == 1', {
1054 'dex_input_paths': [
1055 '>@(input_jars_paths)',
1060 'dex_input_paths': [
1061 '>@(library_dexed_jars_paths)',
1065 ['emma_instrument != 0', {
1068 'dex_input_paths': [
1069 '<(emma_device_jar)'
1073 ['is_test_apk == 1 and tested_apk_dex_path != "/"', {
1075 'dex_additional_options': [
1076 '--excluded-paths', '@FileArg(>(tested_apk_dex_path).inputs)'
1080 '>(tested_apk_dex_path).inputs',
1083 ['proguard_enabled == "true"', {
1084 'inputs': [ '<(obfuscate_stamp)' ]
1086 'inputs': [ '<(instr_stamp)' ]
1089 'includes': [ 'android/dex_action.gypi' ],
1093 'extra_inputs': ['<(codegen_stamp)'],
1095 '<(resource_zip_path)',
1098 ['is_test_apk == 0', {
1100 '>@(dependencies_res_zip_paths)',
1105 'includes': [ 'android/package_resources_action.gypi' ],
1109 'apk_path': '<(unsigned_apk_path)',
1111 ['native_lib_target != ""', {
1112 'extra_inputs': ['<(native_lib_placeholder_stamp)'],
1114 ['create_abi_split == 0', {
1115 'native_libs_dir': '<(apk_package_native_libs_dir)',
1117 'native_libs_dir': '<(DEPTH)/build/android/ant/empty/res',
1121 'includes': ['android/apkbuilder_action.gypi'],