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 'push_stamp': '<(intermediate_dir)/push.stamp',
130 'link_stamp': '<(intermediate_dir)/link.stamp',
131 'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp',
132 'resource_zip_path': '<(intermediate_dir)/<(_target_name).resources.zip',
133 'resource_packaged_apk_name': '<(apk_name)-resources.ap_',
134 'resource_packaged_apk_path': '<(intermediate_dir)/<(resource_packaged_apk_name)',
135 'shared_resources%': 0,
136 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk',
137 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk',
138 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk',
139 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp',
140 'device_intermediate_dir': '/data/data/org.chromium.gyp_managed_install/<(_target_name)/<(CONFIGURATION_NAME)',
141 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh',
142 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh',
143 'create_standalone_apk%': 1,
144 'res_v14_verify_only%': 0,
147 'native_lib_target%': '',
148 'native_lib_version_name%': '',
149 'use_chromium_linker%' : 0,
150 'load_library_from_zip_file%' : 0,
151 'use_relocation_packer%' : 0,
152 'enable_chromium_linker_tests%': 0,
156 ['gyp_managed_install == 1 and native_lib_target != ""', {
157 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-standalone-unsigned.apk',
159 'unsigned_standalone_apk_path': '<(unsigned_apk_path)',
161 ['gyp_managed_install == 1', {
162 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed',
164 'apk_package_native_libs_dir': '<(intermediate_dir)/libs',
166 ['is_test_apk == 0 and emma_coverage != 0', {
167 'emma_instrument%': 1,
169 'emma_instrument%': 0,
173 'native_lib_target%': '',
174 'native_lib_version_name%': '',
175 'use_chromium_linker%' : 0,
176 'load_library_from_zip_file%' : 0,
177 'use_relocation_packer%' : 0,
178 'enable_chromium_linker_tests%': 0,
179 'emma_instrument%': '<(emma_instrument)',
180 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)',
181 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)',
182 'libchromium_android_linker': 'libchromium_android_linker.>(android_product_extension)',
183 'extra_native_libs': [],
184 'native_lib_placeholder_stamp': '<(apk_package_native_libs_dir)/<(android_app_abi)/native_lib_placeholder.stamp',
185 'native_lib_placeholders': [],
187 # Pass the jar path to the apk's "fake" jar target. This would be better as
188 # direct_dependent_settings, but a variable set by a direct_dependent_settings
189 # cannot be lifted in a dependent to all_dependent_settings.
190 'all_dependent_settings': {
192 ['proguard_enabled == "true"', {
194 'proguard_enabled': 'true',
199 'apk_output_jar_path': '<(jar_path)',
200 'tested_apk_obfuscated_jar_path': '<(obfuscated_jar_path)',
201 'tested_apk_dex_path': '<(dex_path)',
205 ['resource_dir!=""', {
207 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ]
210 ['R_package != ""', {
212 # We generate R.java in package R_package (in addition to the package
213 # listed in the AndroidManifest.xml, which is unavoidable).
214 'additional_res_packages': ['<(R_package)'],
215 'additional_R_text_files': ['<(intermediate_dir)/R.txt'],
218 ['native_lib_target != "" and component == "shared_library"', {
220 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries',
223 ['use_chromium_linker == 1', {
225 '<(DEPTH)/base/base.gyp:chromium_android_linker',
228 ['native_lib_target != ""', {
231 ['use_chromium_linker == 1', {
233 'chromium_linker_path': [
234 '<(SHARED_LIB_DIR)/<(libchromium_android_linker)',
239 'chromium_linker_path': [],
243 'generated_src_dirs': [ '<(native_libraries_java_dir)' ],
244 'native_libs_paths': [
245 '<(SHARED_LIB_DIR)/<(native_lib_target).>(android_product_extension)',
246 '<@(chromium_linker_path)'
248 'package_input_paths': [
249 '<(apk_package_native_libs_dir)/<(android_app_abi)/gdbserver',
254 # gdbserver is always copied into the APK's native libs dir. The ant
255 # build scripts (apkbuilder task) will only include it in a debug
257 'destination': '<(apk_package_native_libs_dir)/<(android_app_abi)',
259 '<(android_gdbserver)',
267 '<@(native_libs_paths)',
268 '<@(extra_native_libs)',
271 'includes': ['../build/android/write_ordered_libraries.gypi'],
274 'action_name': 'native_libraries_<(_target_name)',
277 ['use_chromium_linker == 1', {
279 'linker_gcc_preprocess_defines': [
280 '--defines', 'ENABLE_CHROMIUM_LINKER',
285 'linker_gcc_preprocess_defines': [],
288 ['load_library_from_zip_file == 1', {
290 'linker_load_from_zip_file_preprocess_defines': [
291 '--defines', 'ENABLE_CHROMIUM_LINKER_LIBRARY_IN_ZIP_FILE',
296 'linker_load_from_zip_file_preprocess_defines': [],
299 ['enable_chromium_linker_tests == 1', {
301 'linker_tests_gcc_preprocess_defines': [
302 '--defines', 'ENABLE_CHROMIUM_LINKER_TESTS',
307 'linker_tests_gcc_preprocess_defines': [],
311 'gcc_preprocess_defines': [
312 '<@(linker_load_from_zip_file_preprocess_defines)',
313 '<@(linker_gcc_preprocess_defines)',
314 '<@(linker_tests_gcc_preprocess_defines)',
317 'message': 'Creating NativeLibraries.java for <(_target_name)',
319 '<(DEPTH)/build/android/gyp/util/build_utils.py',
320 '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
321 '<(ordered_libraries_file)',
322 '<(native_libraries_template)',
325 '<(native_libraries_java_stamp)',
328 'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
330 '--output=<(native_libraries_java_file)',
331 '--template=<(native_libraries_template)',
332 '--stamp=<(native_libraries_java_stamp)',
333 '--defines', 'NATIVE_LIBRARIES_LIST=@FileArg(<(ordered_libraries_file):java_libraries_list)',
334 '--defines', 'NATIVE_LIBRARIES_VERSION_NUMBER="<(native_lib_version_name)"',
335 '<@(gcc_preprocess_defines)',
339 'action_name': 'strip_native_libraries',
341 'ordered_libraries_file%': '<(ordered_libraries_file)',
342 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
344 '<@(native_libs_paths)',
345 '<@(extra_native_libs)',
347 'stamp': '<(strip_stamp)'
349 'includes': ['../build/android/strip_native_libraries.gypi'],
352 'action_name': 'insert_chromium_version',
354 'ordered_libraries_file%': '<(ordered_libraries_file)',
355 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
356 'version_string': '<(native_lib_version_name)',
360 'stamp': '<(version_stamp)'
362 'includes': ['../build/android/insert_chromium_version.gypi'],
365 'action_name': 'pack_arm_relocations',
368 ['use_chromium_linker == 1 and use_relocation_packer == 1 and profiling != 1', {
374 'exclude_packing_list': [
375 '<(libchromium_android_linker)',
377 'ordered_libraries_file%': '<(ordered_libraries_file)',
378 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
379 'packed_libraries_dir': '<(libraries_source_dir)',
383 'stamp': '<(pack_arm_relocations_stamp)',
385 'includes': ['../build/android/pack_arm_relocations.gypi'],
390 '<@(additional_bundled_libs)',
392 'ordered_libraries_file': '<(additional_ordered_libraries_file)',
393 'subtarget': '_additional_libraries',
395 'includes': ['../build/android/write_ordered_libraries.gypi'],
398 'action_name': 'strip_additional_libraries',
400 'ordered_libraries_file': '<(additional_ordered_libraries_file)',
401 'stripped_libraries_dir': '<(libraries_source_dir)',
403 '<@(additional_bundled_libs)',
406 'stamp': '<(strip_additional_stamp)'
408 'includes': ['../build/android/strip_native_libraries.gypi'],
411 'action_name': 'Create native lib placeholder files for previous releases',
413 'placeholders': ['<@(native_lib_placeholders)'],
415 ['gyp_managed_install == 1', {
416 # This "library" just needs to be put in the .apk. It is not loaded
418 'placeholders': ['libfix.crbug.384638.so'],
423 '<(DEPTH)/build/android/gyp/create_placeholder_files.py',
426 '<(native_lib_placeholder_stamp)',
429 'python', '<(DEPTH)/build/android/gyp/create_placeholder_files.py',
430 '--dest-lib-dir=<(apk_package_native_libs_dir)/<(android_app_abi)/',
431 '--stamp=<(native_lib_placeholder_stamp)',
437 ['gyp_managed_install == 1', {
439 'libraries_top_dir': '<(intermediate_dir)/lib.stripped',
440 'libraries_source_dir': '<(libraries_top_dir)/lib/<(android_app_abi)',
441 'device_library_dir': '<(device_intermediate_dir)/lib.stripped',
442 'configuration_name': '<(CONFIGURATION_NAME)',
445 '<(DEPTH)/build/android/setup.gyp:get_build_device_configurations',
446 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
450 'includes': ['../build/android/push_libraries.gypi'],
453 'action_name': 'create device library symlinks',
454 'message': 'Creating links on device for <(_target_name)',
456 '<(DEPTH)/build/android/gyp/util/build_utils.py',
457 '<(DEPTH)/build/android/gyp/create_device_library_links.py',
458 '<(apk_install_record)',
459 '<(build_device_config_path)',
460 '<(ordered_libraries_file)',
466 'python', '<(DEPTH)/build/android/gyp/create_device_library_links.py',
467 '--build-device-configuration=<(build_device_config_path)',
468 '--libraries=@FileArg(<(ordered_libraries_file):libraries)',
469 '--script-host-path=<(symlink_script_host_path)',
470 '--script-device-path=<(symlink_script_device_path)',
471 '--target-dir=<(device_library_dir)',
472 '--apk=<(incomplete_apk_path)',
473 '--stamp=<(link_stamp)',
474 '--configuration-name=<(CONFIGURATION_NAME)',
479 ['create_standalone_apk == 1', {
482 'action_name': 'create standalone APK',
485 '<(ordered_libraries_file)',
486 '<(strip_additional_stamp)',
487 '<(pack_arm_relocations_stamp)',
489 'input_apk_path': '<(unsigned_apk_path)',
490 'output_apk_path': '<(unsigned_standalone_apk_path)',
491 'libraries_top_dir%': '<(libraries_top_dir)',
493 'includes': [ 'android/create_standalone_apk_action.gypi' ],
499 # gyp_managed_install != 1
501 'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_app_abi)',
502 'package_input_paths': [
503 '<(strip_additional_stamp)',
504 '<(pack_arm_relocations_stamp)',
509 }], # native_lib_target != ''
510 ['gyp_managed_install == 0 or create_standalone_apk == 1', {
513 'action_name': 'finalize standalone apk',
515 'input_apk_path': '<(unsigned_standalone_apk_path)',
516 'output_apk_path': '<(final_apk_path)',
518 'includes': [ 'android/finalize_apk_action.gypi']
522 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar',
525 ['gyp_managed_install == 1', {
528 'action_name': 'finalize incomplete apk',
530 'input_apk_path': '<(unsigned_apk_path)',
531 'output_apk_path': '<(incomplete_apk_path)',
533 'includes': [ 'android/finalize_apk_action.gypi']
536 'action_name': 'apk_install_<(_target_name)',
537 'message': 'Installing <(apk_name).apk',
539 '<(DEPTH)/build/android/gyp/util/build_utils.py',
540 '<(DEPTH)/build/android/gyp/apk_install.py',
541 '<(build_device_config_path)',
542 '<(incomplete_apk_path)',
545 '<(apk_install_record)',
548 'python', '<(DEPTH)/build/android/gyp/apk_install.py',
549 '--apk-path=<(incomplete_apk_path)',
550 '--build-device-configuration=<(build_device_config_path)',
551 '--install-record=<(apk_install_record)',
552 '--configuration-name=<(CONFIGURATION_NAME)',
557 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar',
560 ['is_test_apk == 1', {
562 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
563 '<(DEPTH)/tools/android/android_tools.gyp:android_tools',
566 ['run_findbugs == 1', {
569 'action_name': 'findbugs_<(_target_name)',
570 'message': 'Running findbugs on <(_target_name)',
572 '<(DEPTH)/build/android/findbugs_diff.py',
573 '<(DEPTH)/build/android/findbugs_filter/findbugs_exclude.xml',
574 '<(DEPTH)/build/android/pylib/utils/findbugs.py',
575 '>@(input_jars_paths)',
583 'python', '<(DEPTH)/build/android/findbugs_diff.py',
584 '--auxclasspath-gyp', '>(input_jars_paths)',
585 '--stamp', '<(findbugs_stamp)',
594 '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum',
598 'action_name': 'process_resources',
599 'message': 'processing resources for <(_target_name)',
601 # Write the inputs list to a file, so that its mtime is updated when
602 # the list of inputs changes.
603 'inputs_list_file': '>|(apk_codegen.<(_target_name).gypcmd >@(additional_input_paths) >@(resource_input_paths))',
604 'process_resources_options': [],
606 ['is_test_apk == 1', {
607 'dependencies_res_zip_paths=': [],
608 'additional_res_packages=': [],
610 ['res_v14_verify_only == 1', {
611 'process_resources_options+': ['--v14-verify-only']
613 ['shared_resources == 1', {
614 'process_resources_options+': ['--shared-resources']
616 ['R_package != ""', {
617 'process_resources_options+': ['--custom-package', '<(R_package)']
619 ['include_all_resources == 1', {
620 'process_resources_options+': ['--include-all-resources']
625 '<(DEPTH)/build/android/gyp/util/build_utils.py',
626 '<(DEPTH)/build/android/gyp/process_resources.py',
627 '<(android_manifest_path)',
628 '>@(additional_input_paths)',
629 '>@(resource_input_paths)',
630 '>@(dependencies_res_zip_paths)',
631 '>(inputs_list_file)',
634 '<(resource_zip_path)',
635 '<(generated_proguard_file)',
639 'python', '<(DEPTH)/build/android/gyp/process_resources.py',
640 '--android-sdk', '<(android_sdk)',
641 '--android-sdk-tools', '<(android_sdk_tools)',
643 '--android-manifest', '<(android_manifest_path)',
644 '--dependencies-res-zips', '>(dependencies_res_zip_paths)',
646 '--extra-res-packages', '>(additional_res_packages)',
647 '--extra-r-text-files', '>(additional_R_text_files)',
649 '--proguard-file', '<(generated_proguard_file)',
651 '--resource-dirs', '<(resource_dir)',
652 '--resource-zip-out', '<(resource_zip_path)',
654 '--R-dir', '<(intermediate_dir)/gen',
656 '--stamp', '<(codegen_stamp)',
658 '<@(process_resources_options)',
662 'action_name': 'javac_<(_target_name)',
663 'message': 'Compiling java for <(_target_name)',
666 '<(intermediate_dir)/gen',
667 '>@(generated_src_dirs)',
669 # If there is a separate find for additional_src_dirs, it will find the
670 # wrong .java files when additional_src_dirs is empty.
671 # TODO(thakis): Gyp caches >! evaluation by command. Both java.gypi and
672 # java_apk.gypi evaluate the same command, and at the moment two targets
673 # set java_in_dir to "java". Add a dummy comment here to make sure
674 # that the two targets (one uses java.gypi, the other java_apk.gypi)
675 # get distinct source lists. Medium-term, make targets list all their
676 # Java files instead of using find. (As is, this will be broken if two
677 # targets use the same java_in_dir and both use java_apk.gypi or
678 # both use java.gypi.)
679 'java_sources': ['>!@(find >(java_in_dir)>(java_in_dir_suffix) >(additional_src_dirs) -name "*.java" # apk)'],
683 '<(DEPTH)/build/android/gyp/util/build_utils.py',
684 '<(DEPTH)/build/android/gyp/javac.py',
686 '>@(input_jars_paths)',
690 ['native_lib_target != ""', {
691 'inputs': [ '<(native_libraries_java_stamp)' ],
699 'python', '<(DEPTH)/build/android/gyp/javac.py',
700 '--classpath=>(input_jars_paths) <(android_sdk_jar)',
701 '--src-gendirs=>(gen_src_dirs)',
702 '--javac-includes=<(javac_includes)',
703 '--chromium-code=<(chromium_code)',
704 '--jar-path=<(javac_jar_path)',
705 '--jar-excluded-classes=<(jar_excluded_classes)',
706 '--stamp=<(compile_stamp)',
711 'action_name': 'instr_jar_<(_target_name)',
712 'message': 'Instrumenting <(_target_name) jar',
714 'input_path': '<(javac_jar_path)',
715 'output_path': '<(jar_path)',
716 'stamp_path': '<(instr_stamp)',
726 'includes': [ 'android/instr_action.gypi' ],
731 '<(java_in_dir)<(java_in_dir_suffix)',
732 '>@(additional_src_dirs)',
734 'lint_jar_path': '<(jar_path)',
735 'stamp_path': '<(lint_stamp)',
736 'result_path': '<(lint_result)',
737 'config_path': '<(lint_config)',
742 'includes': [ 'android/lint_action.gypi' ],
745 'action_name': 'obfuscate_<(_target_name)',
746 'message': 'Obfuscating <(_target_name)',
748 'additional_obfuscate_options': [],
749 'additional_obfuscate_input_paths': [],
750 'proguard_out_dir': '<(intermediate_dir)/proguard',
751 'proguard_input_jar_paths': [
752 '>@(input_jars_paths)',
755 'target_conditions': [
756 ['is_test_apk == 1', {
757 'additional_obfuscate_options': [
761 ['is_test_apk == 1 and tested_apk_obfuscated_jar_path != "/"', {
762 'additional_obfuscate_options': [
763 '--tested-apk-obfuscated-jar-path', '>(tested_apk_obfuscated_jar_path)',
765 'additional_obfuscate_input_paths': [
766 '>(tested_apk_obfuscated_jar_path).info',
769 ['proguard_enabled == "true"', {
770 'additional_obfuscate_options': [
771 '--proguard-enabled',
775 'obfuscate_input_jars_paths': [
776 '>@(input_jars_paths)',
781 ['is_test_apk == 1', {
788 '<(DEPTH)/build/android/gyp/apk_obfuscate.py',
789 '<(DEPTH)/build/android/gyp/util/build_utils.py',
790 '>@(proguard_flags_paths)',
791 '>@(obfuscate_input_jars_paths)',
792 '>@(additional_obfuscate_input_paths)',
796 '<(obfuscate_stamp)',
798 # In non-Release builds, these paths will all be empty files.
799 '<(obfuscated_jar_path)',
800 '<(obfuscated_jar_path).info',
801 '<(obfuscated_jar_path).dump',
802 '<(obfuscated_jar_path).seeds',
803 '<(obfuscated_jar_path).mapping',
804 '<(obfuscated_jar_path).usage',
807 'python', '<(DEPTH)/build/android/gyp/apk_obfuscate.py',
809 '--configuration-name', '<(CONFIGURATION_NAME)',
811 '--android-sdk', '<(android_sdk)',
812 '--android-sdk-tools', '<(android_sdk_tools)',
813 '--android-sdk-jar', '<(android_sdk_jar)',
815 '--input-jars-paths=>(proguard_input_jar_paths)',
816 '--proguard-configs=>(proguard_flags_paths)',
818 '--test-jar-path', '<(test_jar_path)',
819 '--obfuscated-jar-path', '<(obfuscated_jar_path)',
821 '--proguard-jar-path', '<(android_sdk_root)/tools/proguard/lib/proguard.jar',
823 '--stamp', '<(obfuscate_stamp)',
825 '>@(additional_obfuscate_options)',
829 'action_name': 'dex_<(_target_name)',
832 '>@(library_dexed_jars_paths)',
835 'output_path': '<(dex_path)',
836 'proguard_enabled_input_path': '<(obfuscated_jar_path)',
838 'target_conditions': [
839 ['emma_instrument != 0', {
847 ['is_test_apk == 1 and tested_apk_dex_path != "/"', {
849 'dex_additional_options': [
850 '--excluded-paths', '@FileArg(>(tested_apk_dex_path).inputs)'
854 '>(tested_apk_dex_path).inputs',
857 ['proguard_enabled == "true"', {
858 'inputs': [ '<(obfuscate_stamp)' ]
860 'inputs': [ '<(instr_stamp)' ]
863 'includes': [ 'android/dex_action.gypi' ],
866 'action_name': 'package_resources',
867 'message': 'packaging resources for <(_target_name)',
869 'package_resources_options': [],
870 'package_resource_zip_input_paths': [
871 '<(resource_zip_path)',
872 '>@(dependencies_res_zip_paths)',
875 ['shared_resources == 1', {
876 'package_resources_options+': ['--shared-resources']
881 ['is_test_apk == 1', {
883 'dependencies_res_zip_paths=': [],
884 'additional_res_packages=': [],
889 # TODO: This isn't always rerun correctly, http://crbug.com/351928
890 '<(DEPTH)/build/android/gyp/util/build_utils.py',
891 '<(DEPTH)/build/android/gyp/package_resources.py',
892 '<(android_manifest_path)',
894 '>@(package_resource_zip_input_paths)',
899 '<(resource_packaged_apk_path)',
902 'python', '<(DEPTH)/build/android/gyp/package_resources.py',
903 '--android-sdk', '<(android_sdk)',
904 '--android-sdk-tools', '<(android_sdk_tools)',
906 '--configuration-name', '<(CONFIGURATION_NAME)',
908 '--android-manifest', '<(android_manifest_path)',
909 '--version-code', '<(app_manifest_version_code)',
910 '--version-name', '<(app_manifest_version_name)',
912 '--asset-dir', '<(asset_location)',
913 '--resource-zips', '>(package_resource_zip_input_paths)',
915 '--no-compress', '<(extensions_to_not_compress)',
917 '--apk-path', '<(resource_packaged_apk_path)',
919 '<@(package_resources_options)',
923 'action_name': 'ant_package_<(_target_name)',
924 'message': 'Packaging <(_target_name)',
926 # Write the inputs list to a file, so that its mtime is updated when
927 # the list of inputs changes.
928 'inputs_list_file': '>|(apk_package.<(_target_name).gypcmd >@(package_input_paths))'
931 '<(DEPTH)/build/android/ant/apk-package.xml',
932 '<(DEPTH)/build/android/gyp/util/build_utils.py',
933 '<(DEPTH)/build/android/gyp/ant.py',
936 '<(obfuscate_stamp)',
937 '<(resource_packaged_apk_path)',
938 '>@(package_input_paths)',
939 '>(inputs_list_file)',
942 '<(unsigned_apk_path)',
945 ['native_lib_target != ""', {
946 'inputs': ['<(native_lib_placeholder_stamp)'],
950 'python', '<(DEPTH)/build/android/gyp/ant.py',
953 '-DDEX_FILE_PATH=<(intermediate_dir)/classes.dex',
954 '-DANDROID_SDK_ROOT=<(android_sdk_root)',
955 '-DANDROID_SDK_TOOLS=<(android_sdk_tools)',
956 '-DRESOURCE_PACKAGED_APK_NAME=<(resource_packaged_apk_name)',
957 '-DAPK_NAME=<(apk_name)',
958 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)',
959 '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)',
960 '-DOUT_DIR=<(intermediate_dir)',
961 '-DUNSIGNED_APK_PATH=<(unsigned_apk_path)',
962 '-DEMMA_INSTRUMENT=<(emma_instrument)',
963 '-DEMMA_DEVICE_JAR=<(emma_device_jar)',
967 '<(DEPTH)/build/android/ant/apk-package.xml',