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