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_dirs - Additional directories containing Android resources.
28 # additional_res_packages - Package names of the R.java files corresponding to
29 # each directory in additional_res_dirs.
30 # additional_src_dirs - Additional directories with .java files to be compiled
31 # and included in the output of this target.
32 # additional_bundled_libs - Additional libraries what will be stripped and
34 # asset_location - The directory where assets are located.
35 # generated_src_dirs - Same as additional_src_dirs except used for .java files
36 # that are generated at build time. This should be set automatically by a
37 # target's dependencies. The .java files in these directories are not
38 # included in the 'inputs' list (unlike additional_src_dirs).
39 # input_jars_paths - The path to jars to be included in the classpath. This
40 # should be filled automatically by depending on the appropriate targets.
41 # is_test_apk - Set to 1 if building a test apk. This prevents resources from
42 # dependencies from being re-included.
43 # native_lib_target - The target_name of the target which generates the final
44 # shared library to be included in this apk. A stripped copy of the
45 # library will be included in the apk.
46 # resource_dir - The directory for resources.
47 # shared_resources - Make a resource package that can be loaded by a different
48 # application at runtime to access the package's resources.
49 # R_package - A custom Java package to generate the resource file R.java in.
50 # By default, the package given in AndroidManifest.xml will be used.
51 # use_chromium_linker - Enable the content dynamic linker that allows sharing the
52 # RELRO section of the native libraries between the different processes.
53 # load_library_from_zip_file - When using the dynamic linker, load the library
54 # directly out of the zip file.
55 # use_relocation_packer - Enable relocation packing. Relies on the chromium
56 # linker, so use_chromium_linker must also be enabled.
57 # enable_chromium_linker_tests - Enable the content dynamic linker test support
58 # code. This allows a test APK to inject a Linker.TestRunner instance at
59 # runtime. Should only be used by the chromium_linker_test_apk target!!
60 # never_lint - Set to 1 to not run lint on this target.
61 # java_in_dir_suffix - To override the /src suffix on java_in_dir.
62 # app_manifest_version_name - set the apps 'human readable' version number.
63 # app_manifest_version_code - set the apps version number.
66 'tested_apk_obfuscated_jar_path%': '/',
67 'tested_apk_dex_path%': '/',
68 'additional_input_paths': [],
69 'input_jars_paths': [],
70 'library_dexed_jars_paths': [],
71 'additional_src_dirs': [],
72 'generated_src_dirs': [],
73 'app_manifest_version_name%': '<(android_app_version_name)',
74 'app_manifest_version_code%': '<(android_app_version_code)',
75 # aapt generates this proguard.txt.
76 'generated_proguard_file': '<(intermediate_dir)/proguard.txt',
77 'proguard_enabled%': 'false',
78 'proguard_flags_paths': ['<(generated_proguard_file)'],
79 'jar_name': 'chromium_apk_<(_target_name).jar',
80 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res',
82 'additional_R_text_files': [],
83 'dependencies_res_zip_paths': [],
84 'additional_res_packages': [],
85 'additional_bundled_libs%': [],
87 'extensions_to_not_compress%': '',
88 'resource_input_paths': [],
89 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)',
90 'asset_location%': '<(intermediate_dir)/assets',
91 'codegen_stamp': '<(intermediate_dir)/codegen.stamp',
92 'package_input_paths': [],
93 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json',
94 'additional_ordered_libraries_file': '<(intermediate_dir)/additional_native_libraries.json',
95 'native_libraries_template': '<(DEPTH)/base/android/java/templates/NativeLibraries.template',
96 'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/',
97 'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.java',
98 'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.stamp',
99 'native_libraries_template_data_dir': '<(intermediate_dir)/native_libraries/',
100 'native_libraries_template_data_file': '<(native_libraries_template_data_dir)/native_libraries_array.h',
101 'native_libraries_template_version_file': '<(native_libraries_template_data_dir)/native_libraries_version.h',
102 'compile_stamp': '<(intermediate_dir)/compile.stamp',
103 'lint_stamp': '<(intermediate_dir)/lint.stamp',
104 'lint_result': '<(intermediate_dir)/lint_result.xml',
105 'lint_config': '<(intermediate_dir)/lint_config.xml',
107 'java_in_dir_suffix%': '/src',
108 'instr_stamp': '<(intermediate_dir)/instr.stamp',
109 'jar_stamp': '<(intermediate_dir)/jar.stamp',
110 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp',
111 'pack_arm_relocations_stamp': '<(intermediate_dir)/pack_arm_relocations.stamp',
112 'strip_stamp': '<(intermediate_dir)/strip.stamp',
113 'stripped_libraries_dir': '<(intermediate_dir)/stripped_libraries',
114 'strip_additional_stamp': '<(intermediate_dir)/strip_additional.stamp',
115 'version_stamp': '<(intermediate_dir)/version.stamp',
116 'javac_includes': [],
117 'jar_excluded_classes': [],
118 'javac_jar_path': '<(intermediate_dir)/<(_target_name).javac.jar',
119 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)',
120 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar',
121 'test_jar_path': '<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar',
122 'dex_path': '<(intermediate_dir)/classes.dex',
123 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar',
124 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml',
125 'push_stamp': '<(intermediate_dir)/push.stamp',
126 'link_stamp': '<(intermediate_dir)/link.stamp',
127 'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp',
128 'resource_zip_path': '<(intermediate_dir)/<(_target_name).resources.zip',
129 'resource_packaged_apk_name': '<(apk_name)-resources.ap_',
130 'resource_packaged_apk_path': '<(intermediate_dir)/<(resource_packaged_apk_name)',
131 'shared_resources%': 0,
132 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk',
133 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk',
134 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk',
135 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp',
136 'device_intermediate_dir': '/data/data/org.chromium.gyp_managed_install/<(_target_name)/<(CONFIGURATION_NAME)',
137 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh',
138 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh',
139 'create_standalone_apk%': 1,
140 'res_v14_verify_only%': 0,
143 'native_lib_target%': '',
144 'native_lib_version_name%': '',
145 'use_chromium_linker%' : 0,
146 'load_library_from_zip_file%' : 0,
147 'use_relocation_packer%' : 0,
148 'enable_chromium_linker_tests%': 0,
152 ['gyp_managed_install == 1 and native_lib_target != ""', {
153 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-standalone-unsigned.apk',
155 'unsigned_standalone_apk_path': '<(unsigned_apk_path)',
157 ['gyp_managed_install == 1', {
158 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed',
160 'apk_package_native_libs_dir': '<(intermediate_dir)/libs',
162 ['is_test_apk == 0 and emma_coverage != 0', {
163 'emma_instrument%': 1,
165 'emma_instrument%': 0,
169 'native_lib_target%': '',
170 'native_lib_version_name%': '',
171 'use_chromium_linker%' : 0,
172 'load_library_from_zip_file%' : 0,
173 'use_relocation_packer%' : 0,
174 'enable_chromium_linker_tests%': 0,
175 'emma_instrument%': '<(emma_instrument)',
176 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)',
177 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)',
178 'libchromium_android_linker': 'libchromium_android_linker.>(android_product_extension)',
179 'extra_native_libs': [],
180 'native_lib_placeholder_stamp': '<(apk_package_native_libs_dir)/<(android_app_abi)/native_lib_placeholder.stamp',
181 'native_lib_placeholders': [],
183 # Pass the jar path to the apk's "fake" jar target. This would be better as
184 # direct_dependent_settings, but a variable set by a direct_dependent_settings
185 # cannot be lifted in a dependent to all_dependent_settings.
186 'all_dependent_settings': {
188 ['proguard_enabled == "true"', {
190 'proguard_enabled': 'true',
195 'apk_output_jar_path': '<(jar_path)',
196 'tested_apk_obfuscated_jar_path': '<(obfuscated_jar_path)',
197 'tested_apk_dex_path': '<(dex_path)',
201 ['resource_dir!=""', {
203 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ]
206 ['R_package != ""', {
208 # We generate R.java in package R_package (in addition to the package
209 # listed in the AndroidManifest.xml, which is unavoidable).
210 'additional_res_packages': ['<(R_package)'],
211 'additional_R_text_files': ['<(intermediate_dir)/R.txt'],
214 ['native_lib_target != "" and component == "shared_library"', {
216 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries',
219 ['use_chromium_linker == 1', {
221 '<(DEPTH)/base/base.gyp:chromium_android_linker',
224 ['native_lib_target != ""', {
227 ['use_chromium_linker == 1', {
229 'chromium_linker_path': [
230 '<(SHARED_LIB_DIR)/<(libchromium_android_linker)',
235 'chromium_linker_path': [],
239 'generated_src_dirs': [ '<(native_libraries_java_dir)' ],
240 'native_libs_paths': [
241 '<(SHARED_LIB_DIR)/<(native_lib_target).>(android_product_extension)',
242 '<@(chromium_linker_path)'
244 'package_input_paths': [
245 '<(apk_package_native_libs_dir)/<(android_app_abi)/gdbserver',
250 # gdbserver is always copied into the APK's native libs dir. The ant
251 # build scripts (apkbuilder task) will only include it in a debug
253 'destination': '<(apk_package_native_libs_dir)/<(android_app_abi)',
255 '<(android_gdbserver)',
263 '<@(native_libs_paths)',
264 '<@(extra_native_libs)',
267 'includes': ['../build/android/write_ordered_libraries.gypi'],
270 'action_name': 'native_libraries_<(_target_name)',
273 ['use_chromium_linker == 1', {
275 'linker_gcc_preprocess_defines': [
276 '--defines', 'ENABLE_CHROMIUM_LINKER',
281 'linker_gcc_preprocess_defines': [],
284 ['load_library_from_zip_file == 1', {
286 'linker_load_from_zip_file_preprocess_defines': [
287 '--defines', 'ENABLE_CHROMIUM_LINKER_LIBRARY_IN_ZIP_FILE',
292 'linker_load_from_zip_file_preprocess_defines': [],
295 ['enable_chromium_linker_tests == 1', {
297 'linker_tests_gcc_preprocess_defines': [
298 '--defines', 'ENABLE_CHROMIUM_LINKER_TESTS',
303 'linker_tests_gcc_preprocess_defines': [],
307 'gcc_preprocess_defines': [
308 '<@(linker_load_from_zip_file_preprocess_defines)',
309 '<@(linker_gcc_preprocess_defines)',
310 '<@(linker_tests_gcc_preprocess_defines)',
313 'message': 'Creating NativeLibraries.java for <(_target_name)',
315 '<(DEPTH)/build/android/gyp/util/build_utils.py',
316 '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
317 '<(ordered_libraries_file)',
318 '<(native_libraries_template)',
321 '<(native_libraries_java_stamp)',
324 'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
326 '--output=<(native_libraries_java_file)',
327 '--template=<(native_libraries_template)',
328 '--stamp=<(native_libraries_java_stamp)',
329 '--defines', 'NATIVE_LIBRARIES_LIST=@FileArg(<(ordered_libraries_file):java_libraries_list)',
330 '--defines', 'NATIVE_LIBRARIES_VERSION_NUMBER="<(native_lib_version_name)"',
331 '<@(gcc_preprocess_defines)',
335 'action_name': 'strip_native_libraries',
337 'ordered_libraries_file%': '<(ordered_libraries_file)',
338 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
340 '<@(native_libs_paths)',
341 '<@(extra_native_libs)',
343 'stamp': '<(strip_stamp)'
345 'includes': ['../build/android/strip_native_libraries.gypi'],
348 'action_name': 'insert_chromium_version',
350 'ordered_libraries_file%': '<(ordered_libraries_file)',
351 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
352 'version_string': '<(native_lib_version_name)',
356 'stamp': '<(version_stamp)'
358 'includes': ['../build/android/insert_chromium_version.gypi'],
361 'action_name': 'pack_arm_relocations',
364 ['use_chromium_linker == 1 and use_relocation_packer == 1 and profiling != 1', {
370 'exclude_packing_list': [
371 '<(libchromium_android_linker)',
373 'ordered_libraries_file%': '<(ordered_libraries_file)',
374 'stripped_libraries_dir%': '<(stripped_libraries_dir)',
375 'packed_libraries_dir': '<(libraries_source_dir)',
379 'stamp': '<(pack_arm_relocations_stamp)',
381 'includes': ['../build/android/pack_arm_relocations.gypi'],
386 '<@(additional_bundled_libs)',
388 'ordered_libraries_file': '<(additional_ordered_libraries_file)',
389 'subtarget': '_additional_libraries',
391 'includes': ['../build/android/write_ordered_libraries.gypi'],
394 'action_name': 'strip_additional_libraries',
396 'ordered_libraries_file': '<(additional_ordered_libraries_file)',
397 'stripped_libraries_dir': '<(libraries_source_dir)',
399 '<@(additional_bundled_libs)',
402 'stamp': '<(strip_additional_stamp)'
404 'includes': ['../build/android/strip_native_libraries.gypi'],
407 'action_name': 'Create native lib placeholder files for previous releases',
409 'placeholders': ['<@(native_lib_placeholders)'],
411 ['gyp_managed_install == 1', {
412 # This "library" just needs to be put in the .apk. It is not loaded
414 'placeholders': ['libfix.crbug.384638.so'],
419 '<(DEPTH)/build/android/gyp/create_placeholder_files.py',
422 '<(native_lib_placeholder_stamp)',
425 'python', '<(DEPTH)/build/android/gyp/create_placeholder_files.py',
426 '--dest-lib-dir=<(apk_package_native_libs_dir)/<(android_app_abi)/',
427 '--stamp=<(native_lib_placeholder_stamp)',
433 ['gyp_managed_install == 1', {
435 'libraries_top_dir': '<(intermediate_dir)/lib.stripped',
436 'libraries_source_dir': '<(libraries_top_dir)/lib/<(android_app_abi)',
437 'device_library_dir': '<(device_intermediate_dir)/lib.stripped',
438 'configuration_name': '<(CONFIGURATION_NAME)',
441 '<(DEPTH)/build/android/setup.gyp:get_build_device_configurations',
442 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
446 'includes': ['../build/android/push_libraries.gypi'],
449 'action_name': 'create device library symlinks',
450 'message': 'Creating links on device for <(_target_name)',
452 '<(DEPTH)/build/android/gyp/util/build_utils.py',
453 '<(DEPTH)/build/android/gyp/create_device_library_links.py',
454 '<(apk_install_record)',
455 '<(build_device_config_path)',
456 '<(ordered_libraries_file)',
462 'python', '<(DEPTH)/build/android/gyp/create_device_library_links.py',
463 '--build-device-configuration=<(build_device_config_path)',
464 '--libraries=@FileArg(<(ordered_libraries_file):libraries)',
465 '--script-host-path=<(symlink_script_host_path)',
466 '--script-device-path=<(symlink_script_device_path)',
467 '--target-dir=<(device_library_dir)',
468 '--apk=<(incomplete_apk_path)',
469 '--stamp=<(link_stamp)',
470 '--configuration-name=<(CONFIGURATION_NAME)',
475 ['create_standalone_apk == 1', {
478 'action_name': 'create standalone APK',
481 '<(ordered_libraries_file)',
482 '<(strip_additional_stamp)',
483 '<(pack_arm_relocations_stamp)',
485 'input_apk_path': '<(unsigned_apk_path)',
486 'output_apk_path': '<(unsigned_standalone_apk_path)',
487 'libraries_top_dir%': '<(libraries_top_dir)',
489 'includes': [ 'android/create_standalone_apk_action.gypi' ],
495 # gyp_managed_install != 1
497 'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_app_abi)',
498 'package_input_paths': [
499 '<(strip_additional_stamp)',
500 '<(pack_arm_relocations_stamp)',
505 }], # native_lib_target != ''
506 ['gyp_managed_install == 0 or create_standalone_apk == 1', {
509 'action_name': 'finalize standalone apk',
511 'input_apk_path': '<(unsigned_standalone_apk_path)',
512 'output_apk_path': '<(final_apk_path)',
514 'includes': [ 'android/finalize_apk_action.gypi']
518 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar',
521 ['gyp_managed_install == 1', {
524 'action_name': 'finalize incomplete apk',
526 'input_apk_path': '<(unsigned_apk_path)',
527 'output_apk_path': '<(incomplete_apk_path)',
529 'includes': [ 'android/finalize_apk_action.gypi']
532 'action_name': 'apk_install_<(_target_name)',
533 'message': 'Installing <(apk_name).apk',
535 '<(DEPTH)/build/android/gyp/util/build_utils.py',
536 '<(DEPTH)/build/android/gyp/apk_install.py',
537 '<(build_device_config_path)',
538 '<(incomplete_apk_path)',
541 '<(apk_install_record)',
544 'python', '<(DEPTH)/build/android/gyp/apk_install.py',
545 '--apk-path=<(incomplete_apk_path)',
546 '--build-device-configuration=<(build_device_config_path)',
547 '--install-record=<(apk_install_record)',
548 '--configuration-name=<(CONFIGURATION_NAME)',
553 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar',
556 ['is_test_apk == 1', {
558 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
559 '<(DEPTH)/tools/android/android_tools.gyp:android_tools',
564 '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum',
568 'action_name': 'process_resources',
569 'message': 'processing resources for <(_target_name)',
571 # Write the inputs list to a file, so that its mtime is updated when
572 # the list of inputs changes.
573 'inputs_list_file': '>|(apk_codegen.<(_target_name).gypcmd >@(additional_input_paths) >@(resource_input_paths))',
574 'process_resources_options': [],
576 ['is_test_apk == 1', {
577 'dependencies_res_zip_paths=': [],
578 'additional_res_packages=': [],
580 ['res_v14_verify_only == 1', {
581 'process_resources_options+': ['--v14-verify-only']
583 ['shared_resources == 1', {
584 'process_resources_options+': ['--shared-resources']
589 '<(DEPTH)/build/android/gyp/util/build_utils.py',
590 '<(DEPTH)/build/android/gyp/process_resources.py',
591 '<(android_manifest_path)',
592 '>@(additional_input_paths)',
593 '>@(resource_input_paths)',
594 '>@(dependencies_res_zip_paths)',
595 '>(inputs_list_file)',
598 '<(resource_zip_path)',
599 '<(generated_proguard_file)',
603 'python', '<(DEPTH)/build/android/gyp/process_resources.py',
604 '--android-sdk', '<(android_sdk)',
605 '--android-sdk-tools', '<(android_sdk_tools)',
607 '--android-manifest', '<(android_manifest_path)',
608 '--dependencies-res-zips', '>(dependencies_res_zip_paths)',
610 '--extra-res-packages', '>(additional_res_packages)',
611 '--extra-r-text-files', '>(additional_R_text_files)',
613 '--proguard-file', '<(generated_proguard_file)',
615 '--resource-dirs', '<(resource_dir)',
616 '--resource-zip-out', '<(resource_zip_path)',
618 '--R-dir', '<(intermediate_dir)/gen',
620 '--stamp', '<(codegen_stamp)',
622 '<@(process_resources_options)',
626 'action_name': 'javac_<(_target_name)',
627 'message': 'Compiling java for <(_target_name)',
630 '<(intermediate_dir)/gen',
631 '>@(generated_src_dirs)',
633 # If there is a separate find for additional_src_dirs, it will find the
634 # wrong .java files when additional_src_dirs is empty.
635 # TODO(thakis): Gyp caches >! evaluation by command. Both java.gypi and
636 # java_apk.gypi evaluate the same command, and at the moment two targets
637 # set java_in_dir to "java". Add a dummy comment here to make sure
638 # that the two targets (one uses java.gypi, the other java_apk.gypi)
639 # get distinct source lists. Medium-term, make targets list all their
640 # Java files instead of using find. (As is, this will be broken if two
641 # targets use the same java_in_dir and both use java_apk.gypi or
642 # both use java.gypi.)
643 'java_sources': ['>!@(find >(java_in_dir)>(java_in_dir_suffix) >(additional_src_dirs) -name "*.java" # apk)'],
647 '<(DEPTH)/build/android/gyp/util/build_utils.py',
648 '<(DEPTH)/build/android/gyp/javac.py',
650 '>@(input_jars_paths)',
654 ['native_lib_target != ""', {
655 'inputs': [ '<(native_libraries_java_stamp)' ],
663 'python', '<(DEPTH)/build/android/gyp/javac.py',
664 '--classpath=>(input_jars_paths) <(android_sdk_jar)',
665 '--src-gendirs=>(gen_src_dirs)',
666 '--javac-includes=<(javac_includes)',
667 '--chromium-code=<(chromium_code)',
668 '--jar-path=<(javac_jar_path)',
669 '--jar-excluded-classes=<(jar_excluded_classes)',
670 '--stamp=<(compile_stamp)',
675 'action_name': 'instr_jar_<(_target_name)',
676 'message': 'Instrumenting <(_target_name) jar',
678 'input_path': '<(javac_jar_path)',
679 'output_path': '<(jar_path)',
680 'stamp_path': '<(instr_stamp)',
690 'includes': [ 'android/instr_action.gypi' ],
695 '<(java_in_dir)<(java_in_dir_suffix)',
696 '>@(additional_src_dirs)',
698 'lint_jar_path': '<(jar_path)',
699 'stamp_path': '<(lint_stamp)',
700 'result_path': '<(lint_result)',
701 'config_path': '<(lint_config)',
706 'includes': [ 'android/lint_action.gypi' ],
709 'action_name': 'obfuscate_<(_target_name)',
710 'message': 'Obfuscating <(_target_name)',
712 'additional_obfuscate_options': [],
713 'additional_obfuscate_input_paths': [],
714 'proguard_out_dir': '<(intermediate_dir)/proguard',
715 'proguard_input_jar_paths': [
716 '>@(input_jars_paths)',
719 'target_conditions': [
720 ['is_test_apk == 1', {
721 'additional_obfuscate_options': [
725 ['is_test_apk == 1 and tested_apk_obfuscated_jar_path != "/"', {
726 'additional_obfuscate_options': [
727 '--tested-apk-obfuscated-jar-path', '>(tested_apk_obfuscated_jar_path)',
729 'additional_obfuscate_input_paths': [
730 '>(tested_apk_obfuscated_jar_path).info',
733 ['proguard_enabled == "true"', {
734 'additional_obfuscate_options': [
735 '--proguard-enabled',
739 'obfuscate_input_jars_paths': [
740 '>@(input_jars_paths)',
745 ['is_test_apk == 1', {
752 '<(DEPTH)/build/android/gyp/apk_obfuscate.py',
753 '<(DEPTH)/build/android/gyp/util/build_utils.py',
754 '>@(proguard_flags_paths)',
755 '>@(obfuscate_input_jars_paths)',
756 '>@(additional_obfuscate_input_paths)',
760 '<(obfuscate_stamp)',
762 # In non-Release builds, these paths will all be empty files.
763 '<(obfuscated_jar_path)',
764 '<(obfuscated_jar_path).info',
765 '<(obfuscated_jar_path).dump',
766 '<(obfuscated_jar_path).seeds',
767 '<(obfuscated_jar_path).mapping',
768 '<(obfuscated_jar_path).usage',
771 'python', '<(DEPTH)/build/android/gyp/apk_obfuscate.py',
773 '--configuration-name', '<(CONFIGURATION_NAME)',
775 '--android-sdk', '<(android_sdk)',
776 '--android-sdk-tools', '<(android_sdk_tools)',
777 '--android-sdk-jar', '<(android_sdk_jar)',
779 '--input-jars-paths=>(proguard_input_jar_paths)',
780 '--proguard-configs=>(proguard_flags_paths)',
783 '--test-jar-path', '<(test_jar_path)',
784 '--obfuscated-jar-path', '<(obfuscated_jar_path)',
786 '--proguard-jar-path', '<(android_sdk_root)/tools/proguard/lib/proguard.jar',
788 '--stamp', '<(obfuscate_stamp)',
790 '>@(additional_obfuscate_options)',
794 'action_name': 'dex_<(_target_name)',
797 '>@(library_dexed_jars_paths)',
800 'output_path': '<(dex_path)',
801 'proguard_enabled_input_path': '<(obfuscated_jar_path)',
803 'target_conditions': [
804 ['emma_instrument != 0', {
812 ['is_test_apk == 1 and tested_apk_dex_path != "/"', {
814 'dex_additional_options': [
815 '--excluded-paths-file', '>(tested_apk_dex_path).inputs'
819 '>(tested_apk_dex_path).inputs',
822 ['proguard_enabled == "true"', {
823 'inputs': [ '<(obfuscate_stamp)' ]
825 'inputs': [ '<(instr_stamp)' ]
828 'includes': [ 'android/dex_action.gypi' ],
831 'action_name': 'package_resources',
832 'message': 'packaging resources for <(_target_name)',
834 'package_resources_options': [],
835 'package_resource_zip_input_paths': [
836 '<(resource_zip_path)',
837 '>@(dependencies_res_zip_paths)',
840 ['shared_resources == 1', {
841 'package_resources_options+': ['--shared-resources']
846 ['is_test_apk == 1', {
848 'dependencies_res_zip_paths=': [],
849 'additional_res_packages=': [],
854 # TODO: This isn't always rerun correctly, http://crbug.com/351928
855 '<(DEPTH)/build/android/gyp/util/build_utils.py',
856 '<(DEPTH)/build/android/gyp/package_resources.py',
857 '<(android_manifest_path)',
859 '>@(package_resource_zip_input_paths)',
864 '<(resource_packaged_apk_path)',
867 'python', '<(DEPTH)/build/android/gyp/package_resources.py',
868 '--android-sdk', '<(android_sdk)',
869 '--android-sdk-tools', '<(android_sdk_tools)',
871 '--configuration-name', '<(CONFIGURATION_NAME)',
873 '--android-manifest', '<(android_manifest_path)',
874 '--version-code', '<(app_manifest_version_code)',
875 '--version-name', '<(app_manifest_version_name)',
877 '--asset-dir', '<(asset_location)',
878 '--resource-zips', '>(package_resource_zip_input_paths)',
880 '--no-compress', '<(extensions_to_not_compress)',
882 '--apk-path', '<(resource_packaged_apk_path)',
884 '<@(package_resources_options)',
888 'action_name': 'ant_package_<(_target_name)',
889 'message': 'Packaging <(_target_name)',
891 # Write the inputs list to a file, so that its mtime is updated when
892 # the list of inputs changes.
893 'inputs_list_file': '>|(apk_package.<(_target_name).gypcmd >@(package_input_paths))'
896 '<(DEPTH)/build/android/ant/apk-package.xml',
897 '<(DEPTH)/build/android/gyp/util/build_utils.py',
898 '<(DEPTH)/build/android/gyp/ant.py',
901 '<(obfuscate_stamp)',
902 '<(resource_packaged_apk_path)',
903 '>@(package_input_paths)',
904 '>(inputs_list_file)',
907 '<(unsigned_apk_path)',
910 ['native_lib_target != ""', {
911 'inputs': ['<(native_lib_placeholder_stamp)'],
915 'python', '<(DEPTH)/build/android/gyp/ant.py',
918 '-DDEX_FILE_PATH=<(intermediate_dir)/classes.dex',
919 '-DANDROID_SDK_ROOT=<(android_sdk_root)',
920 '-DANDROID_SDK_TOOLS=<(android_sdk_tools)',
921 '-DRESOURCE_PACKAGED_APK_NAME=<(resource_packaged_apk_name)',
922 '-DAPK_NAME=<(apk_name)',
923 '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)',
924 '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)',
925 '-DOUT_DIR=<(intermediate_dir)',
926 '-DUNSIGNED_APK_PATH=<(unsigned_apk_path)',
927 '-DEMMA_INSTRUMENT=<(emma_instrument)',
928 '-DEMMA_DEVICE_JAR=<(emma_device_jar)',
932 '<(DEPTH)/build/android/ant/apk-package.xml',