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 'java_in_dir_suffix%': '/src',
107 'instr_stamp': '<(intermediate_dir)/instr.stamp',
108 'jar_stamp': '<(intermediate_dir)/jar.stamp',
109 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp',
110 'pack_arm_relocations_stamp': '<(intermediate_dir)/pack_arm_relocations.stamp',
111 'strip_stamp': '<(intermediate_dir)/strip.stamp',
112 'stripped_libraries_dir': '<(intermediate_dir)/stripped_libraries',
113 'strip_additional_stamp': '<(intermediate_dir)/strip_additional.stamp',
114 'version_stamp': '<(intermediate_dir)/version.stamp',
115 'javac_includes': [],
116 'jar_excluded_classes': [],
117 'javac_jar_path': '<(intermediate_dir)/<(_target_name).javac.jar',
118 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)',
119 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar',
120 'test_jar_path': '<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar',
121 'dex_path': '<(intermediate_dir)/classes.dex',
122 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar',
123 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml',
124 'push_stamp': '<(intermediate_dir)/push.stamp',
125 'link_stamp': '<(intermediate_dir)/link.stamp',
126 'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp',
127 'resource_zip_path': '<(intermediate_dir)/<(_target_name).resources.zip',
128 'resource_packaged_apk_name': '<(apk_name)-resources.ap_',
129 'resource_packaged_apk_path': '<(intermediate_dir)/<(resource_packaged_apk_name)',
130 'shared_resources%': 0,
131 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk',
132 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk',
133 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk',
134 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp',
135 'device_intermediate_dir': '/data/data/org.chromium.gyp_managed_install/<(_target_name)/<(CONFIGURATION_NAME)',
136 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh',
137 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh',
138 'create_standalone_apk%': 1,
139 'res_v14_verify_only%': 0,
142 'native_lib_target%': '',
143 'native_lib_version_name%': '',
144 'use_chromium_linker%' : 0,
145 'load_library_from_zip_file%' : 0,
146 'use_relocation_packer%' : 0,
147 'enable_chromium_linker_tests%': 0,
151 ['gyp_managed_install == 1 and native_lib_target != ""', {
152 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-standalone-unsigned.apk',
154 'unsigned_standalone_apk_path': '<(unsigned_apk_path)',
156 ['gyp_managed_install == 1', {
157 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed',
159 'apk_package_native_libs_dir': '<(intermediate_dir)/libs',
161 ['is_test_apk == 0 and emma_coverage != 0', {
162 'emma_instrument%': 1,
164 'emma_instrument%': 0,
168 'native_lib_target%': '',
169 'native_lib_version_name%': '',
170 'use_chromium_linker%' : 0,
171 'load_library_from_zip_file%' : 0,
172 'use_relocation_packer%' : 0,
173 'enable_chromium_linker_tests%': 0,
174 'emma_instrument%': '<(emma_instrument)',
175 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)',
176 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)',
177 'libchromium_android_linker': 'libchromium_android_linker.>(android_product_extension)',
178 'extra_native_libs': [],
179 'native_lib_placeholder_stamp': '<(apk_package_native_libs_dir)/<(android_app_abi)/native_lib_placeholder.stamp',
180 'native_lib_placeholders': [],
182 # Pass the jar path to the apk's "fake" jar target. This would be better as
183 # direct_dependent_settings, but a variable set by a direct_dependent_settings
184 # cannot be lifted in a dependent to all_dependent_settings.
185 'all_dependent_settings': {
187 ['proguard_enabled == "true"', {
189 'proguard_enabled': 'true',
194 'apk_output_jar_path': '<(jar_path)',
195 'tested_apk_obfuscated_jar_path': '<(obfuscated_jar_path)',
196 'tested_apk_dex_path': '<(dex_path)',
200 ['resource_dir!=""', {
202 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ]
205 ['R_package != ""', {
207 # We generate R.java in package R_package (in addition to the package
208 # listed in the AndroidManifest.xml, which is unavoidable).
209 'additional_res_packages': ['<(R_package)'],
210 'additional_R_text_files': ['<(intermediate_dir)/R.txt'],
213 ['native_lib_target != "" and component == "shared_library"', {
215 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries',
218 ['use_chromium_linker == 1', {
220 '<(DEPTH)/base/base.gyp:chromium_android_linker',
223 ['native_lib_target != ""', {
226 ['use_chromium_linker == 1', {
228 'chromium_linker_path': [
229 '<(SHARED_LIB_DIR)/<(libchromium_android_linker)',
234 'chromium_linker_path': [],
238 'generated_src_dirs': [ '<(native_libraries_java_dir)' ],
239 'native_libs_paths': [
240 '<(SHARED_LIB_DIR)/<(native_lib_target).>(android_product_extension)',
241 '<@(chromium_linker_path)'
243 'package_input_paths': [
244 '<(apk_package_native_libs_dir)/<(android_app_abi)/gdbserver',
249 # gdbserver is always copied into the APK's native libs dir. The ant
250 # build scripts (apkbuilder task) will only include it in a debug
252 'destination': '<(apk_package_native_libs_dir)/<(android_app_abi)',
254 '<(android_gdbserver)',
262 '<@(native_libs_paths)',
263 '<@(extra_native_libs)',
266 'includes': ['../build/android/write_ordered_libraries.gypi'],
269 'action_name': 'native_libraries_<(_target_name)',
272 ['use_chromium_linker == 1', {
274 'linker_gcc_preprocess_defines': [
275 '--defines', 'ENABLE_CHROMIUM_LINKER',
280 'linker_gcc_preprocess_defines': [],
283 ['load_library_from_zip_file == 1', {
285 'linker_load_from_zip_file_preprocess_defines': [
286 '--defines', 'ENABLE_CHROMIUM_LINKER_LIBRARY_IN_ZIP_FILE',
291 'linker_load_from_zip_file_preprocess_defines': [],
294 ['enable_chromium_linker_tests == 1', {
296 'linker_tests_gcc_preprocess_defines': [
297 '--defines', 'ENABLE_CHROMIUM_LINKER_TESTS',
302 'linker_tests_gcc_preprocess_defines': [],
306 'gcc_preprocess_defines': [
307 '<@(linker_load_from_zip_file_preprocess_defines)',
308 '<@(linker_gcc_preprocess_defines)',
309 '<@(linker_tests_gcc_preprocess_defines)',
312 'message': 'Creating NativeLibraries.java for <(_target_name)',
314 '<(DEPTH)/build/android/gyp/util/build_utils.py',
315 '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
316 '<(ordered_libraries_file)',
317 '<(native_libraries_template)',
320 '<(native_libraries_java_stamp)',
323 'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
325 '--output=<(native_libraries_java_file)',
326 '--template=<(native_libraries_template)',
327 '--stamp=<(native_libraries_java_stamp)',
328 '--defines', 'NATIVE_LIBRARIES_LIST=@FileArg(<(ordered_libraries_file):java_libraries_list)',
329 '--defines', 'NATIVE_LIBRARIES_VERSION_NUMBER="<(native_lib_version_name)"',
330 '<@(gcc_preprocess_defines)',
334 'action_name': 'strip_native_libraries',
336 'ordered_libraries_file%': '<(ordered_libraries_file)',
337 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
339 '<@(native_libs_paths)',
340 '<@(extra_native_libs)',
342 'stamp': '<(strip_stamp)'
344 'includes': ['../build/android/strip_native_libraries.gypi'],
347 'action_name': 'insert_chromium_version',
349 'ordered_libraries_file%': '<(ordered_libraries_file)',
350 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
351 'version_string': '<(native_lib_version_name)',
355 'stamp': '<(version_stamp)'
357 'includes': ['../build/android/insert_chromium_version.gypi'],
360 'action_name': 'pack_arm_relocations',
363 ['use_chromium_linker == 1 and use_relocation_packer == 1 and profiling != 1', {
369 'exclude_packing_list': [
370 '<(libchromium_android_linker)',
372 'ordered_libraries_file%': '<(ordered_libraries_file)',
373 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
374 'packed_libraries_dir': '<(libraries_source_dir)',
378 'stamp': '<(pack_arm_relocations_stamp)',
380 'includes': ['../build/android/pack_arm_relocations.gypi'],
385 '<@(additional_bundled_libs)',
387 'ordered_libraries_file': '<(additional_ordered_libraries_file)',
388 'subtarget': '_additional_libraries',
390 'includes': ['../build/android/write_ordered_libraries.gypi'],
393 'action_name': 'strip_additional_libraries',
395 'ordered_libraries_file': '<(additional_ordered_libraries_file)',
396 'stripped_libraries_dir': '<(libraries_source_dir)',
398 '<@(additional_bundled_libs)',
401 'stamp': '<(strip_additional_stamp)'
403 'includes': ['../build/android/strip_native_libraries.gypi'],
406 'action_name': 'Create native lib placeholder files for previous releases',
408 'placeholders': ['<@(native_lib_placeholders)'],
410 ['gyp_managed_install == 1', {
411 # This "library" just needs to be put in the .apk. It is not loaded
413 'placeholders': ['libfix.crbug.384638.so'],
418 '<(DEPTH)/build/android/gyp/create_placeholder_files.py',
421 '<(native_lib_placeholder_stamp)',
424 'python', '<(DEPTH)/build/android/gyp/create_placeholder_files.py',
425 '--dest-lib-dir=<(apk_package_native_libs_dir)/<(android_app_abi)/',
426 '--stamp=<(native_lib_placeholder_stamp)',
432 ['gyp_managed_install == 1', {
434 'libraries_top_dir': '<(intermediate_dir)/lib.stripped',
435 'libraries_source_dir': '<(libraries_top_dir)/lib/<(android_app_abi)',
436 'device_library_dir': '<(device_intermediate_dir)/lib.stripped',
437 'configuration_name': '<(CONFIGURATION_NAME)',
440 '<(DEPTH)/build/android/setup.gyp:get_build_device_configurations',
441 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
445 'includes': ['../build/android/push_libraries.gypi'],
448 'action_name': 'create device library symlinks',
449 'message': 'Creating links on device for <(_target_name)',
451 '<(DEPTH)/build/android/gyp/util/build_utils.py',
452 '<(DEPTH)/build/android/gyp/create_device_library_links.py',
453 '<(apk_install_record)',
454 '<(build_device_config_path)',
455 '<(ordered_libraries_file)',
461 'python', '<(DEPTH)/build/android/gyp/create_device_library_links.py',
462 '--build-device-configuration=<(build_device_config_path)',
463 '--libraries=@FileArg(<(ordered_libraries_file):libraries)',
464 '--script-host-path=<(symlink_script_host_path)',
465 '--script-device-path=<(symlink_script_device_path)',
466 '--target-dir=<(device_library_dir)',
467 '--apk=<(incomplete_apk_path)',
468 '--stamp=<(link_stamp)',
469 '--configuration-name=<(CONFIGURATION_NAME)',
474 ['create_standalone_apk == 1', {
477 'action_name': 'create standalone APK',
480 '<(ordered_libraries_file)',
481 '<(strip_additional_stamp)',
482 '<(pack_arm_relocations_stamp)',
484 'input_apk_path': '<(unsigned_apk_path)',
485 'output_apk_path': '<(unsigned_standalone_apk_path)',
486 'libraries_top_dir%': '<(libraries_top_dir)',
488 'includes': [ 'android/create_standalone_apk_action.gypi' ],
494 # gyp_managed_install != 1
496 'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_app_abi)',
497 'package_input_paths': [
498 '<(strip_additional_stamp)',
499 '<(pack_arm_relocations_stamp)',
504 }], # native_lib_target != ''
505 ['gyp_managed_install == 0 or create_standalone_apk == 1', {
508 'action_name': 'finalize standalone apk',
510 'input_apk_path': '<(unsigned_standalone_apk_path)',
511 'output_apk_path': '<(final_apk_path)',
513 'includes': [ 'android/finalize_apk_action.gypi']
517 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar',
520 ['gyp_managed_install == 1', {
523 'action_name': 'finalize incomplete apk',
525 'input_apk_path': '<(unsigned_apk_path)',
526 'output_apk_path': '<(incomplete_apk_path)',
528 'includes': [ 'android/finalize_apk_action.gypi']
531 'action_name': 'apk_install_<(_target_name)',
532 'message': 'Installing <(apk_name).apk',
534 '<(DEPTH)/build/android/gyp/util/build_utils.py',
535 '<(DEPTH)/build/android/gyp/apk_install.py',
536 '<(build_device_config_path)',
537 '<(incomplete_apk_path)',
540 '<(apk_install_record)',
543 'python', '<(DEPTH)/build/android/gyp/apk_install.py',
544 '--apk-path=<(incomplete_apk_path)',
545 '--build-device-configuration=<(build_device_config_path)',
546 '--install-record=<(apk_install_record)',
547 '--configuration-name=<(CONFIGURATION_NAME)',
552 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar',
555 ['is_test_apk == 1', {
557 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
558 '<(DEPTH)/tools/android/android_tools.gyp:android_tools',
563 '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum',
567 'action_name': 'process_resources',
568 'message': 'processing resources for <(_target_name)',
570 # Write the inputs list to a file, so that its mtime is updated when
571 # the list of inputs changes.
572 'inputs_list_file': '>|(apk_codegen.<(_target_name).gypcmd >@(additional_input_paths) >@(resource_input_paths))',
573 'process_resources_options': [],
575 ['is_test_apk == 1', {
576 'dependencies_res_zip_paths=': [],
577 'additional_res_packages=': [],
579 ['res_v14_verify_only == 1', {
580 'process_resources_options+': ['--v14-verify-only']
582 ['shared_resources == 1', {
583 'process_resources_options+': ['--shared-resources']
588 '<(DEPTH)/build/android/gyp/util/build_utils.py',
589 '<(DEPTH)/build/android/gyp/process_resources.py',
590 '<(android_manifest_path)',
591 '>@(additional_input_paths)',
592 '>@(resource_input_paths)',
593 '>@(dependencies_res_zip_paths)',
594 '>(inputs_list_file)',
597 '<(resource_zip_path)',
598 '<(generated_proguard_file)',
602 'python', '<(DEPTH)/build/android/gyp/process_resources.py',
603 '--android-sdk', '<(android_sdk)',
604 '--android-sdk-tools', '<(android_sdk_tools)',
606 '--android-manifest', '<(android_manifest_path)',
607 '--dependencies-res-zips', '>(dependencies_res_zip_paths)',
609 '--extra-res-packages', '>(additional_res_packages)',
610 '--extra-r-text-files', '>(additional_R_text_files)',
612 '--proguard-file', '<(generated_proguard_file)',
614 '--resource-dirs', '<(resource_dir)',
615 '--resource-zip-out', '<(resource_zip_path)',
617 '--R-dir', '<(intermediate_dir)/gen',
619 '--stamp', '<(codegen_stamp)',
621 '<@(process_resources_options)',
625 'action_name': 'javac_<(_target_name)',
626 'message': 'Compiling java for <(_target_name)',
629 '<(intermediate_dir)/gen',
630 '>@(generated_src_dirs)',
632 # If there is a separate find for additional_src_dirs, it will find the
633 # wrong .java files when additional_src_dirs is empty.
634 # TODO(thakis): Gyp caches >! evaluation by command. Both java.gypi and
635 # java_apk.gypi evaluate the same command, and at the moment two targets
636 # set java_in_dir to "java". Add a dummy comment here to make sure
637 # that the two targets (one uses java.gypi, the other java_apk.gypi)
638 # get distinct source lists. Medium-term, make targets list all their
639 # Java files instead of using find. (As is, this will be broken if two
640 # targets use the same java_in_dir and both use java_apk.gypi or
641 # both use java.gypi.)
642 'java_sources': ['>!@(find >(java_in_dir)>(java_in_dir_suffix) >(additional_src_dirs) -name "*.java" # apk)'],
646 '<(DEPTH)/build/android/gyp/util/build_utils.py',
647 '<(DEPTH)/build/android/gyp/javac.py',
649 '>@(input_jars_paths)',
653 ['native_lib_target != ""', {
654 'inputs': [ '<(native_libraries_java_stamp)' ],
662 'python', '<(DEPTH)/build/android/gyp/javac.py',
663 '--classpath=>(input_jars_paths) <(android_sdk_jar)',
664 '--src-gendirs=>(gen_src_dirs)',
665 '--javac-includes=<(javac_includes)',
666 '--chromium-code=<(chromium_code)',
667 '--jar-path=<(javac_jar_path)',
668 '--jar-excluded-classes=<(jar_excluded_classes)',
669 '--stamp=<(compile_stamp)',
674 'action_name': 'instr_jar_<(_target_name)',
675 'message': 'Instrumenting <(_target_name) jar',
677 'input_path': '<(javac_jar_path)',
678 'output_path': '<(jar_path)',
679 'stamp_path': '<(instr_stamp)',
689 'includes': [ 'android/instr_action.gypi' ],
694 '<(java_in_dir)<(java_in_dir_suffix)',
695 '>@(additional_src_dirs)',
697 'lint_jar_path': '<(jar_path)',
698 'stamp_path': '<(lint_stamp)',
699 'result_path': '<(lint_result)',
700 'config_path': '<(lint_config)',
705 'includes': [ 'android/lint_action.gypi' ],
708 'action_name': 'obfuscate_<(_target_name)',
709 'message': 'Obfuscating <(_target_name)',
711 'additional_obfuscate_options': [],
712 'additional_obfuscate_input_paths': [],
713 'proguard_out_dir': '<(intermediate_dir)/proguard',
714 'proguard_input_jar_paths': [
715 '>@(input_jars_paths)',
718 'target_conditions': [
719 ['is_test_apk == 1', {
720 'additional_obfuscate_options': [
724 ['is_test_apk == 1 and tested_apk_obfuscated_jar_path != "/"', {
725 'additional_obfuscate_options': [
726 '--tested-apk-obfuscated-jar-path', '>(tested_apk_obfuscated_jar_path)',
728 'additional_obfuscate_input_paths': [
729 '>(tested_apk_obfuscated_jar_path).info',
732 ['proguard_enabled == "true"', {
733 'additional_obfuscate_options': [
734 '--proguard-enabled',
738 'obfuscate_input_jars_paths': [
739 '>@(input_jars_paths)',
744 ['is_test_apk == 1', {
751 '<(DEPTH)/build/android/gyp/apk_obfuscate.py',
752 '<(DEPTH)/build/android/gyp/util/build_utils.py',
753 '>@(proguard_flags_paths)',
754 '>@(obfuscate_input_jars_paths)',
755 '>@(additional_obfuscate_input_paths)',
759 '<(obfuscate_stamp)',
761 # In non-Release builds, these paths will all be empty files.
762 '<(obfuscated_jar_path)',
763 '<(obfuscated_jar_path).info',
764 '<(obfuscated_jar_path).dump',
765 '<(obfuscated_jar_path).seeds',
766 '<(obfuscated_jar_path).mapping',
767 '<(obfuscated_jar_path).usage',
770 'python', '<(DEPTH)/build/android/gyp/apk_obfuscate.py',
772 '--configuration-name', '<(CONFIGURATION_NAME)',
774 '--android-sdk', '<(android_sdk)',
775 '--android-sdk-tools', '<(android_sdk_tools)',
776 '--android-sdk-jar', '<(android_sdk_jar)',
778 '--input-jars-paths=>(proguard_input_jar_paths)',
779 '--proguard-configs=>(proguard_flags_paths)',
782 '--test-jar-path', '<(test_jar_path)',
783 '--obfuscated-jar-path', '<(obfuscated_jar_path)',
785 '--proguard-jar-path', '<(android_sdk_root)/tools/proguard/lib/proguard.jar',
787 '--stamp', '<(obfuscate_stamp)',
789 '>@(additional_obfuscate_options)',
793 'action_name': 'dex_<(_target_name)',
796 '>@(library_dexed_jars_paths)',
799 'output_path': '<(dex_path)',
800 'proguard_enabled_input_path': '<(obfuscated_jar_path)',
802 'target_conditions': [
803 ['emma_instrument != 0', {
811 ['is_test_apk == 1 and tested_apk_dex_path != "/"', {
813 'dex_additional_options': [
814 '--excluded-paths', '@FileArg(>(tested_apk_dex_path).inputs)'
818 '>(tested_apk_dex_path).inputs',
821 ['proguard_enabled == "true"', {
822 'inputs': [ '<(obfuscate_stamp)' ]
824 'inputs': [ '<(instr_stamp)' ]
827 'includes': [ 'android/dex_action.gypi' ],
830 'action_name': 'package_resources',
831 'message': 'packaging resources for <(_target_name)',
833 'package_resources_options': [],
834 'package_resource_zip_input_paths': [
835 '<(resource_zip_path)',
836 '>@(dependencies_res_zip_paths)',
839 ['shared_resources == 1', {
840 'package_resources_options+': ['--shared-resources']
845 ['is_test_apk == 1', {
847 'dependencies_res_zip_paths=': [],
848 'additional_res_packages=': [],
853 # TODO: This isn't always rerun correctly, http://crbug.com/351928
854 '<(DEPTH)/build/android/gyp/util/build_utils.py',
855 '<(DEPTH)/build/android/gyp/package_resources.py',
856 '<(android_manifest_path)',
858 '>@(package_resource_zip_input_paths)',
863 '<(resource_packaged_apk_path)',
866 'python', '<(DEPTH)/build/android/gyp/package_resources.py',
867 '--android-sdk', '<(android_sdk)',
868 '--android-sdk-tools', '<(android_sdk_tools)',
870 '--configuration-name', '<(CONFIGURATION_NAME)',
872 '--android-manifest', '<(android_manifest_path)',
873 '--version-code', '<(app_manifest_version_code)',
874 '--version-name', '<(app_manifest_version_name)',
876 '--asset-dir', '<(asset_location)',
877 '--resource-zips', '>(package_resource_zip_input_paths)',
879 '--no-compress', '<(extensions_to_not_compress)',
881 '--apk-path', '<(resource_packaged_apk_path)',
883 '<@(package_resources_options)',
887 'action_name': 'ant_package_<(_target_name)',
888 'message': 'Packaging <(_target_name)',
890 # Write the inputs list to a file, so that its mtime is updated when
891 # the list of inputs changes.
892 'inputs_list_file': '>|(apk_package.<(_target_name).gypcmd >@(package_input_paths))'
895 '<(DEPTH)/build/android/ant/apk-package.xml',
896 '<(DEPTH)/build/android/gyp/util/build_utils.py',
897 '<(DEPTH)/build/android/gyp/ant.py',
900 '<(obfuscate_stamp)',
901 '<(resource_packaged_apk_path)',
902 '>@(package_input_paths)',
903 '>(inputs_list_file)',
906 '<(unsigned_apk_path)',
909 ['native_lib_target != ""', {
910 'inputs': ['<(native_lib_placeholder_stamp)'],
914 'python', '<(DEPTH)/build/android/gyp/ant.py',
917 '-DDEX_FILE_PATH=<(intermediate_dir)/classes.dex',
918 '-DANDROID_SDK_ROOT=<(android_sdk_root)',
919 '-DANDROID_SDK_TOOLS=<(android_sdk_tools)',
920 '-DRESOURCE_PACKAGED_APK_NAME=<(resource_packaged_apk_name)',
921 '-DAPK_NAME=<(apk_name)',
922 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)',
923 '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)',
924 '-DOUT_DIR=<(intermediate_dir)',
925 '-DUNSIGNED_APK_PATH=<(unsigned_apk_path)',
926 '-DEMMA_INSTRUMENT=<(emma_instrument)',
927 '-DEMMA_DEVICE_JAR=<(emma_device_jar)',
931 '<(DEPTH)/build/android/ant/apk-package.xml',