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/config/android/config.gni") | 7 import("//build/config/android/config.gni") |
8 import("//build/config/android/internal_rules.gni") | 8 import("//build/config/android/internal_rules.gni") |
9 import("//build/config/compiler/compiler.gni") | 9 import("//build/config/compiler/compiler.gni") |
10 import("//build/config/dcheck_always_on.gni") | 10 import("//build/config/dcheck_always_on.gni") |
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 # ":bar_java" | 1188 # ":bar_java" |
1189 # ] | 1189 # ] |
1190 # } | 1190 # } |
1191 template("java_prebuilt") { | 1191 template("java_prebuilt") { |
1192 set_sources_assignment_filter([]) | 1192 set_sources_assignment_filter([]) |
1193 java_prebuilt_impl(target_name) { | 1193 java_prebuilt_impl(target_name) { |
1194 forward_variables_from(invoker, "*") | 1194 forward_variables_from(invoker, "*") |
1195 } | 1195 } |
1196 } | 1196 } |
1197 | 1197 |
| 1198 # Combines all dependent .jar files into a single .jar file. |
| 1199 # |
| 1200 # Variables: |
| 1201 # output_jar_path: Path to the output jar. |
| 1202 # override_build_config: Use a pre-existing .build_config. Must be of type |
| 1203 # "apk". |
| 1204 # use_interface_jars: Use all dependent interface .jars rather than |
| 1205 # implementation .jars. |
| 1206 # data, deps, testonly, visibility: Usual meaning. |
| 1207 # |
| 1208 # Example |
| 1209 # dist_jar("lib_fatjar") { |
| 1210 # deps = [ ":my_java_lib" ] |
| 1211 # } |
| 1212 template("dist_jar") { |
| 1213 if (defined(invoker.override_build_config)) { |
| 1214 _build_config = invoker.override_build_config |
| 1215 } else { |
| 1216 _build_config = "$target_gen_dir/$target_name.build_config" |
| 1217 _build_config_target_name = "${target_name}__build_config" |
| 1218 |
| 1219 write_build_config(_build_config_target_name) { |
| 1220 forward_variables_from(invoker, [ "testonly" ]) |
| 1221 type = "dist_jar" |
| 1222 if (defined(invoker.deps)) { |
| 1223 possible_config_deps = invoker.deps |
| 1224 } |
| 1225 build_config = _build_config |
| 1226 } |
| 1227 } |
| 1228 |
| 1229 action(target_name) { |
| 1230 forward_variables_from(invoker, |
| 1231 [ |
| 1232 "data", |
| 1233 "deps", |
| 1234 "testonly", |
| 1235 "visibility", |
| 1236 ]) |
| 1237 script = "//build/android/gyp/create_dist_jar.py" |
| 1238 depfile = "$target_gen_dir/$target_name.d" |
| 1239 |
| 1240 inputs = [ |
| 1241 _build_config, |
| 1242 ] |
| 1243 |
| 1244 outputs = [ |
| 1245 invoker.output_jar_path, |
| 1246 ] |
| 1247 |
| 1248 if (defined(_build_config_target_name)) { |
| 1249 deps += [ ":$_build_config_target_name" ] |
| 1250 } |
| 1251 |
| 1252 args = [ |
| 1253 "--depfile", |
| 1254 rebase_path(depfile, root_build_dir), |
| 1255 "--output", |
| 1256 rebase_path(invoker.output_jar_path, root_build_dir), |
| 1257 ] |
| 1258 |
| 1259 _rebased_build_config = rebase_path(_build_config, root_build_dir) |
| 1260 if (defined(invoker.use_interface_jars) && invoker.use_interface_jars) { |
| 1261 args += [ "--inputs=@FileArg($_rebased_build_config:dist_jar:all_interfa
ce_jars)" ] |
| 1262 } else { |
| 1263 args += [ "--inputs=@FileArg($_rebased_build_config:dist_jar:dependency_
jars)" ] |
| 1264 } |
| 1265 } |
| 1266 } |
| 1267 |
1198 # Declare an Android library target | 1268 # Declare an Android library target |
1199 # | 1269 # |
1200 # This target creates an Android library containing java code and Android | 1270 # This target creates an Android library containing java code and Android |
1201 # resources. | 1271 # resources. |
1202 # | 1272 # |
1203 # Variables | 1273 # Variables |
1204 # deps: Specifies the dependencies of this target. Java targets in this list | 1274 # deps: Specifies the dependencies of this target. Java targets in this list |
1205 # will be added to the javac classpath. Android resources in dependencies | 1275 # will be added to the javac classpath. Android resources in dependencies |
1206 # will be used when building this library. | 1276 # will be used when building this library. |
1207 # | 1277 # |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1816 if (emma_coverage && !_emma_never_instrument) { | 1886 if (emma_coverage && !_emma_never_instrument) { |
1817 deps += [ "//third_party/android_tools:emma_device_java" ] | 1887 deps += [ "//third_party/android_tools:emma_device_java" ] |
1818 } | 1888 } |
1819 } | 1889 } |
1820 | 1890 |
1821 # TODO(cjhopman): This is only ever needed to calculate the list of tests to | 1891 # TODO(cjhopman): This is only ever needed to calculate the list of tests to |
1822 # run. See build/android/pylib/instrumentation/test_jar.py. We should be | 1892 # run. See build/android/pylib/instrumentation/test_jar.py. We should be |
1823 # able to just do that calculation at build time instead. | 1893 # able to just do that calculation at build time instead. |
1824 if (defined(invoker.dist_ijar_path)) { | 1894 if (defined(invoker.dist_ijar_path)) { |
1825 _dist_ijar_path = invoker.dist_ijar_path | 1895 _dist_ijar_path = invoker.dist_ijar_path |
1826 action("${_template_name}_dist_ijar") { | 1896 dist_jar("${_template_name}_dist_ijar") { |
1827 script = "//build/android/gyp/create_dist_jar.py" | 1897 override_build_config = _build_config |
1828 depfile = "$target_gen_dir/$target_name.d" | 1898 output_jar_path = _dist_ijar_path |
1829 inputs = [ | |
1830 _build_config, | |
1831 ] | |
1832 outputs = [ | |
1833 "${_dist_ijar_path}", | |
1834 ] | |
1835 data = [ | 1899 data = [ |
1836 _dist_ijar_path, | 1900 _dist_ijar_path, |
1837 ] | 1901 ] |
1838 args = [ | 1902 use_interface_jars = true |
1839 "--depfile", | |
1840 rebase_path(depfile, root_build_dir), | |
1841 "--output", | |
1842 rebase_path("${_dist_ijar_path}", root_build_dir), | |
1843 "--inputs=@FileArg($_rebased_build_config:dist_jar:all_interface_jars)
", | |
1844 ] | |
1845 deps = [ | 1903 deps = [ |
1846 ":$build_config_target", # Generates the build config file. | 1904 ":$build_config_target", |
1847 ":$java_target", # Generates the jar file. | 1905 ":$java_target", |
1848 ] | 1906 ] |
1849 } | 1907 } |
1850 } | 1908 } |
1851 | 1909 |
1852 if (_proguard_enabled) { | 1910 if (_proguard_enabled) { |
1853 _proguard_configs = [ _generated_proguard_config ] | 1911 _proguard_configs = [ _generated_proguard_config ] |
1854 if (defined(invoker.proguard_configs)) { | 1912 if (defined(invoker.proguard_configs)) { |
1855 _proguard_configs += invoker.proguard_configs | 1913 _proguard_configs += invoker.proguard_configs |
1856 } | 1914 } |
1857 assert(_proguard_configs != []) # Mark as used. | 1915 assert(_proguard_configs != []) # Mark as used. |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2829 # because in practice they seem to contain classes required to be in the | 2887 # because in practice they seem to contain classes required to be in the |
2830 # classpath. | 2888 # classpath. |
2831 deps += _subjar_targets | 2889 deps += _subjar_targets |
2832 } | 2890 } |
2833 if (defined(_res_target_name)) { | 2891 if (defined(_res_target_name)) { |
2834 deps += [ ":$_res_target_name" ] | 2892 deps += [ ":$_res_target_name" ] |
2835 } | 2893 } |
2836 } | 2894 } |
2837 } | 2895 } |
2838 } | 2896 } |
OLD | NEW |