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("//base/android/linker/config.gni") | 5 import("//base/android/linker/config.gni") |
6 import("//build/config/android/config.gni") | 6 import("//build/config/android/config.gni") |
7 import("//build/config/android/internal_rules.gni") | 7 import("//build/config/android/internal_rules.gni") |
8 import("//tools/grit/grit_rule.gni") | 8 import("//tools/grit/grit_rule.gni") |
9 import("//tools/relocation_packer/config.gni") | 9 import("//tools/relocation_packer/config.gni") |
10 | 10 |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 } | 633 } |
634 | 634 |
635 group(target_name) { | 635 group(target_name) { |
636 deps = [ | 636 deps = [ |
637 ":${target_name}__build_config", | 637 ":${target_name}__build_config", |
638 ":${target_name}__zip", | 638 ":${target_name}__zip", |
639 ] | 639 ] |
640 } | 640 } |
641 } | 641 } |
642 | 642 |
| 643 # Declare a Java executable target |
| 644 # |
| 645 # This target creates an executable from java code and libraries. The executable |
| 646 # will be in the output folder's /bin/ directory. |
| 647 # |
| 648 # Variables |
| 649 # deps: Specifies the dependencies of this target. Java targets in this list |
| 650 # will be included in the executable (and the javac classpath). |
| 651 # |
| 652 # java_files: List of .java files included in this library. |
| 653 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars |
| 654 # will be added to java_files and be included in this library. |
| 655 # srcjars: List of srcjars to be included in this library, together with the |
| 656 # ones obtained from srcjar_deps. |
| 657 # |
| 658 # chromium_code: If true, extra analysis warning/errors will be enabled. |
| 659 # |
| 660 # datadeps, testonly |
| 661 # |
| 662 # Example |
| 663 # java_library("foo") { |
| 664 # java_files = [ "org/chromium/foo/FooMain.java" ] |
| 665 # deps = [ ":bar_java" ] |
| 666 # main_class = "org.chromium.foo.FooMain" |
| 667 # } |
| 668 template("java_binary") { |
| 669 # TODO(cjhopman): This should not act like a java_library for dependents (i.e. |
| 670 # dependents shouldn't get the jar in their classpath, etc.). |
| 671 java_library_impl(target_name) { |
| 672 if (defined(invoker.DEPRECATED_java_in_dir)) { DEPRECATED_java_in_dir = invo
ker.DEPRECATED_java_in_dir } |
| 673 if (defined(invoker.chromium_code)) { chromium_code = invoker.chromium_code
} |
| 674 if (defined(invoker.datadeps)) { deps = invoker.datadeps } |
| 675 if (defined(invoker.deps)) { deps = invoker.deps } |
| 676 if (defined(invoker.java_files)) { java_files = invoker.java_files } |
| 677 if (defined(invoker.srcjar_deps)) { srcjar_deps = invoker.srcjar_deps } |
| 678 if (defined(invoker.srcjars)) { srcjars = invoker.srcjars } |
| 679 if (defined(invoker.testonly)) { testonly = invoker.testonly } |
| 680 |
| 681 main_class = invoker.main_class |
| 682 } |
| 683 } |
| 684 |
643 | 685 |
| 686 # Declare an java library target |
| 687 # |
| 688 # Variables |
| 689 # deps: Specifies the dependencies of this target. Java targets in this list |
| 690 # will be added to the javac classpath. |
| 691 # |
| 692 # java_files: List of .java files included in this library. |
| 693 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars |
| 694 # will be added to java_files and be included in this library. |
| 695 # srcjars: List of srcjars to be included in this library, together with the |
| 696 # ones obtained from srcjar_deps. |
| 697 # DEPRECATED_java_in_dir: Directory containing java files. All .java files in |
| 698 # this directory will be included in the library. This is only supported to |
| 699 # ease the gyp->gn conversion and will be removed in the future. |
| 700 # |
| 701 # chromium_code: If true, extra analysis warning/errors will be enabled. |
| 702 # jar_excluded_patterns: List of patterns of .class files to exclude from the |
| 703 # final jar. |
| 704 # |
| 705 # proguard_preprocess: If true, proguard preprocessing will be run. This can |
| 706 # be used to remove unwanted parts of the library. |
| 707 # proguard_config: Path to the proguard config for preprocessing. |
| 708 # |
| 709 # supports_android: If true, Android targets (android_library, android_apk) |
| 710 # may depend on this target. Note: if true, this target must only use the |
| 711 # subset of Java available on Android. |
| 712 # requires_android_platform: If true, this library may depend on |
| 713 # android-specific targets. If this is the case, there should be some |
| 714 # android-platform-like implementation available at runtime (Android, |
| 715 # robolectric, etc). |
| 716 # |
| 717 # datadeps, testonly |
| 718 # |
| 719 # Example |
| 720 # java_library("foo_java") { |
| 721 # java_files = [ |
| 722 # "org/chromium/foo/Foo.java", |
| 723 # "org/chromium/foo/FooInterface.java", |
| 724 # "org/chromium/foo/FooService.java", |
| 725 # ] |
| 726 # deps = [ |
| 727 # ":bar_java" |
| 728 # ] |
| 729 # srcjar_deps = [ |
| 730 # ":foo_generated_enum" |
| 731 # ] |
| 732 # jar_excluded_patterns = [ |
| 733 # "*/FooService.class", "*/FooService##*.class" |
| 734 # ] |
| 735 # } |
| 736 template("java_library") { |
| 737 java_library_impl(target_name) { |
| 738 if (defined(invoker.DEPRECATED_java_in_dir)) { DEPRECATED_java_in_dir = invo
ker.DEPRECATED_java_in_dir } |
| 739 if (defined(invoker.chromium_code)) { chromium_code = invoker.chromium_code
} |
| 740 if (defined(invoker.datadeps)) { deps = invoker.datadeps } |
| 741 if (defined(invoker.deps)) { deps = invoker.deps } |
| 742 if (defined(invoker.jar_excluded_patterns)) { jar_excluded_patterns = invoke
r.jar_excluded_patterns } |
| 743 if (defined(invoker.java_files)) { java_files = invoker.java_files } |
| 744 if (defined(invoker.proguard_config)) { proguard_config = invoker.proguard_c
onfig } |
| 745 if (defined(invoker.proguard_preprocess)) { proguard_preprocess = invoker.pr
oguard_preprocess } |
| 746 if (defined(invoker.srcjar_deps)) { srcjar_deps = invoker.srcjar_deps } |
| 747 if (defined(invoker.srcjars)) { srcjars = invoker.srcjars } |
| 748 if (defined(invoker.testonly)) { testonly = invoker.testonly } |
| 749 if (defined(invoker.jar_path)) { jar_path = invoker.jar_path } |
| 750 |
| 751 if (defined(invoker.supports_android) && invoker.supports_android) { |
| 752 supports_android = true |
| 753 } |
| 754 if (defined(invoker.requires_android_platform) |
| 755 && invoker.requires_android_platform) { |
| 756 supports_android = true |
| 757 requires_android = true |
| 758 } |
| 759 } |
| 760 } |
| 761 |
| 762 |
| 763 # Declare an java library target for a prebuilt jar |
| 764 # |
| 765 # Variables |
| 766 # deps: Specifies the dependencies of this target. Java targets in this list |
| 767 # will be added to the javac classpath. |
| 768 # jar_path: Path to the prebuilt jar. |
| 769 # proguard_preprocess: If true, proguard preprocessing will be run. This can |
| 770 # be used to remove unwanted parts of the library. |
| 771 # proguard_config: Path to the proguard config for preprocessing. |
| 772 # |
| 773 # Example |
| 774 # java_prebuilt("foo_java") { |
| 775 # jar_path = "foo.jar" |
| 776 # deps = [ |
| 777 # ":foo_resources", |
| 778 # ":bar_java" |
| 779 # ] |
| 780 # } |
| 781 template("java_prebuilt") { |
| 782 java_prebuilt_impl(target_name) { |
| 783 jar_path = invoker.jar_path |
| 784 if (defined(invoker.testonly)) { testonly = invoker.testonly } |
| 785 if (defined(invoker.deps)) { deps = invoker.deps } |
| 786 if (defined(invoker.proguard_config)) { proguard_config = invoker.proguard_c
onfig } |
| 787 if (defined(invoker.proguard_preprocess)) { proguard_preprocess = invoker.pr
oguard_preprocess } |
| 788 } |
| 789 } |
| 790 |
644 # Declare an Android library target | 791 # Declare an Android library target |
645 # | 792 # |
646 # This target creates an Android library containing java code and Android | 793 # This target creates an Android library containing java code and Android |
647 # resources. | 794 # resources. |
648 # | 795 # |
649 # Variables | 796 # Variables |
650 # deps: Specifies the dependencies of this target. Java targets in this list | 797 # deps: Specifies the dependencies of this target. Java targets in this list |
651 # will be added to the javac classpath. Android resources in dependencies | 798 # will be added to the javac classpath. Android resources in dependencies |
652 # will be used when building this library. | 799 # will be used when building this library. |
| 800 # |
653 # java_files: List of .java files included in this library. | 801 # java_files: List of .java files included in this library. |
654 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars | 802 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars |
655 # will be added to java_files and be included in this library. | 803 # will be added to java_files and be included in this library. |
656 # srcjars: List of srcjars to be included in this library, together with the | 804 # srcjars: List of srcjars to be included in this library, together with the |
657 # ones obtained from srcjar_deps. | 805 # ones obtained from srcjar_deps. |
| 806 # DEPRECATED_java_in_dir: Directory containing java files. All .java files in |
| 807 # this directory will be included in the library. This is only supported to |
| 808 # ease the gyp->gn conversion and will be removed in the future. |
| 809 # |
658 # chromium_code: If true, extra analysis warning/errors will be enabled. | 810 # chromium_code: If true, extra analysis warning/errors will be enabled. |
659 # jar_excluded_patterns: List of patterns of .class files to exclude from the | 811 # jar_excluded_patterns: List of patterns of .class files to exclude from the |
660 # final jar. | 812 # final jar. |
| 813 # |
661 # proguard_preprocess: If true, proguard preprocessing will be run. This can | 814 # proguard_preprocess: If true, proguard preprocessing will be run. This can |
662 # be used to remove unwanted parts of the library. | 815 # be used to remove unwanted parts of the library. |
663 # proguard_config: Path to the proguard config for preprocessing. | 816 # proguard_config: Path to the proguard config for preprocessing. |
664 # | 817 # |
665 # DEPRECATED_java_in_dir: Directory containing java files. All .java files in | |
666 # this directory will be included in the library. This is only supported to | |
667 # ease the gyp->gn conversion and will be removed in the future. | |
668 # | 818 # |
669 # Example | 819 # Example |
670 # android_library("foo_java") { | 820 # android_library("foo_java") { |
671 # java_files = [ | 821 # java_files = [ |
672 # "android/org/chromium/foo/Foo.java", | 822 # "android/org/chromium/foo/Foo.java", |
673 # "android/org/chromium/foo/FooInterface.java", | 823 # "android/org/chromium/foo/FooInterface.java", |
674 # "android/org/chromium/foo/FooService.java", | 824 # "android/org/chromium/foo/FooService.java", |
675 # ] | 825 # ] |
676 # deps = [ | 826 # deps = [ |
677 # ":bar_java" | 827 # ":bar_java" |
678 # ] | 828 # ] |
679 # srcjar_deps = [ | 829 # srcjar_deps = [ |
680 # ":foo_generated_enum" | 830 # ":foo_generated_enum" |
681 # ] | 831 # ] |
682 # jar_excluded_patterns = [ | 832 # jar_excluded_patterns = [ |
683 # "*/FooService.class", "*/FooService##*.class" | 833 # "*/FooService.class", "*/FooService##*.class" |
684 # ] | 834 # ] |
685 # } | 835 # } |
686 template("android_library") { | 836 template("android_library") { |
687 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 837 assert(!defined(invoker.jar_path), |
| 838 "android_library does not support a custom jar path") |
| 839 java_library_impl(target_name) { |
| 840 if (defined(invoker.DEPRECATED_java_in_dir)) { DEPRECATED_java_in_dir = invo
ker.DEPRECATED_java_in_dir } |
| 841 if (defined(invoker.chromium_code)) { chromium_code = invoker.chromium_code
} |
| 842 if (defined(invoker.datadeps)) { deps = invoker.datadeps } |
| 843 if (defined(invoker.deps)) { deps = invoker.deps } |
| 844 if (defined(invoker.jar_excluded_patterns)) { jar_excluded_patterns = invoke
r.jar_excluded_patterns } |
| 845 if (defined(invoker.java_files)) { java_files = invoker.java_files } |
| 846 if (defined(invoker.proguard_config)) { proguard_config = invoker.proguard_c
onfig } |
| 847 if (defined(invoker.proguard_preprocess)) { proguard_preprocess = invoker.pr
oguard_preprocess } |
| 848 if (defined(invoker.srcjar_deps)) { srcjar_deps = invoker.srcjar_deps } |
| 849 if (defined(invoker.srcjars)) { srcjars = invoker.srcjars } |
| 850 if (defined(invoker.testonly)) { testonly = invoker.testonly } |
| 851 if (defined(invoker.dex_path)) { dex_path = invoker.dex_path } |
688 | 852 |
689 assert(defined(invoker.java_files) || defined(invoker.DEPRECATED_java_in_dir) | 853 supports_android = true |
690 || defined(invoker.srcjars) || defined(invoker.srcjar_deps)) | 854 requires_android = true |
691 _base_path = "$target_gen_dir/$target_name" | |
692 _build_config = _base_path + ".build_config" | |
693 _jar_path = _base_path + ".jar" | |
694 if (defined(invoker.dex_path)) { | |
695 _dex_path = invoker.dex_path | |
696 } else { | |
697 _dex_path = _base_path + ".dex.jar" | |
698 } | |
699 | 855 |
700 write_build_config("${target_name}__build_config") { | 856 if (!defined(jar_excluded_patterns)) { jar_excluded_patterns = [] } |
701 type = "android_library" | 857 jar_excluded_patterns += [ |
702 | |
703 deps = [] | |
704 if (defined(invoker.deps)) { | |
705 deps += invoker.deps | |
706 } | |
707 | |
708 build_config = _build_config | |
709 jar_path = _jar_path | |
710 dex_path = _dex_path | |
711 } | |
712 | |
713 _chromium_code = true | |
714 if (defined(invoker.chromium_code)) { | |
715 _chromium_code = invoker.chromium_code | |
716 } | |
717 | |
718 android_java_library(target_name) { | |
719 chromium_code = _chromium_code | |
720 if (defined(invoker.java_files)) { | |
721 java_files = invoker.java_files | |
722 } else if (defined(invoker.DEPRECATED_java_in_dir)) { | |
723 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir | |
724 } | |
725 build_config = _build_config | |
726 jar_path = _jar_path | |
727 dex_path = _dex_path | |
728 | |
729 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { | |
730 proguard_preprocess = true | |
731 proguard_config = invoker.proguard_config | |
732 } | |
733 | |
734 jar_excluded_patterns = [ | |
735 "*/R.class", "*/R##*.class", | 858 "*/R.class", "*/R##*.class", |
736 "*/Manifest.class", "*/Manifest##*.class", | 859 "*/Manifest.class", "*/Manifest##*.class", |
737 ] | 860 ] |
738 if (defined(invoker.jar_excluded_patterns)) { | |
739 jar_excluded_patterns += invoker.jar_excluded_patterns | |
740 } | |
741 | |
742 if (defined(invoker.srcjar_deps)) { | |
743 srcjar_deps = invoker.srcjar_deps | |
744 } | |
745 if (defined(invoker.srcjars)) { | |
746 srcjars = invoker.srcjars | |
747 } | |
748 } | 861 } |
749 } | 862 } |
750 | 863 |
751 template("java_library") { | |
752 if (defined(invoker.testonly)) { testonly = invoker.testonly } | |
753 | |
754 assert(defined(invoker.java_files) || defined(invoker.DEPRECATED_java_in_dir) | |
755 || defined(invoker.srcjars)) | |
756 | |
757 _srcjar_deps = [] | |
758 if (defined(invoker.srcjar_deps)) { | |
759 _srcjar_deps = invoker.srcjar_deps | |
760 } | |
761 | |
762 _srcjars = [] | |
763 if (defined(invoker.srcjars)) { | |
764 _srcjars = invoker.srcjars | |
765 } | |
766 | |
767 _java_files = [] | |
768 if (defined(invoker.java_files)) { | |
769 _java_files = invoker.java_files | |
770 } else if (defined(invoker.DEPRECATED_java_in_dir)) { | |
771 _src_dir = invoker.DEPRECATED_java_in_dir + "/src" | |
772 _src_dir_exists = exec_script("//build/dir_exists.py", | |
773 [ rebase_path(_src_dir, root_build_dir) ], | |
774 "string") | |
775 assert(_src_dir_exists == "False", | |
776 "In GN, java_in_dir should be the fully specified java directory " + | |
777 "(i.e. including the trailing \"/src\")") | |
778 | |
779 _java_files_build_rel = exec_script( | |
780 "//build/android/gyp/find.py", | |
781 [ | |
782 "--pattern", | |
783 "*.java", | |
784 rebase_path(invoker.DEPRECATED_java_in_dir, root_build_dir) | |
785 ], | |
786 "list lines" | |
787 ) | |
788 _java_files = rebase_path(_java_files_build_rel, ".", root_build_dir) | |
789 } | |
790 assert(_java_files != [] || _srcjar_deps != [] || _srcjars != []) | |
791 | |
792 # TODO(cjhopman): Write a proper build config so that java library | |
793 # dependencies work correctly. | |
794 _build_config = "$target_gen_dir/$target_name.build_config" | |
795 write_file( | |
796 _build_config, | |
797 "{ \"javac\": { \"classpath\": [], \"srcjars\": [] } }") | |
798 | |
799 _jar_path = "$root_build_dir/lib.java/$target_name.jar" | |
800 if (defined(invoker.jar_path)) { | |
801 _jar_path = invoker.jar_path | |
802 } | |
803 | |
804 compile_java(target_name) { | |
805 build_config = _build_config | |
806 jar_path = _jar_path | |
807 java_files = _java_files | |
808 srcjar_deps = _srcjar_deps | |
809 srcjars = _srcjars | |
810 } | |
811 } | |
812 | |
813 | |
814 # Declare an Android library target for a prebuilt jar | 864 # Declare an Android library target for a prebuilt jar |
815 # | 865 # |
816 # This target creates an Android library containing java code and Android | 866 # This target creates an Android library containing java code and Android |
817 # resources. | 867 # resources. |
818 # | 868 # |
819 # Variables | 869 # Variables |
820 # deps: Specifies the dependencies of this target. Java targets in this list | 870 # deps: Specifies the dependencies of this target. Java targets in this list |
821 # will be added to the javac classpath. Android resources in dependencies | 871 # will be added to the javac classpath. Android resources in dependencies |
822 # will be used when building this library. | 872 # will be used when building this library. |
823 # jar_path: Path to the prebuilt jar. | 873 # jar_path: Path to the prebuilt jar. |
824 # proguard_preprocess: If true, proguard preprocessing will be run. This can | 874 # proguard_preprocess: If true, proguard preprocessing will be run. This can |
825 # be used to remove unwanted parts of the library. | 875 # be used to remove unwanted parts of the library. |
826 # proguard_config: Path to the proguard config for preprocessing. | 876 # proguard_config: Path to the proguard config for preprocessing. |
827 # | 877 # |
828 # Example | 878 # Example |
829 # android_java_prebuilt("foo_java") { | 879 # android_java_prebuilt("foo_java") { |
830 # jar_path = "foo.jar" | 880 # jar_path = "foo.jar" |
831 # deps = [ | 881 # deps = [ |
832 # ":foo_resources", | 882 # ":foo_resources", |
833 # ":bar_java" | 883 # ":bar_java" |
834 # ] | 884 # ] |
835 # } | 885 # } |
836 template("android_java_prebuilt") { | 886 template("android_java_prebuilt") { |
837 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 887 java_prebuilt_impl(target_name) { |
838 | 888 jar_path = invoker.jar_path |
839 assert(defined(invoker.jar_path)) | 889 supports_android = true |
840 _base_path = "${target_gen_dir}/$target_name" | 890 requires_android = true |
841 _jar_path = _base_path + ".jar" | 891 if (defined(invoker.testonly)) { testonly = invoker.testonly } |
842 _dex_path = _base_path + ".dex.jar" | 892 if (defined(invoker.deps)) { deps = invoker.deps } |
843 _build_config = _base_path + ".build_config" | 893 if (defined(invoker.proguard_config)) { proguard_config = invoker.proguard_c
onfig } |
844 | 894 if (defined(invoker.proguard_preprocess)) { proguard_preprocess = invoker.pr
oguard_preprocess } |
845 write_build_config("${target_name}__build_config") { | |
846 type = "android_library" | |
847 | |
848 deps = [] | |
849 if (defined(invoker.deps)) { | |
850 deps += invoker.deps | |
851 } | |
852 build_config = _build_config | |
853 jar_path = _jar_path | |
854 dex_path = _dex_path | |
855 } | |
856 | |
857 java_prebuilt("${target_name}__process_jar") { | |
858 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { | |
859 proguard_preprocess = true | |
860 proguard_config = invoker.proguard_config | |
861 } | |
862 | |
863 build_config = _build_config | |
864 input_jar_path = invoker.jar_path | |
865 output_jar_path = _jar_path | |
866 } | |
867 | |
868 dex("${target_name}__dex") { | |
869 sources = [_jar_path] | |
870 output = _dex_path | |
871 } | |
872 | |
873 group(target_name) { | |
874 deps = [ | |
875 ":${target_name}__build_config", | |
876 ":${target_name}__dex", | |
877 ] | |
878 } | 895 } |
879 } | 896 } |
880 | 897 |
881 | 898 |
882 | 899 |
883 # Declare an Android apk target | 900 # Declare an Android apk target |
884 # | 901 # |
885 # This target creates an Android APK containing java code, resources, assets, | 902 # This target creates an Android APK containing java code, resources, assets, |
886 # and (possibly) native libraries. | 903 # and (possibly) native libraries. |
887 # | 904 # |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 # native_libs = [ | 944 # native_libs = [ |
928 # native_lib_path | 945 # native_lib_path |
929 # ] | 946 # ] |
930 # } | 947 # } |
931 template("android_apk") { | 948 template("android_apk") { |
932 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 949 if (defined(invoker.testonly)) { testonly = invoker.testonly } |
933 | 950 |
934 assert(defined(invoker.final_apk_path) || defined(invoker.apk_name)) | 951 assert(defined(invoker.final_apk_path) || defined(invoker.apk_name)) |
935 gen_dir = "$target_gen_dir/$target_name" | 952 gen_dir = "$target_gen_dir/$target_name" |
936 base_path = "$gen_dir/$target_name" | 953 base_path = "$gen_dir/$target_name" |
937 build_config = "$base_path.build_config" | 954 _build_config = "$base_path.build_config" |
938 resources_zip_path = "$base_path.resources.zip" | 955 resources_zip_path = "$base_path.resources.zip" |
939 all_resources_zip_path = "$base_path.resources.all.zip" | 956 all_resources_zip_path = "$base_path.resources.all.zip" |
940 jar_path = "$base_path.jar" | 957 jar_path = "$base_path.jar" |
941 final_dex_path = "$gen_dir/classes.dex" | 958 final_dex_path = "$gen_dir/classes.dex" |
942 _template_name = target_name | 959 _template_name = target_name |
943 _final_apk_path = "" | 960 _final_apk_path = "" |
944 if (defined(invoker.final_apk_path)) { | 961 if (defined(invoker.final_apk_path)) { |
945 _final_apk_path = invoker.final_apk_path | 962 _final_apk_path = invoker.final_apk_path |
946 } else if (defined(invoker.apk_name)) { | 963 } else if (defined(invoker.apk_name)) { |
947 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk" | 964 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 ] | 1019 ] |
1003 } | 1020 } |
1004 | 1021 |
1005 _enable_relocation_packing = false | 1022 _enable_relocation_packing = false |
1006 if (_use_chromium_linker && defined(invoker.enable_relocation_packing) && | 1023 if (_use_chromium_linker && defined(invoker.enable_relocation_packing) && |
1007 invoker.enable_relocation_packing) { | 1024 invoker.enable_relocation_packing) { |
1008 _enable_relocation_packing = true | 1025 _enable_relocation_packing = true |
1009 } | 1026 } |
1010 } | 1027 } |
1011 | 1028 |
1012 _rebased_build_config = rebase_path(build_config, root_build_dir) | 1029 _rebased_build_config = rebase_path(_build_config, root_build_dir) |
1013 | 1030 |
1014 write_build_config("${_template_name}__build_config") { | 1031 write_build_config("${_template_name}__build_config") { |
1015 type = "android_apk" | 1032 type = "android_apk" |
1016 dex_path = final_dex_path | 1033 dex_path = final_dex_path |
1017 resources_zip = resources_zip_path | 1034 resources_zip = resources_zip_path |
| 1035 build_config = _build_config |
1018 | 1036 |
1019 if (defined(invoker.deps)) { | 1037 if (defined(invoker.deps)) { |
1020 deps = invoker.deps | 1038 deps = invoker.deps |
1021 } | 1039 } |
1022 | 1040 |
1023 native_libs = _native_libs | 1041 native_libs = _native_libs |
1024 } | 1042 } |
1025 | 1043 |
1026 final_deps = [] | 1044 final_deps = [] |
1027 | 1045 |
1028 final_deps += [":${_template_name}__process_resources"] | 1046 final_deps += [":${_template_name}__process_resources"] |
1029 process_resources("${_template_name}__process_resources") { | 1047 process_resources("${_template_name}__process_resources") { |
1030 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" | 1048 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" |
1031 android_manifest = invoker.android_manifest | 1049 android_manifest = invoker.android_manifest |
1032 resource_dirs = ["//build/android/ant/empty/res"] | 1050 resource_dirs = ["//build/android/ant/empty/res"] |
1033 zip_path = resources_zip_path | 1051 zip_path = resources_zip_path |
1034 generate_constant_ids = true | 1052 generate_constant_ids = true |
| 1053 build_config = _build_config |
1035 } | 1054 } |
1036 _srcjar_deps += [":${_template_name}__process_resources"] | 1055 _srcjar_deps += [":${_template_name}__process_resources"] |
1037 | 1056 |
1038 if (_native_libs != []) { | 1057 if (_native_libs != []) { |
1039 _enable_chromium_linker_tests = false | 1058 _enable_chromium_linker_tests = false |
1040 if (defined(invoker.enable_chromium_linker_tests)) { | 1059 if (defined(invoker.enable_chromium_linker_tests)) { |
1041 _enable_chromium_linker_tests = invoker.enable_chromium_linker_tests | 1060 _enable_chromium_linker_tests = invoker.enable_chromium_linker_tests |
1042 } | 1061 } |
1043 | 1062 |
1044 _native_lib_version_name = "" | 1063 _native_lib_version_name = "" |
1045 | 1064 |
1046 java_cpp_template("${_template_name}__native_libraries_java") { | 1065 java_cpp_template("${_template_name}__native_libraries_java") { |
1047 package_name = "org/chromium/base/library_loader" | 1066 package_name = "org/chromium/base/library_loader" |
1048 sources = [ | 1067 sources = [ |
1049 "//base/android/java/templates/NativeLibraries.template", | 1068 "//base/android/java/templates/NativeLibraries.template", |
1050 ] | 1069 ] |
1051 inputs = [ | 1070 inputs = [ |
1052 build_config, | 1071 _build_config, |
1053 ] | 1072 ] |
1054 | 1073 |
1055 defines = [ | 1074 defines = [ |
1056 "NATIVE_LIBRARIES_LIST=" + | 1075 "NATIVE_LIBRARIES_LIST=" + |
1057 "@FileArg($_rebased_build_config:native:java_libraries_list)", | 1076 "@FileArg($_rebased_build_config:native:java_libraries_list)", |
1058 "NATIVE_LIBRARIES_VERSION_NUMBER=\"$_native_lib_version_name\"", | 1077 "NATIVE_LIBRARIES_VERSION_NUMBER=\"$_native_lib_version_name\"", |
1059 ] | 1078 ] |
1060 if (_use_chromium_linker) { | 1079 if (_use_chromium_linker) { |
1061 defines += ["ENABLE_CHROMIUM_LINKER"] | 1080 defines += ["ENABLE_CHROMIUM_LINKER"] |
1062 } | 1081 } |
1063 if (_load_library_from_apk) { | 1082 if (_load_library_from_apk) { |
1064 defines += ["ENABLE_CHROMIUM_LINKER_LIBRARY_IN_ZIP_FILE"] | 1083 defines += ["ENABLE_CHROMIUM_LINKER_LIBRARY_IN_ZIP_FILE"] |
1065 } | 1084 } |
1066 if (_enable_chromium_linker_tests) { | 1085 if (_enable_chromium_linker_tests) { |
1067 defines += ["ENABLE_CHROMIUM_LINKER_TESTS"] | 1086 defines += ["ENABLE_CHROMIUM_LINKER_TESTS"] |
1068 } | 1087 } |
1069 } | 1088 } |
1070 _srcjar_deps += [ ":${_template_name}__native_libraries_java" ] | 1089 _srcjar_deps += [ ":${_template_name}__native_libraries_java" ] |
1071 } | 1090 } |
1072 | 1091 |
1073 final_deps += [ ":${_template_name}__java" ] | 1092 final_deps += [ ":${_template_name}__java" ] |
1074 android_java_library("${_template_name}__java") { | 1093 java_library_impl("${_template_name}__java") { |
| 1094 supports_android = true |
| 1095 requires_android = true |
| 1096 override_build_config = _build_config |
1075 android_manifest = invoker.android_manifest | 1097 android_manifest = invoker.android_manifest |
| 1098 chromium_code = true |
1076 if (defined(invoker.java_files)) { | 1099 if (defined(invoker.java_files)) { |
1077 java_files = invoker.java_files | 1100 java_files = invoker.java_files |
1078 } else if (defined(invoker.DEPRECATED_java_in_dir)) { | 1101 } else if (defined(invoker.DEPRECATED_java_in_dir)) { |
1079 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir | 1102 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir |
1080 } else { | 1103 } else { |
1081 java_files = [] | 1104 java_files = [] |
1082 } | 1105 } |
1083 srcjar_deps = _srcjar_deps | 1106 srcjar_deps = _srcjar_deps |
1084 dex_path = base_path + ".dex.jar" | 1107 dex_path = base_path + ".dex.jar" |
1085 } | 1108 } |
1086 | 1109 |
1087 if (_dist_jar_path != "") { | 1110 if (_dist_jar_path != "") { |
1088 final_deps += [ ":${_template_name}__create_dist_jar" ] | 1111 final_deps += [ ":${_template_name}__create_dist_jar" ] |
1089 # TODO(cjhopman): This is only ever needed to calculate the list of tests to | 1112 # TODO(cjhopman): This is only ever needed to calculate the list of tests to |
1090 # run. See build/android/pylib/instrumentation/test_jar.py. We should be | 1113 # run. See build/android/pylib/instrumentation/test_jar.py. We should be |
1091 # able to just do that calculation at build time instead. | 1114 # able to just do that calculation at build time instead. |
1092 action("${_template_name}__create_dist_jar") { | 1115 action("${_template_name}__create_dist_jar") { |
1093 script = "//build/android/gyp/create_dist_jar.py" | 1116 script = "//build/android/gyp/create_dist_jar.py" |
1094 depfile = "$target_gen_dir/$target_name.d" | 1117 depfile = "$target_gen_dir/$target_name.d" |
1095 inputs = [ build_config ] | 1118 inputs = [ _build_config ] |
1096 outputs = [ | 1119 outputs = [ |
1097 depfile, | 1120 depfile, |
1098 _dist_jar_path, | 1121 _dist_jar_path, |
1099 ] | 1122 ] |
1100 args = [ | 1123 args = [ |
1101 "--depfile", rebase_path(depfile, root_build_dir), | 1124 "--depfile", rebase_path(depfile, root_build_dir), |
1102 "--output", rebase_path(_dist_jar_path, root_build_dir), | 1125 "--output", rebase_path(_dist_jar_path, root_build_dir), |
1103 "--inputs=@FileArg($_rebased_build_config:dist_jar:dependency_jars)", | 1126 "--inputs=@FileArg($_rebased_build_config:dist_jar:dependency_jars)", |
1104 ] | 1127 ] |
1105 inputs += [ jar_path ] | 1128 inputs += [ jar_path ] |
1106 _rebased_jar_path = rebase_path([ jar_path ], root_build_dir) | 1129 _rebased_jar_path = rebase_path([ jar_path ], root_build_dir) |
1107 args += [ | 1130 args += [ |
1108 "--inputs=$_rebased_jar_path", | 1131 "--inputs=$_rebased_jar_path", |
1109 ] | 1132 ] |
1110 } | 1133 } |
1111 } | 1134 } |
1112 | 1135 |
1113 final_deps += [":${_template_name}__final_dex"] | 1136 final_deps += [":${_template_name}__final_dex"] |
1114 dex("${_template_name}__final_dex") { | 1137 dex("${_template_name}__final_dex") { |
1115 deps = [ ":${_template_name}__java" ] | 1138 deps = [ ":${_template_name}__java" ] |
1116 sources = [ jar_path ] | 1139 sources = [ jar_path ] |
1117 inputs = [ build_config ] | 1140 inputs = [ _build_config ] |
1118 output = final_dex_path | 1141 output = final_dex_path |
1119 dex_arg_key = "${_rebased_build_config}:apk_dex:dependency_dex_files" | 1142 dex_arg_key = "${_rebased_build_config}:apk_dex:dependency_dex_files" |
1120 args = [ "--inputs=@FileArg($dex_arg_key)" ] | 1143 args = [ "--inputs=@FileArg($dex_arg_key)" ] |
1121 } | 1144 } |
1122 | 1145 |
1123 if (_native_libs != []) { | 1146 if (_native_libs != []) { |
1124 action("${_template_name}__prepare_native") { | 1147 action("${_template_name}__prepare_native") { |
1125 script = "//build/android/gyp/pack_arm_relocations.py" | 1148 script = "//build/android/gyp/pack_arm_relocations.py" |
1126 packed_libraries_dir = "$_native_libs_dir/$android_app_abi" | 1149 packed_libraries_dir = "$_native_libs_dir/$android_app_abi" |
1127 depfile = "$target_gen_dir/$target_name.d" | 1150 depfile = "$target_gen_dir/$target_name.d" |
1128 outputs = [ | 1151 outputs = [ |
1129 depfile | 1152 depfile |
1130 ] | 1153 ] |
1131 inputs = [ | 1154 inputs = [ |
1132 build_config | 1155 _build_config |
1133 ] | 1156 ] |
1134 deps = [] | 1157 deps = [] |
1135 skip_packing_list = [ | 1158 skip_packing_list = [ |
1136 "gdbserver", | 1159 "gdbserver", |
1137 "libchromium_android_linker.so", | 1160 "libchromium_android_linker.so", |
1138 ] | 1161 ] |
1139 | 1162 |
1140 enable_packing_arg = 0 | 1163 enable_packing_arg = 0 |
1141 if (_enable_relocation_packing) { | 1164 if (_enable_relocation_packing) { |
1142 enable_packing_arg = 1 | 1165 enable_packing_arg = 1 |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 } | 1492 } |
1470 | 1493 |
1471 # TODO(GYP): implement this. | 1494 # TODO(GYP): implement this. |
1472 template("uiautomator_test") { | 1495 template("uiautomator_test") { |
1473 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 1496 if (defined(invoker.testonly)) { testonly = invoker.testonly } |
1474 assert(target_name != "") | 1497 assert(target_name != "") |
1475 assert(invoker.deps != [] || true) | 1498 assert(invoker.deps != [] || true) |
1476 group(target_name) { | 1499 group(target_name) { |
1477 } | 1500 } |
1478 } | 1501 } |
OLD | NEW |