OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # This file is meant to be included into a target to provide a rule | 5 # This file is meant to be included into a target to provide a rule |
6 # to build Android APKs in a consistent manner. | 6 # to build Android APKs in a consistent manner. |
7 # | 7 # |
8 # To use this, create a gyp target with the following form: | 8 # To use this, create a gyp target with the following form: |
9 # { | 9 # { |
10 # 'target_name': 'my_package_apk', | 10 # 'target_name': 'my_package_apk', |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 'R_package%':'', | 66 'R_package%':'', |
67 'additional_res_dirs': [], | 67 'additional_res_dirs': [], |
68 'additional_res_packages': [], | 68 'additional_res_packages': [], |
69 'is_test_apk%': 0, | 69 'is_test_apk%': 0, |
70 'java_strings_grd%': '', | 70 'java_strings_grd%': '', |
71 'library_manifest_paths' : [], | 71 'library_manifest_paths' : [], |
72 'resource_input_paths': [], | 72 'resource_input_paths': [], |
73 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)', | 73 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)', |
74 'asset_location%': '<(intermediate_dir)/assets', | 74 'asset_location%': '<(intermediate_dir)/assets', |
75 'codegen_stamp': '<(intermediate_dir)/codegen.stamp', | 75 'codegen_stamp': '<(intermediate_dir)/codegen.stamp', |
76 'compile_input_paths': [ ], | 76 'compile_input_paths': [], |
77 'package_input_paths': [ ], | 77 'package_input_paths': [], |
78 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json', | 78 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json', |
79 # TODO(cjhopman): build/ shouldn't refer to content/. The libraryloader and | 79 # TODO(cjhopman): build/ shouldn't refer to content/. The libraryloader and |
80 # nativelibraries template should be moved out of content/ (to base/?). | 80 # nativelibraries template should be moved out of content/ (to base/?). |
81 # http://crbug.com/225101 | 81 # http://crbug.com/225101 |
82 'native_libraries_template': '<(DEPTH)/content/public/android/java/templates
/NativeLibraries.template', | 82 'native_libraries_template': '<(DEPTH)/content/public/android/java/templates
/NativeLibraries.template', |
83 'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/', | 83 'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/', |
84 'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.
java', | 84 'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.
java', |
85 'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.st
amp', | 85 'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.st
amp', |
86 'native_libraries_template_data_dir': '<(intermediate_dir)/native_libraries/
', | 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', | 87 'native_libraries_template_data_file': '<(native_libraries_template_data_dir
)/native_libraries_array.h', |
88 'native_libraries_template_data_stamp': '<(intermediate_dir)/native_librarie
s_template_data.stamp', | 88 'native_libraries_template_data_stamp': '<(intermediate_dir)/native_librarie
s_template_data.stamp', |
89 'compile_stamp': '<(intermediate_dir)/compile.stamp', | 89 'compile_stamp': '<(intermediate_dir)/compile.stamp', |
90 'jar_stamp': '<(intermediate_dir)/jar.stamp', | 90 'jar_stamp': '<(intermediate_dir)/jar.stamp', |
91 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', | 91 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', |
92 'strip_stamp': '<(intermediate_dir)/strip.stamp', | 92 'strip_stamp': '<(intermediate_dir)/strip.stamp', |
93 'classes_dir': '<(intermediate_dir)/classes', | 93 'classes_dir': '<(intermediate_dir)/classes', |
94 'javac_includes': [], | 94 'javac_includes': [], |
95 'jar_excluded_classes': [], | 95 'jar_excluded_classes': [], |
96 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 96 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
97 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', | 97 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', |
98 'dex_path': '<(intermediate_dir)/classes.dex', | 98 'dex_path': '<(intermediate_dir)/classes.dex', |
99 'android_manifest': '<(java_in_dir)/AndroidManifest.xml', | 99 'android_manifest': '<(java_in_dir)/AndroidManifest.xml', |
| 100 'push_stamp': '<(intermediate_dir)/push.stamp', |
| 101 'link_stamp': '<(intermediate_dir)/link.stamp', |
100 'codegen_input_paths': [], | 102 'codegen_input_paths': [], |
101 'final_apk_path': '<(PRODUCT_DIR)/apks/<(apk_name).apk', | 103 'final_apk_path': '<(PRODUCT_DIR)/apks/<(apk_name).apk', |
102 'apk_install_stamp': '<(intermediate_dir)/apk_install.stamp', | 104 'apk_install_stamp': '<(intermediate_dir)/apk_install.stamp', |
103 }, | 105 }, |
104 # Pass the jar path to the apk's "fake" jar target. This would be better as | 106 # Pass the jar path to the apk's "fake" jar target. This would be better as |
105 # direct_dependent_settings, but a variable set by a direct_dependent_settings | 107 # direct_dependent_settings, but a variable set by a direct_dependent_settings |
106 # cannot be lifted in a dependent to all_dependent_settings. | 108 # cannot be lifted in a dependent to all_dependent_settings. |
107 'all_dependent_settings': { | 109 'all_dependent_settings': { |
108 'variables': { | 110 'variables': { |
109 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 111 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
(...skipping 11 matching lines...) Expand all Loading... |
121 # listed in the AndroidManifest.xml, which is unavoidable). | 123 # listed in the AndroidManifest.xml, which is unavoidable). |
122 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], | 124 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], |
123 'additional_res_packages': ['<(R_package)'], | 125 'additional_res_packages': ['<(R_package)'], |
124 'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'], | 126 'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'], |
125 }, | 127 }, |
126 }], | 128 }], |
127 ['native_libs_paths != []', { | 129 ['native_libs_paths != []', { |
128 'variables': { | 130 'variables': { |
129 'compile_input_paths': [ '<(native_libraries_java_stamp)' ], | 131 'compile_input_paths': [ '<(native_libraries_java_stamp)' ], |
130 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], | 132 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], |
131 'package_input_paths': [ '<(strip_stamp)' ], | |
132 }, | 133 }, |
133 'actions': [ | 134 'actions': [ |
134 { | 135 { |
135 'action_name': 'ordered_libraries_<(_target_name)', | 136 'action_name': 'ordered_libraries_<(_target_name)', |
136 'message': 'Writing dependency ordered libraries for <(_target_name).'
, | 137 'message': 'Writing dependency ordered libraries for <(_target_name).'
, |
137 'inputs': [ | 138 'inputs': [ |
138 '<(DEPTH)/build/android/pylib/build_utils.py', | 139 '<(DEPTH)/build/android/pylib/build_utils.py', |
139 '<(DEPTH)/build/android/write_ordered_libraries.py', | 140 '<(DEPTH)/build/android/write_ordered_libraries.py', |
140 '<@(native_libs_paths)', | 141 '<@(native_libs_paths)', |
141 ], | 142 ], |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 'python', '<(DEPTH)/build/android/gcc_preprocess.py', | 183 'python', '<(DEPTH)/build/android/gcc_preprocess.py', |
183 '--include-path=<(native_libraries_template_data_dir)', | 184 '--include-path=<(native_libraries_template_data_dir)', |
184 '--output=<(native_libraries_java_file)', | 185 '--output=<(native_libraries_java_file)', |
185 '--template=<(native_libraries_template)', | 186 '--template=<(native_libraries_template)', |
186 '--stamp=<(native_libraries_java_stamp)', | 187 '--stamp=<(native_libraries_java_stamp)', |
187 ], | 188 ], |
188 }, | 189 }, |
189 { | 190 { |
190 'action_name': 'strip_native_libraries', | 191 'action_name': 'strip_native_libraries', |
191 'message': 'Stripping libraries for <(_target_name)', | 192 'message': 'Stripping libraries for <(_target_name)', |
192 'variables': { | |
193 'apk_libraries_dir': '<(intermediate_dir)/libs/<(android_app_abi)', | |
194 }, | |
195 'inputs': [ | 193 'inputs': [ |
196 '<(DEPTH)/build/android/pylib/build_utils.py', | 194 '<(DEPTH)/build/android/pylib/build_utils.py', |
197 '<(DEPTH)/build/android/strip_library_for_apk.py', | 195 '<(DEPTH)/build/android/strip_library_for_apk.py', |
198 '<(ordered_libraries_file)' | 196 '<(ordered_libraries_file)' |
199 ], | 197 ], |
200 'outputs': [ | 198 'outputs': [ |
201 '<(strip_stamp)', | 199 '<(strip_stamp)', |
202 ], | 200 ], |
203 'action': [ | 201 'action': [ |
204 'python', '<(DEPTH)/build/android/strip_library_for_apk.py', | 202 'python', '<(DEPTH)/build/android/strip_library_for_apk.py', |
205 '--android-strip=<(android_strip)', | 203 '--android-strip=<(android_strip)', |
206 '--android-strip-arg=--strip-unneeded', | 204 '--android-strip-arg=--strip-unneeded', |
207 '--stripped-libraries-dir=<(apk_libraries_dir)', | 205 '--stripped-libraries-dir=<(apk_libraries_dir)', |
208 '--libraries-dir=<(SHARED_LIB_DIR)', | 206 '--libraries-dir=<(SHARED_LIB_DIR)', |
209 '--libraries-file=<(ordered_libraries_file)', | 207 '--libraries-file=<(ordered_libraries_file)', |
210 '--stamp=<(strip_stamp)', | 208 '--stamp=<(strip_stamp)', |
211 ], | 209 ], |
212 }, | 210 }, |
213 ], | 211 ], |
| 212 'conditions': [ |
| 213 ['gyp_managed_install == 1', { |
| 214 'variables': { |
| 215 'apk_libraries_dir': '<(intermediate_dir)/lib.stripped/', |
| 216 'device_library_dir': '/data/local/tmp/chromium/lib.stripped/<(_targ
et_name)', |
| 217 }, |
| 218 'dependencies': [ |
| 219 '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum', |
| 220 ], |
| 221 'actions': [ |
| 222 { |
| 223 'action_name': 'push_libraries_<(_target_name)', |
| 224 'message': 'Pushing libraries to device for <(_target_name)', |
| 225 'inputs': [ |
| 226 '<(DEPTH)/build/android/pylib/build_utils.py', |
| 227 '<(DEPTH)/build/android/gyp/push_libraries.py', |
| 228 '<(strip_stamp)', |
| 229 ], |
| 230 'outputs': [ |
| 231 '<(push_stamp)' |
| 232 ], |
| 233 'action': [ |
| 234 'python', '<(DEPTH)/build/android/gyp/push_libraries.py', |
| 235 '--libraries-dir=<(apk_libraries_dir)', |
| 236 '--device-dir=<(device_library_dir)', |
| 237 '--libraries-json=<(ordered_libraries_file)', |
| 238 '--stamp=<(push_stamp)', |
| 239 ], |
| 240 }, |
| 241 { |
| 242 'action_name': 'create_library_links', |
| 243 'message': 'Creating links on device for <(_target_name).', |
| 244 'inputs': [ |
| 245 '<(DEPTH)/build/android/gyp/create_device_library_links.py', |
| 246 '<(apk_install_stamp)', |
| 247 '<(push_stamp)' |
| 248 ], |
| 249 'outputs': [ |
| 250 '<(link_stamp)' |
| 251 ], |
| 252 'action': [ |
| 253 'python', '<(DEPTH)/build/android/gyp/create_device_library_link
s.py', |
| 254 '--apk=<(final_apk_path)', |
| 255 '--libraries-json=<(ordered_libraries_file)', |
| 256 '--target-dir=<(device_library_dir)', |
| 257 '--stamp=<(link_stamp)', |
| 258 ], |
| 259 }, |
| 260 ], |
| 261 }, { |
| 262 'variables': { |
| 263 'apk_libraries_dir': '<(intermediate_dir)/libs/<(android_app_abi)', |
| 264 'package_input_paths': [ '<(strip_stamp)' ], |
| 265 }, |
| 266 }], |
| 267 ], |
214 }], # native_libs_paths != [] | 268 }], # native_libs_paths != [] |
215 ['java_strings_grd != ""', { | 269 ['java_strings_grd != ""', { |
216 'variables': { | 270 'variables': { |
217 'res_grit_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)_apk/res_grit
', | 271 'res_grit_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)_apk/res_grit
', |
218 'additional_res_dirs': ['<(res_grit_dir)'], | 272 'additional_res_dirs': ['<(res_grit_dir)'], |
219 # grit_grd_file is used by grit_action.gypi, included below. | 273 # grit_grd_file is used by grit_action.gypi, included below. |
220 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)', | 274 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)', |
221 'resource_input_paths': [ | 275 'resource_input_paths': [ |
222 '<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(res_grit_dir
)" <(grit_grd_file))' | 276 '<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(res_grit_dir
)" <(grit_grd_file))' |
223 ], | 277 ], |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 | 543 |
490 # Add list of inputs to the command line, so if inputs change | 544 # Add list of inputs to the command line, so if inputs change |
491 # (e.g. if a Java file is removed), the command will be re-run. | 545 # (e.g. if a Java file is removed), the command will be re-run. |
492 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. | 546 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
493 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', | 547 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', |
494 | 548 |
495 ] | 549 ] |
496 }, | 550 }, |
497 ], | 551 ], |
498 } | 552 } |
OLD | NEW |