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 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 | 1009 |
1009 template("process_java_prebuilt") { | 1010 template("process_java_prebuilt") { |
1010 set_sources_assignment_filter([]) | 1011 set_sources_assignment_filter([]) |
1011 forward_variables_from(invoker, [ "testonly" ]) | 1012 forward_variables_from(invoker, [ "testonly" ]) |
1012 | 1013 |
1013 assert(invoker.build_config != "") | 1014 assert(invoker.build_config != "") |
1014 _build_config = invoker.build_config | 1015 _build_config = invoker.build_config |
1015 _rebased_build_config = rebase_path(_build_config, root_build_dir) | 1016 _rebased_build_config = rebase_path(_build_config, root_build_dir) |
1016 assert(_rebased_build_config != "" || true) # Mark used. | 1017 assert(_rebased_build_config != "" || true) # Mark used. |
1017 | 1018 |
| 1019 _input_jar_path = invoker.input_jar_path |
| 1020 _output_jar_path = invoker.output_jar_path |
| 1021 |
1018 _proguard_preprocess = | 1022 _proguard_preprocess = |
1019 defined(invoker.proguard_preprocess) && invoker.proguard_preprocess | 1023 defined(invoker.proguard_preprocess) && invoker.proguard_preprocess |
1020 _input_jar_path = invoker.input_jar_path | |
1021 _output_jar_path = invoker.output_jar_path | |
1022 | 1024 |
1023 _jar_excluded_patterns = [] | 1025 _jar_excluded_patterns = [] |
1024 if (defined(invoker.jar_excluded_patterns)) { | 1026 if (defined(invoker.jar_excluded_patterns)) { |
1025 _jar_excluded_patterns = invoker.jar_excluded_patterns | 1027 _jar_excluded_patterns = invoker.jar_excluded_patterns |
1026 } | 1028 } |
1027 _strip_resource_classes = defined(invoker.strip_resource_classes) && | 1029 _strip_resource_classes = defined(invoker.strip_resource_classes) && |
1028 invoker.strip_resource_classes | 1030 invoker.strip_resource_classes |
1029 _filter_jar = _jar_excluded_patterns != [] || _strip_resource_classes | 1031 _filter_jar = _jar_excluded_patterns != [] || _strip_resource_classes |
1030 | 1032 |
| 1033 _enable_assert = |
| 1034 defined(invoker.supports_android) && invoker.supports_android && |
| 1035 (is_java_debug || dcheck_always_on) |
| 1036 assert(_enable_assert || true) # Mark used. |
| 1037 |
1031 if (_filter_jar) { | 1038 if (_filter_jar) { |
1032 _filter_target = "${target_name}__filter" | 1039 _filter_target = "${target_name}__filter" |
1033 _output_jar_target = _filter_target | |
1034 } | |
1035 if (_proguard_preprocess) { | |
1036 _proguard_target = "${target_name}__proguard_process" | |
1037 _output_jar_target = _proguard_target | |
1038 } | |
1039 if (!_filter_jar && !_proguard_preprocess) { | |
1040 _copy_target = "${target_name}__copy" | |
1041 _output_jar_target = _copy_target | |
1042 } | |
1043 | 1040 |
1044 if (_filter_jar) { | 1041 _filter_jar_path = "$target_out_dir/$target_name-filtered.jar" |
1045 _filtered_jar_path = _output_jar_path | |
1046 if (_proguard_preprocess) { | |
1047 _filtered_jar_path = "$target_out_dir/$target_name-filtered.jar" | |
1048 } | |
1049 action(_filter_target) { | 1042 action(_filter_target) { |
1050 script = "//build/android/gyp/jar.py" | 1043 script = "//build/android/gyp/jar.py" |
1051 forward_variables_from(invoker, | 1044 forward_variables_from(invoker, |
1052 [ | 1045 [ |
1053 "deps", | 1046 "deps", |
1054 "public_deps", | 1047 "public_deps", |
1055 ]) | 1048 ]) |
1056 inputs = [ | 1049 inputs = [ |
1057 _build_config, | 1050 _build_config, |
1058 _input_jar_path, | 1051 _input_jar_path, |
1059 ] | 1052 ] |
1060 outputs = [ | 1053 outputs = [ |
1061 _filtered_jar_path, | 1054 _filter_jar_path, |
1062 ] | 1055 ] |
1063 args = [ | 1056 args = [ |
1064 "--input-jar", | 1057 "--input-jar", |
1065 rebase_path(_input_jar_path, root_build_dir), | 1058 rebase_path(_input_jar_path, root_build_dir), |
1066 "--jar-path", | 1059 "--jar-path", |
1067 rebase_path(_filtered_jar_path, root_build_dir), | 1060 rebase_path(_filter_jar_path, root_build_dir), |
1068 "--excluded-classes=$_jar_excluded_patterns", | 1061 "--excluded-classes=$_jar_excluded_patterns", |
1069 ] | 1062 ] |
1070 if (_strip_resource_classes) { | 1063 if (_strip_resource_classes) { |
1071 args += [ "--strip-resource-classes-for=@FileArg($_rebased_build_confi
g:javac:resource_packages)" ] | 1064 args += [ "--strip-resource-classes-for=@FileArg($_rebased_build_confi
g:javac:resource_packages)" ] |
1072 } | 1065 } |
1073 } | 1066 } |
1074 } | 1067 } |
1075 | 1068 |
1076 if (_proguard_preprocess) { | 1069 if (_proguard_preprocess) { |
| 1070 _output_jar_target = "${target_name}__proguard_process" |
| 1071 _proguard_output_jar = _output_jar_path |
1077 _proguard_config_path = invoker.proguard_preprocess_config | 1072 _proguard_config_path = invoker.proguard_preprocess_config |
1078 proguard(_proguard_target) { | 1073 proguard(_output_jar_target) { |
1079 if (_filter_jar) { | 1074 if (_filter_jar) { |
1080 _proguard_input_jar = _filtered_jar_path | 1075 _proguard_input_jar = _filter_jar_path |
1081 public_deps = [ | 1076 deps = [ |
1082 ":$_filter_target", | 1077 ":$_filter_target", |
1083 ] | 1078 ] |
1084 } else { | 1079 } else { |
1085 _proguard_input_jar = _input_jar_path | 1080 _proguard_input_jar = _input_jar_path |
1086 public_deps = [] | 1081 deps = [] |
1087 } | 1082 } |
1088 if (defined(invoker.deps)) { | 1083 if (defined(invoker.deps)) { |
1089 deps = invoker.deps | 1084 deps += invoker.deps |
1090 } | 1085 } |
1091 if (defined(invoker.public_deps)) { | 1086 if (defined(invoker.public_deps)) { |
1092 public_deps += invoker.public_deps | 1087 public_deps = invoker.public_deps |
1093 } | 1088 } |
1094 inputs = [ | 1089 inputs = [ |
1095 _build_config, | 1090 _build_config, |
1096 _proguard_config_path, | 1091 _proguard_config_path, |
1097 _proguard_input_jar, | 1092 _proguard_input_jar, |
1098 ] | 1093 ] |
1099 output_jar_path = _output_jar_path | 1094 output_jar_path = _proguard_output_jar |
1100 | 1095 |
1101 _rebased_input_paths = [ rebase_path(_input_jar_path, root_build_dir) ] | 1096 _rebased_input_paths = |
| 1097 [ rebase_path(_proguard_input_jar, root_build_dir) ] |
1102 _rebased_proguard_configs = | 1098 _rebased_proguard_configs = |
1103 [ rebase_path(_proguard_config_path, root_build_dir) ] | 1099 [ rebase_path(_proguard_config_path, root_build_dir) ] |
1104 args = [ | 1100 args = [ |
1105 "--input-paths=$_rebased_input_paths", | 1101 "--input-paths=$_rebased_input_paths", |
1106 "--proguard-configs=$_rebased_proguard_configs", | 1102 "--proguard-configs=$_rebased_proguard_configs", |
1107 "--classpath=@FileArg($_rebased_build_config:javac:classpath)", | 1103 "--classpath=@FileArg($_rebased_build_config:javac:classpath)", |
1108 ] | 1104 ] |
1109 } | 1105 } |
1110 } else if (!_filter_jar) { | 1106 } else if (_enable_assert) { |
1111 copy(_copy_target) { | 1107 _output_jar_target = "${target_name}__assert" |
1112 forward_variables_from(invoker, | 1108 _assert_output_jar = _output_jar_path |
1113 [ | 1109 action(_output_jar_target) { |
1114 "deps", | 1110 script = "$root_out_dir/bin/helper/java_assertion_enabler" |
1115 "public_deps", | 1111 if (_filter_jar) { |
1116 ]) | 1112 _assert_input_jar = _filter_jar_path |
| 1113 deps = [ |
| 1114 ":$_filter_target", |
| 1115 "//build/android/java_assertion_enabler", |
| 1116 ] |
| 1117 } else { |
| 1118 _assert_input_jar = _input_jar_path |
| 1119 deps = [ |
| 1120 "//build/android/java_assertion_enabler", |
| 1121 ] |
| 1122 } |
| 1123 if (defined(invoker.deps)) { |
| 1124 deps += invoker.deps |
| 1125 } |
| 1126 if (defined(invoker.public_deps)) { |
| 1127 public_deps = invoker.public_deps |
| 1128 } |
| 1129 inputs = [ |
| 1130 _assert_input_jar, |
| 1131 ] |
| 1132 outputs = [ |
| 1133 _assert_output_jar, |
| 1134 ] |
| 1135 args = [ |
| 1136 rebase_path(_assert_input_jar, root_build_dir), |
| 1137 rebase_path(_assert_output_jar, root_build_dir), |
| 1138 ] |
| 1139 } |
| 1140 } else { |
| 1141 _output_jar_target = "${target_name}__copy" |
| 1142 copy(_output_jar_target) { |
| 1143 if (_filter_jar) { |
| 1144 _copy_input_jar = _filter_jar_path |
| 1145 public_deps = [ |
| 1146 ":$_filter_target", |
| 1147 ] |
| 1148 } else { |
| 1149 _copy_input_jar = _input_jar_path |
| 1150 public_deps = [] |
| 1151 } |
| 1152 if (defined(invoker.deps)) { |
| 1153 deps = invoker.deps |
| 1154 } |
| 1155 if (defined(invoker.public_deps)) { |
| 1156 public_deps += invoker.public_deps |
| 1157 } |
1117 sources = [ | 1158 sources = [ |
1118 _input_jar_path, | 1159 _copy_input_jar, |
1119 ] | 1160 ] |
1120 outputs = [ | 1161 outputs = [ |
1121 _output_jar_path, | 1162 _output_jar_path, |
1122 ] | 1163 ] |
1123 } | 1164 } |
1124 } | 1165 } |
1125 | 1166 |
1126 group(target_name) { | 1167 group(target_name) { |
1127 forward_variables_from(invoker, | 1168 forward_variables_from(invoker, |
1128 [ | 1169 [ |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1803 ]) | 1844 ]) |
1804 | 1845 |
1805 visibility = [ | 1846 visibility = [ |
1806 ":$_ijar_target_name", | 1847 ":$_ijar_target_name", |
1807 ":$_template_name", | 1848 ":$_template_name", |
1808 ] | 1849 ] |
1809 if (_supports_android) { | 1850 if (_supports_android) { |
1810 visibility += [ ":$_dex_target_name" ] | 1851 visibility += [ ":$_dex_target_name" ] |
1811 } | 1852 } |
1812 | 1853 |
| 1854 supports_android = _supports_android |
1813 build_config = _build_config | 1855 build_config = _build_config |
1814 input_jar_path = invoker.jar_path | 1856 input_jar_path = invoker.jar_path |
1815 output_jar_path = _jar_path | 1857 output_jar_path = _jar_path |
1816 | 1858 |
1817 deps = [ ":$_build_config_target_name" ] + _deps + _jar_deps | 1859 deps = [ ":$_build_config_target_name" ] + _deps + _jar_deps |
1818 } | 1860 } |
1819 | 1861 |
1820 generate_interface_jar(_ijar_target_name) { | 1862 generate_interface_jar(_ijar_target_name) { |
1821 if (!defined(invoker.proguard_preprocess) || | 1863 if (!defined(invoker.proguard_preprocess) || |
1822 !invoker.proguard_preprocess) { | 1864 !invoker.proguard_preprocess) { |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2094 } | 2136 } |
2095 } | 2137 } |
2096 | 2138 |
2097 process_java_prebuilt(_process_prebuilt_target_name) { | 2139 process_java_prebuilt(_process_prebuilt_target_name) { |
2098 forward_variables_from(invoker, | 2140 forward_variables_from(invoker, |
2099 [ | 2141 [ |
2100 "jar_excluded_patterns", | 2142 "jar_excluded_patterns", |
2101 "proguard_preprocess", | 2143 "proguard_preprocess", |
2102 "proguard_preprocess_config", | 2144 "proguard_preprocess_config", |
2103 ]) | 2145 ]) |
| 2146 supports_android = _supports_android |
2104 build_config = _build_config | 2147 build_config = _build_config |
2105 input_jar_path = _javac_jar_path | 2148 input_jar_path = _javac_jar_path |
2106 output_jar_path = _process_prebuilt_jar_path | 2149 output_jar_path = _process_prebuilt_jar_path |
2107 | 2150 |
2108 deps = [ | 2151 deps = [ |
2109 ":$_javac_target_name", | 2152 ":$_javac_target_name", |
2110 ] | 2153 ] |
2111 if (defined(invoker.deps)) { | 2154 if (defined(invoker.deps)) { |
2112 deps += invoker.deps | 2155 deps += invoker.deps |
2113 } | 2156 } |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2704 rebase_path(root_build_dir, root_build_dir), | 2747 rebase_path(root_build_dir, root_build_dir), |
2705 "--packed-libraries-dir", | 2748 "--packed-libraries-dir", |
2706 rebase_path(_packed_libraries_dir, root_build_dir), | 2749 rebase_path(_packed_libraries_dir, root_build_dir), |
2707 "--libraries=${invoker.libraries_filearg}", | 2750 "--libraries=${invoker.libraries_filearg}", |
2708 "--filelistjson", | 2751 "--filelistjson", |
2709 rebase_path(invoker.file_list_json, root_build_dir), | 2752 rebase_path(invoker.file_list_json, root_build_dir), |
2710 ] | 2753 ] |
2711 } | 2754 } |
2712 } | 2755 } |
2713 } | 2756 } |
OLD | NEW |