Chromium Code Reviews| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 'variables': { | 53 'variables': { |
| 54 'additional_input_paths': [], | 54 'additional_input_paths': [], |
| 55 'input_jars_paths': [], | 55 'input_jars_paths': [], |
| 56 'additional_src_dirs': [], | 56 'additional_src_dirs': [], |
| 57 'generated_src_dirs': [], | 57 'generated_src_dirs': [], |
| 58 'app_manifest_version_name%': '<(android_app_version_name)', | 58 'app_manifest_version_name%': '<(android_app_version_name)', |
| 59 'app_manifest_version_code%': '<(android_app_version_code)', | 59 'app_manifest_version_code%': '<(android_app_version_code)', |
| 60 'proguard_enabled%': 'false', | 60 'proguard_enabled%': 'false', |
| 61 'proguard_flags_path%': '<(DEPTH)/build/android/empty_proguard.flags', | 61 'proguard_flags_path%': '<(DEPTH)/build/android/empty_proguard.flags', |
| 62 'native_libs_paths': [], | 62 'native_libs_paths': [], |
| 63 'jar_name%': 'chromium_apk_<(_target_name).jar', | 63 'jar_name': 'chromium_apk_<(_target_name).jar', |
| 64 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res', | 64 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res', |
| 65 'R_package%':'', | 65 'R_package%':'', |
| 66 'additional_res_dirs': [], | 66 'additional_res_dirs': [], |
| 67 'additional_res_packages': [], | 67 'additional_res_packages': [], |
| 68 'is_test_apk%': 0, | 68 'is_test_apk%': 0, |
| 69 'java_strings_grd%': '', | 69 'java_strings_grd%': '', |
| 70 'grit_grd_file%': '', | 70 'grit_grd_file%': '', |
| 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_stamp': '<(intermediate_dir)/compile.stamp', | 76 'compile_stamp': '<(intermediate_dir)/compile.stamp', |
| 77 'jar_stamp': '<(intermediate_dir)/jar.stamp', | |
| 78 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', | |
| 77 'android_manifest': '<(java_in_dir)/AndroidManifest.xml', | 79 'android_manifest': '<(java_in_dir)/AndroidManifest.xml', |
| 80 'classes_dir': '<(intermediate_dir)/classes', | |
| 78 'codegen_input_paths': [], | 81 'codegen_input_paths': [], |
| 82 'javac_includes': [], | |
| 83 'jar_excluded_classes': [], | |
| 84 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | |
| 85 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', | |
| 86 'dex_path': '<(intermediate_dir)/classes.dex', | |
| 79 }, | 87 }, |
| 80 'sources': [ | 88 'sources': [ |
| 81 '<@(native_libs_paths)' | 89 '<@(native_libs_paths)', |
| 82 ], | 90 ], |
| 83 # Pass the jar path to the apk's "fake" jar target. This would be better as | 91 # Pass the jar path to the apk's "fake" jar target. This would be better as |
| 84 # direct_dependent_settings, but a variable set by a direct_dependent_settings | 92 # direct_dependent_settings, but a variable set by a direct_dependent_settings |
| 85 # cannot be lifted in a dependent to all_dependent_settings. | 93 # cannot be lifted in a dependent to all_dependent_settings. |
| 86 'all_dependent_settings': { | 94 'all_dependent_settings': { |
| 87 'variables': { | 95 'variables': { |
| 88 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 96 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
| 89 }, | 97 }, |
| 90 }, | 98 }, |
| 91 'rules': [ | 99 'rules': [ |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 '-buildfile', | 200 '-buildfile', |
| 193 '<(DEPTH)/build/android/ant/apk-codegen.xml', | 201 '<(DEPTH)/build/android/ant/apk-codegen.xml', |
| 194 | 202 |
| 195 # Add list of inputs to the command line, so if inputs change | 203 # Add list of inputs to the command line, so if inputs change |
| 196 # (e.g. if a Java file is removed), the command will be re-run. | 204 # (e.g. if a Java file is removed), the command will be re-run. |
| 197 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. | 205 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
| 198 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', | 206 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', |
| 199 ], | 207 ], |
| 200 }, | 208 }, |
| 201 { | 209 { |
| 202 'action_name': 'ant_compile_<(_target_name)', | 210 'action_name': 'javac_<(_target_name)', |
| 203 'message': 'Compiling java for <(_target_name)', | 211 'message': 'Compiling java for <(_target_name)', |
| 212 'variables': { | |
| 213 'all_src_dirs': [ | |
| 214 '>(java_in_dir)/src', | |
| 215 '>(intermediate_dir)/gen', | |
| 216 '>@(additional_src_dirs)', | |
| 217 '>@(generated_src_dirs)', | |
| 218 ], | |
| 219 }, | |
| 204 'inputs': [ | 220 'inputs': [ |
| 205 '<(DEPTH)/build/android/ant/apk-compile.xml', | 221 '<(DEPTH)/build/android/pylib/build_utils.py', |
| 206 '<(DEPTH)/build/android/ant/create-test-jar.js', | 222 '<(DEPTH)/build/android/javac.py', |
| 207 # If there is a separate find for additional_src_dirs, it will find the | 223 # If there is a separate find for additional_src_dirs, it will find the |
| 208 # wrong .java files when additional_src_dirs is empty. | 224 # wrong .java files when additional_src_dirs is empty. |
| 209 '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', | 225 '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', |
| 210 '>@(input_jars_paths)', | 226 '>@(input_jars_paths)', |
| 211 '<(codegen_stamp)', | 227 '<(codegen_stamp)', |
| 212 '<(proguard_flags_path)', | |
| 213 ], | 228 ], |
| 214 'outputs': [ | 229 'outputs': [ |
| 215 '<(compile_stamp)', | 230 '<(compile_stamp)', |
| 216 ], | 231 ], |
| 217 'action': [ | 232 'action': [ |
| 233 'python', '<(DEPTH)/build/android/javac.py', | |
| 234 '--output-dir=<(classes_dir)', | |
| 235 '--classpath=>(input_jars_paths) <(android_sdk_jar)', | |
|
Yaron
2013/03/23 00:15:11
Doesn't this needed to be quoted and with a ":" se
cjhopman
2013/03/25 18:00:03
Gyp expands a gyp-list (in a string context as her
| |
| 236 '--src-dirs=>(all_src_dirs)', | |
| 237 '--javac-includes=<(javac_includes)', | |
| 238 '--stamp=<(compile_stamp)', | |
| 239 | |
| 240 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja . | |
| 241 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', | |
| 242 ], | |
| 243 }, | |
| 244 { | |
| 245 'action_name': 'jar_<(_target_name)', | |
| 246 'message': 'Creating <(_target_name) jar', | |
| 247 'inputs': [ | |
| 248 '<(DEPTH)/build/android/pylib/build_utils.py', | |
| 249 '<(DEPTH)/build/android/jar.py', | |
| 250 '<(compile_stamp)', | |
| 251 ], | |
| 252 'outputs': [ | |
| 253 '<(jar_stamp)', | |
| 254 ], | |
| 255 'action': [ | |
| 256 'python', '<(DEPTH)/build/android/jar.py', | |
| 257 '--classes-dir=<(classes_dir)', | |
| 258 '--jar-path=<(jar_path)', | |
| 259 '--excluded-classes=<(jar_excluded_classes)', | |
| 260 '--stamp=<(jar_stamp)', | |
| 261 | |
| 262 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja . | |
| 263 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', | |
| 264 ] | |
| 265 }, | |
| 266 { | |
| 267 'action_name': 'ant_obfuscate_<(_target_name)', | |
| 268 'message': 'Obfuscating <(_target_name)', | |
| 269 'inputs': [ | |
| 270 '<(DEPTH)/build/android/ant/apk-obfuscate.xml', | |
| 271 '<(DEPTH)/build/android/ant/create-test-jar.js', | |
| 272 '<(compile_stamp)', | |
| 273 '<(proguard_flags_path)', | |
| 274 ], | |
| 275 'outputs': [ | |
| 276 '<(obfuscate_stamp)', | |
| 277 ], | |
| 278 'action': [ | |
| 218 'ant', '-quiet', | 279 'ant', '-quiet', |
| 219 '-DOUT_DIR=<(intermediate_dir)', | 280 '-DOUT_DIR=<(intermediate_dir)', |
| 220 '-DANDROID_SDK_ROOT=<(android_sdk_root)', | 281 '-DANDROID_SDK_ROOT=<(android_sdk_root)', |
| 221 '-DANDROID_SDK_VERSION=<(android_sdk_version)', | 282 '-DANDROID_SDK_VERSION=<(android_sdk_version)', |
| 222 '-DANDROID_SDK_JAR=<(android_sdk_jar)', | 283 '-DANDROID_SDK_JAR=<(android_sdk_jar)', |
| 223 '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)', | 284 '-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)', |
| 224 '-DGENERATED_SRC_DIRS=>(generated_src_dirs)', | 285 '-DGENERATED_SRC_DIRS=>(generated_src_dirs)', |
| 225 '-DINPUT_JARS_PATHS=>(input_jars_paths)', | 286 '-DINPUT_JARS_PATHS=>(input_jars_paths)', |
| 226 '-DSOURCE_DIR=<(java_in_dir)/src', | |
| 227 '-DPROGUARD_FLAGS=<(proguard_flags_path)', | 287 '-DPROGUARD_FLAGS=<(proguard_flags_path)', |
| 228 '-DPROGUARD_ENABLED=<(proguard_enabled)', | 288 '-DPROGUARD_ENABLED=<(proguard_enabled)', |
| 229 '-DJAR_PATH=<(PRODUCT_DIR)/lib.java/<(jar_name)', | 289 '-DJAR_PATH=<(PRODUCT_DIR)/lib.java/<(jar_name)', |
| 230 '-DIS_TEST_APK=<(is_test_apk)', | 290 '-DIS_TEST_APK=<(is_test_apk)', |
| 231 '-DCREATE_TEST_JAR_PATH=<(DEPTH)/build/android/ant/create-test-jar.js', | 291 '-DCREATE_TEST_JAR_PATH=<(DEPTH)/build/android/ant/create-test-jar.js', |
| 292 '-DOBFUSCATED_JAR_PATH=<(obfuscated_jar_path)', | |
| 232 '-DAPK_NAME=<(apk_name)', | 293 '-DAPK_NAME=<(apk_name)', |
| 233 | 294 |
| 234 '-DSTAMP=<(compile_stamp)', | 295 '-DSTAMP=<(obfuscate_stamp)', |
| 235 '-Dbasedir=.', | 296 '-Dbasedir=.', |
| 236 '-buildfile', | 297 '-buildfile', |
| 237 '<(DEPTH)/build/android/ant/apk-compile.xml', | 298 '<(DEPTH)/build/android/ant/apk-obfuscate.xml', |
| 238 | 299 |
| 239 # Add list of inputs to the command line, so if inputs change | 300 # Add list of inputs to the command line, so if inputs change |
| 240 # (e.g. if a Java file is removed), the command will be re-run. | 301 # (e.g. if a Java file is removed), the command will be re-run. |
| 241 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. | 302 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
| 242 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', | 303 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', |
| 243 ], | 304 ], |
| 244 }, | 305 }, |
| 245 { | 306 { |
| 307 'action_name': 'dex_<(_target_name)', | |
| 308 'message': 'Dexing <(_target_name) jar', | |
| 309 'variables': { | |
| 310 'conditions': [ | |
| 311 ['proguard_enabled==1', { | |
| 312 'dex_inputs': [ '<(obfuscated_jar_path)' ], | |
| 313 }, { | |
| 314 'dex_inputs': [ | |
| 315 '>@(input_jars_paths)', | |
| 316 '<(classes_dir)', | |
| 317 ], | |
| 318 }], | |
| 319 ], | |
| 320 }, | |
| 321 'inputs': [ | |
| 322 '<(DEPTH)/build/android/pylib/build_utils.py', | |
| 323 '<(DEPTH)/build/android/dex.py', | |
| 324 '<(compile_stamp)', | |
| 325 '>@(dex_inputs)', | |
| 326 ], | |
| 327 'outputs': [ | |
| 328 '<(dex_path)', | |
| 329 ], | |
| 330 'action': [ | |
| 331 'python', '<(DEPTH)/build/android/dex.py', | |
| 332 '--dex-path=<(dex_path)', | |
| 333 '--android-sdk-root=<(android_sdk_root)', | |
| 334 | |
| 335 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja . | |
| 336 '--ignore=>!(echo >(_inputs) | md5sum)', | |
| 337 | |
| 338 '>@(dex_inputs)', | |
| 339 ] | |
| 340 }, | |
| 341 { | |
| 246 'action_name': 'ant_package_<(_target_name)', | 342 'action_name': 'ant_package_<(_target_name)', |
| 247 'message': 'Packaging <(_target_name).', | 343 'message': 'Packaging <(_target_name).', |
| 248 'inputs': [ | 344 'inputs': [ |
| 249 '<(DEPTH)/build/android/ant/apk-package.xml', | 345 '<(DEPTH)/build/android/ant/apk-package.xml', |
| 250 #TODO(cjhopman): this should be the stripped library paths. | 346 #TODO(cjhopman): this should be the stripped library paths. |
| 251 '>@(native_libs_paths)', | 347 '>@(native_libs_paths)', |
| 348 '<(dex_path)', | |
| 252 '<(codegen_stamp)', | 349 '<(codegen_stamp)', |
| 253 '<(compile_stamp)', | 350 '<(obfuscate_stamp)', |
| 254 ], | 351 ], |
| 255 'conditions': [ | 352 'conditions': [ |
| 256 ['is_test_apk == 1', { | 353 ['is_test_apk == 1', { |
| 257 'variables': { | 354 'variables': { |
| 258 'additional_res_dirs=': [], | 355 'additional_res_dirs=': [], |
| 259 'additional_res_packages=': [], | 356 'additional_res_packages=': [], |
| 260 } | 357 } |
| 261 }], | 358 }], |
| 262 ], | 359 ], |
| 263 'outputs': [ | 360 'outputs': [ |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 287 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. | 384 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
| 288 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', | 385 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', |
| 289 | 386 |
| 290 '-Dbasedir=.', | 387 '-Dbasedir=.', |
| 291 '-buildfile', | 388 '-buildfile', |
| 292 '<(DEPTH)/build/android/ant/apk-package.xml', | 389 '<(DEPTH)/build/android/ant/apk-package.xml', |
| 293 ] | 390 ] |
| 294 }, | 391 }, |
| 295 ], | 392 ], |
| 296 } | 393 } |
| OLD | NEW |