Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1386)

Unified Diff: build/config/android/rules.gni

Issue 2842603002: (Reland x2) Expose resources in Robolectric/JUnit tests. (Closed)
Patch Set: Rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/config/android/internal_rules.gni ('k') | chrome/android/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/android/rules.gni
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni
index a08a4755523c40ed357bf8869112b651a42b47b2..50014b54eadeefa76fc9f8d38ab20a3f0a977c8d 100644
--- a/build/config/android/rules.gni
+++ b/build/config/android/rules.gni
@@ -579,7 +579,10 @@ if (enable_java_templates) {
assert(defined(invoker.res_dir))
_base_path = "$target_gen_dir/$target_name"
- _resources_zip = _base_path + ".resources.zip"
+
+ # JUnit tests use resource zip files. These must not be put in gen/
+ # directory or they will not be available to tester bots.
+ _resources_zip = "${target_out_dir}/${target_name}.resources.zip"
_build_config = _base_path + ".build_config"
write_build_config("${target_name}__build_config") {
@@ -676,7 +679,10 @@ if (enable_java_templates) {
assert(defined(invoker.resource_dirs))
base_path = "$target_gen_dir/$target_name"
- zip_path = base_path + ".resources.zip"
+
+ # JUnit tests use resource zip files. These must not be put in gen/
+ # directory or they will not be available to tester bots.
+ zip_path = "${target_out_dir}/${target_name}.resources.zip"
srcjar_path = base_path + ".srcjar"
r_text_out_path = base_path + "_R.txt"
build_config = base_path + ".build_config"
@@ -895,7 +901,10 @@ if (enable_java_templates) {
forward_variables_from(invoker, [ "testonly" ])
base_path = "$target_gen_dir/$target_name"
- resources_zip = base_path + ".resources.zip"
+
+ # JUnit tests use resource zip files. These must not be put in gen/
+ # directory or they will not be available to tester bots.
+ resources_zip = "${target_out_dir}/${target_name}.resources.zip"
build_config = base_path + ".build_config"
write_build_config("${target_name}__build_config") {
@@ -907,6 +916,7 @@ if (enable_java_templates) {
grit_target_name = "${target_name}__grit"
grit_output_dir = "$target_gen_dir/$extra_output_path"
+
grit(grit_target_name) {
forward_variables_from(invoker, [ "deps" ])
grit_flags = [
@@ -961,7 +971,10 @@ if (enable_java_templates) {
forward_variables_from(invoker, [ "testonly" ])
base_path = "$target_gen_dir/$target_name"
- resources_zip = base_path + ".resources.zip"
+
+ # JUnit tests use resource zip files. These must not be put in gen/
+ # directory or they will not be available to tester bots.
+ resources_zip = "${target_out_dir}/${target_name}.resources.zip"
build_config = base_path + ".build_config"
build_config_target_name = "${target_name}__build_config"
@@ -1067,11 +1080,27 @@ if (enable_java_templates) {
_java_binary_target_name = "${target_name}__java_binary"
_test_runner_target_name = "${target_name}__test_runner_script"
+ _build_config = "$target_gen_dir/$target_name.build_config"
+ _build_config_target_name = "${target_name}__build_config"
+
+ write_build_config(_build_config_target_name) {
+ type = "junit_binary"
+ build_config = _build_config
+ if (defined(invoker.deps)) {
+ possible_config_deps = invoker.deps
+ }
+ }
+
test_runner_script(_test_runner_target_name) {
test_name = invoker.target_name
test_suite = invoker.target_name
test_type = "junit"
ignore_all_data_deps = true
+ forward_variables_from(invoker,
+ [
+ "android_manifest_path",
+ "package_name",
+ ])
}
java_binary(_java_binary_target_name) {
@@ -1091,6 +1120,7 @@ if (enable_java_templates) {
}
group(target_name) {
public_deps = [
+ ":$_build_config_target_name",
":$_java_binary_target_name",
":$_test_runner_target_name",
]
@@ -1516,7 +1546,10 @@ if (enable_java_templates) {
gen_dir = "$target_gen_dir/$target_name"
base_path = "$gen_dir/$target_name"
_build_config = "$target_gen_dir/$target_name.build_config"
- resources_zip_path = "$base_path.resources.zip"
+
+ # JUnit tests use resource zip files. These must not be put in gen/
+ # directory or they will not be available to tester bots.
+ resources_zip_path = "${target_out_dir}/${target_name}.resources.zip"
_all_resources_zip_path = "$base_path.resources.all.zip"
_jar_path = "$base_path.jar"
_lib_dex_path = "$base_path.dex.jar"
« no previous file with comments | « build/config/android/internal_rules.gni ('k') | chrome/android/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698