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 # Do not add any imports to non-//build directories here. | 5 # Do not add any imports to non-//build directories here. |
6 # Some projects (e.g. V8) do not have non-build directories DEPS'ed in. | 6 # Some projects (e.g. V8) do not have non-build directories DEPS'ed in. |
7 import("//build_overrides/build.gni") | 7 import("//build_overrides/build.gni") |
8 import("//build/config/android/config.gni") | 8 import("//build/config/android/config.gni") |
| 9 import("//build/config/dcheck_always_on.gni") |
9 import("//build/config/sanitizers/sanitizers.gni") | 10 import("//build/config/sanitizers/sanitizers.gni") |
10 | 11 |
11 assert(is_android) | 12 assert(is_android) |
12 | 13 |
13 # These identify targets that have .build_config files (except for android_apk, | 14 # These identify targets that have .build_config files (except for android_apk, |
14 # java_binary, resource_rewriter, since we never need to depend on these). | 15 # java_binary, resource_rewriter, since we never need to depend on these). |
15 _java_target_whitelist = [ | 16 _java_target_whitelist = [ |
16 "*:*_java", | 17 "*:*_java", |
17 "*:*_javalib", | 18 "*:*_javalib", |
18 "*:*_java_*", # e.g. java_test_support | 19 "*:*_java_*", # e.g. java_test_support |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 | 983 |
983 template("process_java_prebuilt") { | 984 template("process_java_prebuilt") { |
984 set_sources_assignment_filter([]) | 985 set_sources_assignment_filter([]) |
985 forward_variables_from(invoker, [ "testonly" ]) | 986 forward_variables_from(invoker, [ "testonly" ]) |
986 | 987 |
987 assert(invoker.build_config != "") | 988 assert(invoker.build_config != "") |
988 _build_config = invoker.build_config | 989 _build_config = invoker.build_config |
989 _rebased_build_config = rebase_path(_build_config, root_build_dir) | 990 _rebased_build_config = rebase_path(_build_config, root_build_dir) |
990 assert(_rebased_build_config != "" || true) # Mark used. | 991 assert(_rebased_build_config != "" || true) # Mark used. |
991 | 992 |
| 993 _input_jar_path = invoker.input_jar_path |
| 994 _output_jar_path = invoker.output_jar_path |
| 995 |
992 _proguard_preprocess = | 996 _proguard_preprocess = |
993 defined(invoker.proguard_preprocess) && invoker.proguard_preprocess | 997 defined(invoker.proguard_preprocess) && invoker.proguard_preprocess |
994 _input_jar_path = invoker.input_jar_path | |
995 _output_jar_path = invoker.output_jar_path | |
996 | 998 |
997 _jar_excluded_patterns = [] | 999 _jar_excluded_patterns = [] |
998 if (defined(invoker.jar_excluded_patterns)) { | 1000 if (defined(invoker.jar_excluded_patterns)) { |
999 _jar_excluded_patterns = invoker.jar_excluded_patterns | 1001 _jar_excluded_patterns = invoker.jar_excluded_patterns |
1000 } | 1002 } |
1001 _strip_resource_classes = defined(invoker.strip_resource_classes) && | 1003 _strip_resource_classes = defined(invoker.strip_resource_classes) && |
1002 invoker.strip_resource_classes | 1004 invoker.strip_resource_classes |
1003 _filter_jar = _jar_excluded_patterns != [] || _strip_resource_classes | 1005 _filter_jar = _jar_excluded_patterns != [] || _strip_resource_classes |
1004 | 1006 |
| 1007 _enable_assert = |
| 1008 defined(invoker.supports_android) && invoker.supports_android && |
| 1009 (is_java_debug || dcheck_always_on) |
| 1010 assert(_enable_assert || true) # Mark used. |
| 1011 |
1005 if (_filter_jar) { | 1012 if (_filter_jar) { |
1006 _filter_target = "${target_name}__filter" | 1013 _filter_target = "${target_name}__filter" |
1007 _output_jar_target = _filter_target | |
1008 } | |
1009 if (_proguard_preprocess) { | |
1010 _proguard_target = "${target_name}__proguard_process" | |
1011 _output_jar_target = _proguard_target | |
1012 } | |
1013 if (!_filter_jar && !_proguard_preprocess) { | |
1014 _copy_target = "${target_name}__copy" | |
1015 _output_jar_target = _copy_target | |
1016 } | |
1017 | 1014 |
1018 if (_filter_jar) { | 1015 _filter_jar_path = "$target_out_dir/$target_name-filtered.jar" |
1019 _filtered_jar_path = _output_jar_path | |
1020 if (_proguard_preprocess) { | |
1021 _filtered_jar_path = "$target_out_dir/$target_name-filtered.jar" | |
1022 } | |
1023 action(_filter_target) { | 1016 action(_filter_target) { |
1024 script = "//build/android/gyp/jar.py" | 1017 script = "//build/android/gyp/jar.py" |
1025 forward_variables_from(invoker, | 1018 forward_variables_from(invoker, |
1026 [ | 1019 [ |
1027 "deps", | 1020 "deps", |
1028 "public_deps", | 1021 "public_deps", |
1029 ]) | 1022 ]) |
1030 inputs = [ | 1023 inputs = [ |
1031 _build_config, | 1024 _build_config, |
1032 _input_jar_path, | 1025 _input_jar_path, |
1033 ] | 1026 ] |
1034 outputs = [ | 1027 outputs = [ |
1035 _filtered_jar_path, | 1028 _filter_jar_path, |
1036 ] | 1029 ] |
1037 args = [ | 1030 args = [ |
1038 "--input-jar", | 1031 "--input-jar", |
1039 rebase_path(_input_jar_path, root_build_dir), | 1032 rebase_path(_input_jar_path, root_build_dir), |
1040 "--jar-path", | 1033 "--jar-path", |
1041 rebase_path(_filtered_jar_path, root_build_dir), | 1034 rebase_path(_filter_jar_path, root_build_dir), |
1042 "--excluded-classes=$_jar_excluded_patterns", | 1035 "--excluded-classes=$_jar_excluded_patterns", |
1043 ] | 1036 ] |
1044 if (_strip_resource_classes) { | 1037 if (_strip_resource_classes) { |
1045 args += [ "--strip-resource-classes-for=@FileArg($_rebased_build_confi
g:javac:resource_packages)" ] | 1038 args += [ "--strip-resource-classes-for=@FileArg($_rebased_build_confi
g:javac:resource_packages)" ] |
1046 } | 1039 } |
1047 } | 1040 } |
1048 } | 1041 } |
1049 | 1042 |
1050 if (_proguard_preprocess) { | 1043 if (_proguard_preprocess) { |
| 1044 _output_jar_target = "${target_name}__proguard_process" |
| 1045 _proguard_output_jar = _output_jar_path |
1051 _proguard_config_path = invoker.proguard_preprocess_config | 1046 _proguard_config_path = invoker.proguard_preprocess_config |
1052 proguard(_proguard_target) { | 1047 proguard(_output_jar_target) { |
1053 if (_filter_jar) { | 1048 if (_filter_jar) { |
1054 _proguard_input_jar = _filtered_jar_path | 1049 _proguard_input_jar = _filter_jar_path |
1055 public_deps = [ | 1050 deps = [ |
1056 ":$_filter_target", | 1051 ":$_filter_target", |
1057 ] | 1052 ] |
1058 } else { | 1053 } else { |
1059 _proguard_input_jar = _input_jar_path | 1054 _proguard_input_jar = _input_jar_path |
1060 public_deps = [] | 1055 deps = [] |
1061 } | 1056 } |
1062 if (defined(invoker.deps)) { | 1057 if (defined(invoker.deps)) { |
1063 deps = invoker.deps | 1058 deps += invoker.deps |
1064 } | 1059 } |
1065 if (defined(invoker.public_deps)) { | 1060 if (defined(invoker.public_deps)) { |
1066 public_deps += invoker.public_deps | 1061 public_deps = invoker.public_deps |
1067 } | 1062 } |
1068 inputs = [ | 1063 inputs = [ |
1069 _build_config, | 1064 _build_config, |
1070 _proguard_config_path, | 1065 _proguard_config_path, |
1071 _proguard_input_jar, | 1066 _proguard_input_jar, |
1072 ] | 1067 ] |
1073 output_jar_path = _output_jar_path | 1068 output_jar_path = _proguard_output_jar |
1074 | 1069 |
1075 _rebased_input_paths = [ rebase_path(_input_jar_path, root_build_dir) ] | 1070 _rebased_input_paths = |
| 1071 [ rebase_path(_proguard_input_jar, root_build_dir) ] |
1076 _rebased_proguard_configs = | 1072 _rebased_proguard_configs = |
1077 [ rebase_path(_proguard_config_path, root_build_dir) ] | 1073 [ rebase_path(_proguard_config_path, root_build_dir) ] |
1078 args = [ | 1074 args = [ |
1079 "--input-paths=$_rebased_input_paths", | 1075 "--input-paths=$_rebased_input_paths", |
1080 "--proguard-configs=$_rebased_proguard_configs", | 1076 "--proguard-configs=$_rebased_proguard_configs", |
1081 "--classpath=@FileArg($_rebased_build_config:javac:classpath)", | 1077 "--classpath=@FileArg($_rebased_build_config:javac:classpath)", |
1082 ] | 1078 ] |
1083 } | 1079 } |
1084 } else if (!_filter_jar) { | 1080 } else if (_enable_assert) { |
1085 copy(_copy_target) { | 1081 _output_jar_target = "${target_name}__assert" |
1086 forward_variables_from(invoker, | 1082 _assert_output_jar = _output_jar_path |
1087 [ | 1083 action(_output_jar_target) { |
1088 "deps", | 1084 script = "$root_out_dir/bin/helper/java_assertion_enabler" |
1089 "public_deps", | 1085 deps = [ |
1090 ]) | 1086 "//build/android/java_assertion_enabler($default_toolchain)", |
| 1087 ] |
| 1088 if (_filter_jar) { |
| 1089 _assert_input_jar = _filter_jar_path |
| 1090 deps += [ ":$_filter_target" ] |
| 1091 } else { |
| 1092 _assert_input_jar = _input_jar_path |
| 1093 } |
| 1094 if (defined(invoker.deps)) { |
| 1095 deps += invoker.deps |
| 1096 } |
| 1097 if (defined(invoker.public_deps)) { |
| 1098 public_deps = invoker.public_deps |
| 1099 } |
| 1100 inputs = [ |
| 1101 _assert_input_jar, |
| 1102 ] |
| 1103 outputs = [ |
| 1104 _assert_output_jar, |
| 1105 ] |
| 1106 args = [ |
| 1107 rebase_path(_assert_input_jar, root_build_dir), |
| 1108 rebase_path(_assert_output_jar, root_build_dir), |
| 1109 ] |
| 1110 } |
| 1111 } else { |
| 1112 _output_jar_target = "${target_name}__copy" |
| 1113 copy(_output_jar_target) { |
| 1114 if (_filter_jar) { |
| 1115 _copy_input_jar = _filter_jar_path |
| 1116 public_deps = [ |
| 1117 ":$_filter_target", |
| 1118 ] |
| 1119 } else { |
| 1120 _copy_input_jar = _input_jar_path |
| 1121 public_deps = [] |
| 1122 } |
| 1123 if (defined(invoker.deps)) { |
| 1124 deps = invoker.deps |
| 1125 } |
| 1126 if (defined(invoker.public_deps)) { |
| 1127 public_deps += invoker.public_deps |
| 1128 } |
1091 sources = [ | 1129 sources = [ |
1092 _input_jar_path, | 1130 _copy_input_jar, |
1093 ] | 1131 ] |
1094 outputs = [ | 1132 outputs = [ |
1095 _output_jar_path, | 1133 _output_jar_path, |
1096 ] | 1134 ] |
1097 } | 1135 } |
1098 } | 1136 } |
1099 | 1137 |
1100 group(target_name) { | 1138 group(target_name) { |
1101 forward_variables_from(invoker, | 1139 forward_variables_from(invoker, |
1102 [ | 1140 [ |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1778 ]) | 1816 ]) |
1779 | 1817 |
1780 visibility = [ | 1818 visibility = [ |
1781 ":$_ijar_target_name", | 1819 ":$_ijar_target_name", |
1782 ":$_template_name", | 1820 ":$_template_name", |
1783 ] | 1821 ] |
1784 if (_supports_android) { | 1822 if (_supports_android) { |
1785 visibility += [ ":$_dex_target_name" ] | 1823 visibility += [ ":$_dex_target_name" ] |
1786 } | 1824 } |
1787 | 1825 |
| 1826 supports_android = _supports_android |
1788 build_config = _build_config | 1827 build_config = _build_config |
1789 input_jar_path = invoker.jar_path | 1828 input_jar_path = invoker.jar_path |
1790 output_jar_path = _jar_path | 1829 output_jar_path = _jar_path |
1791 | 1830 |
1792 deps = [ ":$_build_config_target_name" ] + _deps + _jar_deps | 1831 deps = [ ":$_build_config_target_name" ] + _deps + _jar_deps |
1793 } | 1832 } |
1794 | 1833 |
1795 generate_interface_jar(_ijar_target_name) { | 1834 generate_interface_jar(_ijar_target_name) { |
1796 if (!defined(invoker.proguard_preprocess) || | 1835 if (!defined(invoker.proguard_preprocess) || |
1797 !invoker.proguard_preprocess) { | 1836 !invoker.proguard_preprocess) { |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2069 } | 2108 } |
2070 } | 2109 } |
2071 | 2110 |
2072 process_java_prebuilt(_process_prebuilt_target_name) { | 2111 process_java_prebuilt(_process_prebuilt_target_name) { |
2073 forward_variables_from(invoker, | 2112 forward_variables_from(invoker, |
2074 [ | 2113 [ |
2075 "jar_excluded_patterns", | 2114 "jar_excluded_patterns", |
2076 "proguard_preprocess", | 2115 "proguard_preprocess", |
2077 "proguard_preprocess_config", | 2116 "proguard_preprocess_config", |
2078 ]) | 2117 ]) |
| 2118 supports_android = _supports_android |
2079 build_config = _build_config | 2119 build_config = _build_config |
2080 input_jar_path = _javac_jar_path | 2120 input_jar_path = _javac_jar_path |
2081 output_jar_path = _process_prebuilt_jar_path | 2121 output_jar_path = _process_prebuilt_jar_path |
2082 | 2122 |
2083 deps = [ | 2123 deps = [ |
2084 ":$_javac_target_name", | 2124 ":$_javac_target_name", |
2085 ] | 2125 ] |
2086 if (defined(invoker.deps)) { | 2126 if (defined(invoker.deps)) { |
2087 deps += invoker.deps | 2127 deps += invoker.deps |
2088 } | 2128 } |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2681 rebase_path(root_build_dir, root_build_dir), | 2721 rebase_path(root_build_dir, root_build_dir), |
2682 "--packed-libraries-dir", | 2722 "--packed-libraries-dir", |
2683 rebase_path(_packed_libraries_dir, root_build_dir), | 2723 rebase_path(_packed_libraries_dir, root_build_dir), |
2684 "--libraries=${invoker.libraries_filearg}", | 2724 "--libraries=${invoker.libraries_filearg}", |
2685 "--filelistjson", | 2725 "--filelistjson", |
2686 rebase_path(invoker.file_list_json, root_build_dir), | 2726 rebase_path(invoker.file_list_json, root_build_dir), |
2687 ] | 2727 ] |
2688 } | 2728 } |
2689 } | 2729 } |
2690 } | 2730 } |
OLD | NEW |