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 # generated_src_dirs - Same as additional_src_dirs except used for .java files
35 # that are generated at build time. This should be set automatically by a
36 # target's dependencies. The .java files in these directories are not
37 # included in the 'inputs' list (unlike additional_src_dirs).
38 # input_jars_paths - The path to jars to be included in the classpath. This
39 # should be filled automatically by depending on the appropriate targets.
40 # is_test_apk - Set to 1 if building a test apk. This prevents resources from
41 # dependencies from being re-included.
42 # native_lib_target - The target_name of the target which generates the final
43 # shared library to be included in this apk. A stripped copy of the
44 # library will be included in the apk.
45 # resource_dir - The directory for resources.
46 # shared_resources - Make a resource package that can be loaded by a different
47 # application at runtime to access the package's resources.
48 # R_package - A custom Java package to generate the resource file R.java in.
49 # By default, the package given in AndroidManifest.xml will be used.
50 # include_all_resources - Set to 1 to include all resource IDs in all generated
52 # use_chromium_linker - Enable the content dynamic linker that allows sharing the
53 # RELRO section of the native libraries between the different processes.
54 # load_library_from_zip_file - When using the dynamic linker, load the library
55 # directly out of the zip file.
56 # use_relocation_packer - Enable relocation packing. Relies on the chromium
57 # linker, so use_chromium_linker must also be enabled.
58 # enable_chromium_linker_tests - Enable the content dynamic linker test support
59 # code. This allows a test APK to inject a Linker.TestRunner instance at
60 # runtime. Should only be used by the chromium_linker_test_apk target!!
61 # never_lint - Set to 1 to not run lint on this target.
62 # java_in_dir_suffix - To override the /src suffix on java_in_dir.
63 # app_manifest_version_name - set the apps 'human readable' version number.
64 # app_manifest_version_code - set the apps version number.
67 'tested_apk_obfuscated_jar_path%': '/',
68 'tested_apk_dex_path%': '/',
69 'additional_input_paths': [],
70 'input_jars_paths': [],
71 'library_dexed_jars_paths': [],
72 'additional_src_dirs': [],
73 'generated_src_dirs': [],
74 'app_manifest_version_name%': '<(android_app_version_name)',
75 'app_manifest_version_code%': '<(android_app_version_code)',
76 # aapt generates this proguard.txt.
77 'generated_proguard_file': '<(intermediate_dir)/proguard.txt',
78 'proguard_enabled%': 'false',
79 'proguard_flags_paths': ['<(generated_proguard_file)'],
80 'jar_name': 'chromium_apk_<(_target_name).jar',
81 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res',
83 'include_all_resources%': 0,
84 'additional_R_text_files': [],
85 'dependencies_res_zip_paths': [],
86 'additional_res_packages': [],
87 'additional_bundled_libs%': [],
89 'extensions_to_not_compress%': '',
90 'resource_input_paths': [],
91 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)',
92 'asset_location%': '<(intermediate_dir)/assets',
93 'codegen_stamp': '<(intermediate_dir)/codegen.stamp',
94 'package_input_paths': [],
95 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json',
96 'additional_ordered_libraries_file': '<(intermediate_dir)/additional_native_libraries.json',
97 'native_libraries_template': '<(DEPTH)/base/android/java/templates/NativeLibraries.template',
98 'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/',
99 'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.java',
100 'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.stamp',
101 'native_libraries_template_data_dir': '<(intermediate_dir)/native_libraries/',
102 'native_libraries_template_data_file': '<(native_libraries_template_data_dir)/native_libraries_array.h',
103 'native_libraries_template_version_file': '<(native_libraries_template_data_dir)/native_libraries_version.h',
104 'compile_stamp': '<(intermediate_dir)/compile.stamp',
105 'lint_stamp': '<(intermediate_dir)/lint.stamp',
106 'lint_result': '<(intermediate_dir)/lint_result.xml',
107 'lint_config': '<(intermediate_dir)/lint_config.xml',
109 'findbugs_stamp': '<(intermediate_dir)/findbugs.stamp',
111 'java_in_dir_suffix%': '/src',
112 'instr_stamp': '<(intermediate_dir)/instr.stamp',
113 'jar_stamp': '<(intermediate_dir)/jar.stamp',
114 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp',
115 'pack_arm_relocations_stamp': '<(intermediate_dir)/pack_arm_relocations.stamp',
116 'strip_stamp': '<(intermediate_dir)/strip.stamp',
117 'stripped_libraries_dir': '<(intermediate_dir)/stripped_libraries',
118 'strip_additional_stamp': '<(intermediate_dir)/strip_additional.stamp',
119 'version_stamp': '<(intermediate_dir)/version.stamp',
120 'javac_includes': [],
121 'jar_excluded_classes': [],
122 'javac_jar_path': '<(intermediate_dir)/<(_target_name).javac.jar',
123 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)',
124 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar',
125 'test_jar_path': '<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar',
126 'dex_path': '<(intermediate_dir)/classes.dex',
127 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar',
128 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml',
129 'split_android_manifest_path': '<(intermediate_dir)/split-manifests/<(android_app_abi)/AndroidManifest.xml',
130 'push_stamp': '<(intermediate_dir)/push.stamp',
131 'link_stamp': '<(intermediate_dir)/link.stamp',
132 'resource_zip_path': '<(intermediate_dir)/<(_target_name).resources.zip',
133 'shared_resources%': 0,
134 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk',
135 'final_abi_split_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name)-abi-<(android_app_abi).apk',
136 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk',
137 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp',
138 'device_intermediate_dir': '/data/data/org.chromium.gyp_managed_install/<(_target_name)/<(CONFIGURATION_NAME)',
139 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh',
140 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh',
141 'create_standalone_apk%': 1,
145 'native_lib_target%': '',
146 'native_lib_version_name%': '',
147 'use_chromium_linker%' : 0,
148 'use_relocation_packer%' : 0,
149 'enable_chromium_linker_tests%': 0,
151 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk',
152 'unsigned_abi_split_apk_path': '<(intermediate_dir)/<(apk_name)-abi-<(android_app_abi)-unsigned.apk',
153 'create_abi_split%': 0,
155 'unsigned_apk_path': '<(unsigned_apk_path)',
156 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)',
157 'create_abi_split%': '<(create_abi_split)',
159 ['gyp_managed_install == 1 and native_lib_target != ""', {
161 ['create_abi_split == 0', {
162 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-standalone-unsigned.apk',
164 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-abi-<(android_app_abi)-standalone-unsigned.apk',
168 'unsigned_standalone_apk_path': '<(unsigned_apk_path)',
170 ['gyp_managed_install == 1', {
171 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed',
173 'apk_package_native_libs_dir': '<(intermediate_dir)/libs',
175 ['is_test_apk == 0 and emma_coverage != 0', {
176 'emma_instrument%': 1,
178 'emma_instrument%': 0,
180 # When using abi splits, the abi split is modified by
181 # gyp_managed_install rather than the main .apk
182 ['create_abi_split == 1', {
183 'managed_input_apk_path': '<(unsigned_abi_split_apk_path)',
185 'managed_input_apk_path': '<(unsigned_apk_path)',
189 'native_lib_target%': '',
190 'native_lib_version_name%': '',
191 'use_chromium_linker%' : 0,
192 'load_library_from_zip_file%' : 0,
193 'use_relocation_packer%' : 0,
194 'enable_chromium_linker_tests%': 0,
195 'emma_instrument%': '<(emma_instrument)',
196 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)',
197 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)',
198 'unsigned_apk_path': '<(unsigned_apk_path)',
199 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)',
200 'create_abi_split%': '<(create_abi_split)',
201 'managed_input_apk_path': '<(managed_input_apk_path)',
202 'libchromium_android_linker': 'libchromium_android_linker.>(android_product_extension)',
203 'extra_native_libs': [],
204 'native_lib_placeholder_stamp': '<(apk_package_native_libs_dir)/<(android_app_abi)/native_lib_placeholder.stamp',
205 'native_lib_placeholders': [],
206 'main_apk_name': '<(apk_name)',
208 # Pass the jar path to the apk's "fake" jar target. This would be better as
209 # direct_dependent_settings, but a variable set by a direct_dependent_settings
210 # cannot be lifted in a dependent to all_dependent_settings.
211 'all_dependent_settings': {
213 ['proguard_enabled == "true"', {
215 'proguard_enabled': 'true',
220 'apk_output_jar_path': '<(jar_path)',
221 'tested_apk_obfuscated_jar_path': '<(obfuscated_jar_path)',
222 'tested_apk_dex_path': '<(dex_path)',
226 ['resource_dir!=""', {
228 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ]
231 ['R_package != ""', {
233 # We generate R.java in package R_package (in addition to the package
234 # listed in the AndroidManifest.xml, which is unavoidable).
235 'additional_res_packages': ['<(R_package)'],
236 'additional_R_text_files': ['<(intermediate_dir)/R.txt'],
239 ['native_lib_target != "" and component == "shared_library"', {
241 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries',
244 ['use_chromium_linker == 1', {
246 '<(DEPTH)/base/base.gyp:chromium_android_linker',
249 ['native_lib_target != ""', {
252 ['use_chromium_linker == 1', {
254 'chromium_linker_path': [
255 '<(SHARED_LIB_DIR)/<(libchromium_android_linker)',
260 'chromium_linker_path': [],
264 'generated_src_dirs': [ '<(native_libraries_java_dir)' ],
265 'native_libs_paths': [
266 '<(SHARED_LIB_DIR)/<(native_lib_target).>(android_product_extension)',
267 '<@(chromium_linker_path)'
269 'package_input_paths': [
270 '<(apk_package_native_libs_dir)/<(android_app_abi)/gdbserver',
275 # gdbserver is always copied into the APK's native libs dir. The ant
276 # build scripts (apkbuilder task) will only include it in a debug
278 'destination': '<(apk_package_native_libs_dir)/<(android_app_abi)',
280 '<(android_gdbserver)',
288 '<@(native_libs_paths)',
289 '<@(extra_native_libs)',
292 'includes': ['../build/android/write_ordered_libraries.gypi'],
295 'action_name': 'native_libraries_<(_target_name)',
298 ['use_chromium_linker == 1', {
300 'linker_gcc_preprocess_defines': [
301 '--defines', 'ENABLE_CHROMIUM_LINKER',
306 'linker_gcc_preprocess_defines': [],
309 ['load_library_from_zip_file == 1', {
311 'linker_load_from_zip_file_preprocess_defines': [
312 '--defines', 'ENABLE_CHROMIUM_LINKER_LIBRARY_IN_ZIP_FILE',
317 'linker_load_from_zip_file_preprocess_defines': [],
320 ['enable_chromium_linker_tests == 1', {
322 'linker_tests_gcc_preprocess_defines': [
323 '--defines', 'ENABLE_CHROMIUM_LINKER_TESTS',
328 'linker_tests_gcc_preprocess_defines': [],
332 'gcc_preprocess_defines': [
333 '<@(linker_load_from_zip_file_preprocess_defines)',
334 '<@(linker_gcc_preprocess_defines)',
335 '<@(linker_tests_gcc_preprocess_defines)',
338 'message': 'Creating NativeLibraries.java for <(_target_name)',
340 '<(DEPTH)/build/android/gyp/util/build_utils.py',
341 '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
342 '<(ordered_libraries_file)',
343 '<(native_libraries_template)',
346 '<(native_libraries_java_stamp)',
349 'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
351 '--output=<(native_libraries_java_file)',
352 '--template=<(native_libraries_template)',
353 '--stamp=<(native_libraries_java_stamp)',
354 '--defines', 'NATIVE_LIBRARIES_LIST=@FileArg(<(ordered_libraries_file):java_libraries_list)',
355 '--defines', 'NATIVE_LIBRARIES_VERSION_NUMBER="<(native_lib_version_name)"',
356 '<@(gcc_preprocess_defines)',
360 'action_name': 'strip_native_libraries',
362 'ordered_libraries_file%': '<(ordered_libraries_file)',
363 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
365 '<@(native_libs_paths)',
366 '<@(extra_native_libs)',
368 'stamp': '<(strip_stamp)'
370 'includes': ['../build/android/strip_native_libraries.gypi'],
373 'action_name': 'insert_chromium_version',
375 'ordered_libraries_file%': '<(ordered_libraries_file)',
376 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
377 'version_string': '<(native_lib_version_name)',
381 'stamp': '<(version_stamp)'
383 'includes': ['../build/android/insert_chromium_version.gypi'],
386 'action_name': 'pack_arm_relocations',
389 ['use_chromium_linker == 1 and use_relocation_packer == 1 and profiling != 1', {
395 'exclude_packing_list': [
396 '<(libchromium_android_linker)',
398 'ordered_libraries_file%': '<(ordered_libraries_file)',
399 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
400 'packed_libraries_dir': '<(libraries_source_dir)',
404 'stamp': '<(pack_arm_relocations_stamp)',
406 'includes': ['../build/android/pack_arm_relocations.gypi'],
411 '<@(additional_bundled_libs)',
413 'ordered_libraries_file': '<(additional_ordered_libraries_file)',
414 'subtarget': '_additional_libraries',
416 'includes': ['../build/android/write_ordered_libraries.gypi'],
419 'action_name': 'strip_additional_libraries',
421 'ordered_libraries_file': '<(additional_ordered_libraries_file)',
422 'stripped_libraries_dir': '<(libraries_source_dir)',
424 '<@(additional_bundled_libs)',
427 'stamp': '<(strip_additional_stamp)'
429 'includes': ['../build/android/strip_native_libraries.gypi'],
432 'action_name': 'Create native lib placeholder files for previous releases',
434 'placeholders': ['<@(native_lib_placeholders)'],
436 ['gyp_managed_install == 1', {
437 # This "library" just needs to be put in the .apk. It is not loaded
439 'placeholders': ['libfix.crbug.384638.so'],
444 '<(DEPTH)/build/android/gyp/create_placeholder_files.py',
447 '<(native_lib_placeholder_stamp)',
450 'python', '<(DEPTH)/build/android/gyp/create_placeholder_files.py',
451 '--dest-lib-dir=<(apk_package_native_libs_dir)/<(android_app_abi)/',
452 '--stamp=<(native_lib_placeholder_stamp)',
458 ['gyp_managed_install == 1', {
460 'libraries_top_dir': '<(intermediate_dir)/lib.stripped',
461 'libraries_source_dir': '<(libraries_top_dir)/lib/<(android_app_abi)',
462 'device_library_dir': '<(device_intermediate_dir)/lib.stripped',
463 'configuration_name': '<(CONFIGURATION_NAME)',
466 '<(DEPTH)/build/android/setup.gyp:get_build_device_configurations',
467 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
471 'includes': ['../build/android/push_libraries.gypi'],
474 'action_name': 'create device library symlinks',
475 'message': 'Creating links on device for <(_target_name)',
477 '<(DEPTH)/build/android/gyp/util/build_utils.py',
478 '<(DEPTH)/build/android/gyp/create_device_library_links.py',
479 '<(apk_install_record)',
480 '<(build_device_config_path)',
481 '<(ordered_libraries_file)',
487 'python', '<(DEPTH)/build/android/gyp/create_device_library_links.py',
488 '--build-device-configuration=<(build_device_config_path)',
489 '--libraries=@FileArg(<(ordered_libraries_file):libraries)',
490 '--script-host-path=<(symlink_script_host_path)',
491 '--script-device-path=<(symlink_script_device_path)',
492 '--target-dir=<(device_library_dir)',
493 '--apk=<(incomplete_apk_path)',
494 '--stamp=<(link_stamp)',
495 '--configuration-name=<(CONFIGURATION_NAME)',
500 ['create_standalone_apk == 1', {
503 'action_name': 'create standalone APK',
506 '<(ordered_libraries_file)',
507 '<(strip_additional_stamp)',
508 '<(pack_arm_relocations_stamp)',
510 'output_apk_path': '<(unsigned_standalone_apk_path)',
511 'libraries_top_dir%': '<(libraries_top_dir)',
512 'input_apk_path': '<(managed_input_apk_path)',
514 'includes': [ 'android/create_standalone_apk_action.gypi' ],
520 # gyp_managed_install != 1
522 'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_app_abi)',
523 'package_input_paths': [
524 '<(strip_additional_stamp)',
525 '<(pack_arm_relocations_stamp)',
530 }], # native_lib_target != ''
531 ['gyp_managed_install == 0 or create_standalone_apk == 1 or create_abi_split == 1', {
533 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar',
536 ['create_abi_split == 1 or gyp_managed_install == 0 or create_standalone_apk == 1', {
539 'action_name': 'finalize_base',
541 'output_apk_path': '<(final_apk_path)',
543 ['create_abi_split == 0', {
544 'input_apk_path': '<(unsigned_standalone_apk_path)',
545 'load_library_from_zip': '<(load_library_from_zip_file)',
547 'input_apk_path': '<(unsigned_apk_path)',
548 'load_library_from_zip': 0,
552 'includes': [ 'android/finalize_apk_action.gypi']
556 ['create_abi_split == 1', {
559 'action_name': 'generate_split_manifest_<(_target_name)',
561 '<(DEPTH)/build/android/gyp/util/build_utils.py',
562 '<(DEPTH)/build/android/gyp/generate_split_manifest.py',
563 '<(android_manifest_path)',
566 '<(split_android_manifest_path)',
569 'python', '<(DEPTH)/build/android/gyp/generate_split_manifest.py',
570 '--main-manifest', '<(android_manifest_path)',
571 '--out-manifest', '<(split_android_manifest_path)',
572 '--split', 'abi_<(android_app_abi)',
577 'apk_name': '<(main_apk_name)-abi-<(android_app_abi)',
578 'asset_location': '',
579 'android_manifest_path': '<(split_android_manifest_path)',
581 'includes': [ 'android/package_resources_action.gypi' ],
585 'apk_name': '<(main_apk_name)-abi-<(android_app_abi)',
586 'apk_path': '<(unsigned_abi_split_apk_path)',
588 'native_libs_dir': '<(apk_package_native_libs_dir)',
589 'extra_inputs': ['<(native_lib_placeholder_stamp)'],
591 'includes': ['android/apkbuilder_action.gypi'],
595 ['create_abi_split == 1 and (gyp_managed_install == 0 or create_standalone_apk == 1)', {
598 'action_name': 'finalize_split',
600 'load_library_from_zip': '<(load_library_from_zip_file)',
601 'output_apk_path': '<(final_abi_split_apk_path)',
603 ['gyp_managed_install == 1', {
604 'input_apk_path': '<(unsigned_standalone_apk_path)',
606 'input_apk_path': '<(unsigned_abi_split_apk_path)',
610 'includes': [ 'android/finalize_apk_action.gypi']
614 ['gyp_managed_install == 1', {
617 'action_name': 'finalize incomplete apk',
619 'load_library_from_zip': 0,
620 'input_apk_path': '<(managed_input_apk_path)',
621 'output_apk_path': '<(incomplete_apk_path)',
623 'includes': [ 'android/finalize_apk_action.gypi']
626 'action_name': 'apk_install_<(_target_name)',
627 'message': 'Installing <(apk_name).apk',
629 '<(DEPTH)/build/android/gyp/util/build_utils.py',
630 '<(DEPTH)/build/android/gyp/apk_install.py',
631 '<(build_device_config_path)',
632 '<(incomplete_apk_path)',
635 '<(apk_install_record)',
638 'python', '<(DEPTH)/build/android/gyp/apk_install.py',
639 '--build-device-configuration=<(build_device_config_path)',
640 '--install-record=<(apk_install_record)',
641 '--configuration-name=<(CONFIGURATION_NAME)',
644 ['create_abi_split == 1', {
649 '--apk-path=<(final_apk_path)',
650 '--split-apk-path=<(incomplete_apk_path)',
654 '--apk-path=<(incomplete_apk_path)',
661 ['is_test_apk == 1', {
663 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
664 '<(DEPTH)/tools/android/android_tools.gyp:android_tools',
667 ['run_findbugs == 1', {
670 'action_name': 'findbugs_<(_target_name)',
671 'message': 'Running findbugs on <(_target_name)',
673 '<(DEPTH)/build/android/findbugs_diff.py',
674 '<(DEPTH)/build/android/findbugs_filter/findbugs_exclude.xml',
675 '<(DEPTH)/build/android/pylib/utils/findbugs.py',
676 '>@(input_jars_paths)',
684 'python', '<(DEPTH)/build/android/findbugs_diff.py',
685 '--auxclasspath-gyp', '>(input_jars_paths)',
686 '--stamp', '<(findbugs_stamp)',
695 '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum',
699 'action_name': 'process_resources',
700 'message': 'processing resources for <(_target_name)',
702 # Write the inputs list to a file, so that its mtime is updated when
703 # the list of inputs changes.
704 'inputs_list_file': '>|(apk_codegen.<(_target_name).gypcmd >@(additional_input_paths) >@(resource_input_paths))',
705 'process_resources_options': [],
707 ['is_test_apk == 1', {
708 'dependencies_res_zip_paths=': [],
709 'additional_res_packages=': [],
711 ['res_v14_skip == 1', {
712 'process_resources_options+': ['--v14-skip']
714 ['shared_resources == 1', {
715 'process_resources_options+': ['--shared-resources']
717 ['R_package != ""', {
718 'process_resources_options+': ['--custom-package', '<(R_package)']
720 ['include_all_resources == 1', {
721 'process_resources_options+': ['--include-all-resources']
726 '<(DEPTH)/build/android/gyp/util/build_utils.py',
727 '<(DEPTH)/build/android/gyp/process_resources.py',
728 '<(android_manifest_path)',
729 '>@(additional_input_paths)',
730 '>@(resource_input_paths)',
731 '>@(dependencies_res_zip_paths)',
732 '>(inputs_list_file)',
735 '<(resource_zip_path)',
736 '<(generated_proguard_file)',
740 'python', '<(DEPTH)/build/android/gyp/process_resources.py',
741 '--android-sdk', '<(android_sdk)',
742 '--android-sdk-tools', '<(android_sdk_tools)',
744 '--android-manifest', '<(android_manifest_path)',
745 '--dependencies-res-zips', '>(dependencies_res_zip_paths)',
747 '--extra-res-packages', '>(additional_res_packages)',
748 '--extra-r-text-files', '>(additional_R_text_files)',
750 '--proguard-file', '<(generated_proguard_file)',
752 '--resource-dirs', '<(resource_dir)',
753 '--resource-zip-out', '<(resource_zip_path)',
755 '--R-dir', '<(intermediate_dir)/gen',
757 '--stamp', '<(codegen_stamp)',
759 '<@(process_resources_options)',
763 'action_name': 'javac_<(_target_name)',
764 'message': 'Compiling java for <(_target_name)',
767 '<(intermediate_dir)/gen',
768 '>@(generated_src_dirs)',
770 # If there is a separate find for additional_src_dirs, it will find the
771 # wrong .java files when additional_src_dirs is empty.
772 # TODO(thakis): Gyp caches >! evaluation by command. Both java.gypi and
773 # java_apk.gypi evaluate the same command, and at the moment two targets
774 # set java_in_dir to "java". Add a dummy comment here to make sure
775 # that the two targets (one uses java.gypi, the other java_apk.gypi)
776 # get distinct source lists. Medium-term, make targets list all their
777 # Java files instead of using find. (As is, this will be broken if two
778 # targets use the same java_in_dir and both use java_apk.gypi or
779 # both use java.gypi.)
780 'java_sources': ['>!@(find >(java_in_dir)>(java_in_dir_suffix) >(additional_src_dirs) -name "*.java" # apk)'],
784 '<(DEPTH)/build/android/gyp/util/build_utils.py',
785 '<(DEPTH)/build/android/gyp/javac.py',
787 '>@(input_jars_paths)',
791 ['native_lib_target != ""', {
792 'inputs': [ '<(native_libraries_java_stamp)' ],
800 'python', '<(DEPTH)/build/android/gyp/javac.py',
801 '--classpath=>(input_jars_paths) <(android_sdk_jar)',
802 '--src-gendirs=>(gen_src_dirs)',
803 '--javac-includes=<(javac_includes)',
804 '--chromium-code=<(chromium_code)',
805 '--jar-path=<(javac_jar_path)',
806 '--jar-excluded-classes=<(jar_excluded_classes)',
807 '--stamp=<(compile_stamp)',
812 'action_name': 'instr_jar_<(_target_name)',
813 'message': 'Instrumenting <(_target_name) jar',
815 'input_path': '<(javac_jar_path)',
816 'output_path': '<(jar_path)',
817 'stamp_path': '<(instr_stamp)',
827 'includes': [ 'android/instr_action.gypi' ],
832 '<(java_in_dir)<(java_in_dir_suffix)',
833 '>@(additional_src_dirs)',
835 'lint_jar_path': '<(jar_path)',
836 'stamp_path': '<(lint_stamp)',
837 'result_path': '<(lint_result)',
838 'config_path': '<(lint_config)',
843 'includes': [ 'android/lint_action.gypi' ],
846 'action_name': 'obfuscate_<(_target_name)',
847 'message': 'Obfuscating <(_target_name)',
849 'additional_obfuscate_options': [],
850 'additional_obfuscate_input_paths': [],
851 'proguard_out_dir': '<(intermediate_dir)/proguard',
852 'proguard_input_jar_paths': [
853 '>@(input_jars_paths)',
856 'target_conditions': [
857 ['is_test_apk == 1', {
858 'additional_obfuscate_options': [
862 ['is_test_apk == 1 and tested_apk_obfuscated_jar_path != "/"', {
863 'additional_obfuscate_options': [
864 '--tested-apk-obfuscated-jar-path', '>(tested_apk_obfuscated_jar_path)',
866 'additional_obfuscate_input_paths': [
867 '>(tested_apk_obfuscated_jar_path).info',
870 ['proguard_enabled == "true"', {
871 'additional_obfuscate_options': [
872 '--proguard-enabled',
876 'obfuscate_input_jars_paths': [
877 '>@(input_jars_paths)',
882 ['is_test_apk == 1', {
889 '<(DEPTH)/build/android/gyp/apk_obfuscate.py',
890 '<(DEPTH)/build/android/gyp/util/build_utils.py',
891 '>@(proguard_flags_paths)',
892 '>@(obfuscate_input_jars_paths)',
893 '>@(additional_obfuscate_input_paths)',
897 '<(obfuscate_stamp)',
899 # In non-Release builds, these paths will all be empty files.
900 '<(obfuscated_jar_path)',
901 '<(obfuscated_jar_path).info',
902 '<(obfuscated_jar_path).dump',
903 '<(obfuscated_jar_path).seeds',
904 '<(obfuscated_jar_path).mapping',
905 '<(obfuscated_jar_path).usage',
908 'python', '<(DEPTH)/build/android/gyp/apk_obfuscate.py',
910 '--configuration-name', '<(CONFIGURATION_NAME)',
912 '--android-sdk', '<(android_sdk)',
913 '--android-sdk-tools', '<(android_sdk_tools)',
914 '--android-sdk-jar', '<(android_sdk_jar)',
916 '--input-jars-paths=>(proguard_input_jar_paths)',
917 '--proguard-configs=>(proguard_flags_paths)',
919 '--test-jar-path', '<(test_jar_path)',
920 '--obfuscated-jar-path', '<(obfuscated_jar_path)',
922 '--proguard-jar-path', '<(android_sdk_root)/tools/proguard/lib/proguard.jar',
924 '--stamp', '<(obfuscate_stamp)',
926 '>@(additional_obfuscate_options)',
930 'action_name': 'dex_<(_target_name)',
933 '>@(library_dexed_jars_paths)',
936 'output_path': '<(dex_path)',
937 'proguard_enabled_input_path': '<(obfuscated_jar_path)',
939 'target_conditions': [
940 ['emma_instrument != 0', {
948 ['is_test_apk == 1 and tested_apk_dex_path != "/"', {
950 'dex_additional_options': [
951 '--excluded-paths', '@FileArg(>(tested_apk_dex_path).inputs)'
955 '>(tested_apk_dex_path).inputs',
958 ['proguard_enabled == "true"', {
959 'inputs': [ '<(obfuscate_stamp)' ]
961 'inputs': [ '<(instr_stamp)' ]
964 'includes': [ 'android/dex_action.gypi' ],
968 'extra_inputs': ['<(codegen_stamp)'],
970 '<(resource_zip_path)',
973 ['is_test_apk == 0', {
975 '>@(dependencies_res_zip_paths)',
980 'includes': [ 'android/package_resources_action.gypi' ],
984 'apk_path': '<(unsigned_apk_path)',
986 ['native_lib_target != ""', {
987 'extra_inputs': ['<(native_lib_placeholder_stamp)'],
989 ['create_abi_split == 0', {
990 'native_libs_dir': '<(apk_package_native_libs_dir)',
992 'native_libs_dir': '<(DEPTH)/build/android/ant/empty/res',
996 'includes': ['android/apkbuilder_action.gypi'],