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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 97 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
98 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', | 98 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', |
99 'dex_path': '<(intermediate_dir)/classes.dex', | 99 'dex_path': '<(intermediate_dir)/classes.dex', |
100 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml', | 100 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml', |
101 'push_stamp': '<(intermediate_dir)/push.stamp', | 101 'push_stamp': '<(intermediate_dir)/push.stamp', |
102 'link_stamp': '<(intermediate_dir)/link.stamp', | 102 'link_stamp': '<(intermediate_dir)/link.stamp', |
103 'codegen_input_paths': [], | 103 'codegen_input_paths': [], |
104 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', | 104 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', |
105 'source_dir': '<(java_in_dir)/src', | 105 'source_dir': '<(java_in_dir)/src', |
106 'apk_install_stamp': '<(intermediate_dir)/apk_install.stamp', | 106 'apk_install_stamp': '<(intermediate_dir)/apk_install.stamp', |
| 107 'strip_output_paths': [], |
107 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', | 108 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', |
108 }, | 109 }, |
109 # Pass the jar path to the apk's "fake" jar target. This would be better as | 110 # Pass the jar path to the apk's "fake" jar target. This would be better as |
110 # direct_dependent_settings, but a variable set by a direct_dependent_settings | 111 # direct_dependent_settings, but a variable set by a direct_dependent_settings |
111 # cannot be lifted in a dependent to all_dependent_settings. | 112 # cannot be lifted in a dependent to all_dependent_settings. |
112 'all_dependent_settings': { | 113 'all_dependent_settings': { |
113 'variables': { | 114 'variables': { |
114 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 115 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
115 }, | 116 }, |
116 }, | 117 }, |
117 'conditions': [ | 118 'conditions': [ |
118 ['resource_dir!=""', { | 119 ['resource_dir!=""', { |
119 'variables': { | 120 'variables': { |
120 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ] | 121 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ] |
121 }, | 122 }, |
122 }], | 123 }], |
123 ['R_package != ""', { | 124 ['R_package != ""', { |
124 'variables': { | 125 'variables': { |
125 # We generate R.java in package R_package (in addition to the package | 126 # We generate R.java in package R_package (in addition to the package |
126 # listed in the AndroidManifest.xml, which is unavoidable). | 127 # listed in the AndroidManifest.xml, which is unavoidable). |
127 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], | 128 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], |
128 'additional_res_packages': ['<(R_package)'], | 129 'additional_res_packages': ['<(R_package)'], |
129 'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'], | 130 'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'], |
130 }, | 131 }, |
131 }], | 132 }], |
132 ['native_lib_target != "" and component == "shared_library"', { | 133 ['native_lib_target != "" and component == "shared_library"', { |
133 'dependencies': [ | 134 'dependencies': [ |
134 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries', | 135 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries', |
135 ] | 136 ], |
| 137 'variables': { |
| 138 # Add a fake output to force the build to always re-run this step. This |
| 139 # is required because the real inputs are not known at gyp-time and |
| 140 # changing base.so may not trigger changes to dependent libraries. |
| 141 'strip_output_paths': [ |
| 142 '<(intermediate_dir)/<(strip_stamp).fake', |
| 143 ], |
| 144 }, |
136 }], | 145 }], |
137 ['native_lib_target != ""', { | 146 ['native_lib_target != ""', { |
138 'variables': { | 147 'variables': { |
139 'compile_input_paths': [ '<(native_libraries_java_stamp)' ], | 148 'compile_input_paths': [ '<(native_libraries_java_stamp)' ], |
140 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], | 149 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], |
141 'native_libs_paths': ['<(SHARED_LIB_DIR)/<(native_lib_target).>(android_
product_extension)'], | 150 'native_libs_paths': ['<(SHARED_LIB_DIR)/<(native_lib_target).>(android_
product_extension)'], |
142 }, | 151 }, |
143 'actions': [ | 152 'actions': [ |
144 { | 153 { |
145 'action_name': 'ordered_libraries_<(_target_name)', | 154 'action_name': 'ordered_libraries_<(_target_name)', |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 { | 209 { |
201 'action_name': 'strip_native_libraries', | 210 'action_name': 'strip_native_libraries', |
202 'message': 'Stripping libraries for <(_target_name)', | 211 'message': 'Stripping libraries for <(_target_name)', |
203 'inputs': [ | 212 'inputs': [ |
204 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 213 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
205 '<(DEPTH)/build/android/gyp/strip_library_for_apk.py', | 214 '<(DEPTH)/build/android/gyp/strip_library_for_apk.py', |
206 '<(ordered_libraries_file)' | 215 '<(ordered_libraries_file)' |
207 ], | 216 ], |
208 'outputs': [ | 217 'outputs': [ |
209 '<(strip_stamp)', | 218 '<(strip_stamp)', |
| 219 '<@(strip_output_paths)', |
210 ], | 220 ], |
211 'action': [ | 221 'action': [ |
212 'python', '<(DEPTH)/build/android/gyp/strip_library_for_apk.py', | 222 'python', '<(DEPTH)/build/android/gyp/strip_library_for_apk.py', |
213 '--android-strip=<(android_strip)', | 223 '--android-strip=<(android_strip)', |
214 '--android-strip-arg=--strip-unneeded', | 224 '--android-strip-arg=--strip-unneeded', |
215 '--stripped-libraries-dir=<(apk_libraries_dir)', | 225 '--stripped-libraries-dir=<(apk_libraries_dir)', |
216 '--libraries-dir=<(SHARED_LIB_DIR)', | 226 '--libraries-dir=<(SHARED_LIB_DIR)', |
217 '--libraries-file=<(ordered_libraries_file)', | 227 '--libraries-file=<(ordered_libraries_file)', |
218 '--stamp=<(strip_stamp)', | 228 '--stamp=<(strip_stamp)', |
219 ], | 229 ], |
(...skipping 13 matching lines...) Expand all Loading... |
233 { | 243 { |
234 'action_name': 'push_libraries_<(_target_name)', | 244 'action_name': 'push_libraries_<(_target_name)', |
235 'message': 'Pushing libraries to device for <(_target_name)', | 245 'message': 'Pushing libraries to device for <(_target_name)', |
236 'inputs': [ | 246 'inputs': [ |
237 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 247 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
238 '<(DEPTH)/build/android/gyp/util/md5_check.py', | 248 '<(DEPTH)/build/android/gyp/util/md5_check.py', |
239 '<(DEPTH)/build/android/gyp/push_libraries.py', | 249 '<(DEPTH)/build/android/gyp/push_libraries.py', |
240 '<(strip_stamp)', | 250 '<(strip_stamp)', |
241 ], | 251 ], |
242 'outputs': [ | 252 'outputs': [ |
243 '<(push_stamp)' | 253 '<(push_stamp)', |
| 254 # If a user switches the connected device, new libraries may |
| 255 # need to be pushed even if there have been no changes. To |
| 256 # ensure that the libraries on the device are always |
| 257 # up-to-date, this step should always be triggered. |
| 258 '<(push_stamp).fake', |
244 ], | 259 ], |
245 'action': [ | 260 'action': [ |
246 'python', '<(DEPTH)/build/android/gyp/push_libraries.py', | 261 'python', '<(DEPTH)/build/android/gyp/push_libraries.py', |
247 '--libraries-dir=<(apk_libraries_dir)', | 262 '--libraries-dir=<(apk_libraries_dir)', |
248 '--device-dir=<(device_library_dir)', | 263 '--device-dir=<(device_library_dir)', |
249 '--libraries-json=<(ordered_libraries_file)', | 264 '--libraries-json=<(ordered_libraries_file)', |
250 '--stamp=<(push_stamp)', | 265 '--stamp=<(push_stamp)', |
251 ], | 266 ], |
252 }, | 267 }, |
253 { | 268 { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 { | 323 { |
309 'action_name': 'apk_install_<(_target_name)', | 324 'action_name': 'apk_install_<(_target_name)', |
310 'message': 'Installing <(apk_name).apk', | 325 'message': 'Installing <(apk_name).apk', |
311 'inputs': [ | 326 'inputs': [ |
312 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 327 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
313 '<(DEPTH)/build/android/gyp/apk_install.py', | 328 '<(DEPTH)/build/android/gyp/apk_install.py', |
314 '<(final_apk_path)', | 329 '<(final_apk_path)', |
315 ], | 330 ], |
316 'outputs': [ | 331 'outputs': [ |
317 '<(apk_install_stamp)' | 332 '<(apk_install_stamp)' |
| 333 # If a user switches the connected device, the APK may need to be |
| 334 # installed even if there have been no changes. To ensure that the |
| 335 # APK on the device is always up-to-date, this step should always |
| 336 # be triggered. |
| 337 '<(apk_install_stamp).fake', |
318 ], | 338 ], |
319 'action': [ | 339 'action': [ |
320 'python', '<(DEPTH)/build/android/gyp/apk_install.py', | 340 'python', '<(DEPTH)/build/android/gyp/apk_install.py', |
321 '--android-sdk-tools=<(android_sdk_tools)', | 341 '--android-sdk-tools=<(android_sdk_tools)', |
322 '--apk-path=<(final_apk_path)', | 342 '--apk-path=<(final_apk_path)', |
323 '--stamp=<(apk_install_stamp)' | 343 '--stamp=<(apk_install_stamp)' |
324 ], | 344 ], |
325 }, | 345 }, |
326 ], | 346 ], |
327 }], | 347 }], |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 '<(DEPTH)/build/android/ant/apk-package.xml', | 589 '<(DEPTH)/build/android/ant/apk-package.xml', |
570 | 590 |
571 # Add list of inputs to the command line, so if inputs change | 591 # Add list of inputs to the command line, so if inputs change |
572 # (e.g. if a Java file is removed), the command will be re-run. | 592 # (e.g. if a Java file is removed), the command will be re-run. |
573 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. | 593 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
574 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', | 594 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', |
575 ] | 595 ] |
576 }, | 596 }, |
577 ], | 597 ], |
578 } | 598 } |
OLD | NEW |