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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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', | 100 'push_stamp': '<(intermediate_dir)/push.stamp', |
101 'link_stamp': '<(intermediate_dir)/link.stamp', | 101 'link_stamp': '<(intermediate_dir)/link.stamp', |
102 'codegen_input_paths': [], | 102 'codegen_input_paths': [], |
103 'final_apk_path': '<(PRODUCT_DIR)/apks/<(apk_name).apk', | 103 'final_apk_path': '<(PRODUCT_DIR)/apks/<(apk_name).apk', |
104 'apk_install_stamp': '<(intermediate_dir)/apk_install.stamp', | 104 'apk_install_stamp': '<(intermediate_dir)/apk_install.stamp', |
105 'strip_output_paths': [], | |
105 }, | 106 }, |
106 # Pass the jar path to the apk's "fake" jar target. This would be better as | 107 # Pass the jar path to the apk's "fake" jar target. This would be better as |
107 # direct_dependent_settings, but a variable set by a direct_dependent_settings | 108 # direct_dependent_settings, but a variable set by a direct_dependent_settings |
108 # cannot be lifted in a dependent to all_dependent_settings. | 109 # cannot be lifted in a dependent to all_dependent_settings. |
109 'all_dependent_settings': { | 110 'all_dependent_settings': { |
110 'variables': { | 111 'variables': { |
111 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 112 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
112 }, | 113 }, |
113 }, | 114 }, |
114 'conditions': [ | 115 'conditions': [ |
115 ['resource_dir!=""', { | 116 ['resource_dir!=""', { |
116 'variables': { | 117 'variables': { |
117 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ] | 118 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ] |
118 }, | 119 }, |
119 }], | 120 }], |
120 ['R_package != ""', { | 121 ['R_package != ""', { |
121 'variables': { | 122 'variables': { |
122 # We generate R.java in package R_package (in addition to the package | 123 # We generate R.java in package R_package (in addition to the package |
123 # listed in the AndroidManifest.xml, which is unavoidable). | 124 # listed in the AndroidManifest.xml, which is unavoidable). |
124 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], | 125 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], |
125 'additional_res_packages': ['<(R_package)'], | 126 'additional_res_packages': ['<(R_package)'], |
126 'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'], | 127 'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'], |
127 }, | 128 }, |
128 }], | 129 }], |
129 ['native_libs_paths != [] and component == "shared_library"', { | 130 ['native_libs_paths != [] and component == "shared_library"', { |
130 'dependencies': [ | 131 'dependencies': [ |
131 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries', | 132 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries', |
132 ] | 133 ], |
134 'variables': { | |
135 # Add a fake output to force the build to always re-run this step. This | |
Yaron
2013/04/04 20:24:23
Can you inline this like the other variables? Nice
cjhopman
2013/04/04 21:13:19
This one has run even if it isn't a managed_instal
Yaron
2013/04/10 20:37:13
Can you file/link to a bug to remove this when it
| |
136 # is required because the real inputs are not known at gyp-time and | |
137 # changing base.so may not trigger changes to dependent libraries. | |
138 'strip_output_paths': [ | |
139 '<(intermediate_dir)/<(strip_stamp).fake', | |
140 ], | |
141 }, | |
133 }], | 142 }], |
134 ['native_libs_paths != []', { | 143 ['native_libs_paths != []', { |
135 'variables': { | 144 'variables': { |
136 'compile_input_paths': [ '<(native_libraries_java_stamp)' ], | 145 'compile_input_paths': [ '<(native_libraries_java_stamp)' ], |
137 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], | 146 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], |
138 }, | 147 }, |
139 'actions': [ | 148 'actions': [ |
140 { | 149 { |
141 'action_name': 'ordered_libraries_<(_target_name)', | 150 'action_name': 'ordered_libraries_<(_target_name)', |
142 'message': 'Writing dependency ordered libraries for <(_target_name).' , | 151 'message': 'Writing dependency ordered libraries for <(_target_name).' , |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 { | 205 { |
197 'action_name': 'strip_native_libraries', | 206 'action_name': 'strip_native_libraries', |
198 'message': 'Stripping libraries for <(_target_name)', | 207 'message': 'Stripping libraries for <(_target_name)', |
199 'inputs': [ | 208 'inputs': [ |
200 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 209 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
201 '<(DEPTH)/build/android/gyp/strip_library_for_apk.py', | 210 '<(DEPTH)/build/android/gyp/strip_library_for_apk.py', |
202 '<(ordered_libraries_file)' | 211 '<(ordered_libraries_file)' |
203 ], | 212 ], |
204 'outputs': [ | 213 'outputs': [ |
205 '<(strip_stamp)', | 214 '<(strip_stamp)', |
215 '<@(strip_output_paths)', | |
206 ], | 216 ], |
207 'action': [ | 217 'action': [ |
208 'python', '<(DEPTH)/build/android/gyp/strip_library_for_apk.py', | 218 'python', '<(DEPTH)/build/android/gyp/strip_library_for_apk.py', |
209 '--android-strip=<(android_strip)', | 219 '--android-strip=<(android_strip)', |
210 '--android-strip-arg=--strip-unneeded', | 220 '--android-strip-arg=--strip-unneeded', |
211 '--stripped-libraries-dir=<(apk_libraries_dir)', | 221 '--stripped-libraries-dir=<(apk_libraries_dir)', |
212 '--libraries-dir=<(SHARED_LIB_DIR)', | 222 '--libraries-dir=<(SHARED_LIB_DIR)', |
213 '--libraries-file=<(ordered_libraries_file)', | 223 '--libraries-file=<(ordered_libraries_file)', |
214 '--stamp=<(strip_stamp)', | 224 '--stamp=<(strip_stamp)', |
215 ], | 225 ], |
(...skipping 12 matching lines...) Expand all Loading... | |
228 { | 238 { |
229 'action_name': 'push_libraries_<(_target_name)', | 239 'action_name': 'push_libraries_<(_target_name)', |
230 'message': 'Pushing libraries to device for <(_target_name)', | 240 'message': 'Pushing libraries to device for <(_target_name)', |
231 'inputs': [ | 241 'inputs': [ |
232 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 242 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
233 '<(DEPTH)/build/android/gyp/util/md5_check.py', | 243 '<(DEPTH)/build/android/gyp/util/md5_check.py', |
234 '<(DEPTH)/build/android/gyp/push_libraries.py', | 244 '<(DEPTH)/build/android/gyp/push_libraries.py', |
235 '<(strip_stamp)', | 245 '<(strip_stamp)', |
236 ], | 246 ], |
237 'outputs': [ | 247 'outputs': [ |
238 '<(push_stamp)' | 248 '<(push_stamp)', |
249 # If a user switches the connected device, new libraries may | |
250 # need to be pushed even if there have been no changes. To | |
251 # ensure that the libraries on the device are always | |
252 # up-to-date, this step should always be triggered. | |
253 '<(push_stamp).fake', | |
239 ], | 254 ], |
240 'action': [ | 255 'action': [ |
241 'python', '<(DEPTH)/build/android/gyp/push_libraries.py', | 256 'python', '<(DEPTH)/build/android/gyp/push_libraries.py', |
242 '--libraries-dir=<(apk_libraries_dir)', | 257 '--libraries-dir=<(apk_libraries_dir)', |
243 '--device-dir=<(device_library_dir)', | 258 '--device-dir=<(device_library_dir)', |
244 '--libraries-json=<(ordered_libraries_file)', | 259 '--libraries-json=<(ordered_libraries_file)', |
245 '--stamp=<(push_stamp)', | 260 '--stamp=<(push_stamp)', |
246 ], | 261 ], |
247 }, | 262 }, |
248 { | 263 { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 { | 316 { |
302 'action_name': 'apk_install_<(_target_name)', | 317 'action_name': 'apk_install_<(_target_name)', |
303 'message': 'Installing <(apk_name).apk', | 318 'message': 'Installing <(apk_name).apk', |
304 'inputs': [ | 319 'inputs': [ |
305 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 320 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
306 '<(DEPTH)/build/android/gyp/apk_install.py', | 321 '<(DEPTH)/build/android/gyp/apk_install.py', |
307 '<(final_apk_path)', | 322 '<(final_apk_path)', |
308 ], | 323 ], |
309 'outputs': [ | 324 'outputs': [ |
310 '<(apk_install_stamp)' | 325 '<(apk_install_stamp)' |
326 # If a user switches the connected device, the APK may need to be | |
327 # installed even if there have been no changes. To ensure that the | |
328 # APK on the device is always up-to-date, this step should always | |
329 # be triggered. | |
330 '<(apk_install_stamp).fake', | |
311 ], | 331 ], |
312 'action': [ | 332 'action': [ |
313 'python', '<(DEPTH)/build/android/gyp/apk_install.py', | 333 'python', '<(DEPTH)/build/android/gyp/apk_install.py', |
314 '--android-sdk-tools=<(android_sdk_tools)', | 334 '--android-sdk-tools=<(android_sdk_tools)', |
315 '--apk-path=<(final_apk_path)', | 335 '--apk-path=<(final_apk_path)', |
316 '--stamp=<(apk_install_stamp)' | 336 '--stamp=<(apk_install_stamp)' |
317 ], | 337 ], |
318 }, | 338 }, |
319 ], | 339 ], |
320 }], | 340 }], |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
553 | 573 |
554 # Add list of inputs to the command line, so if inputs change | 574 # Add list of inputs to the command line, so if inputs change |
555 # (e.g. if a Java file is removed), the command will be re-run. | 575 # (e.g. if a Java file is removed), the command will be re-run. |
556 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. | 576 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
557 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', | 577 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', |
558 | 578 |
559 ] | 579 ] |
560 }, | 580 }, |
561 ], | 581 ], |
562 } | 582 } |
OLD | NEW |