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