| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp', | 103 'package_resources_stamp': '<(intermediate_dir)/package_resources.stamp', |
| 104 'codegen_input_paths': [], | 104 'codegen_input_paths': [], |
| 105 'keystore_path': '<(DEPTH)/build/android/ant/chromium-debug.keystore', | 105 'keystore_path': '<(DEPTH)/build/android/ant/chromium-debug.keystore', |
| 106 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk', | 106 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk', |
| 107 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', | 107 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', |
| 108 'source_dir': '<(java_in_dir)/src', | 108 'source_dir': '<(java_in_dir)/src', |
| 109 'apk_install_stamp': '<(intermediate_dir)/apk_install.stamp', | 109 'apk_install_stamp': '<(intermediate_dir)/apk_install.stamp', |
| 110 'strip_output_paths': [], | |
| 111 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', | 110 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', |
| 112 }, | 111 }, |
| 113 # Pass the jar path to the apk's "fake" jar target. This would be better as | 112 # Pass the jar path to the apk's "fake" jar target. This would be better as |
| 114 # direct_dependent_settings, but a variable set by a direct_dependent_settings | 113 # direct_dependent_settings, but a variable set by a direct_dependent_settings |
| 115 # cannot be lifted in a dependent to all_dependent_settings. | 114 # cannot be lifted in a dependent to all_dependent_settings. |
| 116 'all_dependent_settings': { | 115 'all_dependent_settings': { |
| 117 'variables': { | 116 'variables': { |
| 118 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 117 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
| 119 }, | 118 }, |
| 120 }, | 119 }, |
| 121 'conditions': [ | 120 'conditions': [ |
| 122 ['resource_dir!=""', { | 121 ['resource_dir!=""', { |
| 123 'variables': { | 122 'variables': { |
| 124 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ] | 123 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ] |
| 125 }, | 124 }, |
| 126 }], | 125 }], |
| 127 ['R_package != ""', { | 126 ['R_package != ""', { |
| 128 'variables': { | 127 'variables': { |
| 129 # We generate R.java in package R_package (in addition to the package | 128 # We generate R.java in package R_package (in addition to the package |
| 130 # listed in the AndroidManifest.xml, which is unavoidable). | 129 # listed in the AndroidManifest.xml, which is unavoidable). |
| 131 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], | 130 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], |
| 132 'additional_res_packages': ['<(R_package)'], | 131 'additional_res_packages': ['<(R_package)'], |
| 133 'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'], | 132 'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'], |
| 134 }, | 133 }, |
| 135 }], | 134 }], |
| 136 ['native_lib_target != "" and component == "shared_library"', { | 135 ['native_lib_target != "" and component == "shared_library"', { |
| 137 'dependencies': [ | 136 'dependencies': [ |
| 138 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries', | 137 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries', |
| 139 ], | 138 ], |
| 140 'variables': { | |
| 141 # Add a fake output to force the build to always re-run this step. This | |
| 142 # is required because the real inputs are not known at gyp-time and | |
| 143 # changing base.so may not trigger changes to dependent libraries. | |
| 144 'strip_output_paths': [ | |
| 145 '<(intermediate_dir)/<(strip_stamp).fake', | |
| 146 ], | |
| 147 }, | |
| 148 }], | 139 }], |
| 149 ['native_lib_target != ""', { | 140 ['native_lib_target != ""', { |
| 150 'variables': { | 141 'variables': { |
| 151 'compile_input_paths': [ '<(native_libraries_java_stamp)' ], | 142 'compile_input_paths': [ '<(native_libraries_java_stamp)' ], |
| 152 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], | 143 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], |
| 153 'native_libs_paths': ['<(SHARED_LIB_DIR)/<(native_lib_target).>(android_
product_extension)'], | 144 'native_libs_paths': ['<(SHARED_LIB_DIR)/<(native_lib_target).>(android_
product_extension)'], |
| 154 }, | 145 }, |
| 155 'actions': [ | 146 'actions': [ |
| 156 { | 147 { |
| 157 'action_name': 'ordered_libraries_<(_target_name)', | 148 'variables': { |
| 158 'message': 'Writing dependency ordered libraries for <(_target_name).'
, | 149 'input_libraries': ['<@(native_libs_paths)'], |
| 159 'inputs': [ | 150 }, |
| 160 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 151 'includes': ['../build/android/write_ordered_libraries.gypi'], |
| 161 '<(DEPTH)/build/android/gyp/write_ordered_libraries.py', | |
| 162 '<@(native_libs_paths)', | |
| 163 ], | |
| 164 'outputs': [ | |
| 165 '<(ordered_libraries_file)', | |
| 166 ], | |
| 167 'action': [ | |
| 168 'python', '<(DEPTH)/build/android/gyp/write_ordered_libraries.py', | |
| 169 '--input-libraries=<(native_libs_paths)', | |
| 170 '--readelf=<(android_readelf)', | |
| 171 '--output=<(ordered_libraries_file)', | |
| 172 ], | |
| 173 }, | 152 }, |
| 174 { | 153 { |
| 175 'action_name': 'native_libraries_template_data_<(_target_name)', | 154 'action_name': 'native_libraries_template_data_<(_target_name)', |
| 176 'message': 'Creating native_libraries_list.h for <(_target_name).', | 155 'message': 'Creating native_libraries_list.h for <(_target_name).', |
| 177 'inputs': [ | 156 'inputs': [ |
| 178 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 157 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 179 '<(DEPTH)/build/android/gyp/create_native_libraries_header.py', | 158 '<(DEPTH)/build/android/gyp/create_native_libraries_header.py', |
| 180 '<(ordered_libraries_file)', | 159 '<(ordered_libraries_file)', |
| 181 ], | 160 ], |
| 182 'outputs': [ | 161 'outputs': [ |
| (...skipping 20 matching lines...) Expand all Loading... |
| 203 ], | 182 ], |
| 204 'action': [ | 183 'action': [ |
| 205 'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py', | 184 'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py', |
| 206 '--include-path=<(native_libraries_template_data_dir)', | 185 '--include-path=<(native_libraries_template_data_dir)', |
| 207 '--output=<(native_libraries_java_file)', | 186 '--output=<(native_libraries_java_file)', |
| 208 '--template=<(native_libraries_template)', | 187 '--template=<(native_libraries_template)', |
| 209 '--stamp=<(native_libraries_java_stamp)', | 188 '--stamp=<(native_libraries_java_stamp)', |
| 210 ], | 189 ], |
| 211 }, | 190 }, |
| 212 { | 191 { |
| 213 'action_name': 'strip_native_libraries', | 192 'variables': { |
| 214 'message': 'Stripping libraries for <(_target_name)', | 193 'stripped_libraries_dir': '<(libraries_source_dir)', |
| 215 'inputs': [ | 194 }, |
| 216 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 195 'includes': ['../build/android/strip_native_libraries.gypi'], |
| 217 '<(DEPTH)/build/android/gyp/strip_library_for_apk.py', | |
| 218 '<(ordered_libraries_file)' | |
| 219 ], | |
| 220 'outputs': [ | |
| 221 '<(strip_stamp)', | |
| 222 '<@(strip_output_paths)', | |
| 223 ], | |
| 224 'action': [ | |
| 225 'python', '<(DEPTH)/build/android/gyp/strip_library_for_apk.py', | |
| 226 '--android-strip=<(android_strip)', | |
| 227 '--android-strip-arg=--strip-unneeded', | |
| 228 '--stripped-libraries-dir=<(apk_libraries_dir)', | |
| 229 '--libraries-dir=<(SHARED_LIB_DIR)', | |
| 230 '--libraries-file=<(ordered_libraries_file)', | |
| 231 '--stamp=<(strip_stamp)', | |
| 232 ], | |
| 233 }, | 196 }, |
| 234 ], | 197 ], |
| 235 'conditions': [ | 198 'conditions': [ |
| 236 ['gyp_managed_install == 1', { | 199 ['gyp_managed_install == 1', { |
| 237 'variables': { | 200 'variables': { |
| 238 'apk_libraries_dir': '<(intermediate_dir)/lib.stripped/<(android_app
_abi)', | 201 'libraries_source_dir': '<(intermediate_dir)/lib.stripped/<(android_
app_abi)', |
| 239 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', | 202 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', |
| 240 'device_library_dir': '/data/local/tmp/chromium/lib.stripped/<(_targ
et_name)', | 203 'device_library_dir': '/data/local/tmp/chromium/lib.stripped/<(_targ
et_name)', |
| 241 }, | 204 }, |
| 242 'dependencies': [ | 205 'dependencies': [ |
| 243 '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum', | 206 '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum', |
| 244 ], | 207 ], |
| 245 'actions': [ | 208 'actions': [ |
| 246 { | 209 { |
| 247 'action_name': 'push_libraries_<(_target_name)', | 210 'includes': ['../build/android/push_libraries.gypi'], |
| 248 'message': 'Pushing libraries to device for <(_target_name)', | |
| 249 'inputs': [ | |
| 250 '<(DEPTH)/build/android/gyp/util/build_utils.py', | |
| 251 '<(DEPTH)/build/android/gyp/util/md5_check.py', | |
| 252 '<(DEPTH)/build/android/gyp/push_libraries.py', | |
| 253 '<(strip_stamp)', | |
| 254 ], | |
| 255 'outputs': [ | |
| 256 '<(push_stamp)', | |
| 257 # If a user switches the connected device, new libraries may | |
| 258 # need to be pushed even if there have been no changes. To | |
| 259 # ensure that the libraries on the device are always | |
| 260 # up-to-date, this step should always be triggered. | |
| 261 '<(push_stamp).fake', | |
| 262 ], | |
| 263 'action': [ | |
| 264 'python', '<(DEPTH)/build/android/gyp/push_libraries.py', | |
| 265 '--libraries-dir=<(apk_libraries_dir)', | |
| 266 '--device-dir=<(device_library_dir)', | |
| 267 '--libraries-json=<(ordered_libraries_file)', | |
| 268 '--stamp=<(push_stamp)', | |
| 269 ], | |
| 270 }, | 211 }, |
| 271 { | 212 { |
| 272 'action_name': 'create_library_links', | 213 'action_name': 'create_library_links', |
| 273 'message': 'Creating links on device for <(_target_name).', | 214 'message': 'Creating links on device for <(_target_name).', |
| 274 'inputs': [ | 215 'inputs': [ |
| 275 '<(DEPTH)/build/android/gyp/create_device_library_links.py', | 216 '<(DEPTH)/build/android/gyp/create_device_library_links.py', |
| 276 '<(apk_install_stamp)', | 217 '<(apk_install_stamp)', |
| 277 '<(push_stamp)' | 218 '<(push_stamp)' |
| 278 ], | 219 ], |
| 279 'outputs': [ | 220 'outputs': [ |
| 280 '<(link_stamp)' | 221 '<(link_stamp)' |
| 281 ], | 222 ], |
| 282 'action': [ | 223 'action': [ |
| 283 'python', '<(DEPTH)/build/android/gyp/create_device_library_link
s.py', | 224 'python', '<(DEPTH)/build/android/gyp/create_device_library_link
s.py', |
| 284 '--apk=<(final_apk_path)', | 225 '--apk=<(final_apk_path)', |
| 285 '--libraries-json=<(ordered_libraries_file)', | 226 '--libraries-json=<(ordered_libraries_file)', |
| 286 '--libraries-dir=<(apk_libraries_dir)', | 227 '--libraries-dir=<(libraries_source_dir)', |
| 287 '--target-dir=<(device_library_dir)', | 228 '--target-dir=<(device_library_dir)', |
| 288 '--stamp=<(link_stamp)', | 229 '--stamp=<(link_stamp)', |
| 289 ], | 230 ], |
| 290 }, | 231 }, |
| 291 ], | 232 ], |
| 292 }, { | 233 }, { |
| 293 # gyp_managed_install != 1 | 234 # gyp_managed_install != 1 |
| 294 'variables': { | 235 'variables': { |
| 295 'apk_libraries_dir': '<(apk_package_native_libs_dir)/<(android_app_a
bi)', | 236 'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_ap
p_abi)', |
| 296 'package_input_paths': [ '<(strip_stamp)' ], | 237 'package_input_paths': [ '<(strip_stamp)' ], |
| 297 }, | 238 }, |
| 298 }], | 239 }], |
| 299 ], | 240 ], |
| 300 }], # native_lib_target != '' | 241 }], # native_lib_target != '' |
| 301 ['java_strings_grd != ""', { | 242 ['java_strings_grd != ""', { |
| 302 'variables': { | 243 'variables': { |
| 303 'res_grit_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)_apk/res_grit
', | 244 'res_grit_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)_apk/res_grit
', |
| 304 'additional_res_dirs': ['<(res_grit_dir)'], | 245 'additional_res_dirs': ['<(res_grit_dir)'], |
| 305 # grit_grd_file is used by grit_action.gypi, included below. | 246 # grit_grd_file is used by grit_action.gypi, included below. |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 '--unsigned-apk-path=<(unsigned_apk_path)', | 591 '--unsigned-apk-path=<(unsigned_apk_path)', |
| 651 '--final-apk-path=<(final_apk_path)', | 592 '--final-apk-path=<(final_apk_path)', |
| 652 '--keystore-path=<(keystore_path)', | 593 '--keystore-path=<(keystore_path)', |
| 653 | 594 |
| 654 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. | 595 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
| 655 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', | 596 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', |
| 656 ], | 597 ], |
| 657 }, | 598 }, |
| 658 ], | 599 ], |
| 659 } | 600 } |
| OLD | NEW |