Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: build/config/android/rules.gni

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

Powered by Google App Engine
This is Rietveld 408576698