OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
6 | 6 |
7 assert(is_android) | 7 assert(is_android) |
8 | 8 |
9 | 9 |
10 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) | 10 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 229 if (defined(invoker.testonly)) { testonly = invoker.testonly } |
230 | 230 |
231 _android_manifest = invoker.android_manifest | 231 _android_manifest = invoker.android_manifest |
232 _base_path = invoker.base_path | 232 _base_path = invoker.base_path |
233 _final_apk_path = invoker.apk_path | 233 _final_apk_path = invoker.apk_path |
234 _resources_zip = invoker.resources_zip | 234 _resources_zip = invoker.resources_zip |
235 _dex_path = invoker.dex_path | 235 _dex_path = invoker.dex_path |
236 _keystore_path = invoker.keystore_path | 236 _keystore_path = invoker.keystore_path |
237 _keystore_name = invoker.keystore_name | 237 _keystore_name = invoker.keystore_name |
238 _keystore_password = invoker.keystore_password | 238 _keystore_password = invoker.keystore_password |
| 239 _load_library_from_apk = invoker.load_library_from_apk |
239 | 240 |
240 _deps = [] | 241 _deps = [] |
241 if (defined(invoker.deps)) { | 242 if (defined(invoker.deps)) { |
242 _deps = invoker.deps | 243 _deps = invoker.deps |
243 } | 244 } |
244 | 245 |
245 _native_libs_dir = "//build/android/empty/res" | 246 _native_libs_dir = "//build/android/empty/res" |
246 if (defined(invoker.native_libs_dir)) { | 247 if (defined(invoker.native_libs_dir)) { |
247 _native_libs_dir = invoker.native_libs_dir | 248 _native_libs_dir = invoker.native_libs_dir |
248 } | 249 } |
(...skipping 15 matching lines...) Expand all Loading... |
264 _configuration_name = "Release" | 265 _configuration_name = "Release" |
265 if (is_debug) { | 266 if (is_debug) { |
266 _configuration_name = "Debug" | 267 _configuration_name = "Debug" |
267 } | 268 } |
268 | 269 |
269 action("${target_name}__package_resources") { | 270 action("${target_name}__package_resources") { |
270 deps = _deps | 271 deps = _deps |
271 | 272 |
272 script = "//build/android/gyp/package_resources.py" | 273 script = "//build/android/gyp/package_resources.py" |
273 depfile = "${target_gen_dir}/${target_name}.d" | 274 depfile = "${target_gen_dir}/${target_name}.d" |
274 source_prereqs = [ | 275 inputs = [ |
275 _android_manifest, | 276 _android_manifest, |
276 _resources_zip, | 277 _resources_zip, |
277 ] | 278 ] |
278 outputs = [depfile, _resource_packaged_apk_path] | 279 outputs = [depfile, _resource_packaged_apk_path] |
279 | 280 |
280 _rebased_resources_zips = [rebase_path(_resources_zip, root_build_dir)] | 281 _rebased_resources_zips = [rebase_path(_resources_zip, root_build_dir)] |
281 args = [ | 282 args = [ |
282 "--depfile", rebase_path(depfile, root_build_dir), | 283 "--depfile", rebase_path(depfile, root_build_dir), |
283 "--android-sdk", rebased_android_sdk, | 284 "--android-sdk", rebased_android_sdk, |
284 "--android-sdk-tools", rebased_android_sdk_build_tools, | 285 "--android-sdk-tools", rebased_android_sdk_build_tools, |
(...skipping 10 matching lines...) Expand all Loading... |
295 "--apk-path", rebase_path(_resource_packaged_apk_path, root_build_dir), | 296 "--apk-path", rebase_path(_resource_packaged_apk_path, root_build_dir), |
296 ] | 297 ] |
297 } | 298 } |
298 | 299 |
299 action("${target_name}__package") { | 300 action("${target_name}__package") { |
300 script = "//build/android/gyp/ant.py" | 301 script = "//build/android/gyp/ant.py" |
301 _ant_script = "//build/android/ant/apk-package.xml" | 302 _ant_script = "//build/android/ant/apk-package.xml" |
302 | 303 |
303 depfile = "$target_gen_dir/$target_name.d" | 304 depfile = "$target_gen_dir/$target_name.d" |
304 | 305 |
305 source_prereqs = [ | 306 inputs = [ |
306 _dex_path, | 307 _dex_path, |
307 _resource_packaged_apk_path, | 308 _resource_packaged_apk_path, |
308 _ant_script | 309 _ant_script |
309 ] | 310 ] |
310 | 311 |
311 outputs = [ | 312 outputs = [ |
312 depfile, | 313 depfile, |
313 _packaged_apk_path, | 314 _packaged_apk_path, |
314 ] | 315 ] |
315 | 316 |
(...skipping 21 matching lines...) Expand all Loading... |
337 "-Dbasedir=.", | 338 "-Dbasedir=.", |
338 "-buildfile", rebase_path(_ant_script, root_build_dir) | 339 "-buildfile", rebase_path(_ant_script, root_build_dir) |
339 ] | 340 ] |
340 } | 341 } |
341 | 342 |
342 action("${target_name}__finalize") { | 343 action("${target_name}__finalize") { |
343 script = "//build/android/gyp/finalize_apk.py" | 344 script = "//build/android/gyp/finalize_apk.py" |
344 depfile = "$target_gen_dir/$target_name.d" | 345 depfile = "$target_gen_dir/$target_name.d" |
345 | 346 |
346 sources = [_packaged_apk_path] | 347 sources = [_packaged_apk_path] |
347 source_prereqs = [_keystore_path] | 348 inputs = [_keystore_path] |
348 outputs = [depfile, _final_apk_path] | 349 outputs = [depfile, _final_apk_path] |
349 | 350 |
350 args = [ | 351 args = [ |
351 "--depfile", rebase_path(depfile, root_build_dir), | 352 "--depfile", rebase_path(depfile, root_build_dir), |
352 "--zipalign-path", rebase_path(zipalign_path, root_build_dir), | 353 "--zipalign-path", rebase_path(zipalign_path, root_build_dir), |
353 "--unsigned-apk-path", rebase_path(_packaged_apk_path, root_build_dir), | 354 "--unsigned-apk-path", rebase_path(_packaged_apk_path, root_build_dir), |
354 "--final-apk-path", rebase_path(_final_apk_path, root_build_dir), | 355 "--final-apk-path", rebase_path(_final_apk_path, root_build_dir), |
355 "--key-path", rebase_path(_keystore_path, root_build_dir), | 356 "--key-path", rebase_path(_keystore_path, root_build_dir), |
356 "--key-name", _keystore_name, | 357 "--key-name", _keystore_name, |
357 "--key-passwd", _keystore_password, | 358 "--key-passwd", _keystore_password, |
358 ] | 359 ] |
| 360 if (_load_library_from_apk) { |
| 361 _rezip_jar_path = "$root_build_dir/lib.java/rezip_apk.jar" |
| 362 inputs += [ |
| 363 _rezip_jar_path |
| 364 ] |
| 365 args += [ |
| 366 "--load-library-from-zip-file=1", |
| 367 "--rezip-apk-jar-path", rebase_path(_rezip_jar_path, root_build_dir) |
| 368 ] |
| 369 } |
359 } | 370 } |
360 | 371 |
361 group(target_name) { | 372 group(target_name) { |
362 deps = [":${target_name}__finalize"] | 373 deps = [":${target_name}__finalize"] |
363 } | 374 } |
364 } | 375 } |
365 | 376 |
366 template("java_prebuilt") { | 377 template("java_prebuilt") { |
367 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 378 if (defined(invoker.testonly)) { testonly = invoker.testonly } |
368 | 379 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 # | 450 # |
440 # Variables | 451 # Variables |
441 # java_files: List of .java files to compile. | 452 # java_files: List of .java files to compile. |
442 # java_deps: List of java dependencies. These should all have a .jar output | 453 # java_deps: List of java dependencies. These should all have a .jar output |
443 # at "${target_gen_dir}/${target_name}.jar. | 454 # at "${target_gen_dir}/${target_name}.jar. |
444 # chromium_code: If true, enable extra warnings. | 455 # chromium_code: If true, enable extra warnings. |
445 # srcjar_deps: List of srcjar dependencies. The .java files contained in the | 456 # srcjar_deps: List of srcjar dependencies. The .java files contained in the |
446 # dependencies srcjar outputs will be compiled and added to the output jar. | 457 # dependencies srcjar outputs will be compiled and added to the output jar. |
447 # jar_path: Use this to explicitly set the output jar path. Defaults to | 458 # jar_path: Use this to explicitly set the output jar path. Defaults to |
448 # "${target_gen_dir}/${target_name}.jar. | 459 # "${target_gen_dir}/${target_name}.jar. |
449 template("java_library") { | 460 template("compile_java") { |
450 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 461 if (defined(invoker.testonly)) { testonly = invoker.testonly } |
451 | 462 |
452 assert(defined(invoker.java_files)) | 463 assert(defined(invoker.java_files)) |
453 assert(defined(invoker.build_config)) | 464 assert(defined(invoker.build_config)) |
454 assert(defined(invoker.jar_path)) | 465 assert(defined(invoker.jar_path)) |
455 | 466 |
456 _java_files = invoker.java_files | 467 _java_files = invoker.java_files |
457 _final_jar_path = invoker.jar_path | 468 _final_jar_path = invoker.jar_path |
458 _intermediate_jar_path = "$target_gen_dir/$target_name.initial.jar" | 469 _intermediate_jar_path = "$target_gen_dir/$target_name.initial.jar" |
459 | 470 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 | 602 |
592 _android_manifest = "//build/android/AndroidManifest.xml" | 603 _android_manifest = "//build/android/AndroidManifest.xml" |
593 if (defined(invoker.android_manifest)) { | 604 if (defined(invoker.android_manifest)) { |
594 _android_manifest = invoker.android_manifest | 605 _android_manifest = invoker.android_manifest |
595 } | 606 } |
596 assert(_android_manifest != "") | 607 assert(_android_manifest != "") |
597 | 608 |
598 _final_deps = [] | 609 _final_deps = [] |
599 _final_datadeps = [] | 610 _final_datadeps = [] |
600 | 611 |
601 java_library("${target_name}__java_library") { | 612 compile_java("${target_name}__compile_java") { |
602 jar_path = _jar_path | 613 jar_path = _jar_path |
603 if (defined(invoker.jar_excluded_patterns)) { | 614 if (defined(invoker.jar_excluded_patterns)) { |
604 jar_excluded_patterns = invoker.jar_excluded_patterns | 615 jar_excluded_patterns = invoker.jar_excluded_patterns |
605 } | 616 } |
606 build_config = invoker.build_config | 617 build_config = invoker.build_config |
607 java_files = _java_files | 618 java_files = _java_files |
608 srcjar_deps = _srcjar_deps | 619 srcjar_deps = _srcjar_deps |
609 srcjars = _srcjars | 620 srcjars = _srcjars |
610 | 621 |
611 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { | 622 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { |
(...skipping 15 matching lines...) Expand all Loading... |
627 } | 638 } |
628 } | 639 } |
629 | 640 |
630 dex("${target_name}__dex") { | 641 dex("${target_name}__dex") { |
631 sources = [_jar_path] | 642 sources = [_jar_path] |
632 output = _dex_path | 643 output = _dex_path |
633 } | 644 } |
634 | 645 |
635 group(target_name) { | 646 group(target_name) { |
636 deps = [ | 647 deps = [ |
637 ":${target_name}__java_library", | 648 ":${target_name}__compile_java", |
638 ":${target_name}__dex", | 649 ":${target_name}__dex", |
639 ] + _final_deps + _final_datadeps | 650 ] + _final_deps + _final_datadeps |
640 } | 651 } |
641 } | 652 } |
642 | 653 |
643 # Runs process_resources.py | 654 # Runs process_resources.py |
644 template("process_resources") { | 655 template("process_resources") { |
645 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 656 if (defined(invoker.testonly)) { testonly = invoker.testonly } |
646 | 657 |
647 zip_path = invoker.zip_path | 658 zip_path = invoker.zip_path |
(...skipping 17 matching lines...) Expand all Loading... |
665 srcjar_path, | 676 srcjar_path, |
666 ] | 677 ] |
667 | 678 |
668 sources_build_rel = exec_script( | 679 sources_build_rel = exec_script( |
669 "//build/android/gyp/find.py", | 680 "//build/android/gyp/find.py", |
670 rebase_path(resource_dirs, root_build_dir), | 681 rebase_path(resource_dirs, root_build_dir), |
671 "list lines" | 682 "list lines" |
672 ) | 683 ) |
673 sources = rebase_path(sources_build_rel, ".", root_build_dir) | 684 sources = rebase_path(sources_build_rel, ".", root_build_dir) |
674 | 685 |
675 source_prereqs = [ | 686 inputs = [ |
676 build_config, | 687 build_config, |
677 android_manifest, | 688 android_manifest, |
678 ] | 689 ] |
679 | 690 |
680 rebase_resource_dirs = rebase_path(resource_dirs, root_build_dir) | 691 rebase_resource_dirs = rebase_path(resource_dirs, root_build_dir) |
681 rebase_build_config = rebase_path(build_config, root_build_dir) | 692 rebase_build_config = rebase_path(build_config, root_build_dir) |
682 args = [ | 693 args = [ |
683 "--depfile", rebase_path(depfile, root_build_dir), | 694 "--depfile", rebase_path(depfile, root_build_dir), |
684 "--android-sdk", rebase_path(android_sdk, root_build_dir), | 695 "--android-sdk", rebase_path(android_sdk, root_build_dir), |
685 "--android-sdk-tools", rebase_path(android_sdk_build_tools, root_build_dir
), | 696 "--android-sdk-tools", rebase_path(android_sdk_build_tools, root_build_dir
), |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 | 764 |
754 if (defined(invoker.clear_dir) && invoker.clear_dir) { | 765 if (defined(invoker.clear_dir) && invoker.clear_dir) { |
755 args += ["--clear"] | 766 args += ["--clear"] |
756 } | 767 } |
757 | 768 |
758 if (defined(invoker.args)) { | 769 if (defined(invoker.args)) { |
759 args += invoker.args | 770 args += invoker.args |
760 } | 771 } |
761 } | 772 } |
762 } | 773 } |
OLD | NEW |