OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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/rules.gni") | 6 import("//build/config/android/rules.gni") |
6 import("//build/util/version.gni") | 7 import("//build/util/version.gni") |
7 import("//chrome/version.gni") | 8 import("//chrome/version.gni") |
8 import("//testing/test.gni") | 9 import("//testing/test.gni") |
9 | 10 |
10 assert(!is_component_build, "Cronet requires static library build.") | 11 assert(!is_component_build, "Cronet requires static library build.") |
11 | 12 |
12 declare_args() { | 13 declare_args() { |
13 cronet_enable_data_reduction_proxy_support = false | 14 cronet_enable_data_reduction_proxy_support = false |
14 } | 15 } |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 | 492 |
492 deps = [ | 493 deps = [ |
493 ":cronet_static", | 494 ":cronet_static", |
494 "//base", | 495 "//base", |
495 "//base/test:test_support", | 496 "//base/test:test_support", |
496 "//components/metrics", | 497 "//components/metrics", |
497 "//net", | 498 "//net", |
498 "//testing/gtest", | 499 "//testing/gtest", |
499 ] | 500 ] |
500 } | 501 } |
| 502 |
| 503 _package_dir = "$root_out_dir/cronet" |
| 504 _extract_cronet_jars_dir = "$target_gen_dir/cronet_jar_extract" |
| 505 |
| 506 action("extract_cronet_jars") { |
| 507 # extract_from_jars.py deletes the target directory before extracting. |
| 508 script = "//components/cronet/tools/extract_from_jars.py" |
| 509 depfile = "$target_gen_dir/$target_name.d" |
| 510 |
| 511 sources = [ |
| 512 "$root_out_dir/lib.java/base/base_java.jar", |
| 513 "$root_out_dir/lib.java/components/cronet/android/cronet_java.jar", |
| 514 "$root_out_dir/lib.java/net/android/net_java.jar", |
| 515 "$root_out_dir/lib.java/url/url_java.jar", |
| 516 ] |
| 517 outputs = [ |
| 518 depfile, |
| 519 ] |
| 520 |
| 521 _rebased_sources = rebase_path(sources, root_build_dir) |
| 522 |
| 523 args = [ |
| 524 "--classes-dir", |
| 525 rebase_path(_extract_cronet_jars_dir, root_build_dir), |
| 526 "--jars=${_rebased_sources}", |
| 527 "--depfile", |
| 528 rebase_path(depfile, root_build_dir), |
| 529 ] |
| 530 |
| 531 deps = [ |
| 532 ":cronet_java", |
| 533 "//base:base_java", |
| 534 "//net/android:net_java", |
| 535 "//url:url_java", |
| 536 ] |
| 537 } |
| 538 |
| 539 action("repackage_extracted_jars") { |
| 540 _output_jar = "$_package_dir/cronet.jar" |
| 541 |
| 542 script = "//build/android/gyp/jar.py" |
| 543 outputs = [ |
| 544 _output_jar, |
| 545 ] |
| 546 |
| 547 args = [ |
| 548 "--classes-dir", |
| 549 rebase_path(_extract_cronet_jars_dir, root_build_dir), |
| 550 "--jar-path", |
| 551 rebase_path(_output_jar, root_build_dir), |
| 552 ] |
| 553 |
| 554 deps = [ |
| 555 ":extract_cronet_jars", |
| 556 ] |
| 557 } |
| 558 |
| 559 template("jar_src") { |
| 560 action(target_name) { |
| 561 _rebased_src_dirs = rebase_path(invoker.src_dirs, root_build_dir) |
| 562 |
| 563 script = "//components/cronet/tools/jar_src.py" |
| 564 depfile = "$target_gen_dir/$target_name.d" |
| 565 outputs = [ |
| 566 depfile, |
| 567 invoker.jar_path, |
| 568 ] |
| 569 args = [ |
| 570 "--src-dir=${_rebased_src_dirs}", |
| 571 "--jar-path", |
| 572 rebase_path(invoker.jar_path, root_build_dir), |
| 573 "--depfile", |
| 574 rebase_path(depfile, root_build_dir), |
| 575 ] |
| 576 } |
| 577 } |
| 578 |
| 579 jar_src("jar_cronet_api_source") { |
| 580 src_dirs = [ "api/src" ] |
| 581 jar_path = "$_package_dir/cronet_api-src.jar" |
| 582 } |
| 583 |
| 584 jar_src("jar_cronet_sample_source") { |
| 585 src_dirs = [ "sample" ] |
| 586 jar_path = "$_package_dir/cronet-sample-src.jar" |
| 587 } |
| 588 |
| 589 jar_src("jar_cronet_other_source") { |
| 590 src_dirs = [ |
| 591 "//base/android/java/src", |
| 592 "//components/cronet/android/java/src", |
| 593 "//net/android/java/src", |
| 594 "//url/android/java/src", |
| 595 ] |
| 596 jar_path = "$_package_dir/cronet-src.jar" |
| 597 } |
| 598 |
| 599 action("generate_licenses") { |
| 600 _license_path = "$_package_dir/LICENSE" |
| 601 |
| 602 script = "//components/cronet/tools/cronet_licenses.py" |
| 603 outputs = [ |
| 604 _license_path, |
| 605 ] |
| 606 args = [ |
| 607 "license", |
| 608 rebase_path(_license_path, root_build_dir), |
| 609 ] |
| 610 } |
| 611 |
| 612 action("generate_javadoc") { |
| 613 script = "//components/cronet/tools/generate_javadoc.py" |
| 614 depfile = "$target_gen_dir/$target_name.d" |
| 615 outputs = [ |
| 616 depfile, |
| 617 ] |
| 618 |
| 619 args = [ |
| 620 "--output-dir", |
| 621 rebase_path(_package_dir, root_build_dir), |
| 622 "--input-dir", |
| 623 rebase_path("//components/cronet", root_build_dir), |
| 624 "--overview-file", |
| 625 rebase_path("$_package_dir/README.md.html", root_build_dir), |
| 626 "--readme-file", |
| 627 rebase_path("//components/cronet/README.md", root_build_dir), |
| 628 "--depfile", |
| 629 rebase_path(depfile, root_build_dir), |
| 630 ] |
| 631 } |
| 632 |
| 633 copy("cronet_package_copy") { |
| 634 sources = [ |
| 635 "$root_out_dir/lib.java/components/cronet/android/cronet_api.jar", |
| 636 "//AUTHORS", |
| 637 "//chrome/VERSION", |
| 638 "//components/cronet/android/proguard.cfg", |
| 639 ] |
| 640 outputs = [ |
| 641 "$_package_dir/{{source_file_part}}", |
| 642 ] |
| 643 |
| 644 deps = [ |
| 645 ":cronet_api", |
| 646 ] |
| 647 } |
| 648 |
| 649 copy("cronet_package_copy_native_lib") { |
| 650 sources = [ |
| 651 "$root_out_dir/libcronet.so", |
| 652 ] |
| 653 outputs = [ |
| 654 "$_package_dir/libs/${android_app_abi}/libcronet.so", |
| 655 ] |
| 656 deps = [ |
| 657 ":cronet", |
| 658 ] |
| 659 } |
| 660 |
| 661 copy("cronet_package_copy_native_lib_unstripped") { |
| 662 sources = [ |
| 663 "$root_out_dir/lib.unstripped/libcronet.so", |
| 664 ] |
| 665 outputs = [ |
| 666 "$_package_dir/symbols/${android_app_abi}/libcronet.so", |
| 667 ] |
| 668 deps = [ |
| 669 ":cronet", |
| 670 ] |
| 671 } |
| 672 |
| 673 group("cronet_package") { |
| 674 deps = [ |
| 675 ":cronet_package_copy", |
| 676 ":cronet_package_copy_native_lib", |
| 677 ":cronet_package_copy_native_lib_unstripped", |
| 678 ":generate_javadoc", |
| 679 ":generate_licenses", |
| 680 ":jar_cronet_api_source", |
| 681 ":jar_cronet_other_source", |
| 682 ":jar_cronet_sample_source", |
| 683 ":repackage_extracted_jars", |
| 684 ] |
| 685 } |
OLD | NEW |