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 # app_as_shared_library - Make a resource package that can be loaded as shared
54 # R_package - A custom Java package to generate the resource file R.java in.
55 # By default, the package given in AndroidManifest.xml will be used.
56 # include_all_resources - Set to 1 to include all resource IDs in all generated
58 # use_chromium_linker - Enable the content dynamic linker that allows sharing the
59 # RELRO section of the native libraries between the different processes.
60 # load_library_from_zip - When using the dynamic linker, load the library
61 # directly out of the zip file.
62 # use_relocation_packer - Enable relocation packing. Relies on the chromium
63 # linker, so use_chromium_linker must also be enabled.
64 # enable_chromium_linker_tests - Enable the content dynamic linker test support
65 # code. This allows a test APK to inject a Linker.TestRunner instance at
66 # runtime. Should only be used by the chromium_linker_test_apk target!!
67 # never_lint - Set to 1 to not run lint on this target.
68 # java_in_dir_suffix - To override the /src suffix on java_in_dir.
69 # app_manifest_version_name - set the apps 'human readable' version number.
70 # app_manifest_version_code - set the apps version number.
73 'tested_apk_obfuscated_jar_path%': '/',
74 'tested_apk_dex_path%': '/',
75 'tested_apk_is_multidex%': 0,
76 'additional_input_paths': [],
77 'create_density_splits%': 0,
78 'language_splits': [],
79 'input_jars_paths': [],
80 'library_dexed_jars_paths': [],
81 'main_dex_list_path': '<(intermediate_dir)/main_dex_list.txt',
82 'main_dex_list_paths': ['<(main_dex_list_path)'],
83 'additional_src_dirs': [],
84 'generated_src_dirs': [],
85 'app_manifest_version_name%': '<(android_app_version_name)',
86 'app_manifest_version_code%': '<(android_app_version_code)',
87 # aapt generates this proguard.txt.
88 'generated_proguard_file': '<(intermediate_dir)/proguard.txt',
89 'proguard_enabled%': 'false',
90 'proguard_flags_paths': ['<(generated_proguard_file)'],
91 'jar_name': 'chromium_apk_<(_target_name).jar',
92 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res',
94 'include_all_resources%': 0,
95 'additional_R_text_files': [],
96 'dependencies_res_zip_paths': [],
97 'additional_res_packages': [],
98 'additional_bundled_libs%': [],
100 # Allow icu data, v8 snapshots, and pak files to be loaded directly from the .apk.
101 # Note: These are actually suffix matches, not necessarily extensions.
102 'extensions_to_not_compress%': '.dat,.bin,.pak',
103 'resource_input_paths': [],
104 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)',
105 'asset_location%': '<(intermediate_dir)/assets',
106 'codegen_stamp': '<(intermediate_dir)/codegen.stamp',
107 'package_input_paths': [],
108 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json',
109 'additional_ordered_libraries_file': '<(intermediate_dir)/additional_native_libraries.json',
110 'native_libraries_template': '<(DEPTH)/base/android/java/templates/NativeLibraries.template',
111 'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/',
112 'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.java',
113 'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.stamp',
114 'native_libraries_template_data_dir': '<(intermediate_dir)/native_libraries/',
115 'native_libraries_template_data_file': '<(native_libraries_template_data_dir)/native_libraries_array.h',
116 'native_libraries_template_version_file': '<(native_libraries_template_data_dir)/native_libraries_version.h',
117 'compile_stamp': '<(intermediate_dir)/compile.stamp',
118 'lint_stamp': '<(intermediate_dir)/lint.stamp',
119 'lint_result': '<(intermediate_dir)/lint_result.xml',
120 'lint_config': '<(intermediate_dir)/lint_config.xml',
122 'findbugs_stamp': '<(intermediate_dir)/findbugs.stamp',
124 'java_in_dir_suffix%': '/src',
125 'instr_stamp': '<(intermediate_dir)/instr.stamp',
126 'jar_stamp': '<(intermediate_dir)/jar.stamp',
127 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp',
128 'pack_relocations_stamp': '<(intermediate_dir)/pack_relocations.stamp',
129 'strip_stamp': '<(intermediate_dir)/strip.stamp',
130 'stripped_libraries_dir': '<(intermediate_dir)/stripped_libraries',
131 'strip_additional_stamp': '<(intermediate_dir)/strip_additional.stamp',
132 'version_stamp': '<(intermediate_dir)/version.stamp',
133 'javac_includes': [],
134 'jar_excluded_classes': [],
135 'javac_jar_path': '<(intermediate_dir)/<(_target_name).javac.jar',
136 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)',
137 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar',
138 'test_jar_path': '<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar',
139 'enable_multidex%': 0,
140 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar',
141 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml',
142 'split_android_manifest_path': '<(intermediate_dir)/split-manifests/<(android_app_abi)/AndroidManifest.xml',
143 'push_stamp': '<(intermediate_dir)/push.stamp',
144 'link_stamp': '<(intermediate_dir)/link.stamp',
145 'resource_zip_path': '<(intermediate_dir)/<(_target_name).resources.zip',
146 'shared_resources%': 0,
147 'app_as_shared_library%': 0,
148 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk',
149 'final_apk_path_no_extension%': '<(PRODUCT_DIR)/apks/<(apk_name)',
150 'final_abi_split_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name)-abi-<(android_app_abi).apk',
151 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk',
152 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp',
153 'device_intermediate_dir': '/data/data/org.chromium.gyp_managed_install/<(_target_name)/<(CONFIGURATION_NAME)',
154 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh',
155 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh',
156 'create_standalone_apk%': 1,
160 'native_lib_target%': '',
161 'native_lib_version_name%': '',
162 'use_chromium_linker%' : 0,
163 'use_relocation_packer%' : 0,
164 'enable_chromium_linker_tests%': 0,
166 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk',
167 'unsigned_abi_split_apk_path': '<(intermediate_dir)/<(apk_name)-abi-<(android_app_abi)-unsigned.apk',
168 'create_abi_split%': 0,
169 'enable_multidex%': 0,
171 'unsigned_apk_path': '<(unsigned_apk_path)',
172 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)',
173 'create_abi_split%': '<(create_abi_split)',
175 ['gyp_managed_install == 1 and native_lib_target != ""', {
177 ['create_abi_split == 0', {
178 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-standalone-unsigned.apk',
180 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-abi-<(android_app_abi)-standalone-unsigned.apk',
184 'unsigned_standalone_apk_path': '<(unsigned_apk_path)',
186 ['gyp_managed_install == 1', {
187 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed',
189 'apk_package_native_libs_dir': '<(intermediate_dir)/libs',
191 ['is_test_apk == 0 and emma_coverage != 0', {
192 'emma_instrument%': 1,
194 'emma_instrument%': 0,
196 # When using abi splits, the abi split is modified by
197 # gyp_managed_install rather than the main .apk
198 ['create_abi_split == 1', {
199 'managed_input_apk_path': '<(unsigned_abi_split_apk_path)',
201 'managed_input_apk_path': '<(unsigned_apk_path)',
203 ['enable_multidex == 1', {
204 'dex_path': '<(intermediate_dir)/classes.dex.zip',
206 'dex_path': '<(intermediate_dir)/classes.dex',
210 'native_lib_target%': '',
211 'native_lib_version_name%': '',
212 'use_chromium_linker%' : 0,
213 'load_library_from_zip%' : 0,
214 'use_relocation_packer%' : 0,
215 'enable_chromium_linker_tests%': 0,
216 'emma_instrument%': '<(emma_instrument)',
217 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)',
218 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)',
219 'unsigned_apk_path': '<(unsigned_apk_path)',
220 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)',
221 'create_abi_split%': '<(create_abi_split)',
222 'managed_input_apk_path': '<(managed_input_apk_path)',
223 'libchromium_android_linker': 'libchromium_android_linker.>(android_product_extension)',
224 'extra_native_libs': [],
225 'native_lib_placeholder_stamp': '<(apk_package_native_libs_dir)/<(android_app_abi)/native_lib_placeholder.stamp',
226 'native_lib_placeholders': [],
227 'main_apk_name': '<(apk_name)',
228 'dex_path': '<(dex_path)',
230 ['chromium_code == 0', {
231 'enable_errorprone': 0,
234 'enable_errorprone%': 0,
235 'errorprone_exe_path': '<(PRODUCT_DIR)/bin.java/chromium_errorprone',
237 # Pass the jar path to the apk's "fake" jar target. This would be better as
238 # direct_dependent_settings, but a variable set by a direct_dependent_settings
239 # cannot be lifted in a dependent to all_dependent_settings.
240 'all_dependent_settings': {
242 ['proguard_enabled == "true"', {
244 'proguard_enabled': 'true',
249 'apk_output_jar_path': '<(jar_path)',
250 'tested_apk_obfuscated_jar_path': '<(obfuscated_jar_path)',
251 'tested_apk_dex_path': '<(dex_path)',
252 'tested_apk_is_multidex': '<(enable_multidex)',
256 ['resource_dir!=""', {
258 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ]
261 ['R_package != ""', {
263 # We generate R.java in package R_package (in addition to the package
264 # listed in the AndroidManifest.xml, which is unavoidable).
265 'additional_res_packages': ['<(R_package)'],
266 'additional_R_text_files': ['<(intermediate_dir)/R.txt'],
269 ['native_lib_target != "" and android_must_copy_system_libraries == 1', {
271 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries',
274 ['use_chromium_linker == 1', {
276 '<(DEPTH)/base/base.gyp:chromium_android_linker',
279 ['enable_errorprone == 1', {
281 '<(DEPTH)/third_party/errorprone/errorprone.gyp:require_errorprone',
284 ['native_lib_target != ""', {
287 ['use_chromium_linker == 1', {
289 'chromium_linker_path': [
290 '<(SHARED_LIB_DIR)/<(libchromium_android_linker)',
295 'chromium_linker_path': [],
299 'generated_src_dirs': [ '<(native_libraries_java_dir)' ],
300 'native_libs_paths': [
301 '<(SHARED_LIB_DIR)/<(native_lib_target).>(android_product_extension)',
302 '<@(chromium_linker_path)'
304 'package_input_paths': [
305 '<(apk_package_native_libs_dir)/<(android_app_abi)/gdbserver',
310 # gdbserver is always copied into the APK's native libs dir. The ant
311 # build scripts (apkbuilder task) will only include it in a debug
313 'destination': '<(apk_package_native_libs_dir)/<(android_app_abi)',
315 '<(android_gdbserver)',
323 '<@(native_libs_paths)',
324 '<@(extra_native_libs)',
327 'includes': ['../build/android/write_ordered_libraries.gypi'],
330 'action_name': 'native_libraries_<(_target_name)',
333 ['use_chromium_linker == 1', {
335 'linker_gcc_preprocess_defines': [
336 '--defines', 'ENABLE_CHROMIUM_LINKER',
341 'linker_gcc_preprocess_defines': [],
344 ['load_library_from_zip == 1', {
346 'linker_load_from_zip_file_preprocess_defines': [
347 '--defines', 'ENABLE_CHROMIUM_LINKER_LIBRARY_IN_ZIP_FILE',
352 'linker_load_from_zip_file_preprocess_defines': [],
355 ['enable_chromium_linker_tests == 1', {
357 'linker_tests_gcc_preprocess_defines': [
358 '--defines', 'ENABLE_CHROMIUM_LINKER_TESTS',
363 'linker_tests_gcc_preprocess_defines': [],
367 'gcc_preprocess_defines': [
368 '<@(linker_load_from_zip_file_preprocess_defines)',
369 '<@(linker_gcc_preprocess_defines)',
370 '<@(linker_tests_gcc_preprocess_defines)',
373 'message': 'Creating NativeLibraries.java for <(_target_name)',
375 '<(DEPTH)/build/android/gyp/util/build_utils.py',
376 '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
377 '<(ordered_libraries_file)',
378 '<(native_libraries_template)',
381 '<(native_libraries_java_stamp)',
384 'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
386 '--output=<(native_libraries_java_file)',
387 '--template=<(native_libraries_template)',
388 '--stamp=<(native_libraries_java_stamp)',
389 '--defines', 'NATIVE_LIBRARIES_LIST=@FileArg(<(ordered_libraries_file):java_libraries_list)',
390 '--defines', 'NATIVE_LIBRARIES_VERSION_NUMBER="<(native_lib_version_name)"',
391 '<@(gcc_preprocess_defines)',
395 'action_name': 'strip_native_libraries',
397 'ordered_libraries_file%': '<(ordered_libraries_file)',
398 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
400 '<@(native_libs_paths)',
401 '<@(extra_native_libs)',
403 'stamp': '<(strip_stamp)'
405 'includes': ['../build/android/strip_native_libraries.gypi'],
408 'action_name': 'insert_chromium_version',
410 'ordered_libraries_file%': '<(ordered_libraries_file)',
411 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
412 'version_string': '<(native_lib_version_name)',
416 'stamp': '<(version_stamp)'
418 'includes': ['../build/android/insert_chromium_version.gypi'],
421 'action_name': 'pack_relocations',
424 ['use_chromium_linker == 1 and use_relocation_packer == 1 and profiling != 1', {
430 'exclude_packing_list': [
431 '<(libchromium_android_linker)',
433 'ordered_libraries_file%': '<(ordered_libraries_file)',
434 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
435 'packed_libraries_dir': '<(libraries_source_dir)',
439 'stamp': '<(pack_relocations_stamp)',
441 'includes': ['../build/android/pack_relocations.gypi'],
446 '<@(additional_bundled_libs)',
448 'ordered_libraries_file': '<(additional_ordered_libraries_file)',
449 'subtarget': '_additional_libraries',
451 'includes': ['../build/android/write_ordered_libraries.gypi'],
454 'action_name': 'strip_additional_libraries',
456 'ordered_libraries_file': '<(additional_ordered_libraries_file)',
457 'stripped_libraries_dir': '<(libraries_source_dir)',
459 '<@(additional_bundled_libs)',
462 'stamp': '<(strip_additional_stamp)'
464 'includes': ['../build/android/strip_native_libraries.gypi'],
467 'action_name': 'Create native lib placeholder files for previous releases',
469 'placeholders': ['<@(native_lib_placeholders)'],
471 ['gyp_managed_install == 1', {
472 # This "library" just needs to be put in the .apk. It is not loaded
474 'placeholders': ['libfix.crbug.384638.so'],
479 '<(DEPTH)/build/android/gyp/create_placeholder_files.py',
482 '<(native_lib_placeholder_stamp)',
485 'python', '<(DEPTH)/build/android/gyp/create_placeholder_files.py',
486 '--dest-lib-dir=<(apk_package_native_libs_dir)/<(android_app_abi)/',
487 '--stamp=<(native_lib_placeholder_stamp)',
493 ['gyp_managed_install == 1', {
495 'libraries_top_dir': '<(intermediate_dir)/lib.stripped',
496 'libraries_source_dir': '<(libraries_top_dir)/lib/<(android_app_abi)',
497 'device_library_dir': '<(device_intermediate_dir)/lib.stripped',
498 'configuration_name': '<(CONFIGURATION_NAME)',
501 '<(DEPTH)/build/android/setup.gyp:get_build_device_configurations',
502 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
506 'includes': ['../build/android/push_libraries.gypi'],
509 'action_name': 'create device library symlinks',
510 'message': 'Creating links on device for <(_target_name)',
512 '<(DEPTH)/build/android/gyp/util/build_utils.py',
513 '<(DEPTH)/build/android/gyp/create_device_library_links.py',
514 '<(apk_install_record)',
515 '<(build_device_config_path)',
516 '<(ordered_libraries_file)',
522 'python', '<(DEPTH)/build/android/gyp/create_device_library_links.py',
523 '--build-device-configuration=<(build_device_config_path)',
524 '--libraries=@FileArg(<(ordered_libraries_file):libraries)',
525 '--script-host-path=<(symlink_script_host_path)',
526 '--script-device-path=<(symlink_script_device_path)',
527 '--target-dir=<(device_library_dir)',
528 '--apk=<(incomplete_apk_path)',
529 '--stamp=<(link_stamp)',
530 '--configuration-name=<(CONFIGURATION_NAME)',
535 ['create_standalone_apk == 1', {
538 'action_name': 'create standalone APK',
541 '<(ordered_libraries_file)',
542 '<(strip_additional_stamp)',
543 '<(pack_relocations_stamp)',
545 'output_apk_path': '<(unsigned_standalone_apk_path)',
546 'libraries_top_dir%': '<(libraries_top_dir)',
547 'input_apk_path': '<(managed_input_apk_path)',
549 'includes': [ 'android/create_standalone_apk_action.gypi' ],
555 # gyp_managed_install != 1
557 'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_app_abi)',
558 'package_input_paths': [
559 '<(strip_additional_stamp)',
560 '<(pack_relocations_stamp)',
565 }], # native_lib_target != ''
566 ['gyp_managed_install == 0 or create_standalone_apk == 1 or create_abi_split == 1', {
568 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar',
571 ['create_abi_split == 1 or gyp_managed_install == 0 or create_standalone_apk == 1', {
574 'action_name': 'finalize_base',
576 'output_apk_path': '<(final_apk_path)',
578 ['create_abi_split == 0', {
579 'input_apk_path': '<(unsigned_standalone_apk_path)',
581 'input_apk_path': '<(unsigned_apk_path)',
582 'load_library_from_zip': 0,
586 'includes': [ 'android/finalize_apk_action.gypi']
590 ['create_abi_split == 1', {
593 'action_name': 'generate_split_manifest_<(_target_name)',
595 '<(DEPTH)/build/android/gyp/util/build_utils.py',
596 '<(DEPTH)/build/android/gyp/generate_split_manifest.py',
597 '<(android_manifest_path)',
600 '<(split_android_manifest_path)',
603 'python', '<(DEPTH)/build/android/gyp/generate_split_manifest.py',
604 '--main-manifest', '<(android_manifest_path)',
605 '--out-manifest', '<(split_android_manifest_path)',
606 '--split', 'abi_<(android_app_abi)',
611 'apk_name': '<(main_apk_name)-abi-<(android_app_abi)',
612 'asset_location': '',
613 'android_manifest_path': '<(split_android_manifest_path)',
614 'create_density_splits': 0,
615 'language_splits=': [],
617 'includes': [ 'android/package_resources_action.gypi' ],
621 'apk_name': '<(main_apk_name)-abi-<(android_app_abi)',
622 'apk_path': '<(unsigned_abi_split_apk_path)',
624 'native_libs_dir': '<(apk_package_native_libs_dir)',
625 'extra_inputs': ['<(native_lib_placeholder_stamp)'],
627 'includes': ['android/apkbuilder_action.gypi'],
631 ['create_abi_split == 1 and (gyp_managed_install == 0 or create_standalone_apk == 1)', {
634 'action_name': 'finalize_split',
636 'output_apk_path': '<(final_abi_split_apk_path)',
638 ['gyp_managed_install == 1', {
639 'input_apk_path': '<(unsigned_standalone_apk_path)',
641 'input_apk_path': '<(unsigned_abi_split_apk_path)',
645 'includes': [ 'android/finalize_apk_action.gypi']
649 ['gyp_managed_install == 1', {
652 'action_name': 'finalize incomplete apk',
654 'load_library_from_zip': 0,
655 'input_apk_path': '<(managed_input_apk_path)',
656 'output_apk_path': '<(incomplete_apk_path)',
658 'includes': [ 'android/finalize_apk_action.gypi']
661 'action_name': 'apk_install_<(_target_name)',
662 'message': 'Installing <(apk_name).apk',
664 '<(DEPTH)/build/android/gyp/util/build_utils.py',
665 '<(DEPTH)/build/android/gyp/apk_install.py',
666 '<(build_device_config_path)',
667 '<(incomplete_apk_path)',
670 '<(apk_install_record)',
673 'python', '<(DEPTH)/build/android/gyp/apk_install.py',
674 '--build-device-configuration=<(build_device_config_path)',
675 '--install-record=<(apk_install_record)',
676 '--configuration-name=<(CONFIGURATION_NAME)',
677 '--android-sdk-tools', '<(android_sdk_tools)',
680 ['create_abi_split == 1', {
685 '--apk-path=<(final_apk_path)',
686 '--split-apk-path=<(incomplete_apk_path)',
690 '--apk-path=<(incomplete_apk_path)',
693 ['create_density_splits == 1', {
695 '<(final_apk_path_no_extension)-density-hdpi.apk',
696 '<(final_apk_path_no_extension)-density-xhdpi.apk',
697 '<(final_apk_path_no_extension)-density-xxhdpi.apk',
698 '<(final_apk_path_no_extension)-density-xxxhdpi.apk',
699 '<(final_apk_path_no_extension)-density-tvdpi.apk',
702 '--split-apk-path=<(final_apk_path_no_extension)-density-hdpi.apk',
703 '--split-apk-path=<(final_apk_path_no_extension)-density-xhdpi.apk',
704 '--split-apk-path=<(final_apk_path_no_extension)-density-xxhdpi.apk',
705 '--split-apk-path=<(final_apk_path_no_extension)-density-xxxhdpi.apk',
706 '--split-apk-path=<(final_apk_path_no_extension)-density-tvdpi.apk',
709 ['language_splits != []', {
711 "<!@(python <(DEPTH)/build/apply_locales.py '<(final_apk_path_no_extension)-lang-ZZLOCALE.apk' <(language_splits))",
714 "<!@(python <(DEPTH)/build/apply_locales.py -- '--split-apk-path=<(final_apk_path_no_extension)-lang-ZZLOCALE.apk' <(language_splits))",
721 ['create_density_splits == 1', {
724 'action_name': 'finalize_density_splits',
728 'includes': [ 'android/finalize_splits_action.gypi']
732 ['is_test_apk == 1', {
734 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
735 '<(DEPTH)/tools/android/android_tools.gyp:android_tools',
738 ['run_findbugs == 1', {
741 'action_name': 'findbugs_<(_target_name)',
742 'message': 'Running findbugs on <(_target_name)',
744 'additional_findbugs_args': [],
745 'findbugs_verbose%': 0,
748 ['findbugs_verbose == 1', {
750 'additional_findbugs_args+': ['-vv'],
755 '<(DEPTH)/build/android/findbugs_diff.py',
756 '<(DEPTH)/build/android/findbugs_filter/findbugs_exclude.xml',
757 '<(DEPTH)/build/android/pylib/utils/findbugs.py',
758 '>@(input_jars_paths)',
766 'python', '<(DEPTH)/build/android/findbugs_diff.py',
767 '--auxclasspath-gyp', '>(input_jars_paths)',
768 '--stamp', '<(findbugs_stamp)',
769 '<@(additional_findbugs_args)',
777 '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum',
781 'action_name': 'process_resources',
782 'message': 'processing resources for <(_target_name)',
784 # Write the inputs list to a file, so that its mtime is updated when
785 # the list of inputs changes.
786 'inputs_list_file': '>|(apk_codegen.<(_target_name).gypcmd >@(additional_input_paths) >@(resource_input_paths))',
787 'process_resources_options': [],
789 ['is_test_apk == 1', {
790 'dependencies_res_zip_paths=': [],
791 'additional_res_packages=': [],
793 ['res_v14_skip == 1', {
794 'process_resources_options+': ['--v14-skip']
796 ['shared_resources == 1', {
797 'process_resources_options+': ['--shared-resources']
799 ['app_as_shared_library == 1', {
800 'process_resources_options+': ['--app-as-shared-lib']
802 ['R_package != ""', {
803 'process_resources_options+': ['--custom-package', '<(R_package)']
805 ['include_all_resources == 1', {
806 'process_resources_options+': ['--include-all-resources']
811 '<(DEPTH)/build/android/gyp/util/build_utils.py',
812 '<(DEPTH)/build/android/gyp/process_resources.py',
813 '<(android_manifest_path)',
814 '>@(additional_input_paths)',
815 '>@(resource_input_paths)',
816 '>@(dependencies_res_zip_paths)',
817 '>(inputs_list_file)',
820 '<(resource_zip_path)',
821 '<(generated_proguard_file)',
825 'python', '<(DEPTH)/build/android/gyp/process_resources.py',
826 '--android-sdk', '<(android_sdk)',
827 '--aapt-path', '<(android_aapt_path)',
829 '--android-manifest', '<(android_manifest_path)',
830 '--dependencies-res-zips', '>(dependencies_res_zip_paths)',
832 '--extra-res-packages', '>(additional_res_packages)',
833 '--extra-r-text-files', '>(additional_R_text_files)',
835 '--proguard-file', '<(generated_proguard_file)',
837 '--resource-dirs', '<(resource_dir)',
838 '--resource-zip-out', '<(resource_zip_path)',
840 '--R-dir', '<(intermediate_dir)/gen',
842 '--stamp', '<(codegen_stamp)',
844 '<@(process_resources_options)',
848 'action_name': 'javac_<(_target_name)',
849 'message': 'Compiling java for <(_target_name)',
854 '<(intermediate_dir)/gen',
855 '>@(generated_src_dirs)',
857 # If there is a separate find for additional_src_dirs, it will find the
858 # wrong .java files when additional_src_dirs is empty.
859 # TODO(thakis): Gyp caches >! evaluation by command. Both java.gypi and
860 # java_apk.gypi evaluate the same command, and at the moment two targets
861 # set java_in_dir to "java". Add a dummy comment here to make sure
862 # that the two targets (one uses java.gypi, the other java_apk.gypi)
863 # get distinct source lists. Medium-term, make targets list all their
864 # Java files instead of using find. (As is, this will be broken if two
865 # targets use the same java_in_dir and both use java_apk.gypi or
866 # both use java.gypi.)
867 'java_sources': ['>!@(find >(java_in_dir)>(java_in_dir_suffix) >(additional_src_dirs) -name "*.java" # apk)'],
869 ['enable_errorprone == 1', {
871 '<(errorprone_exe_path)',
873 'extra_args': [ '--use-errorprone-path=<(errorprone_exe_path)' ],
878 '<(DEPTH)/build/android/gyp/util/build_utils.py',
879 '<(DEPTH)/build/android/gyp/javac.py',
881 '>@(input_jars_paths)',
886 ['native_lib_target != ""', {
887 'inputs': [ '<(native_libraries_java_stamp)' ],
895 'python', '<(DEPTH)/build/android/gyp/javac.py',
896 '--bootclasspath=<(android_sdk_jar)',
897 '--classpath=>(input_jars_paths) <(android_sdk_jar)',
898 '--src-gendirs=>(gen_src_dirs)',
899 '--javac-includes=<(javac_includes)',
900 '--chromium-code=<(chromium_code)',
901 '--jar-path=<(javac_jar_path)',
902 '--jar-excluded-classes=<(jar_excluded_classes)',
903 '--stamp=<(compile_stamp)',
909 'action_name': 'main_dex_list_for_<(_target_name)',
911 'jar_path': '<(javac_jar_path)',
912 'output_path': '<(main_dex_list_path)',
914 'includes': [ 'android/main_dex_action.gypi' ],
917 'action_name': 'instr_jar_<(_target_name)',
918 'message': 'Instrumenting <(_target_name) jar',
920 'input_path': '<(javac_jar_path)',
921 'output_path': '<(jar_path)',
922 'stamp_path': '<(instr_stamp)',
932 'includes': [ 'android/instr_action.gypi' ],
937 '<(java_in_dir)<(java_in_dir_suffix)',
938 '>@(additional_src_dirs)',
940 'lint_jar_path': '<(jar_path)',
941 'stamp_path': '<(lint_stamp)',
942 'result_path': '<(lint_result)',
943 'config_path': '<(lint_config)',
948 'includes': [ 'android/lint_action.gypi' ],
951 'action_name': 'obfuscate_<(_target_name)',
952 'message': 'Obfuscating <(_target_name)',
954 'additional_obfuscate_options': [],
955 'additional_obfuscate_input_paths': [],
956 'proguard_out_dir': '<(intermediate_dir)/proguard',
957 'proguard_input_jar_paths': [
958 '>@(input_jars_paths)',
961 'target_conditions': [
962 ['is_test_apk == 1', {
963 'additional_obfuscate_options': [
967 ['is_test_apk == 1 and tested_apk_obfuscated_jar_path != "/"', {
968 'additional_obfuscate_options': [
969 '--tested-apk-obfuscated-jar-path', '>(tested_apk_obfuscated_jar_path)',
971 'additional_obfuscate_input_paths': [
972 '>(tested_apk_obfuscated_jar_path).info',
975 ['proguard_enabled == "true"', {
976 'additional_obfuscate_options': [
977 '--proguard-enabled',
981 'obfuscate_input_jars_paths': [
982 '>@(input_jars_paths)',
987 ['is_test_apk == 1', {
994 '<(DEPTH)/build/android/gyp/apk_obfuscate.py',
995 '<(DEPTH)/build/android/gyp/util/build_utils.py',
996 '>@(proguard_flags_paths)',
997 '>@(obfuscate_input_jars_paths)',
998 '>@(additional_obfuscate_input_paths)',
1002 '<(obfuscate_stamp)',
1004 # In non-Release builds, these paths will all be empty files.
1005 '<(obfuscated_jar_path)',
1006 '<(obfuscated_jar_path).info',
1007 '<(obfuscated_jar_path).dump',
1008 '<(obfuscated_jar_path).seeds',
1009 '<(obfuscated_jar_path).mapping',
1010 '<(obfuscated_jar_path).usage',
1013 'python', '<(DEPTH)/build/android/gyp/apk_obfuscate.py',
1015 '--configuration-name', '<(CONFIGURATION_NAME)',
1017 '--android-sdk', '<(android_sdk)',
1018 '--android-sdk-tools', '<(android_sdk_tools)',
1019 '--android-sdk-jar', '<(android_sdk_jar)',
1021 '--input-jars-paths=>(proguard_input_jar_paths)',
1022 '--proguard-configs=>(proguard_flags_paths)',
1024 '--test-jar-path', '<(test_jar_path)',
1025 '--obfuscated-jar-path', '<(obfuscated_jar_path)',
1027 '--proguard-jar-path', '<(DEPTH)/third_party/proguard/lib/proguard.jar',
1029 '--stamp', '<(obfuscate_stamp)',
1031 '>@(additional_obfuscate_options)',
1035 'action_name': 'dex_<(_target_name)',
1037 'dex_additional_options': [],
1038 'dex_input_paths': [
1041 'output_path': '<(dex_path)',
1042 'proguard_enabled_input_path': '<(obfuscated_jar_path)',
1045 ['enable_multidex == 1', {
1047 'dex_additional_options': [
1049 '--main-dex-list-paths', '>@(main_dex_list_paths)',
1053 '>@(main_dex_list_paths)',
1057 'target_conditions': [
1058 ['enable_multidex == 1 or tested_apk_is_multidex == 1', {
1060 'dex_input_paths': [
1061 '>@(input_jars_paths)',
1066 'dex_input_paths': [
1067 '>@(library_dexed_jars_paths)',
1071 ['emma_instrument != 0', {
1074 'dex_input_paths': [
1075 '<(emma_device_jar)'
1079 ['is_test_apk == 1 and tested_apk_dex_path != "/"', {
1081 'dex_additional_options': [
1082 '--excluded-paths', '@FileArg(>(tested_apk_dex_path).inputs)'
1086 '>(tested_apk_dex_path).inputs',
1089 ['proguard_enabled == "true"', {
1090 'inputs': [ '<(obfuscate_stamp)' ]
1092 'inputs': [ '<(instr_stamp)' ]
1095 'includes': [ 'android/dex_action.gypi' ],
1099 'extra_inputs': ['<(codegen_stamp)'],
1101 '<(resource_zip_path)',
1104 ['is_test_apk == 0', {
1106 '>@(dependencies_res_zip_paths)',
1111 'includes': [ 'android/package_resources_action.gypi' ],
1115 'apk_path': '<(unsigned_apk_path)',
1117 ['native_lib_target != ""', {
1118 'extra_inputs': ['<(native_lib_placeholder_stamp)'],
1120 ['create_abi_split == 0', {
1121 'native_libs_dir': '<(apk_package_native_libs_dir)',
1123 'native_libs_dir': '<(DEPTH)/build/android/ant/empty/res',
1127 'includes': ['android/apkbuilder_action.gypi'],