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 # use_chromium_linker - Enable the content dynamic linker that allows sharing the
51 # RELRO section of the native libraries between the different processes.
52 # load_library_from_zip_file - When using the dynamic linker, load the library
53 # directly out of the zip file.
54 # use_relocation_packer - Enable relocation packing. Relies on the chromium
55 # linker, so use_chromium_linker must also be enabled.
56 # enable_chromium_linker_tests - Enable the content dynamic linker test support
57 # code. This allows a test APK to inject a Linker.TestRunner instance at
58 # runtime. Should only be used by the chromium_linker_test_apk target!!
59 # never_lint - Set to 1 to not run lint on this target.
60 # java_in_dir_suffix - To override the /src suffix on java_in_dir.
61 # app_manifest_version_name - set the apps 'human readable' version number.
62 # app_manifest_version_code - set the apps version number.
65 'tested_apk_obfuscated_jar_path%': '/',
66 'tested_apk_dex_path%': '/',
67 'additional_input_paths': [],
68 'input_jars_paths': [],
69 'library_dexed_jars_paths': [],
70 'additional_src_dirs': [],
71 'generated_src_dirs': [],
72 'app_manifest_version_name%': '<(android_app_version_name)',
73 'app_manifest_version_code%': '<(android_app_version_code)',
74 # aapt generates this proguard.txt.
75 'generated_proguard_file': '<(intermediate_dir)/proguard.txt',
76 'proguard_enabled%': 'false',
77 'proguard_flags_paths': ['<(generated_proguard_file)'],
78 'jar_name': 'chromium_apk_<(_target_name).jar',
79 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res',
81 'additional_R_text_files': [],
82 'dependencies_res_zip_paths': [],
83 'additional_res_packages': [],
84 'additional_bundled_libs%': [],
86 'extensions_to_not_compress%': '',
87 'resource_input_paths': [],
88 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)',
89 'asset_location%': '<(intermediate_dir)/assets',
90 'codegen_stamp': '<(intermediate_dir)/codegen.stamp',
91 'package_input_paths': [],
92 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json',
93 'additional_ordered_libraries_file': '<(intermediate_dir)/additional_native_libraries.json',
94 'native_libraries_template': '<(DEPTH)/base/android/java/templates/NativeLibraries.template',
95 'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/',
96 'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.java',
97 'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.stamp',
98 'native_libraries_template_data_dir': '<(intermediate_dir)/native_libraries/',
99 'native_libraries_template_data_file': '<(native_libraries_template_data_dir)/native_libraries_array.h',
100 'native_libraries_template_version_file': '<(native_libraries_template_data_dir)/native_libraries_version.h',
101 'compile_stamp': '<(intermediate_dir)/compile.stamp',
102 'lint_stamp': '<(intermediate_dir)/lint.stamp',
103 'lint_result': '<(intermediate_dir)/lint_result.xml',
104 'lint_config': '<(intermediate_dir)/lint_config.xml',
106 'findbugs_stamp': '<(intermediate_dir)/findbugs.stamp',
108 'java_in_dir_suffix%': '/src',
109 'instr_stamp': '<(intermediate_dir)/instr.stamp',
110 'jar_stamp': '<(intermediate_dir)/jar.stamp',
111 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp',
112 'pack_arm_relocations_stamp': '<(intermediate_dir)/pack_arm_relocations.stamp',
113 'strip_stamp': '<(intermediate_dir)/strip.stamp',
114 'stripped_libraries_dir': '<(intermediate_dir)/stripped_libraries',
115 'strip_additional_stamp': '<(intermediate_dir)/strip_additional.stamp',
116 'version_stamp': '<(intermediate_dir)/version.stamp',
117 'javac_includes': [],
118 'jar_excluded_classes': [],
119 'javac_jar_path': '<(intermediate_dir)/<(_target_name).javac.jar',
120 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)',
121 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar',
122 'test_jar_path': '<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar',
123 'dex_path': '<(intermediate_dir)/classes.dex',
124 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar',
125 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml',
126 'push_stamp': '<(intermediate_dir)/push.stamp',
127 'link_stamp': '<(intermediate_dir)/link.stamp',
128 'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp',
129 'resource_zip_path': '<(intermediate_dir)/<(_target_name).resources.zip',
130 'resource_packaged_apk_name': '<(apk_name)-resources.ap_',
131 'resource_packaged_apk_path': '<(intermediate_dir)/<(resource_packaged_apk_name)',
132 'shared_resources%': 0,
133 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk',
134 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk',
135 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk',
136 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp',
137 'device_intermediate_dir': '/data/data/org.chromium.gyp_managed_install/<(_target_name)/<(CONFIGURATION_NAME)',
138 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh',
139 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh',
140 'create_standalone_apk%': 1,
141 'res_v14_verify_only%': 0,
144 'native_lib_target%': '',
145 'native_lib_version_name%': '',
146 'use_chromium_linker%' : 0,
147 'load_library_from_zip_file%' : 0,
148 'use_relocation_packer%' : 0,
149 'enable_chromium_linker_tests%': 0,
153 ['gyp_managed_install == 1 and native_lib_target != ""', {
154 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-standalone-unsigned.apk',
156 'unsigned_standalone_apk_path': '<(unsigned_apk_path)',
158 ['gyp_managed_install == 1', {
159 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed',
161 'apk_package_native_libs_dir': '<(intermediate_dir)/libs',
163 ['is_test_apk == 0 and emma_coverage != 0', {
164 'emma_instrument%': 1,
166 'emma_instrument%': 0,
170 'native_lib_target%': '',
171 'native_lib_version_name%': '',
172 'use_chromium_linker%' : 0,
173 'load_library_from_zip_file%' : 0,
174 'use_relocation_packer%' : 0,
175 'enable_chromium_linker_tests%': 0,
176 'emma_instrument%': '<(emma_instrument)',
177 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)',
178 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)',
179 'libchromium_android_linker': 'libchromium_android_linker.>(android_product_extension)',
180 'extra_native_libs': [],
181 'native_lib_placeholder_stamp': '<(apk_package_native_libs_dir)/<(android_app_abi)/native_lib_placeholder.stamp',
182 'native_lib_placeholders': [],
184 # Pass the jar path to the apk's "fake" jar target. This would be better as
185 # direct_dependent_settings, but a variable set by a direct_dependent_settings
186 # cannot be lifted in a dependent to all_dependent_settings.
187 'all_dependent_settings': {
189 ['proguard_enabled == "true"', {
191 'proguard_enabled': 'true',
196 'apk_output_jar_path': '<(jar_path)',
197 'tested_apk_obfuscated_jar_path': '<(obfuscated_jar_path)',
198 'tested_apk_dex_path': '<(dex_path)',
202 ['resource_dir!=""', {
204 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ]
207 ['R_package != ""', {
209 # We generate R.java in package R_package (in addition to the package
210 # listed in the AndroidManifest.xml, which is unavoidable).
211 'additional_res_packages': ['<(R_package)'],
212 'additional_R_text_files': ['<(intermediate_dir)/R.txt'],
215 ['native_lib_target != "" and component == "shared_library"', {
217 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries',
220 ['use_chromium_linker == 1', {
222 '<(DEPTH)/base/base.gyp:chromium_android_linker',
225 ['native_lib_target != ""', {
228 ['use_chromium_linker == 1', {
230 'chromium_linker_path': [
231 '<(SHARED_LIB_DIR)/<(libchromium_android_linker)',
236 'chromium_linker_path': [],
240 'generated_src_dirs': [ '<(native_libraries_java_dir)' ],
241 'native_libs_paths': [
242 '<(SHARED_LIB_DIR)/<(native_lib_target).>(android_product_extension)',
243 '<@(chromium_linker_path)'
245 'package_input_paths': [
246 '<(apk_package_native_libs_dir)/<(android_app_abi)/gdbserver',
251 # gdbserver is always copied into the APK's native libs dir. The ant
252 # build scripts (apkbuilder task) will only include it in a debug
254 'destination': '<(apk_package_native_libs_dir)/<(android_app_abi)',
256 '<(android_gdbserver)',
264 '<@(native_libs_paths)',
265 '<@(extra_native_libs)',
268 'includes': ['../build/android/write_ordered_libraries.gypi'],
271 'action_name': 'native_libraries_<(_target_name)',
274 ['use_chromium_linker == 1', {
276 'linker_gcc_preprocess_defines': [
277 '--defines', 'ENABLE_CHROMIUM_LINKER',
282 'linker_gcc_preprocess_defines': [],
285 ['load_library_from_zip_file == 1', {
287 'linker_load_from_zip_file_preprocess_defines': [
288 '--defines', 'ENABLE_CHROMIUM_LINKER_LIBRARY_IN_ZIP_FILE',
293 'linker_load_from_zip_file_preprocess_defines': [],
296 ['enable_chromium_linker_tests == 1', {
298 'linker_tests_gcc_preprocess_defines': [
299 '--defines', 'ENABLE_CHROMIUM_LINKER_TESTS',
304 'linker_tests_gcc_preprocess_defines': [],
308 'gcc_preprocess_defines': [
309 '<@(linker_load_from_zip_file_preprocess_defines)',
310 '<@(linker_gcc_preprocess_defines)',
311 '<@(linker_tests_gcc_preprocess_defines)',
314 'message': 'Creating NativeLibraries.java for <(_target_name)',
316 '<(DEPTH)/build/android/gyp/util/build_utils.py',
317 '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
318 '<(ordered_libraries_file)',
319 '<(native_libraries_template)',
322 '<(native_libraries_java_stamp)',
325 'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
327 '--output=<(native_libraries_java_file)',
328 '--template=<(native_libraries_template)',
329 '--stamp=<(native_libraries_java_stamp)',
330 '--defines', 'NATIVE_LIBRARIES_LIST=@FileArg(<(ordered_libraries_file):java_libraries_list)',
331 '--defines', 'NATIVE_LIBRARIES_VERSION_NUMBER="<(native_lib_version_name)"',
332 '<@(gcc_preprocess_defines)',
336 'action_name': 'strip_native_libraries',
338 'ordered_libraries_file%': '<(ordered_libraries_file)',
339 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
341 '<@(native_libs_paths)',
342 '<@(extra_native_libs)',
344 'stamp': '<(strip_stamp)'
346 'includes': ['../build/android/strip_native_libraries.gypi'],
349 'action_name': 'insert_chromium_version',
351 'ordered_libraries_file%': '<(ordered_libraries_file)',
352 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
353 'version_string': '<(native_lib_version_name)',
357 'stamp': '<(version_stamp)'
359 'includes': ['../build/android/insert_chromium_version.gypi'],
362 'action_name': 'pack_arm_relocations',
365 ['use_chromium_linker == 1 and use_relocation_packer == 1 and profiling != 1', {
371 'exclude_packing_list': [
372 '<(libchromium_android_linker)',
374 'ordered_libraries_file%': '<(ordered_libraries_file)',
375 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
376 'packed_libraries_dir': '<(libraries_source_dir)',
380 'stamp': '<(pack_arm_relocations_stamp)',
382 'includes': ['../build/android/pack_arm_relocations.gypi'],
387 '<@(additional_bundled_libs)',
389 'ordered_libraries_file': '<(additional_ordered_libraries_file)',
390 'subtarget': '_additional_libraries',
392 'includes': ['../build/android/write_ordered_libraries.gypi'],
395 'action_name': 'strip_additional_libraries',
397 'ordered_libraries_file': '<(additional_ordered_libraries_file)',
398 'stripped_libraries_dir': '<(libraries_source_dir)',
400 '<@(additional_bundled_libs)',
403 'stamp': '<(strip_additional_stamp)'
405 'includes': ['../build/android/strip_native_libraries.gypi'],
408 'action_name': 'Create native lib placeholder files for previous releases',
410 'placeholders': ['<@(native_lib_placeholders)'],
412 ['gyp_managed_install == 1', {
413 # This "library" just needs to be put in the .apk. It is not loaded
415 'placeholders': ['libfix.crbug.384638.so'],
420 '<(DEPTH)/build/android/gyp/create_placeholder_files.py',
423 '<(native_lib_placeholder_stamp)',
426 'python', '<(DEPTH)/build/android/gyp/create_placeholder_files.py',
427 '--dest-lib-dir=<(apk_package_native_libs_dir)/<(android_app_abi)/',
428 '--stamp=<(native_lib_placeholder_stamp)',
434 ['gyp_managed_install == 1', {
436 'libraries_top_dir': '<(intermediate_dir)/lib.stripped',
437 'libraries_source_dir': '<(libraries_top_dir)/lib/<(android_app_abi)',
438 'device_library_dir': '<(device_intermediate_dir)/lib.stripped',
439 'configuration_name': '<(CONFIGURATION_NAME)',
442 '<(DEPTH)/build/android/setup.gyp:get_build_device_configurations',
443 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
447 'includes': ['../build/android/push_libraries.gypi'],
450 'action_name': 'create device library symlinks',
451 'message': 'Creating links on device for <(_target_name)',
453 '<(DEPTH)/build/android/gyp/util/build_utils.py',
454 '<(DEPTH)/build/android/gyp/create_device_library_links.py',
455 '<(apk_install_record)',
456 '<(build_device_config_path)',
457 '<(ordered_libraries_file)',
463 'python', '<(DEPTH)/build/android/gyp/create_device_library_links.py',
464 '--build-device-configuration=<(build_device_config_path)',
465 '--libraries=@FileArg(<(ordered_libraries_file):libraries)',
466 '--script-host-path=<(symlink_script_host_path)',
467 '--script-device-path=<(symlink_script_device_path)',
468 '--target-dir=<(device_library_dir)',
469 '--apk=<(incomplete_apk_path)',
470 '--stamp=<(link_stamp)',
471 '--configuration-name=<(CONFIGURATION_NAME)',
476 ['create_standalone_apk == 1', {
479 'action_name': 'create standalone APK',
482 '<(ordered_libraries_file)',
483 '<(strip_additional_stamp)',
484 '<(pack_arm_relocations_stamp)',
486 'input_apk_path': '<(unsigned_apk_path)',
487 'output_apk_path': '<(unsigned_standalone_apk_path)',
488 'libraries_top_dir%': '<(libraries_top_dir)',
490 'includes': [ 'android/create_standalone_apk_action.gypi' ],
496 # gyp_managed_install != 1
498 'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_app_abi)',
499 'package_input_paths': [
500 '<(strip_additional_stamp)',
501 '<(pack_arm_relocations_stamp)',
506 }], # native_lib_target != ''
507 ['gyp_managed_install == 0 or create_standalone_apk == 1', {
510 'action_name': 'finalize standalone apk',
512 'input_apk_path': '<(unsigned_standalone_apk_path)',
513 'output_apk_path': '<(final_apk_path)',
515 'includes': [ 'android/finalize_apk_action.gypi']
519 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar',
522 ['gyp_managed_install == 1', {
525 'action_name': 'finalize incomplete apk',
527 'input_apk_path': '<(unsigned_apk_path)',
528 'output_apk_path': '<(incomplete_apk_path)',
530 'includes': [ 'android/finalize_apk_action.gypi']
533 'action_name': 'apk_install_<(_target_name)',
534 'message': 'Installing <(apk_name).apk',
536 '<(DEPTH)/build/android/gyp/util/build_utils.py',
537 '<(DEPTH)/build/android/gyp/apk_install.py',
538 '<(build_device_config_path)',
539 '<(incomplete_apk_path)',
542 '<(apk_install_record)',
545 'python', '<(DEPTH)/build/android/gyp/apk_install.py',
546 '--apk-path=<(incomplete_apk_path)',
547 '--build-device-configuration=<(build_device_config_path)',
548 '--install-record=<(apk_install_record)',
549 '--configuration-name=<(CONFIGURATION_NAME)',
554 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar',
557 ['is_test_apk == 1', {
559 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
560 '<(DEPTH)/tools/android/android_tools.gyp:android_tools',
563 ['run_findbugs == 1', {
566 'action_name': 'findbugs_<(_target_name)',
567 'message': 'Running findbugs on <(_target_name)',
569 '<(DEPTH)/build/android/findbugs_diff.py',
570 '<(DEPTH)/build/android/findbugs_filter/findbugs_exclude.xml',
571 '<(DEPTH)/build/android/pylib/utils/findbugs.py',
572 '>@(input_jars_paths)',
580 'python', '<(DEPTH)/build/android/findbugs_diff.py',
581 '--auxclasspath-gyp', '>(input_jars_paths)',
582 '--stamp', '<(findbugs_stamp)',
591 '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum',
595 'action_name': 'process_resources',
596 'message': 'processing resources for <(_target_name)',
598 # Write the inputs list to a file, so that its mtime is updated when
599 # the list of inputs changes.
600 'inputs_list_file': '>|(apk_codegen.<(_target_name).gypcmd >@(additional_input_paths) >@(resource_input_paths))',
601 'process_resources_options': [],
603 ['is_test_apk == 1', {
604 'dependencies_res_zip_paths=': [],
605 'additional_res_packages=': [],
607 ['res_v14_verify_only == 1', {
608 'process_resources_options+': ['--v14-verify-only']
610 ['shared_resources == 1', {
611 'process_resources_options+': ['--shared-resources']
616 '<(DEPTH)/build/android/gyp/util/build_utils.py',
617 '<(DEPTH)/build/android/gyp/process_resources.py',
618 '<(android_manifest_path)',
619 '>@(additional_input_paths)',
620 '>@(resource_input_paths)',
621 '>@(dependencies_res_zip_paths)',
622 '>(inputs_list_file)',
625 '<(resource_zip_path)',
626 '<(generated_proguard_file)',
630 'python', '<(DEPTH)/build/android/gyp/process_resources.py',
631 '--android-sdk', '<(android_sdk)',
632 '--android-sdk-tools', '<(android_sdk_tools)',
634 '--android-manifest', '<(android_manifest_path)',
635 '--dependencies-res-zips', '>(dependencies_res_zip_paths)',
637 '--extra-res-packages', '>(additional_res_packages)',
638 '--extra-r-text-files', '>(additional_R_text_files)',
640 '--proguard-file', '<(generated_proguard_file)',
642 '--resource-dirs', '<(resource_dir)',
643 '--resource-zip-out', '<(resource_zip_path)',
645 '--R-dir', '<(intermediate_dir)/gen',
647 '--stamp', '<(codegen_stamp)',
649 '<@(process_resources_options)',
653 'action_name': 'javac_<(_target_name)',
654 'message': 'Compiling java for <(_target_name)',
657 '<(intermediate_dir)/gen',
658 '>@(generated_src_dirs)',
660 # If there is a separate find for additional_src_dirs, it will find the
661 # wrong .java files when additional_src_dirs is empty.
662 # TODO(thakis): Gyp caches >! evaluation by command. Both java.gypi and
663 # java_apk.gypi evaluate the same command, and at the moment two targets
664 # set java_in_dir to "java". Add a dummy comment here to make sure
665 # that the two targets (one uses java.gypi, the other java_apk.gypi)
666 # get distinct source lists. Medium-term, make targets list all their
667 # Java files instead of using find. (As is, this will be broken if two
668 # targets use the same java_in_dir and both use java_apk.gypi or
669 # both use java.gypi.)
670 'java_sources': ['>!@(find >(java_in_dir)>(java_in_dir_suffix) >(additional_src_dirs) -name "*.java" # apk)'],
674 '<(DEPTH)/build/android/gyp/util/build_utils.py',
675 '<(DEPTH)/build/android/gyp/javac.py',
677 '>@(input_jars_paths)',
681 ['native_lib_target != ""', {
682 'inputs': [ '<(native_libraries_java_stamp)' ],
690 'python', '<(DEPTH)/build/android/gyp/javac.py',
691 '--classpath=>(input_jars_paths) <(android_sdk_jar)',
692 '--src-gendirs=>(gen_src_dirs)',
693 '--javac-includes=<(javac_includes)',
694 '--chromium-code=<(chromium_code)',
695 '--jar-path=<(javac_jar_path)',
696 '--jar-excluded-classes=<(jar_excluded_classes)',
697 '--stamp=<(compile_stamp)',
702 'action_name': 'instr_jar_<(_target_name)',
703 'message': 'Instrumenting <(_target_name) jar',
705 'input_path': '<(javac_jar_path)',
706 'output_path': '<(jar_path)',
707 'stamp_path': '<(instr_stamp)',
717 'includes': [ 'android/instr_action.gypi' ],
722 '<(java_in_dir)<(java_in_dir_suffix)',
723 '>@(additional_src_dirs)',
725 'lint_jar_path': '<(jar_path)',
726 'stamp_path': '<(lint_stamp)',
727 'result_path': '<(lint_result)',
728 'config_path': '<(lint_config)',
733 'includes': [ 'android/lint_action.gypi' ],
736 'action_name': 'obfuscate_<(_target_name)',
737 'message': 'Obfuscating <(_target_name)',
739 'additional_obfuscate_options': [],
740 'additional_obfuscate_input_paths': [],
741 'proguard_out_dir': '<(intermediate_dir)/proguard',
742 'proguard_input_jar_paths': [
743 '>@(input_jars_paths)',
746 'target_conditions': [
747 ['is_test_apk == 1', {
748 'additional_obfuscate_options': [
752 ['is_test_apk == 1 and tested_apk_obfuscated_jar_path != "/"', {
753 'additional_obfuscate_options': [
754 '--tested-apk-obfuscated-jar-path', '>(tested_apk_obfuscated_jar_path)',
756 'additional_obfuscate_input_paths': [
757 '>(tested_apk_obfuscated_jar_path).info',
760 ['proguard_enabled == "true"', {
761 'additional_obfuscate_options': [
762 '--proguard-enabled',
766 'obfuscate_input_jars_paths': [
767 '>@(input_jars_paths)',
772 ['is_test_apk == 1', {
779 '<(DEPTH)/build/android/gyp/apk_obfuscate.py',
780 '<(DEPTH)/build/android/gyp/util/build_utils.py',
781 '>@(proguard_flags_paths)',
782 '>@(obfuscate_input_jars_paths)',
783 '>@(additional_obfuscate_input_paths)',
787 '<(obfuscate_stamp)',
789 # In non-Release builds, these paths will all be empty files.
790 '<(obfuscated_jar_path)',
791 '<(obfuscated_jar_path).info',
792 '<(obfuscated_jar_path).dump',
793 '<(obfuscated_jar_path).seeds',
794 '<(obfuscated_jar_path).mapping',
795 '<(obfuscated_jar_path).usage',
798 'python', '<(DEPTH)/build/android/gyp/apk_obfuscate.py',
800 '--configuration-name', '<(CONFIGURATION_NAME)',
802 '--android-sdk', '<(android_sdk)',
803 '--android-sdk-tools', '<(android_sdk_tools)',
804 '--android-sdk-jar', '<(android_sdk_jar)',
806 '--input-jars-paths=>(proguard_input_jar_paths)',
807 '--proguard-configs=>(proguard_flags_paths)',
809 '--test-jar-path', '<(test_jar_path)',
810 '--obfuscated-jar-path', '<(obfuscated_jar_path)',
812 '--proguard-jar-path', '<(android_sdk_root)/tools/proguard/lib/proguard.jar',
814 '--stamp', '<(obfuscate_stamp)',
816 '>@(additional_obfuscate_options)',
820 'action_name': 'dex_<(_target_name)',
823 '>@(library_dexed_jars_paths)',
826 'output_path': '<(dex_path)',
827 'proguard_enabled_input_path': '<(obfuscated_jar_path)',
829 'target_conditions': [
830 ['emma_instrument != 0', {
838 ['is_test_apk == 1 and tested_apk_dex_path != "/"', {
840 'dex_additional_options': [
841 '--excluded-paths', '@FileArg(>(tested_apk_dex_path).inputs)'
845 '>(tested_apk_dex_path).inputs',
848 ['proguard_enabled == "true"', {
849 'inputs': [ '<(obfuscate_stamp)' ]
851 'inputs': [ '<(instr_stamp)' ]
854 'includes': [ 'android/dex_action.gypi' ],
857 'action_name': 'package_resources',
858 'message': 'packaging resources for <(_target_name)',
860 'package_resources_options': [],
861 'package_resource_zip_input_paths': [
862 '<(resource_zip_path)',
863 '>@(dependencies_res_zip_paths)',
866 ['shared_resources == 1', {
867 'package_resources_options+': ['--shared-resources']
872 ['is_test_apk == 1', {
874 'dependencies_res_zip_paths=': [],
875 'additional_res_packages=': [],
880 # TODO: This isn't always rerun correctly, http://crbug.com/351928
881 '<(DEPTH)/build/android/gyp/util/build_utils.py',
882 '<(DEPTH)/build/android/gyp/package_resources.py',
883 '<(android_manifest_path)',
885 '>@(package_resource_zip_input_paths)',
890 '<(resource_packaged_apk_path)',
893 'python', '<(DEPTH)/build/android/gyp/package_resources.py',
894 '--android-sdk', '<(android_sdk)',
895 '--android-sdk-tools', '<(android_sdk_tools)',
897 '--configuration-name', '<(CONFIGURATION_NAME)',
899 '--android-manifest', '<(android_manifest_path)',
900 '--version-code', '<(app_manifest_version_code)',
901 '--version-name', '<(app_manifest_version_name)',
903 '--asset-dir', '<(asset_location)',
904 '--resource-zips', '>(package_resource_zip_input_paths)',
906 '--no-compress', '<(extensions_to_not_compress)',
908 '--apk-path', '<(resource_packaged_apk_path)',
910 '<@(package_resources_options)',
914 'action_name': 'ant_package_<(_target_name)',
915 'message': 'Packaging <(_target_name)',
917 # Write the inputs list to a file, so that its mtime is updated when
918 # the list of inputs changes.
919 'inputs_list_file': '>|(apk_package.<(_target_name).gypcmd >@(package_input_paths))'
922 '<(DEPTH)/build/android/ant/apk-package.xml',
923 '<(DEPTH)/build/android/gyp/util/build_utils.py',
924 '<(DEPTH)/build/android/gyp/ant.py',
927 '<(obfuscate_stamp)',
928 '<(resource_packaged_apk_path)',
929 '>@(package_input_paths)',
930 '>(inputs_list_file)',
933 '<(unsigned_apk_path)',
936 ['native_lib_target != ""', {
937 'inputs': ['<(native_lib_placeholder_stamp)'],
941 'python', '<(DEPTH)/build/android/gyp/ant.py',
944 '-DDEX_FILE_PATH=<(intermediate_dir)/classes.dex',
945 '-DANDROID_SDK_ROOT=<(android_sdk_root)',
946 '-DANDROID_SDK_TOOLS=<(android_sdk_tools)',
947 '-DRESOURCE_PACKAGED_APK_NAME=<(resource_packaged_apk_name)',
948 '-DAPK_NAME=<(apk_name)',
949 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)',
950 '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)',
951 '-DOUT_DIR=<(intermediate_dir)',
952 '-DUNSIGNED_APK_PATH=<(unsigned_apk_path)',
953 '-DEMMA_INSTRUMENT=<(emma_instrument)',
954 '-DEMMA_DEVICE_JAR=<(emma_device_jar)',
958 '<(DEPTH)/build/android/ant/apk-package.xml',