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)',
226 'enable_errorprone%': '0',
227 'errorprone_exe_path': '<(PRODUCT_DIR)/bin.java/chromium_errorprone',
229 # Pass the jar path to the apk's "fake" jar target. This would be better as
230 # direct_dependent_settings, but a variable set by a direct_dependent_settings
231 # cannot be lifted in a dependent to all_dependent_settings.
232 'all_dependent_settings': {
234 ['proguard_enabled == "true"', {
236 'proguard_enabled': 'true',
241 'apk_output_jar_path': '<(jar_path)',
242 'tested_apk_obfuscated_jar_path': '<(obfuscated_jar_path)',
243 'tested_apk_dex_path': '<(dex_path)',
244 'tested_apk_is_multidex': '<(enable_multidex)',
248 ['resource_dir!=""', {
250 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ]
253 ['R_package != ""', {
255 # We generate R.java in package R_package (in addition to the package
256 # listed in the AndroidManifest.xml, which is unavoidable).
257 'additional_res_packages': ['<(R_package)'],
258 'additional_R_text_files': ['<(intermediate_dir)/R.txt'],
261 ['native_lib_target != "" and android_must_copy_system_libraries == 1', {
263 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries',
266 ['use_chromium_linker == 1', {
268 '<(DEPTH)/base/base.gyp:chromium_android_linker',
271 ['enable_errorprone == 1', {
273 '<(DEPTH)/third_party/errorprone/errorprone.gyp:require_errorprone',
276 ['native_lib_target != ""', {
279 ['use_chromium_linker == 1', {
281 'chromium_linker_path': [
282 '<(SHARED_LIB_DIR)/<(libchromium_android_linker)',
287 'chromium_linker_path': [],
291 'generated_src_dirs': [ '<(native_libraries_java_dir)' ],
292 'native_libs_paths': [
293 '<(SHARED_LIB_DIR)/<(native_lib_target).>(android_product_extension)',
294 '<@(chromium_linker_path)'
296 'package_input_paths': [
297 '<(apk_package_native_libs_dir)/<(android_app_abi)/gdbserver',
302 # gdbserver is always copied into the APK's native libs dir. The ant
303 # build scripts (apkbuilder task) will only include it in a debug
305 'destination': '<(apk_package_native_libs_dir)/<(android_app_abi)',
307 '<(android_gdbserver)',
315 '<@(native_libs_paths)',
316 '<@(extra_native_libs)',
319 'includes': ['../build/android/write_ordered_libraries.gypi'],
322 'action_name': 'native_libraries_<(_target_name)',
325 ['use_chromium_linker == 1', {
327 'linker_gcc_preprocess_defines': [
328 '--defines', 'ENABLE_CHROMIUM_LINKER',
333 'linker_gcc_preprocess_defines': [],
336 ['load_library_from_zip == 1', {
338 'linker_load_from_zip_file_preprocess_defines': [
339 '--defines', 'ENABLE_CHROMIUM_LINKER_LIBRARY_IN_ZIP_FILE',
344 'linker_load_from_zip_file_preprocess_defines': [],
347 ['enable_chromium_linker_tests == 1', {
349 'linker_tests_gcc_preprocess_defines': [
350 '--defines', 'ENABLE_CHROMIUM_LINKER_TESTS',
355 'linker_tests_gcc_preprocess_defines': [],
359 'gcc_preprocess_defines': [
360 '<@(linker_load_from_zip_file_preprocess_defines)',
361 '<@(linker_gcc_preprocess_defines)',
362 '<@(linker_tests_gcc_preprocess_defines)',
365 'message': 'Creating NativeLibraries.java for <(_target_name)',
367 '<(DEPTH)/build/android/gyp/util/build_utils.py',
368 '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
369 '<(ordered_libraries_file)',
370 '<(native_libraries_template)',
373 '<(native_libraries_java_stamp)',
376 'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
378 '--output=<(native_libraries_java_file)',
379 '--template=<(native_libraries_template)',
380 '--stamp=<(native_libraries_java_stamp)',
381 '--defines', 'NATIVE_LIBRARIES_LIST=@FileArg(<(ordered_libraries_file):java_libraries_list)',
382 '--defines', 'NATIVE_LIBRARIES_VERSION_NUMBER="<(native_lib_version_name)"',
383 '<@(gcc_preprocess_defines)',
387 'action_name': 'strip_native_libraries',
389 'ordered_libraries_file%': '<(ordered_libraries_file)',
390 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
392 '<@(native_libs_paths)',
393 '<@(extra_native_libs)',
395 'stamp': '<(strip_stamp)'
397 'includes': ['../build/android/strip_native_libraries.gypi'],
400 'action_name': 'insert_chromium_version',
402 'ordered_libraries_file%': '<(ordered_libraries_file)',
403 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
404 'version_string': '<(native_lib_version_name)',
408 'stamp': '<(version_stamp)'
410 'includes': ['../build/android/insert_chromium_version.gypi'],
413 'action_name': 'pack_relocations',
416 ['use_chromium_linker == 1 and use_relocation_packer == 1 and profiling != 1', {
422 'exclude_packing_list': [
423 '<(libchromium_android_linker)',
425 'ordered_libraries_file%': '<(ordered_libraries_file)',
426 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
427 'packed_libraries_dir': '<(libraries_source_dir)',
431 'stamp': '<(pack_relocations_stamp)',
433 'includes': ['../build/android/pack_relocations.gypi'],
438 '<@(additional_bundled_libs)',
440 'ordered_libraries_file': '<(additional_ordered_libraries_file)',
441 'subtarget': '_additional_libraries',
443 'includes': ['../build/android/write_ordered_libraries.gypi'],
446 'action_name': 'strip_additional_libraries',
448 'ordered_libraries_file': '<(additional_ordered_libraries_file)',
449 'stripped_libraries_dir': '<(libraries_source_dir)',
451 '<@(additional_bundled_libs)',
454 'stamp': '<(strip_additional_stamp)'
456 'includes': ['../build/android/strip_native_libraries.gypi'],
459 'action_name': 'Create native lib placeholder files for previous releases',
461 'placeholders': ['<@(native_lib_placeholders)'],
463 ['gyp_managed_install == 1', {
464 # This "library" just needs to be put in the .apk. It is not loaded
466 'placeholders': ['libfix.crbug.384638.so'],
471 '<(DEPTH)/build/android/gyp/create_placeholder_files.py',
474 '<(native_lib_placeholder_stamp)',
477 'python', '<(DEPTH)/build/android/gyp/create_placeholder_files.py',
478 '--dest-lib-dir=<(apk_package_native_libs_dir)/<(android_app_abi)/',
479 '--stamp=<(native_lib_placeholder_stamp)',
485 ['gyp_managed_install == 1', {
487 'libraries_top_dir': '<(intermediate_dir)/lib.stripped',
488 'libraries_source_dir': '<(libraries_top_dir)/lib/<(android_app_abi)',
489 'device_library_dir': '<(device_intermediate_dir)/lib.stripped',
490 'configuration_name': '<(CONFIGURATION_NAME)',
493 '<(DEPTH)/build/android/setup.gyp:get_build_device_configurations',
494 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
498 'includes': ['../build/android/push_libraries.gypi'],
501 'action_name': 'create device library symlinks',
502 'message': 'Creating links on device for <(_target_name)',
504 '<(DEPTH)/build/android/gyp/util/build_utils.py',
505 '<(DEPTH)/build/android/gyp/create_device_library_links.py',
506 '<(apk_install_record)',
507 '<(build_device_config_path)',
508 '<(ordered_libraries_file)',
514 'python', '<(DEPTH)/build/android/gyp/create_device_library_links.py',
515 '--build-device-configuration=<(build_device_config_path)',
516 '--libraries=@FileArg(<(ordered_libraries_file):libraries)',
517 '--script-host-path=<(symlink_script_host_path)',
518 '--script-device-path=<(symlink_script_device_path)',
519 '--target-dir=<(device_library_dir)',
520 '--apk=<(incomplete_apk_path)',
521 '--stamp=<(link_stamp)',
522 '--configuration-name=<(CONFIGURATION_NAME)',
527 ['create_standalone_apk == 1', {
530 'action_name': 'create standalone APK',
533 '<(ordered_libraries_file)',
534 '<(strip_additional_stamp)',
535 '<(pack_relocations_stamp)',
537 'output_apk_path': '<(unsigned_standalone_apk_path)',
538 'libraries_top_dir%': '<(libraries_top_dir)',
539 'input_apk_path': '<(managed_input_apk_path)',
541 'includes': [ 'android/create_standalone_apk_action.gypi' ],
547 # gyp_managed_install != 1
549 'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_app_abi)',
550 'package_input_paths': [
551 '<(strip_additional_stamp)',
552 '<(pack_relocations_stamp)',
557 }], # native_lib_target != ''
558 ['gyp_managed_install == 0 or create_standalone_apk == 1 or create_abi_split == 1', {
560 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar',
563 ['create_abi_split == 1 or gyp_managed_install == 0 or create_standalone_apk == 1', {
566 'action_name': 'finalize_base',
568 'output_apk_path': '<(final_apk_path)',
570 ['create_abi_split == 0', {
571 'input_apk_path': '<(unsigned_standalone_apk_path)',
573 'input_apk_path': '<(unsigned_apk_path)',
574 'load_library_from_zip': 0,
578 'includes': [ 'android/finalize_apk_action.gypi']
582 ['create_abi_split == 1', {
585 'action_name': 'generate_split_manifest_<(_target_name)',
587 '<(DEPTH)/build/android/gyp/util/build_utils.py',
588 '<(DEPTH)/build/android/gyp/generate_split_manifest.py',
589 '<(android_manifest_path)',
592 '<(split_android_manifest_path)',
595 'python', '<(DEPTH)/build/android/gyp/generate_split_manifest.py',
596 '--main-manifest', '<(android_manifest_path)',
597 '--out-manifest', '<(split_android_manifest_path)',
598 '--split', 'abi_<(android_app_abi)',
603 'apk_name': '<(main_apk_name)-abi-<(android_app_abi)',
604 'asset_location': '',
605 'android_manifest_path': '<(split_android_manifest_path)',
606 'create_density_splits': 0,
607 'language_splits=': [],
609 'includes': [ 'android/package_resources_action.gypi' ],
613 'apk_name': '<(main_apk_name)-abi-<(android_app_abi)',
614 'apk_path': '<(unsigned_abi_split_apk_path)',
616 'native_libs_dir': '<(apk_package_native_libs_dir)',
617 'extra_inputs': ['<(native_lib_placeholder_stamp)'],
619 'includes': ['android/apkbuilder_action.gypi'],
623 ['create_abi_split == 1 and (gyp_managed_install == 0 or create_standalone_apk == 1)', {
626 'action_name': 'finalize_split',
628 'output_apk_path': '<(final_abi_split_apk_path)',
630 ['gyp_managed_install == 1', {
631 'input_apk_path': '<(unsigned_standalone_apk_path)',
633 'input_apk_path': '<(unsigned_abi_split_apk_path)',
637 'includes': [ 'android/finalize_apk_action.gypi']
641 ['gyp_managed_install == 1', {
644 'action_name': 'finalize incomplete apk',
646 'load_library_from_zip': 0,
647 'input_apk_path': '<(managed_input_apk_path)',
648 'output_apk_path': '<(incomplete_apk_path)',
650 'includes': [ 'android/finalize_apk_action.gypi']
653 'action_name': 'apk_install_<(_target_name)',
654 'message': 'Installing <(apk_name).apk',
656 '<(DEPTH)/build/android/gyp/util/build_utils.py',
657 '<(DEPTH)/build/android/gyp/apk_install.py',
658 '<(build_device_config_path)',
659 '<(incomplete_apk_path)',
662 '<(apk_install_record)',
665 'python', '<(DEPTH)/build/android/gyp/apk_install.py',
666 '--build-device-configuration=<(build_device_config_path)',
667 '--install-record=<(apk_install_record)',
668 '--configuration-name=<(CONFIGURATION_NAME)',
669 '--android-sdk-tools', '<(android_sdk_tools)',
672 ['create_abi_split == 1', {
677 '--apk-path=<(final_apk_path)',
678 '--split-apk-path=<(incomplete_apk_path)',
682 '--apk-path=<(incomplete_apk_path)',
685 ['create_density_splits == 1', {
687 '<(final_apk_path_no_extension)-density-hdpi.apk',
688 '<(final_apk_path_no_extension)-density-xhdpi.apk',
689 '<(final_apk_path_no_extension)-density-xxhdpi.apk',
690 '<(final_apk_path_no_extension)-density-xxxhdpi.apk',
691 '<(final_apk_path_no_extension)-density-tvdpi.apk',
694 '--split-apk-path=<(final_apk_path_no_extension)-density-hdpi.apk',
695 '--split-apk-path=<(final_apk_path_no_extension)-density-xhdpi.apk',
696 '--split-apk-path=<(final_apk_path_no_extension)-density-xxhdpi.apk',
697 '--split-apk-path=<(final_apk_path_no_extension)-density-xxxhdpi.apk',
698 '--split-apk-path=<(final_apk_path_no_extension)-density-tvdpi.apk',
701 ['language_splits != []', {
703 "<!@(python <(DEPTH)/build/apply_locales.py '<(final_apk_path_no_extension)-lang-ZZLOCALE.apk' <(language_splits))",
706 "<!@(python <(DEPTH)/build/apply_locales.py -- '--split-apk-path=<(final_apk_path_no_extension)-lang-ZZLOCALE.apk' <(language_splits))",
713 ['create_density_splits == 1', {
716 'action_name': 'finalize_density_splits',
720 'includes': [ 'android/finalize_splits_action.gypi']
724 ['is_test_apk == 1', {
726 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
727 '<(DEPTH)/tools/android/android_tools.gyp:android_tools',
730 ['run_findbugs == 1', {
733 'action_name': 'findbugs_<(_target_name)',
734 'message': 'Running findbugs on <(_target_name)',
736 'additional_findbugs_args': [],
737 'findbugs_verbose%': 0,
740 ['findbugs_verbose == 1', {
742 'additional_findbugs_args+': ['-vv'],
747 '<(DEPTH)/build/android/findbugs_diff.py',
748 '<(DEPTH)/build/android/findbugs_filter/findbugs_exclude.xml',
749 '<(DEPTH)/build/android/pylib/utils/findbugs.py',
750 '>@(input_jars_paths)',
758 'python', '<(DEPTH)/build/android/findbugs_diff.py',
759 '--auxclasspath-gyp', '>(input_jars_paths)',
760 '--stamp', '<(findbugs_stamp)',
761 '<@(additional_findbugs_args)',
769 '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum',
773 'action_name': 'process_resources',
774 'message': 'processing resources for <(_target_name)',
776 # Write the inputs list to a file, so that its mtime is updated when
777 # the list of inputs changes.
778 'inputs_list_file': '>|(apk_codegen.<(_target_name).gypcmd >@(additional_input_paths) >@(resource_input_paths))',
779 'process_resources_options': [],
781 ['is_test_apk == 1', {
782 'dependencies_res_zip_paths=': [],
783 'additional_res_packages=': [],
785 ['res_v14_skip == 1', {
786 'process_resources_options+': ['--v14-skip']
788 ['shared_resources == 1', {
789 'process_resources_options+': ['--shared-resources']
791 ['R_package != ""', {
792 'process_resources_options+': ['--custom-package', '<(R_package)']
794 ['include_all_resources == 1', {
795 'process_resources_options+': ['--include-all-resources']
800 '<(DEPTH)/build/android/gyp/util/build_utils.py',
801 '<(DEPTH)/build/android/gyp/process_resources.py',
802 '<(android_manifest_path)',
803 '>@(additional_input_paths)',
804 '>@(resource_input_paths)',
805 '>@(dependencies_res_zip_paths)',
806 '>(inputs_list_file)',
809 '<(resource_zip_path)',
810 '<(generated_proguard_file)',
814 'python', '<(DEPTH)/build/android/gyp/process_resources.py',
815 '--android-sdk', '<(android_sdk)',
816 '--aapt-path', '<(android_aapt_path)',
818 '--android-manifest', '<(android_manifest_path)',
819 '--dependencies-res-zips', '>(dependencies_res_zip_paths)',
821 '--extra-res-packages', '>(additional_res_packages)',
822 '--extra-r-text-files', '>(additional_R_text_files)',
824 '--proguard-file', '<(generated_proguard_file)',
826 '--resource-dirs', '<(resource_dir)',
827 '--resource-zip-out', '<(resource_zip_path)',
829 '--R-dir', '<(intermediate_dir)/gen',
831 '--stamp', '<(codegen_stamp)',
833 '<@(process_resources_options)',
837 'action_name': 'javac_<(_target_name)',
838 'message': 'Compiling java for <(_target_name)',
843 '<(intermediate_dir)/gen',
844 '>@(generated_src_dirs)',
846 # If there is a separate find for additional_src_dirs, it will find the
847 # wrong .java files when additional_src_dirs is empty.
848 # TODO(thakis): Gyp caches >! evaluation by command. Both java.gypi and
849 # java_apk.gypi evaluate the same command, and at the moment two targets
850 # set java_in_dir to "java". Add a dummy comment here to make sure
851 # that the two targets (one uses java.gypi, the other java_apk.gypi)
852 # get distinct source lists. Medium-term, make targets list all their
853 # Java files instead of using find. (As is, this will be broken if two
854 # targets use the same java_in_dir and both use java_apk.gypi or
855 # both use java.gypi.)
856 'java_sources': ['>!@(find >(java_in_dir)>(java_in_dir_suffix) >(additional_src_dirs) -name "*.java" # apk)'],
858 ['enable_errorprone == 1', {
860 '<(errorprone_exe_path)',
862 'extra_args': [ '--use-errorprone-path=<(errorprone_exe_path)' ],
867 '<(DEPTH)/build/android/gyp/util/build_utils.py',
868 '<(DEPTH)/build/android/gyp/javac.py',
870 '>@(input_jars_paths)',
875 ['native_lib_target != ""', {
876 'inputs': [ '<(native_libraries_java_stamp)' ],
884 'python', '<(DEPTH)/build/android/gyp/javac.py',
885 '--bootclasspath=<(android_sdk_jar)',
886 '--classpath=>(input_jars_paths) <(android_sdk_jar)',
887 '--src-gendirs=>(gen_src_dirs)',
888 '--javac-includes=<(javac_includes)',
889 '--chromium-code=<(chromium_code)',
890 '--jar-path=<(javac_jar_path)',
891 '--jar-excluded-classes=<(jar_excluded_classes)',
892 '--stamp=<(compile_stamp)',
898 'action_name': 'main_dex_list_for_<(_target_name)',
900 'jar_path': '<(javac_jar_path)',
901 'output_path': '<(main_dex_list_path)',
903 'includes': [ 'android/main_dex_action.gypi' ],
906 'action_name': 'instr_jar_<(_target_name)',
907 'message': 'Instrumenting <(_target_name) jar',
909 'input_path': '<(javac_jar_path)',
910 'output_path': '<(jar_path)',
911 'stamp_path': '<(instr_stamp)',
921 'includes': [ 'android/instr_action.gypi' ],
926 '<(java_in_dir)<(java_in_dir_suffix)',
927 '>@(additional_src_dirs)',
929 'lint_jar_path': '<(jar_path)',
930 'stamp_path': '<(lint_stamp)',
931 'result_path': '<(lint_result)',
932 'config_path': '<(lint_config)',
937 'includes': [ 'android/lint_action.gypi' ],
940 'action_name': 'obfuscate_<(_target_name)',
941 'message': 'Obfuscating <(_target_name)',
943 'additional_obfuscate_options': [],
944 'additional_obfuscate_input_paths': [],
945 'proguard_out_dir': '<(intermediate_dir)/proguard',
946 'proguard_input_jar_paths': [
947 '>@(input_jars_paths)',
950 'target_conditions': [
951 ['is_test_apk == 1', {
952 'additional_obfuscate_options': [
956 ['is_test_apk == 1 and tested_apk_obfuscated_jar_path != "/"', {
957 'additional_obfuscate_options': [
958 '--tested-apk-obfuscated-jar-path', '>(tested_apk_obfuscated_jar_path)',
960 'additional_obfuscate_input_paths': [
961 '>(tested_apk_obfuscated_jar_path).info',
964 ['proguard_enabled == "true"', {
965 'additional_obfuscate_options': [
966 '--proguard-enabled',
970 'obfuscate_input_jars_paths': [
971 '>@(input_jars_paths)',
976 ['is_test_apk == 1', {
983 '<(DEPTH)/build/android/gyp/apk_obfuscate.py',
984 '<(DEPTH)/build/android/gyp/util/build_utils.py',
985 '>@(proguard_flags_paths)',
986 '>@(obfuscate_input_jars_paths)',
987 '>@(additional_obfuscate_input_paths)',
991 '<(obfuscate_stamp)',
993 # In non-Release builds, these paths will all be empty files.
994 '<(obfuscated_jar_path)',
995 '<(obfuscated_jar_path).info',
996 '<(obfuscated_jar_path).dump',
997 '<(obfuscated_jar_path).seeds',
998 '<(obfuscated_jar_path).mapping',
999 '<(obfuscated_jar_path).usage',
1002 'python', '<(DEPTH)/build/android/gyp/apk_obfuscate.py',
1004 '--configuration-name', '<(CONFIGURATION_NAME)',
1006 '--android-sdk', '<(android_sdk)',
1007 '--android-sdk-tools', '<(android_sdk_tools)',
1008 '--android-sdk-jar', '<(android_sdk_jar)',
1010 '--input-jars-paths=>(proguard_input_jar_paths)',
1011 '--proguard-configs=>(proguard_flags_paths)',
1013 '--test-jar-path', '<(test_jar_path)',
1014 '--obfuscated-jar-path', '<(obfuscated_jar_path)',
1016 '--proguard-jar-path', '<(android_sdk_root)/tools/proguard/lib/proguard.jar',
1018 '--stamp', '<(obfuscate_stamp)',
1020 '>@(additional_obfuscate_options)',
1024 'action_name': 'dex_<(_target_name)',
1026 'dex_additional_options': [],
1027 'dex_input_paths': [
1030 'output_path': '<(dex_path)',
1031 'proguard_enabled_input_path': '<(obfuscated_jar_path)',
1034 ['enable_multidex == 1', {
1036 'dex_additional_options': [
1038 '--main-dex-list-paths', '>@(main_dex_list_paths)',
1042 '>@(main_dex_list_paths)',
1046 'target_conditions': [
1047 ['enable_multidex == 1 or tested_apk_is_multidex == 1', {
1049 'dex_input_paths': [
1050 '>@(input_jars_paths)',
1055 'dex_input_paths': [
1056 '>@(library_dexed_jars_paths)',
1060 ['emma_instrument != 0', {
1063 'dex_input_paths': [
1064 '<(emma_device_jar)'
1068 ['is_test_apk == 1 and tested_apk_dex_path != "/"', {
1070 'dex_additional_options': [
1071 '--excluded-paths', '@FileArg(>(tested_apk_dex_path).inputs)'
1075 '>(tested_apk_dex_path).inputs',
1078 ['proguard_enabled == "true"', {
1079 'inputs': [ '<(obfuscate_stamp)' ]
1081 'inputs': [ '<(instr_stamp)' ]
1084 'includes': [ 'android/dex_action.gypi' ],
1088 'extra_inputs': ['<(codegen_stamp)'],
1090 '<(resource_zip_path)',
1093 ['is_test_apk == 0', {
1095 '>@(dependencies_res_zip_paths)',
1100 'includes': [ 'android/package_resources_action.gypi' ],
1104 'apk_path': '<(unsigned_apk_path)',
1106 ['native_lib_target != ""', {
1107 'extra_inputs': ['<(native_lib_placeholder_stamp)'],
1109 ['create_abi_split == 0', {
1110 'native_libs_dir': '<(apk_package_native_libs_dir)',
1112 'native_libs_dir': '<(DEPTH)/build/android/ant/empty/res',
1116 'includes': ['android/apkbuilder_action.gypi'],