Suppress leak caused by 107541 (chrome not calling SkGraphics::Term())
[chromium-blink-merge.git] / build / java_apk.gypi
blobe388690f767a9941d92b944f4d09ffba3ce71ac9
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:
9 # {
10 #   'target_name': 'my_package_apk',
11 #   'type': 'none',
12 #   'variables': {
13 #     'apk_name': 'MyPackage',
14 #     'java_in_dir': 'path/to/package/root',
15 #     'resource_dir': 'path/to/package/root/res',
16 #   },
17 #   'includes': ['path/to/this/gypi/file'],
18 # }
20 # Required variables:
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
23 #    <(java_in_dir)/src.
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 #  asset_location - The directory where assets are located.
33 #  generated_src_dirs - Same as additional_src_dirs except used for .java files
34 #    that are generated at build time. This should be set automatically by a
35 #    target's dependencies. The .java files in these directories are not
36 #    included in the 'inputs' list (unlike additional_src_dirs).
37 #  input_jars_paths - The path to jars to be included in the classpath. This
38 #    should be filled automatically by depending on the appropriate targets.
39 #  is_test_apk - Set to 1 if building a test apk.  This prevents resources from
40 #    dependencies from being re-included.
41 #  native_lib_target - The target_name of the target which generates the final
42 #    shared library to be included in this apk. A stripped copy of the
43 #    library will be included in the apk.
44 #  resource_dir - The directory for resources.
45 #  R_package - A custom Java package to generate the resource file R.java in.
46 #    By default, the package given in AndroidManifest.xml will be used.
47 #  java_strings_grd - The name of the grd file from which to generate localized
48 #    strings.xml files, if any.
49 #  library_manifest_paths'- Paths to additional AndroidManifest.xml files from
50 #    libraries.
53   'variables': {
54     'additional_input_paths': [],
55     'input_jars_paths': [],
56     'library_dexed_jars_paths': [],
57     'additional_src_dirs': [],
58     'generated_src_dirs': [],
59     'app_manifest_version_name%': '<(android_app_version_name)',
60     'app_manifest_version_code%': '<(android_app_version_code)',
61     'proguard_enabled%': 'false',
62     'proguard_flags_paths%': ['<(DEPTH)/build/android/empty_proguard.flags'],
63     'jar_name': 'chromium_apk_<(_target_name).jar',
64     'resource_dir%':'<(DEPTH)/build/android/ant/empty/res',
65     'R_package%':'',
66     'additional_R_text_files': [],
67     'additional_res_dirs': [],
68     'additional_res_packages': [],
69     'is_test_apk%': 0,
70     'java_strings_grd%': '',
71     'library_manifest_paths' : [],
72     'resource_input_paths': [],
73     'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)',
74     'asset_location%': '<(intermediate_dir)/assets',
75     'codegen_stamp': '<(intermediate_dir)/codegen.stamp',
76     'compile_input_paths': [],
77     'package_input_paths': [],
78     'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json',
79     # TODO(cjhopman): build/ shouldn't refer to content/. The libraryloader and
80     # nativelibraries template should be moved out of content/ (to base/?).
81     # http://crbug.com/225101
82     'native_libraries_template': '<(DEPTH)/content/public/android/java/templates/NativeLibraries.template',
83     'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/',
84     'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.java',
85     'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.stamp',
86     'native_libraries_template_data_dir': '<(intermediate_dir)/native_libraries/',
87     'native_libraries_template_data_file': '<(native_libraries_template_data_dir)/native_libraries_array.h',
88     'native_libraries_template_data_stamp': '<(intermediate_dir)/native_libraries_template_data.stamp',
89     'compile_stamp': '<(intermediate_dir)/compile.stamp',
90     'jar_stamp': '<(intermediate_dir)/jar.stamp',
91     'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp',
92     'strip_stamp': '<(intermediate_dir)/strip.stamp',
93     'classes_dir': '<(intermediate_dir)/classes',
94     'javac_includes': [],
95     'jar_excluded_classes': [],
96     'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)',
97     'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar',
98     'dex_path': '<(intermediate_dir)/classes.dex',
99     'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml',
100     'push_stamp': '<(intermediate_dir)/push.stamp',
101     'link_stamp': '<(intermediate_dir)/link.stamp',
102     'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp',
103     'codegen_input_paths': [],
104     'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk',
105     'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk',
106     'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk',
107     'source_dir': '<(java_in_dir)/src',
108     'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp',
109     'device_intermediate_dir': '/data/local/tmp/chromium/<(_target_name)/<(CONFIGURATION_NAME)',
110     'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh',
111     'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh',
112     'create_standalone_apk%': 1,
113     'variables': {
114       'variables': {
115         'native_lib_target%': '',
116       },
117       'conditions': [
118         ['gyp_managed_install == 1 and native_lib_target != ""', {
119           'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-standalone-unsigned.apk',
120         }, {
121           'unsigned_standalone_apk_path': '<(unsigned_apk_path)',
122         }],
123         ['gyp_managed_install == 1', {
124           'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed',
125         }, {
126           'apk_package_native_libs_dir': '<(intermediate_dir)/libs',
127         }],
128       ],
129     },
130     'native_lib_target%': '',
131     'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)',
132     'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)',
133   },
134   # Pass the jar path to the apk's "fake" jar target.  This would be better as
135   # direct_dependent_settings, but a variable set by a direct_dependent_settings
136   # cannot be lifted in a dependent to all_dependent_settings.
137   'all_dependent_settings': {
138     'variables': {
139       'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)',
140     },
141   },
142   'conditions': [
143     ['resource_dir!=""', {
144       'variables': {
145         'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ]
146       },
147     }],
148     ['R_package != ""', {
149       'variables': {
150         # We generate R.java in package R_package (in addition to the package
151         # listed in the AndroidManifest.xml, which is unavoidable).
152         'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'],
153         'additional_res_packages': ['<(R_package)'],
154         'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'],
155       },
156     }],
157     ['native_lib_target != "" and component == "shared_library"', {
158       'dependencies': [
159         '<(DEPTH)/build/android/setup.gyp:copy_system_libraries',
160       ],
161     }],
162     ['native_lib_target != ""', {
163       'variables': {
164         'compile_input_paths': [ '<(native_libraries_java_stamp)' ],
165         'generated_src_dirs': [ '<(native_libraries_java_dir)' ],
166         'native_libs_paths': [
167           '<(SHARED_LIB_DIR)/<(native_lib_target).>(android_product_extension)'
168         ],
169         'package_input_paths': [
170           '<(apk_package_native_libs_dir)/<(android_app_abi)/gdbserver',
171         ],
172       },
173       'copies': [
174         {
175           # gdbserver is always copied into the APK's native libs dir. The ant
176           # build scripts (apkbuilder task) will only include it in a debug
177           # build.
178           'destination': '<(apk_package_native_libs_dir)/<(android_app_abi)',
179           'files': [
180             '<(android_gdbserver)',
181           ],
182         },
183       ],
184       'actions': [
185         {
186           'variables': {
187             'input_libraries': ['<@(native_libs_paths)'],
188           },
189           'includes': ['../build/android/write_ordered_libraries.gypi'],
190         },
191         {
192           'action_name': 'native_libraries_template_data_<(_target_name)',
193           'message': 'Creating native_libraries_list.h for <(_target_name).',
194           'inputs': [
195             '<(DEPTH)/build/android/gyp/util/build_utils.py',
196             '<(DEPTH)/build/android/gyp/create_native_libraries_header.py',
197             '<(ordered_libraries_file)',
198           ],
199           'outputs': [
200             '<(native_libraries_template_data_stamp)',
201           ],
202           'action': [
203             'python', '<(DEPTH)/build/android/gyp/create_native_libraries_header.py',
204             '--ordered-libraries=<(ordered_libraries_file)',
205             '--output=<(native_libraries_template_data_file)',
206             '--stamp=<(native_libraries_template_data_stamp)',
207           ],
208         },
209         {
210           'action_name': 'native_libraries_<(_target_name)',
211           'message': 'Creating NativeLibraries.java for <(_target_name).',
212           'inputs': [
213             '<(DEPTH)/build/android/gyp/util/build_utils.py',
214             '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
215             '<(native_libraries_template_data_stamp)',
216             '<(native_libraries_template)',
217           ],
218           'outputs': [
219             '<(native_libraries_java_stamp)',
220           ],
221           'action': [
222             'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py',
223             '--include-path=<(native_libraries_template_data_dir)',
224             '--output=<(native_libraries_java_file)',
225             '--template=<(native_libraries_template)',
226             '--stamp=<(native_libraries_java_stamp)',
227           ],
228         },
229         {
230           'action_name': 'strip_native_libraries',
231           'variables': {
232             'ordered_libraries_file%': '<(ordered_libraries_file)',
233             'stripped_libraries_dir': '<(libraries_source_dir)',
234             'input_paths': ['<@(native_libs_paths)'],
235             'stamp': '<(strip_stamp)'
236           },
237           'includes': ['../build/android/strip_native_libraries.gypi'],
238         },
239       ],
240       'conditions': [
241         ['gyp_managed_install == 1', {
242           'variables': {
243             'libraries_top_dir': '<(intermediate_dir)/lib.stripped',
244             'libraries_source_dir': '<(libraries_top_dir)/lib/<(android_app_abi)',
245             'device_library_dir': '<(device_intermediate_dir)/lib.stripped',
246           },
247           'dependencies': [
248             '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum',
249             '<(DEPTH)/build/android/setup.gyp:get_build_device_configurations',
250           ],
251           'actions': [
252             {
253               'includes': ['../build/android/push_libraries.gypi'],
254             },
255             {
256               'action_name': 'create device library symlinks',
257               'message': 'Creating links on device for <(_target_name).',
258               'inputs': [
259                 '<(DEPTH)/build/android/gyp/util/build_utils.py',
260                 '<(DEPTH)/build/android/gyp/create_device_library_links.py',
261                 '<(apk_install_record)',
262                 '<(build_device_config_path)',
263                 '<(ordered_libraries_file)',
264               ],
265               'outputs': [
266                 '<(link_stamp)'
267               ],
268               'action': [
269                 'python', '<(DEPTH)/build/android/gyp/create_device_library_links.py',
270                 '--build-device-configuration=<(build_device_config_path)',
271                 '--libraries-json=<(ordered_libraries_file)',
272                 '--script-host-path=<(symlink_script_host_path)',
273                 '--script-device-path=<(symlink_script_device_path)',
274                 '--target-dir=<(device_library_dir)',
275                 '--apk=<(incomplete_apk_path)',
276                 '--stamp=<(link_stamp)',
277               ],
278             },
279           ],
280           'conditions': [
281             ['create_standalone_apk == 1', {
282               'actions': [
283                 {
284                   'action_name': 'create standalone APK',
285                   'variables': {
286                     'inputs': [
287                       '<(ordered_libraries_file)',
288                       '<(strip_stamp)',
289                     ],
290                     'input_apk_path': '<(unsigned_apk_path)',
291                     'output_apk_path': '<(unsigned_standalone_apk_path)',
292                     'libraries_top_dir%': '<(libraries_top_dir)',
293                   },
294                   'includes': [ 'android/create_standalone_apk_action.gypi' ],
295                 },
296               ],
297             }],
298           ],
299         }, {
300           # gyp_managed_install != 1
301           'variables': {
302             'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_app_abi)',
303             'package_input_paths': [ '<(strip_stamp)' ],
304           },
305         }],
306       ],
307     }], # native_lib_target != ''
308     ['gyp_managed_install == 0 or create_standalone_apk == 1', {
309       'actions': [
310         {
311           'action_name': 'finalize standalone apk',
312           'variables': {
313             'input_apk_path': '<(unsigned_standalone_apk_path)',
314             'output_apk_path': '<(final_apk_path)',
315           },
316           'includes': [ 'android/finalize_apk_action.gypi']
317         },
318       ],
319     }],
320     ['java_strings_grd != ""', {
321       'variables': {
322         'res_grit_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)_apk/res_grit',
323         'additional_res_dirs': ['<(res_grit_dir)'],
324         # grit_grd_file is used by grit_action.gypi, included below.
325         'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)',
326         'resource_input_paths': [
327           '<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(res_grit_dir)" <(grit_grd_file))'
328         ],
329       },
330       'actions': [
331         {
332           'action_name': 'generate_localized_strings_xml',
333           'variables': {
334             'grit_additional_defines': ['-E', 'ANDROID_JAVA_TAGGED_ONLY=false'],
335             'grit_out_dir': '<(res_grit_dir)',
336             # resource_ids is unneeded since we don't generate .h headers.
337             'grit_resource_ids': '',
338           },
339           'includes': ['../build/grit_action.gypi'],
340         },
341       ],
342     }],
343     ['gyp_managed_install == 1', {
344       'actions': [
345         {
346           'action_name': 'finalize incomplete apk',
347           'variables': {
348             'input_apk_path': '<(unsigned_apk_path)',
349             'output_apk_path': '<(incomplete_apk_path)',
350           },
351           'includes': [ 'android/finalize_apk_action.gypi']
352         },
353         {
354           'action_name': 'apk_install_<(_target_name)',
355           'message': 'Installing <(apk_name).apk',
356           'inputs': [
357             '<(DEPTH)/build/android/gyp/util/build_utils.py',
358             '<(DEPTH)/build/android/gyp/apk_install.py',
359             '<(build_device_config_path)',
360             '<(incomplete_apk_path)',
361           ],
362           'outputs': [
363             '<(apk_install_record)',
364           ],
365           'action': [
366             'python', '<(DEPTH)/build/android/gyp/apk_install.py',
367             '--android-sdk-tools=<(android_sdk_tools)',
368             '--apk-path=<(incomplete_apk_path)',
369             '--build-device-configuration=<(build_device_config_path)',
370             '--install-record=<(apk_install_record)',
371           ],
372         },
373       ],
374     }],
375   ],
376   'actions': [
377     {
378       'action_name': 'ant_codegen_<(_target_name)',
379       'message': 'Generating R.java for <(_target_name)',
380       'conditions': [
381         ['is_test_apk == 1', {
382           'variables': {
383             'additional_res_dirs=': [],
384             'additional_res_packages=': [],
385           }
386         }],
387       ],
388       'inputs': [
389         '<(DEPTH)/build/android/ant/apk-codegen.xml',
390         '<(DEPTH)/build/android/gyp/util/build_utils.py',
391         '<(DEPTH)/build/android/gyp/ant.py',
392         '<(android_manifest_path)',
393         '>@(additional_input_paths)',
394         '>@(codegen_input_paths)',
395         '>@(library_manifest_paths)',
396         '>@(resource_input_paths)',
397       ],
398       'outputs': [
399         '<(codegen_stamp)',
400       ],
401       'action': [
402         'python', '<(DEPTH)/build/android/gyp/ant.py',
403         '-quiet',
404         '-DADDITIONAL_RES_DIRS=>(additional_res_dirs)',
405         '-DADDITIONAL_RES_PACKAGES=>(additional_res_packages)',
406         '-DADDITIONAL_R_TEXT_FILES=>(additional_R_text_files)',
407         '-DANDROID_MANIFEST=<(android_manifest_path)',
408         '-DANDROID_SDK_JAR=<(android_sdk_jar)',
409         '-DANDROID_SDK_ROOT=<(android_sdk_root)',
410         '-DANDROID_SDK_VERSION=<(android_sdk_version)',
411         '-DLIBRARY_MANIFEST_PATHS=>(library_manifest_paths)',
412         '-DOUT_DIR=<(intermediate_dir)',
413         '-DRESOURCE_DIR=<(resource_dir)',
415         '-DSTAMP=<(codegen_stamp)',
416         '-Dbasedir=.',
417         '-buildfile',
418         '<(DEPTH)/build/android/ant/apk-codegen.xml',
420         # Add list of inputs to the command line, so if inputs change
421         # (e.g. if a Java file is removed), the command will be re-run.
422         # TODO(newt): remove this once crbug.com/177552 is fixed in ninja.
423         '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)',
424       ],
425     },
426     {
427       'action_name': 'javac_<(_target_name)',
428       'message': 'Compiling java for <(_target_name)',
429       'variables': {
430         'all_src_dirs': [
431           '<(java_in_dir)/src',
432           '<(intermediate_dir)/gen',
433           '>@(additional_src_dirs)',
434           '>@(generated_src_dirs)',
435         ],
436       },
437       'inputs': [
438         '<(DEPTH)/build/android/gyp/util/build_utils.py',
439         '<(DEPTH)/build/android/gyp/javac.py',
440         # If there is a separate find for additional_src_dirs, it will find the
441         # wrong .java files when additional_src_dirs is empty.
442         '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")',
443         '>@(input_jars_paths)',
444         '<(codegen_stamp)',
445         '>@(compile_input_paths)',
446       ],
447       'outputs': [
448         '<(compile_stamp)',
449       ],
450       'action': [
451         'python', '<(DEPTH)/build/android/gyp/javac.py',
452         '--output-dir=<(classes_dir)',
453         '--classpath=>(input_jars_paths) <(android_sdk_jar)',
454         '--src-dirs=>(all_src_dirs)',
455         '--javac-includes=<(javac_includes)',
456         '--chromium-code=<(chromium_code)',
457         '--stamp=<(compile_stamp)',
459         # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja.
460         '--ignore=>!(echo \'>(_inputs)\' | md5sum)',
461       ],
462     },
463     {
464       'action_name': 'jar_<(_target_name)',
465       'message': 'Creating <(_target_name) jar',
466       'inputs': [
467         '<(DEPTH)/build/android/gyp/util/build_utils.py',
468         '<(DEPTH)/build/android/gyp/util/md5_check.py',
469         '<(DEPTH)/build/android/gyp/jar.py',
470         '<(compile_stamp)',
471       ],
472       'outputs': [
473         '<(jar_stamp)',
474       ],
475       'action': [
476         'python', '<(DEPTH)/build/android/gyp/jar.py',
477         '--classes-dir=<(classes_dir)',
478         '--jar-path=<(jar_path)',
479         '--excluded-classes=<(jar_excluded_classes)',
480         '--stamp=<(jar_stamp)',
482         # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja.
483         '--ignore=>!(echo \'>(_inputs)\' | md5sum)',
484       ]
485     },
486     {
487       'action_name': 'ant_obfuscate_<(_target_name)',
488       'message': 'Obfuscating <(_target_name)',
489       'inputs': [
490         '<(DEPTH)/build/android/ant/apk-obfuscate.xml',
491         '<(DEPTH)/build/android/ant/create-test-jar.js',
492         '<(DEPTH)/build/android/gyp/util/build_utils.py',
493         '<(DEPTH)/build/android/gyp/ant.py',
494         '<(compile_stamp)',
495         '>@(proguard_flags_paths)',
496       ],
497       'outputs': [
498         '<(obfuscate_stamp)',
499       ],
500       'action': [
501         'python', '<(DEPTH)/build/android/gyp/ant.py',
502         '-quiet',
503         '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)',
504         '-DANDROID_SDK_JAR=<(android_sdk_jar)',
505         '-DANDROID_SDK_ROOT=<(android_sdk_root)',
506         '-DANDROID_SDK_VERSION=<(android_sdk_version)',
507         '-DAPK_NAME=<(apk_name)',
508         '-DCREATE_TEST_JAR_PATH=<(DEPTH)/build/android/ant/create-test-jar.js',
509         '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)',
510         '-DGENERATED_SRC_DIRS=>(generated_src_dirs)',
511         '-DINPUT_JARS_PATHS=>(input_jars_paths)',
512         '-DIS_TEST_APK=<(is_test_apk)',
513         '-DJAR_PATH=<(PRODUCT_DIR)/lib.java/<(jar_name)',
514         '-DOBFUSCATED_JAR_PATH=<(obfuscated_jar_path)',
515         '-DOUT_DIR=<(intermediate_dir)',
516         '-DPROGUARD_ENABLED=<(proguard_enabled)',
517         '-DPROGUARD_FLAGS=<(proguard_flags_paths)',
518         '-DTEST_JAR_PATH=<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar',
520         '-DSTAMP=<(obfuscate_stamp)',
521         '-Dbasedir=.',
522         '-buildfile',
523         '<(DEPTH)/build/android/ant/apk-obfuscate.xml',
525         # Add list of inputs to the command line, so if inputs change
526         # (e.g. if a Java file is removed), the command will be re-run.
527         # TODO(newt): remove this once crbug.com/177552 is fixed in ninja.
528         '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)',
529       ],
530     },
531     {
532       'action_name': 'dex_<(_target_name)',
533       'variables': {
534         'conditions': [
535           ['proguard_enabled == "true"', {
536             'input_paths': [ '<(obfuscate_stamp)' ],
537             'proguard_enabled_input_path': '<(obfuscated_jar_path)',
538           }],
539         ],
540         'input_paths': [ '<(compile_stamp)' ],
541         'dex_input_paths': [ '>@(library_dexed_jars_paths)' ],
542         'dex_generated_input_dirs': [ '<(classes_dir)' ],
543         'output_path': '<(dex_path)',
544       },
545       'includes': [ 'android/dex_action.gypi' ],
546     },
547     {
548       'action_name': 'ant package resources',
549       'message': 'Packaging resources for <(_target_name) APK.',
550       'inputs': [
551         '<(DEPTH)/build/android/ant/apk-package-resources.xml',
552         '<(DEPTH)/build/android/gyp/util/build_utils.py',
553         '<(DEPTH)/build/android/gyp/ant.py',
554         '<(android_manifest_path)',
555         '<(codegen_stamp)',
557         '>@(library_manifest_paths)',
558         '>@(additional_input_paths)',
559       ],
560       'conditions': [
561         ['is_test_apk == 1', {
562           'variables': {
563             'additional_res_dirs=': [],
564             'additional_res_packages=': [],
565           }
566         }],
567       ],
568       'outputs': [
569         '<(package_resources_stamp)',
570       ],
571       'action': [
572         'python', '<(DEPTH)/build/android/gyp/ant.py',
573         '-quiet',
574         '-DADDITIONAL_RES_DIRS=>(additional_res_dirs)',
575         '-DADDITIONAL_RES_PACKAGES=>(additional_res_packages)',
576         '-DADDITIONAL_R_TEXT_FILES=>(additional_R_text_files)',
577         '-DANDROID_SDK_JAR=<(android_sdk_jar)',
578         '-DANDROID_SDK_ROOT=<(android_sdk_root)',
579         '-DAPK_NAME=<(apk_name)',
580         '-DAPP_MANIFEST_VERSION_CODE=<(app_manifest_version_code)',
581         '-DAPP_MANIFEST_VERSION_NAME=<(app_manifest_version_name)',
582         '-DASSET_DIR=<(asset_location)',
583         '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)',
584         '-DOUT_DIR=<(intermediate_dir)',
585         '-DRESOURCE_DIR=<(resource_dir)',
587         '-DSTAMP=<(package_resources_stamp)',
589         '-Dbasedir=.',
590         '-buildfile',
591         '<(DEPTH)/build/android/ant/apk-package-resources.xml',
593         # Add list of inputs to the command line, so if inputs change
594         # (e.g. if a Java file is removed), the command will be re-run.
595         # TODO(newt): remove this once crbug.com/177552 is fixed in ninja.
596         '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)',
597       ]
598     },
599     {
600       'action_name': 'ant_package_<(_target_name)',
601       'message': 'Packaging <(_target_name).',
602       'inputs': [
603         '<(DEPTH)/build/android/ant/apk-package.xml',
604         '<(DEPTH)/build/android/gyp/util/build_utils.py',
605         '<(DEPTH)/build/android/gyp/ant.py',
606         '<(dex_path)',
607         '<(codegen_stamp)',
608         '<(obfuscate_stamp)',
609         '<(package_resources_stamp)',
610         '>@(package_input_paths)',
611       ],
612       'outputs': [
613         '<(unsigned_apk_path)',
614       ],
615       'action': [
616         'python', '<(DEPTH)/build/android/gyp/ant.py',
617         '-quiet',
618         '-DANDROID_SDK_ROOT=<(android_sdk_root)',
619         '-DAPK_NAME=<(apk_name)',
620         '-DCONFIGURATION_NAME=<(CONFIGURATION_NAME)',
621         '-DNATIVE_LIBS_DIR=<(apk_package_native_libs_dir)',
622         '-DOUT_DIR=<(intermediate_dir)',
623         '-DSOURCE_DIR=<(source_dir)',
624         '-DUNSIGNED_APK_PATH=<(unsigned_apk_path)',
626         '-Dbasedir=.',
627         '-buildfile',
628         '<(DEPTH)/build/android/ant/apk-package.xml',
630         # Add list of inputs to the command line, so if inputs change
631         # (e.g. if a Java file is removed), the command will be re-run.
632         # TODO(newt): remove this once crbug.com/177552 is fixed in ninja.
633         '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)',
634       ]
635     },
636   ],