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/dcheck_always_on.gni") |
10 import("//build/config/sanitizers/sanitizers.gni") | 10 import("//build/config/sanitizers/sanitizers.gni") |
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 _output_jar_path = invoker.output_jar_path | 1035 _output_jar_path = invoker.output_jar_path |
1036 | 1036 |
1037 _jar_excluded_patterns = [] | 1037 _jar_excluded_patterns = [] |
1038 if (defined(invoker.jar_excluded_patterns)) { | 1038 if (defined(invoker.jar_excluded_patterns)) { |
1039 _jar_excluded_patterns = invoker.jar_excluded_patterns | 1039 _jar_excluded_patterns = invoker.jar_excluded_patterns |
1040 } | 1040 } |
1041 _strip_resource_classes = defined(invoker.strip_resource_classes) && | 1041 _strip_resource_classes = defined(invoker.strip_resource_classes) && |
1042 invoker.strip_resource_classes | 1042 invoker.strip_resource_classes |
1043 _filter_jar = _jar_excluded_patterns != [] || _strip_resource_classes | 1043 _filter_jar = _jar_excluded_patterns != [] || _strip_resource_classes |
1044 | 1044 |
1045 _proguard_preprocess = | |
1046 defined(invoker.proguard_preprocess) && invoker.proguard_preprocess | |
1047 | |
1048 _enable_assert = | 1045 _enable_assert = |
1049 defined(invoker.supports_android) && invoker.supports_android && | 1046 defined(invoker.supports_android) && invoker.supports_android && |
1050 (is_java_debug || dcheck_always_on) | 1047 (is_java_debug || dcheck_always_on) |
1051 | 1048 |
1052 _retrolambda = defined(invoker.supports_android) && | 1049 _retrolambda = defined(invoker.supports_android) && |
1053 invoker.supports_android && use_java8 | 1050 invoker.supports_android && use_java8 |
1054 | 1051 |
1055 _deps = [] | 1052 _deps = [] |
1056 _previous_output_jar = _input_jar_path | 1053 _previous_output_jar = _input_jar_path |
1057 | 1054 |
(...skipping 28 matching lines...) Expand all Loading... |
1086 if (_strip_resource_classes) { | 1083 if (_strip_resource_classes) { |
1087 args += [ "--strip-resource-classes-for=@FileArg($_rebased_build_confi
g:javac:resource_packages)" ] | 1084 args += [ "--strip-resource-classes-for=@FileArg($_rebased_build_confi
g:javac:resource_packages)" ] |
1088 } | 1085 } |
1089 } | 1086 } |
1090 | 1087 |
1091 _deps = [] | 1088 _deps = [] |
1092 _deps = [ ":$_filter_target" ] | 1089 _deps = [ ":$_filter_target" ] |
1093 _previous_output_jar = _filter_output_jar | 1090 _previous_output_jar = _filter_output_jar |
1094 } | 1091 } |
1095 | 1092 |
1096 if (_proguard_preprocess) { | |
1097 _proguard_target = "${target_name}__proguard_process" | |
1098 _proguard_input_jar = _previous_output_jar | |
1099 _proguard_output_jar = "$target_out_dir/$target_name-proguarded.jar" | |
1100 _proguard_config_path = invoker.proguard_preprocess_config | |
1101 | |
1102 proguard(_proguard_target) { | |
1103 deps = _deps | |
1104 if (defined(invoker.deps)) { | |
1105 deps += invoker.deps | |
1106 } | |
1107 if (defined(invoker.public_deps)) { | |
1108 public_deps = invoker.public_deps | |
1109 } | |
1110 inputs = [ | |
1111 _build_config, | |
1112 _proguard_config_path, | |
1113 _proguard_input_jar, | |
1114 ] | |
1115 output_jar_path = _proguard_output_jar | |
1116 | |
1117 _rebased_input_paths = | |
1118 [ rebase_path(_proguard_input_jar, root_build_dir) ] | |
1119 _rebased_proguard_configs = | |
1120 [ rebase_path(_proguard_config_path, root_build_dir) ] | |
1121 args = [ | |
1122 "--input-paths=$_rebased_input_paths", | |
1123 "--proguard-configs=$_rebased_proguard_configs", | |
1124 "--classpath=@FileArg($_rebased_build_config:javac:classpath)", | |
1125 ] | |
1126 } | |
1127 | |
1128 _deps = [] | |
1129 _deps = [ ":$_proguard_target" ] | |
1130 _previous_output_jar = _proguard_output_jar | |
1131 } | |
1132 | |
1133 if (_enable_assert) { | 1093 if (_enable_assert) { |
1134 _assert_target = "${target_name}__assert" | 1094 _assert_target = "${target_name}__assert" |
1135 _assert_input_jar = _previous_output_jar | 1095 _assert_input_jar = _previous_output_jar |
1136 _assert_output_jar = "$target_out_dir/$target_name-asserted.jar" | 1096 _assert_output_jar = "$target_out_dir/$target_name-asserted.jar" |
1137 | 1097 |
1138 action(_assert_target) { | 1098 action(_assert_target) { |
1139 script = "$root_build_dir/bin/helper/java_assertion_enabler" | 1099 script = "$root_build_dir/bin/helper/java_assertion_enabler" |
1140 deps = [ | 1100 deps = [ |
1141 "//build/android/java_assertion_enabler($default_toolchain)", | 1101 "//build/android/java_assertion_enabler($default_toolchain)", |
1142 ] | 1102 ] |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1882 # Use original jar_path because _jar_path points to a library without | 1842 # Use original jar_path because _jar_path points to a library without |
1883 # resources. | 1843 # resources. |
1884 java_resources_jar = invoker.jar_path | 1844 java_resources_jar = invoker.jar_path |
1885 } | 1845 } |
1886 } | 1846 } |
1887 | 1847 |
1888 process_java_prebuilt(_process_jar_target_name) { | 1848 process_java_prebuilt(_process_jar_target_name) { |
1889 forward_variables_from(invoker, | 1849 forward_variables_from(invoker, |
1890 [ | 1850 [ |
1891 "jar_excluded_patterns", | 1851 "jar_excluded_patterns", |
1892 "proguard_preprocess", | |
1893 "proguard_preprocess_config", | |
1894 "strip_resource_classes", | 1852 "strip_resource_classes", |
1895 ]) | 1853 ]) |
1896 | 1854 |
1897 visibility = [ | 1855 visibility = [ |
1898 ":$_ijar_target_name", | 1856 ":$_ijar_target_name", |
1899 ":$_template_name", | 1857 ":$_template_name", |
1900 ] | 1858 ] |
1901 if (_supports_android) { | 1859 if (_supports_android) { |
1902 visibility += [ ":$_dex_target_name" ] | 1860 visibility += [ ":$_dex_target_name" ] |
1903 } | 1861 } |
1904 | 1862 |
1905 supports_android = _supports_android | 1863 supports_android = _supports_android |
1906 build_config = _build_config | 1864 build_config = _build_config |
1907 input_jar_path = invoker.jar_path | 1865 input_jar_path = invoker.jar_path |
1908 output_jar_path = _jar_path | 1866 output_jar_path = _jar_path |
1909 | 1867 |
1910 deps = [ ":$_build_config_target_name" ] + _deps + _jar_deps | 1868 deps = [ ":$_build_config_target_name" ] + _deps + _jar_deps |
1911 } | 1869 } |
1912 | 1870 |
1913 generate_interface_jar(_ijar_target_name) { | 1871 generate_interface_jar(_ijar_target_name) { |
1914 if (!defined(invoker.proguard_preprocess) || | 1872 # Always used the unfiltered .jar to create the interface jar so that |
1915 !invoker.proguard_preprocess) { | 1873 # other targets will resolve filtered classes when depending on |
1916 # Always used the unfiltered .jar to create the interface jar so that | 1874 # BuildConfig, NativeLibraries, etc. |
1917 # other targets will resolve filtered classes when depending on | 1875 input_jar = invoker.jar_path |
1918 # BuildConfig, NativeLibraries, etc. | 1876 deps = _deps + _jar_deps |
1919 input_jar = invoker.jar_path | |
1920 deps = _deps + _jar_deps | |
1921 } else { | |
1922 # However, still apply pre-proguarding, since ignoring that can break | |
1923 # compiles. | |
1924 input_jar = _jar_path | |
1925 deps = [ | |
1926 ":$_process_jar_target_name", | |
1927 ] | |
1928 } | |
1929 | |
1930 output_jar = _ijar_path | 1877 output_jar = _ijar_path |
1931 } | 1878 } |
1932 | 1879 |
1933 if (_supports_android) { | 1880 if (_supports_android) { |
1934 dex(_dex_target_name) { | 1881 dex(_dex_target_name) { |
1935 sources = [ | 1882 sources = [ |
1936 _jar_path, | 1883 _jar_path, |
1937 ] | 1884 ] |
1938 output = _dex_path | 1885 output = _dex_path |
1939 deps = [ ":$_process_jar_target_name" ] + _deps + _jar_deps | 1886 deps = [ ":$_process_jar_target_name" ] + _deps + _jar_deps |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2183 inputs += [ file_tuple[0] ] | 2130 inputs += [ file_tuple[0] ] |
2184 args += | 2131 args += |
2185 [ "--additional-jar-file=" + file_tuple[0] + ":" + file_tuple[1] ] | 2132 [ "--additional-jar-file=" + file_tuple[0] + ":" + file_tuple[1] ] |
2186 } | 2133 } |
2187 if (invoker.java_files != []) { | 2134 if (invoker.java_files != []) { |
2188 args += [ "@" + rebase_path(invoker.java_sources_file, root_build_dir) ] | 2135 args += [ "@" + rebase_path(invoker.java_sources_file, root_build_dir) ] |
2189 } | 2136 } |
2190 } | 2137 } |
2191 | 2138 |
2192 process_java_prebuilt(_process_prebuilt_target_name) { | 2139 process_java_prebuilt(_process_prebuilt_target_name) { |
2193 forward_variables_from(invoker, | 2140 forward_variables_from(invoker, [ "jar_excluded_patterns" ]) |
2194 [ | |
2195 "jar_excluded_patterns", | |
2196 "proguard_preprocess", | |
2197 "proguard_preprocess_config", | |
2198 ]) | |
2199 supports_android = _supports_android | 2141 supports_android = _supports_android |
2200 build_config = _build_config | 2142 build_config = _build_config |
2201 input_jar_path = _javac_jar_path | 2143 input_jar_path = _javac_jar_path |
2202 output_jar_path = _process_prebuilt_jar_path | 2144 output_jar_path = _process_prebuilt_jar_path |
2203 | 2145 |
2204 deps = [ | 2146 deps = [ |
2205 ":$_javac_target_name", | 2147 ":$_javac_target_name", |
2206 ] | 2148 ] |
2207 if (defined(invoker.deps)) { | 2149 if (defined(invoker.deps)) { |
2208 deps += invoker.deps | 2150 deps += invoker.deps |
(...skipping 13 matching lines...) Expand all Loading... |
2222 output_jar_path = _final_jar_path | 2164 output_jar_path = _final_jar_path |
2223 | 2165 |
2224 if (!defined(deps)) { | 2166 if (!defined(deps)) { |
2225 deps = [] | 2167 deps = [] |
2226 } | 2168 } |
2227 deps += [ ":$_process_prebuilt_target_name" ] | 2169 deps += [ ":$_process_prebuilt_target_name" ] |
2228 } | 2170 } |
2229 } | 2171 } |
2230 | 2172 |
2231 generate_interface_jar(_ijar_target_name) { | 2173 generate_interface_jar(_ijar_target_name) { |
2232 if (!defined(invoker.proguard_preprocess) || | 2174 # Always used the unfiltered .jar to create the interface jar so that |
2233 !invoker.proguard_preprocess) { | 2175 # other targets will resolve filtered classes when depending on |
2234 # Always used the unfiltered .jar to create the interface jar so that | 2176 # BuildConfig, NativeLibraries, etc. |
2235 # other targets will resolve filtered classes when depending on | 2177 input_jar = _javac_jar_path |
2236 # BuildConfig, NativeLibraries, etc. | 2178 deps = [ |
2237 input_jar = _javac_jar_path | 2179 ":$_javac_target_name", |
2238 deps = [ | 2180 ] |
2239 ":$_javac_target_name", | |
2240 ] | |
2241 } else { | |
2242 # However, still apply pre-proguarding, since ignoring that can break | |
2243 # compiles. | |
2244 input_jar = _process_prebuilt_jar_path | |
2245 deps = [ | |
2246 ":$_process_prebuilt_target_name", | |
2247 ] | |
2248 } | |
2249 output_jar = _final_ijar_path | 2181 output_jar = _final_ijar_path |
2250 } | 2182 } |
2251 | 2183 |
2252 group(_final_target_name) { | 2184 group(_final_target_name) { |
2253 forward_variables_from(invoker, [ "visibility" ]) | 2185 forward_variables_from(invoker, [ "visibility" ]) |
2254 public_deps = [ | 2186 public_deps = [ |
2255 ":$_ijar_target_name", | 2187 ":$_ijar_target_name", |
2256 ] | 2188 ] |
2257 if (_emma_instrument) { | 2189 if (_emma_instrument) { |
2258 public_deps += [ ":$_emma_instr_target_name" ] | 2190 public_deps += [ ":$_emma_instr_target_name" ] |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2434 "additional_jar_files", | 2366 "additional_jar_files", |
2435 "alternative_android_sdk_ijar", | 2367 "alternative_android_sdk_ijar", |
2436 "alternative_android_sdk_ijar_dep", | 2368 "alternative_android_sdk_ijar_dep", |
2437 "dist_jar_path", | 2369 "dist_jar_path", |
2438 "enable_errorprone", | 2370 "enable_errorprone", |
2439 "enable_incremental_javac_override", | 2371 "enable_incremental_javac_override", |
2440 "jar_excluded_patterns", | 2372 "jar_excluded_patterns", |
2441 "manifest_entries", | 2373 "manifest_entries", |
2442 "processors_javac", | 2374 "processors_javac", |
2443 "processor_args_javac", | 2375 "processor_args_javac", |
2444 "proguard_preprocess_config", | |
2445 "proguard_preprocess", | |
2446 "provider_configurations", | 2376 "provider_configurations", |
2447 ]) | 2377 ]) |
2448 jar_path = _jar_path | 2378 jar_path = _jar_path |
2449 build_config = _build_config | 2379 build_config = _build_config |
2450 java_files = _java_files | 2380 java_files = _java_files |
2451 if (_java_files != []) { | 2381 if (_java_files != []) { |
2452 java_sources_file = _java_sources_file | 2382 java_sources_file = _java_sources_file |
2453 } | 2383 } |
2454 srcjar_deps = _srcjar_deps | 2384 srcjar_deps = _srcjar_deps |
2455 srcjars = _srcjars | 2385 srcjars = _srcjars |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2837 rebase_path(root_build_dir, root_build_dir), | 2767 rebase_path(root_build_dir, root_build_dir), |
2838 "--packed-libraries-dir", | 2768 "--packed-libraries-dir", |
2839 rebase_path(_packed_libraries_dir, root_build_dir), | 2769 rebase_path(_packed_libraries_dir, root_build_dir), |
2840 "--libraries=${invoker.libraries_filearg}", | 2770 "--libraries=${invoker.libraries_filearg}", |
2841 "--filelistjson", | 2771 "--filelistjson", |
2842 rebase_path(invoker.file_list_json, root_build_dir), | 2772 rebase_path(invoker.file_list_json, root_build_dir), |
2843 ] | 2773 ] |
2844 } | 2774 } |
2845 } | 2775 } |
2846 } | 2776 } |
OLD | NEW |