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 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 | 1197 |
1198 # Declare an Android library target | 1198 # Declare an Android library target |
1199 # | 1199 # |
1200 # This target creates an Android library containing java code and Android | 1200 # This target creates an Android library containing java code and Android |
1201 # resources. | 1201 # resources. |
1202 # | 1202 # |
1203 # Variables | 1203 # Variables |
1204 # deps: Specifies the dependencies of this target. Java targets in this list | 1204 # deps: Specifies the dependencies of this target. Java targets in this list |
1205 # will be added to the javac classpath. Android resources in dependencies | 1205 # will be added to the javac classpath. Android resources in dependencies |
1206 # will be used when building this library. | 1206 # will be used when building this library. |
| 1207 # public_deps: Specifies the dependencies of this target that will be |
| 1208 # exposed as part of its public API (the .class files will be available |
| 1209 # in the output jar). |
1207 # | 1210 # |
1208 # java_files: List of .java files included in this library. | 1211 # java_files: List of .java files included in this library. |
1209 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars | 1212 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars |
1210 # will be added to java_files and be included in this library. | 1213 # will be added to java_files and be included in this library. |
1211 # srcjars: List of srcjars to be included in this library, together with the | 1214 # srcjars: List of srcjars to be included in this library, together with the |
1212 # ones obtained from srcjar_deps. | 1215 # ones obtained from srcjar_deps. |
1213 # | 1216 # |
1214 # input_jars_paths: A list of paths to the jars that should be included | 1217 # input_jars_paths: A list of paths to the jars that should be included |
1215 # in the classpath. These are in addition to library .jars that | 1218 # in the classpath. These are in addition to library .jars that |
1216 # appear in deps. | 1219 # appear in deps. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 # } | 1265 # } |
1263 template("android_library") { | 1266 template("android_library") { |
1264 set_sources_assignment_filter([]) | 1267 set_sources_assignment_filter([]) |
1265 assert(!defined(invoker.jar_path), | 1268 assert(!defined(invoker.jar_path), |
1266 "android_library does not support a custom jar path") | 1269 "android_library does not support a custom jar path") |
1267 | 1270 |
1268 if (defined(invoker.alternative_android_sdk_ijar)) { | 1271 if (defined(invoker.alternative_android_sdk_ijar)) { |
1269 assert(defined(invoker.alternative_android_sdk_ijar_dep)) | 1272 assert(defined(invoker.alternative_android_sdk_ijar_dep)) |
1270 } | 1273 } |
1271 | 1274 |
1272 java_library_impl(target_name) { | 1275 _java_library_impl_target_name = target_name |
| 1276 _needs_dist_jar = false |
| 1277 |
| 1278 if (defined(invoker.public_deps)) { |
| 1279 forward_variables_from(invoker, [ "testonly" ]) |
| 1280 |
| 1281 _public_deps = invoker.public_deps |
| 1282 _java_library_impl_target_name = "${target_name}__java_library_impl" |
| 1283 _public_deps += [ ":${_java_library_impl_target_name}" ] |
| 1284 _needs_dist_jar = true |
| 1285 |
| 1286 dist_jar(target_name) { |
| 1287 _target_dir_name = get_label_info(":$target_name", "dir") |
| 1288 output_jar_path = |
| 1289 "$root_out_dir/lib.java$_target_dir_name/${target_name}.jar" |
| 1290 deps = _public_deps |
| 1291 } |
| 1292 } |
| 1293 |
| 1294 java_library_impl(_java_library_impl_target_name) { |
1273 forward_variables_from(invoker, "*") | 1295 forward_variables_from(invoker, "*") |
1274 | 1296 |
| 1297 if (_needs_dist_jar) { |
| 1298 output_name = "${target_name}_no_public_deps" |
| 1299 } |
| 1300 |
1275 supports_android = true | 1301 supports_android = true |
1276 requires_android = true | 1302 requires_android = true |
1277 | 1303 |
1278 if (!defined(jar_excluded_patterns)) { | 1304 if (!defined(jar_excluded_patterns)) { |
1279 jar_excluded_patterns = [] | 1305 jar_excluded_patterns = [] |
1280 } | 1306 } |
1281 jar_excluded_patterns += [ | 1307 jar_excluded_patterns += [ |
1282 "*/R.class", | 1308 "*/R.class", |
1283 "*/R\$*.class", | 1309 "*/R\$*.class", |
1284 "*/Manifest.class", | 1310 "*/Manifest.class", |
(...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2820 # because in practice they seem to contain classes required to be in the | 2846 # because in practice they seem to contain classes required to be in the |
2821 # classpath. | 2847 # classpath. |
2822 deps += _subjar_targets | 2848 deps += _subjar_targets |
2823 } | 2849 } |
2824 if (defined(_res_target_name)) { | 2850 if (defined(_res_target_name)) { |
2825 deps += [ ":$_res_target_name" ] | 2851 deps += [ ":$_res_target_name" ] |
2826 } | 2852 } |
2827 } | 2853 } |
2828 } | 2854 } |
2829 } | 2855 } |
OLD | NEW |