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 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 # and (possibly) native libraries. | 1339 # and (possibly) native libraries. |
1340 # | 1340 # |
1341 # Variables | 1341 # Variables |
1342 # alternative_android_sdk_jar: The alternative android sdk jar used in | 1342 # alternative_android_sdk_jar: The alternative android sdk jar used in |
1343 # proguard. | 1343 # proguard. |
1344 # android_aapt_path: Android aapt tool to replace default one to build | 1344 # android_aapt_path: Android aapt tool to replace default one to build |
1345 # resource. | 1345 # resource. |
1346 # android_manifest: Path to AndroidManifest.xml. | 1346 # android_manifest: Path to AndroidManifest.xml. |
1347 # android_manifest_dep: Target that generates AndroidManifest (if applicable
) | 1347 # android_manifest_dep: Target that generates AndroidManifest (if applicable
) |
1348 # chromium_code: If true, extra analysis warning/errors will be enabled. | 1348 # chromium_code: If true, extra analysis warning/errors will be enabled. |
1349 # create_dist_ijar: Whether to define the "${target_name}_dist_ijar" target | 1349 # dist_ijar_path: Path to create "${target_name}_dist_ijar" target |
1350 # (used by instrumentation_test_apk). | 1350 # (used by instrumentation_test_apk). |
1351 # data_deps: List of dependencies needed at runtime. These will be built but | 1351 # data_deps: List of dependencies needed at runtime. These will be built but |
1352 # won't change the generated .apk in any way (in fact they may be built | 1352 # won't change the generated .apk in any way (in fact they may be built |
1353 # after the .apk is). | 1353 # after the .apk is). |
1354 # deps: List of dependencies. All Android java resources and libraries in th
e | 1354 # deps: List of dependencies. All Android java resources and libraries in th
e |
1355 # "transitive closure" of these dependencies will be included in the apk. | 1355 # "transitive closure" of these dependencies will be included in the apk. |
1356 # Note: this "transitive closure" actually only includes such targets if | 1356 # Note: this "transitive closure" actually only includes such targets if |
1357 # they are depended on through android_library or android_resources target
s | 1357 # they are depended on through android_library or android_resources target
s |
1358 # (and so not through builtin targets like 'action', 'group', etc). | 1358 # (and so not through builtin targets like 'action', 'group', etc). |
1359 # install_script_name: Name of wrapper script (default=target_name). | 1359 # install_script_name: Name of wrapper script (default=target_name). |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1787 deps += [ "${invoker.apk_under_test}__java" ] | 1787 deps += [ "${invoker.apk_under_test}__java" ] |
1788 } | 1788 } |
1789 if (emma_coverage && !_emma_never_instrument) { | 1789 if (emma_coverage && !_emma_never_instrument) { |
1790 deps += [ "//third_party/android_tools:emma_device_java" ] | 1790 deps += [ "//third_party/android_tools:emma_device_java" ] |
1791 } | 1791 } |
1792 } | 1792 } |
1793 | 1793 |
1794 # TODO(cjhopman): This is only ever needed to calculate the list of tests to | 1794 # TODO(cjhopman): This is only ever needed to calculate the list of tests to |
1795 # run. See build/android/pylib/instrumentation/test_jar.py. We should be | 1795 # run. See build/android/pylib/instrumentation/test_jar.py. We should be |
1796 # able to just do that calculation at build time instead. | 1796 # able to just do that calculation at build time instead. |
1797 if (defined(invoker.create_dist_ijar) && invoker.create_dist_ijar) { | 1797 if (defined(invoker.dist_ijar_path)) { |
1798 _dist_ijar_path = "$root_build_dir/test.lib.java/" + | 1798 _dist_ijar_path = invoker.dist_ijar_path |
1799 get_path_info(_final_apk_path, "name") + ".jar" | |
1800 action("${_template_name}_dist_ijar") { | 1799 action("${_template_name}_dist_ijar") { |
1801 script = "//build/android/gyp/create_dist_jar.py" | 1800 script = "//build/android/gyp/create_dist_jar.py" |
1802 depfile = "$target_gen_dir/$target_name.d" | 1801 depfile = "$target_gen_dir/$target_name.d" |
1803 inputs = [ | 1802 inputs = [ |
1804 _build_config, | 1803 _build_config, |
1805 ] | 1804 ] |
1806 outputs = [ | 1805 outputs = [ |
1807 "${_dist_ijar_path}", | 1806 "${_dist_ijar_path}", |
1808 ] | 1807 ] |
1809 data = [ | 1808 data = [ |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2252 # apk_under_test = "Foo" | 2251 # apk_under_test = "Foo" |
2253 # java_files = [ | 2252 # java_files = [ |
2254 # "android/org/chromium/foo/FooTestCase.java", | 2253 # "android/org/chromium/foo/FooTestCase.java", |
2255 # "android/org/chromium/foo/FooExampleTest.java", | 2254 # "android/org/chromium/foo/FooExampleTest.java", |
2256 # ] | 2255 # ] |
2257 # deps = [ | 2256 # deps = [ |
2258 # ":foo_test_support_java" | 2257 # ":foo_test_support_java" |
2259 # ] | 2258 # ] |
2260 # } | 2259 # } |
2261 template("instrumentation_test_apk") { | 2260 template("instrumentation_test_apk") { |
| 2261 assert(defined(invoker.apk_name)) |
2262 testonly = true | 2262 testonly = true |
2263 _apk_target_name = "${target_name}__apk" | 2263 _apk_target_name = "${target_name}__apk" |
2264 _test_runner_target_name = "${target_name}__test_runner_script" | 2264 _test_runner_target_name = "${target_name}__test_runner_script" |
2265 _install_script_name = "install_$target_name" | 2265 _install_script_name = "install_$target_name" |
| 2266 _dist_ijar_path = |
| 2267 "$root_build_dir/test.lib.java/" + invoker.apk_name + ".jar" |
2266 | 2268 |
2267 test_runner_script(_test_runner_target_name) { | 2269 test_runner_script(_test_runner_target_name) { |
2268 forward_variables_from(invoker, | 2270 forward_variables_from(invoker, |
2269 [ | 2271 [ |
2270 "additional_apks", | 2272 "additional_apks", |
2271 "apk_under_test", | 2273 "apk_under_test", |
2272 "data", | 2274 "data", |
2273 "data_deps", | 2275 "data_deps", |
2274 "deps", | 2276 "deps", |
2275 "ignore_all_data_deps", | 2277 "ignore_all_data_deps", |
2276 "public_deps", | 2278 "public_deps", |
2277 ]) | 2279 ]) |
2278 test_name = invoker.target_name | 2280 test_name = invoker.target_name |
2279 test_type = "instrumentation" | 2281 test_type = "instrumentation" |
2280 apk_target = ":$_apk_target_name" | 2282 apk_target = ":$_apk_target_name" |
| 2283 test_jar = _dist_ijar_path |
2281 } | 2284 } |
2282 | 2285 |
2283 test_runner_script("${_test_runner_target_name}_incremental") { | 2286 test_runner_script("${_test_runner_target_name}_incremental") { |
2284 forward_variables_from(invoker, | 2287 forward_variables_from(invoker, |
2285 [ | 2288 [ |
2286 "additional_apks", | 2289 "additional_apks", |
2287 "apk_under_test", | 2290 "apk_under_test", |
2288 "data", | 2291 "data", |
2289 "data_deps", | 2292 "data_deps", |
2290 "deps", | 2293 "deps", |
2291 "ignore_all_data_deps", | 2294 "ignore_all_data_deps", |
2292 "public_deps", | 2295 "public_deps", |
2293 ]) | 2296 ]) |
2294 test_name = "${invoker.target_name}_incremental" | 2297 test_name = "${invoker.target_name}_incremental" |
2295 test_type = "instrumentation" | 2298 test_type = "instrumentation" |
2296 apk_target = ":$_apk_target_name" | 2299 apk_target = ":$_apk_target_name" |
| 2300 test_jar = _dist_ijar_path |
2297 incremental_install = true | 2301 incremental_install = true |
2298 } | 2302 } |
2299 | 2303 |
2300 android_apk(_apk_target_name) { | 2304 android_apk(_apk_target_name) { |
2301 deps = [] | 2305 deps = [] |
2302 data_deps = [] | 2306 data_deps = [] |
2303 forward_variables_from(invoker, "*") | 2307 forward_variables_from(invoker, "*") |
2304 install_script_name = _install_script_name | 2308 install_script_name = _install_script_name |
2305 deps += [ "//testing/android/broker:broker_java" ] | 2309 deps += [ "//testing/android/broker:broker_java" ] |
2306 data_deps += [ | 2310 data_deps += [ |
(...skipping 10 matching lines...) Expand all Loading... |
2317 # code and the test java code. This is to allow us to apply all ProGuard | 2321 # code and the test java code. This is to allow us to apply all ProGuard |
2318 # optimizations that we ship with, but not have them break tests. The | 2322 # optimizations that we ship with, but not have them break tests. The |
2319 # apk under test will still have the same resources, assets, and | 2323 # apk under test will still have the same resources, assets, and |
2320 # manifest, all of which are the ones used in the tests. | 2324 # manifest, all of which are the ones used in the tests. |
2321 if (!defined(invoker.proguard_configs)) { | 2325 if (!defined(invoker.proguard_configs)) { |
2322 proguard_configs = [] | 2326 proguard_configs = [] |
2323 } | 2327 } |
2324 proguard_configs += [ "//testing/android/proguard_for_test.flags" ] | 2328 proguard_configs += [ "//testing/android/proguard_for_test.flags" ] |
2325 } | 2329 } |
2326 | 2330 |
2327 create_dist_ijar = true | 2331 dist_ijar_path = _dist_ijar_path |
2328 if (defined(invoker.run_findbugs_override)) { | 2332 if (defined(invoker.run_findbugs_override)) { |
2329 # Only allow findbugs when there are java files. | 2333 # Only allow findbugs when there are java files. |
2330 run_findbugs_override = | 2334 run_findbugs_override = |
2331 invoker.run_findbugs_override && defined(invoker.java_files) | 2335 invoker.run_findbugs_override && defined(invoker.java_files) |
2332 } | 2336 } |
2333 } | 2337 } |
2334 | 2338 |
2335 group(target_name) { | 2339 group(target_name) { |
2336 public_deps = [ | 2340 public_deps = [ |
2337 ":$_apk_target_name", | 2341 ":$_apk_target_name", |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2761 # because in practice they seem to contain classes required to be in the | 2765 # because in practice they seem to contain classes required to be in the |
2762 # classpath. | 2766 # classpath. |
2763 deps += _subjar_targets | 2767 deps += _subjar_targets |
2764 } | 2768 } |
2765 if (defined(_res_target_name)) { | 2769 if (defined(_res_target_name)) { |
2766 deps += [ ":$_res_target_name" ] | 2770 deps += [ ":$_res_target_name" ] |
2767 } | 2771 } |
2768 } | 2772 } |
2769 } | 2773 } |
2770 } | 2774 } |
OLD | NEW |