| 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 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 | 999 |
| 1001 template("process_java_prebuilt") { | 1000 template("process_java_prebuilt") { |
| 1002 set_sources_assignment_filter([]) | 1001 set_sources_assignment_filter([]) |
| 1003 forward_variables_from(invoker, [ "testonly" ]) | 1002 forward_variables_from(invoker, [ "testonly" ]) |
| 1004 | 1003 |
| 1005 assert(invoker.build_config != "") | 1004 assert(invoker.build_config != "") |
| 1006 _build_config = invoker.build_config | 1005 _build_config = invoker.build_config |
| 1007 _rebased_build_config = rebase_path(_build_config, root_build_dir) | 1006 _rebased_build_config = rebase_path(_build_config, root_build_dir) |
| 1008 assert(_rebased_build_config != "" || true) # Mark used. | 1007 assert(_rebased_build_config != "" || true) # Mark used. |
| 1009 | 1008 |
| 1009 _proguard_preprocess = |
| 1010 defined(invoker.proguard_preprocess) && invoker.proguard_preprocess |
| 1010 _input_jar_path = invoker.input_jar_path | 1011 _input_jar_path = invoker.input_jar_path |
| 1011 _output_jar_path = invoker.output_jar_path | 1012 _output_jar_path = invoker.output_jar_path |
| 1012 | 1013 |
| 1013 _proguard_preprocess = | |
| 1014 defined(invoker.proguard_preprocess) && invoker.proguard_preprocess | |
| 1015 | |
| 1016 _jar_excluded_patterns = [] | 1014 _jar_excluded_patterns = [] |
| 1017 if (defined(invoker.jar_excluded_patterns)) { | 1015 if (defined(invoker.jar_excluded_patterns)) { |
| 1018 _jar_excluded_patterns = invoker.jar_excluded_patterns | 1016 _jar_excluded_patterns = invoker.jar_excluded_patterns |
| 1019 } | 1017 } |
| 1020 _strip_resource_classes = defined(invoker.strip_resource_classes) && | 1018 _strip_resource_classes = defined(invoker.strip_resource_classes) && |
| 1021 invoker.strip_resource_classes | 1019 invoker.strip_resource_classes |
| 1022 _filter_jar = _jar_excluded_patterns != [] || _strip_resource_classes | 1020 _filter_jar = _jar_excluded_patterns != [] || _strip_resource_classes |
| 1023 | 1021 |
| 1024 _enable_assert = | 1022 if (_filter_jar) { |
| 1025 defined(invoker.supports_android) && invoker.supports_android && | 1023 _filter_target = "${target_name}__filter" |
| 1026 (is_java_debug || dcheck_always_on) | 1024 _output_jar_target = _filter_target |
| 1027 assert(_enable_assert || true) # Mark used. | 1025 } |
| 1026 if (_proguard_preprocess) { |
| 1027 _proguard_target = "${target_name}__proguard_process" |
| 1028 _output_jar_target = _proguard_target |
| 1029 } |
| 1030 if (!_filter_jar && !_proguard_preprocess) { |
| 1031 _copy_target = "${target_name}__copy" |
| 1032 _output_jar_target = _copy_target |
| 1033 } |
| 1028 | 1034 |
| 1029 if (_filter_jar) { | 1035 if (_filter_jar) { |
| 1030 _filter_target = "${target_name}__filter" | 1036 _filtered_jar_path = _output_jar_path |
| 1031 | 1037 if (_proguard_preprocess) { |
| 1032 _filter_jar_path = "$target_out_dir/$target_name-filtered.jar" | 1038 _filtered_jar_path = "$target_out_dir/$target_name-filtered.jar" |
| 1039 } |
| 1033 action(_filter_target) { | 1040 action(_filter_target) { |
| 1034 script = "//build/android/gyp/jar.py" | 1041 script = "//build/android/gyp/jar.py" |
| 1035 forward_variables_from(invoker, | 1042 forward_variables_from(invoker, |
| 1036 [ | 1043 [ |
| 1037 "deps", | 1044 "deps", |
| 1038 "public_deps", | 1045 "public_deps", |
| 1039 ]) | 1046 ]) |
| 1040 inputs = [ | 1047 inputs = [ |
| 1041 _build_config, | 1048 _build_config, |
| 1042 _input_jar_path, | 1049 _input_jar_path, |
| 1043 ] | 1050 ] |
| 1044 outputs = [ | 1051 outputs = [ |
| 1045 _filter_jar_path, | 1052 _filtered_jar_path, |
| 1046 ] | 1053 ] |
| 1047 args = [ | 1054 args = [ |
| 1048 "--input-jar", | 1055 "--input-jar", |
| 1049 rebase_path(_input_jar_path, root_build_dir), | 1056 rebase_path(_input_jar_path, root_build_dir), |
| 1050 "--jar-path", | 1057 "--jar-path", |
| 1051 rebase_path(_filter_jar_path, root_build_dir), | 1058 rebase_path(_filtered_jar_path, root_build_dir), |
| 1052 "--excluded-classes=$_jar_excluded_patterns", | 1059 "--excluded-classes=$_jar_excluded_patterns", |
| 1053 ] | 1060 ] |
| 1054 if (_strip_resource_classes) { | 1061 if (_strip_resource_classes) { |
| 1055 args += [ "--strip-resource-classes-for=@FileArg($_rebased_build_confi
g:javac:resource_packages)" ] | 1062 args += [ "--strip-resource-classes-for=@FileArg($_rebased_build_confi
g:javac:resource_packages)" ] |
| 1056 } | 1063 } |
| 1057 } | 1064 } |
| 1058 } | 1065 } |
| 1059 | 1066 |
| 1060 if (_proguard_preprocess) { | 1067 if (_proguard_preprocess) { |
| 1061 _output_jar_target = "${target_name}__proguard_process" | |
| 1062 _proguard_output_jar = _output_jar_path | |
| 1063 _proguard_config_path = invoker.proguard_preprocess_config | 1068 _proguard_config_path = invoker.proguard_preprocess_config |
| 1064 proguard(_output_jar_target) { | 1069 proguard(_proguard_target) { |
| 1065 if (_filter_jar) { | 1070 if (_filter_jar) { |
| 1066 _proguard_input_jar = _filter_jar_path | 1071 _proguard_input_jar = _filtered_jar_path |
| 1067 deps = [ | 1072 public_deps = [ |
| 1068 ":$_filter_target", | 1073 ":$_filter_target", |
| 1069 ] | 1074 ] |
| 1070 } else { | 1075 } else { |
| 1071 _proguard_input_jar = _input_jar_path | 1076 _proguard_input_jar = _input_jar_path |
| 1072 deps = [] | 1077 public_deps = [] |
| 1073 } | 1078 } |
| 1074 if (defined(invoker.deps)) { | 1079 if (defined(invoker.deps)) { |
| 1075 deps += invoker.deps | 1080 deps = invoker.deps |
| 1076 } | 1081 } |
| 1077 if (defined(invoker.public_deps)) { | 1082 if (defined(invoker.public_deps)) { |
| 1078 public_deps = invoker.public_deps | 1083 public_deps += invoker.public_deps |
| 1079 } | 1084 } |
| 1080 inputs = [ | 1085 inputs = [ |
| 1081 _build_config, | 1086 _build_config, |
| 1082 _proguard_config_path, | 1087 _proguard_config_path, |
| 1083 _proguard_input_jar, | 1088 _proguard_input_jar, |
| 1084 ] | 1089 ] |
| 1085 output_jar_path = _proguard_output_jar | 1090 output_jar_path = _output_jar_path |
| 1086 | 1091 |
| 1087 _rebased_input_paths = | 1092 _rebased_input_paths = [ rebase_path(_input_jar_path, root_build_dir) ] |
| 1088 [ rebase_path(_proguard_input_jar, root_build_dir) ] | |
| 1089 _rebased_proguard_configs = | 1093 _rebased_proguard_configs = |
| 1090 [ rebase_path(_proguard_config_path, root_build_dir) ] | 1094 [ rebase_path(_proguard_config_path, root_build_dir) ] |
| 1091 args = [ | 1095 args = [ |
| 1092 "--input-paths=$_rebased_input_paths", | 1096 "--input-paths=$_rebased_input_paths", |
| 1093 "--proguard-configs=$_rebased_proguard_configs", | 1097 "--proguard-configs=$_rebased_proguard_configs", |
| 1094 "--classpath=@FileArg($_rebased_build_config:javac:classpath)", | 1098 "--classpath=@FileArg($_rebased_build_config:javac:classpath)", |
| 1095 ] | 1099 ] |
| 1096 } | 1100 } |
| 1097 } else if (_enable_assert) { | 1101 } else if (!_filter_jar) { |
| 1098 _output_jar_target = "${target_name}__assert" | 1102 copy(_copy_target) { |
| 1099 _assert_output_jar = _output_jar_path | 1103 forward_variables_from(invoker, |
| 1100 action(_output_jar_target) { | 1104 [ |
| 1101 script = "$root_out_dir/bin/helper/java_assertion_enabler" | 1105 "deps", |
| 1102 deps = [ | 1106 "public_deps", |
| 1103 "//build/android/java_assertion_enabler($default_toolchain)", | 1107 ]) |
| 1104 ] | |
| 1105 if (_filter_jar) { | |
| 1106 _assert_input_jar = _filter_jar_path | |
| 1107 deps += [ ":$_filter_target" ] | |
| 1108 } else { | |
| 1109 _assert_input_jar = _input_jar_path | |
| 1110 } | |
| 1111 if (defined(invoker.deps)) { | |
| 1112 deps += invoker.deps | |
| 1113 } | |
| 1114 if (defined(invoker.public_deps)) { | |
| 1115 public_deps = invoker.public_deps | |
| 1116 } | |
| 1117 inputs = [ | |
| 1118 _assert_input_jar, | |
| 1119 ] | |
| 1120 outputs = [ | |
| 1121 _assert_output_jar, | |
| 1122 ] | |
| 1123 args = [ | |
| 1124 rebase_path(_assert_input_jar, root_build_dir), | |
| 1125 rebase_path(_assert_output_jar, root_build_dir), | |
| 1126 ] | |
| 1127 } | |
| 1128 } else { | |
| 1129 _output_jar_target = "${target_name}__copy" | |
| 1130 copy(_output_jar_target) { | |
| 1131 if (_filter_jar) { | |
| 1132 _copy_input_jar = _filter_jar_path | |
| 1133 public_deps = [ | |
| 1134 ":$_filter_target", | |
| 1135 ] | |
| 1136 } else { | |
| 1137 _copy_input_jar = _input_jar_path | |
| 1138 public_deps = [] | |
| 1139 } | |
| 1140 if (defined(invoker.deps)) { | |
| 1141 deps = invoker.deps | |
| 1142 } | |
| 1143 if (defined(invoker.public_deps)) { | |
| 1144 public_deps += invoker.public_deps | |
| 1145 } | |
| 1146 sources = [ | 1108 sources = [ |
| 1147 _copy_input_jar, | 1109 _input_jar_path, |
| 1148 ] | 1110 ] |
| 1149 outputs = [ | 1111 outputs = [ |
| 1150 _output_jar_path, | 1112 _output_jar_path, |
| 1151 ] | 1113 ] |
| 1152 } | 1114 } |
| 1153 } | 1115 } |
| 1154 | 1116 |
| 1155 group(target_name) { | 1117 group(target_name) { |
| 1156 forward_variables_from(invoker, | 1118 forward_variables_from(invoker, |
| 1157 [ | 1119 [ |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 ]) | 1795 ]) |
| 1834 | 1796 |
| 1835 visibility = [ | 1797 visibility = [ |
| 1836 ":$_ijar_target_name", | 1798 ":$_ijar_target_name", |
| 1837 ":$_template_name", | 1799 ":$_template_name", |
| 1838 ] | 1800 ] |
| 1839 if (_supports_android) { | 1801 if (_supports_android) { |
| 1840 visibility += [ ":$_dex_target_name" ] | 1802 visibility += [ ":$_dex_target_name" ] |
| 1841 } | 1803 } |
| 1842 | 1804 |
| 1843 supports_android = _supports_android | |
| 1844 build_config = _build_config | 1805 build_config = _build_config |
| 1845 input_jar_path = invoker.jar_path | 1806 input_jar_path = invoker.jar_path |
| 1846 output_jar_path = _jar_path | 1807 output_jar_path = _jar_path |
| 1847 | 1808 |
| 1848 deps = [ ":$_build_config_target_name" ] + _deps + _jar_deps | 1809 deps = [ ":$_build_config_target_name" ] + _deps + _jar_deps |
| 1849 } | 1810 } |
| 1850 | 1811 |
| 1851 generate_interface_jar(_ijar_target_name) { | 1812 generate_interface_jar(_ijar_target_name) { |
| 1852 if (!defined(invoker.proguard_preprocess) || | 1813 if (!defined(invoker.proguard_preprocess) || |
| 1853 !invoker.proguard_preprocess) { | 1814 !invoker.proguard_preprocess) { |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2125 } | 2086 } |
| 2126 } | 2087 } |
| 2127 | 2088 |
| 2128 process_java_prebuilt(_process_prebuilt_target_name) { | 2089 process_java_prebuilt(_process_prebuilt_target_name) { |
| 2129 forward_variables_from(invoker, | 2090 forward_variables_from(invoker, |
| 2130 [ | 2091 [ |
| 2131 "jar_excluded_patterns", | 2092 "jar_excluded_patterns", |
| 2132 "proguard_preprocess", | 2093 "proguard_preprocess", |
| 2133 "proguard_preprocess_config", | 2094 "proguard_preprocess_config", |
| 2134 ]) | 2095 ]) |
| 2135 supports_android = _supports_android | |
| 2136 build_config = _build_config | 2096 build_config = _build_config |
| 2137 input_jar_path = _javac_jar_path | 2097 input_jar_path = _javac_jar_path |
| 2138 output_jar_path = _process_prebuilt_jar_path | 2098 output_jar_path = _process_prebuilt_jar_path |
| 2139 | 2099 |
| 2140 deps = [ | 2100 deps = [ |
| 2141 ":$_javac_target_name", | 2101 ":$_javac_target_name", |
| 2142 ] | 2102 ] |
| 2143 if (defined(invoker.deps)) { | 2103 if (defined(invoker.deps)) { |
| 2144 deps += invoker.deps | 2104 deps += invoker.deps |
| 2145 } | 2105 } |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2736 rebase_path(root_build_dir, root_build_dir), | 2696 rebase_path(root_build_dir, root_build_dir), |
| 2737 "--packed-libraries-dir", | 2697 "--packed-libraries-dir", |
| 2738 rebase_path(_packed_libraries_dir, root_build_dir), | 2698 rebase_path(_packed_libraries_dir, root_build_dir), |
| 2739 "--libraries=${invoker.libraries_filearg}", | 2699 "--libraries=${invoker.libraries_filearg}", |
| 2740 "--filelistjson", | 2700 "--filelistjson", |
| 2741 rebase_path(invoker.file_list_json, root_build_dir), | 2701 rebase_path(invoker.file_list_json, root_build_dir), |
| 2742 ] | 2702 ] |
| 2743 } | 2703 } |
| 2744 } | 2704 } |
| 2745 } | 2705 } |
| OLD | NEW |