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