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

Side by Side Diff: build/config/android/rules.gni

Issue 2819983002: (Reland) Expose resources in Robolectric/JUnit tests. (Closed)
Patch Set: Fix 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 unified diff | Download patch
OLDNEW
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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 891
892 write_build_config("${target_name}__build_config") { 892 write_build_config("${target_name}__build_config") {
893 type = "android_resources" 893 type = "android_resources"
894 } 894 }
895 895
896 # Put grit files into this subdirectory of target_gen_dir. 896 # Put grit files into this subdirectory of target_gen_dir.
897 extra_output_path = target_name + "_grit_output" 897 extra_output_path = target_name + "_grit_output"
898 898
899 grit_target_name = "${target_name}__grit" 899 grit_target_name = "${target_name}__grit"
900 grit_output_dir = "$target_gen_dir/$extra_output_path" 900 grit_output_dir = "$target_gen_dir/$extra_output_path"
901
901 grit(grit_target_name) { 902 grit(grit_target_name) {
902 forward_variables_from(invoker, [ "deps" ]) 903 forward_variables_from(invoker, [ "deps" ])
903 grit_flags = [ 904 grit_flags = [
904 "-E", 905 "-E",
905 "ANDROID_JAVA_TAGGED_ONLY=false", 906 "ANDROID_JAVA_TAGGED_ONLY=false",
906 ] 907 ]
907 output_dir = grit_output_dir 908 output_dir = grit_output_dir
908 resource_ids = "" 909 resource_ids = ""
909 source = invoker.grd_file 910 source = invoker.grd_file
910 outputs = invoker.outputs 911 outputs = invoker.outputs
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 # java_files = [ "org/chromium/foo/FooTest.java" ] 1052 # java_files = [ "org/chromium/foo/FooTest.java" ]
1052 # deps = [ ":bar_java" ] 1053 # deps = [ ":bar_java" ]
1053 # } 1054 # }
1054 template("junit_binary") { 1055 template("junit_binary") {
1055 set_sources_assignment_filter([]) 1056 set_sources_assignment_filter([])
1056 testonly = true 1057 testonly = true
1057 1058
1058 _java_binary_target_name = "${target_name}__java_binary" 1059 _java_binary_target_name = "${target_name}__java_binary"
1059 _test_runner_target_name = "${target_name}__test_runner_script" 1060 _test_runner_target_name = "${target_name}__test_runner_script"
1060 1061
1062 _build_config = "$target_gen_dir/$target_name.build_config"
1063 _build_config_target_name = "${target_name}__build_config"
1064
1065 write_build_config(_build_config_target_name) {
1066 type = "junit_binary"
1067 build_config = _build_config
1068 if (defined(invoker.deps)) {
1069 possible_config_deps = invoker.deps
1070 }
1071 }
1072
1061 test_runner_script(_test_runner_target_name) { 1073 test_runner_script(_test_runner_target_name) {
1062 test_name = invoker.target_name 1074 test_name = invoker.target_name
1063 test_suite = invoker.target_name 1075 test_suite = invoker.target_name
1064 test_type = "junit" 1076 test_type = "junit"
1065 ignore_all_data_deps = true 1077 ignore_all_data_deps = true
1078 forward_variables_from(invoker,
1079 [
1080 "android_manifest_path",
1081 "package_name",
1082 ])
1066 } 1083 }
1067 1084
1068 java_binary(_java_binary_target_name) { 1085 java_binary(_java_binary_target_name) {
1069 deps = [] 1086 deps = []
1070 output_name = invoker.target_name 1087 output_name = invoker.target_name
1071 forward_variables_from(invoker, "*") 1088 forward_variables_from(invoker, "*")
1072 testonly = true 1089 testonly = true
1073 bypass_platform_checks = true 1090 bypass_platform_checks = true
1074 main_class = "org.chromium.testing.local.JunitTestMain" 1091 main_class = "org.chromium.testing.local.JunitTestMain"
1075 wrapper_script_name = "helper/$target_name" 1092 wrapper_script_name = "helper/$target_name"
1076 deps += [ 1093 deps += [
1077 "//testing/android/junit:junit_test_support", 1094 "//testing/android/junit:junit_test_support",
1078 "//third_party/junit", 1095 "//third_party/junit",
1079 "//third_party/mockito:mockito_java", 1096 "//third_party/mockito:mockito_java",
1080 "//third_party/robolectric:robolectric_all_java", 1097 "//third_party/robolectric:robolectric_all_java",
1081 ] 1098 ]
1082 } 1099 }
1083 group(target_name) { 1100 group(target_name) {
1084 public_deps = [ 1101 public_deps = [
1102 ":$_build_config_target_name",
1085 ":$_java_binary_target_name", 1103 ":$_java_binary_target_name",
1086 ":$_test_runner_target_name", 1104 ":$_test_runner_target_name",
1087 ] 1105 ]
1088 } 1106 }
1089 } 1107 }
1090 1108
1091 # Declare a java library target 1109 # Declare a java library target
1092 # 1110 #
1093 # Variables 1111 # Variables
1094 # deps: Specifies the dependencies of this target. Java targets in this list 1112 # deps: Specifies the dependencies of this target. Java targets in this list
(...skipping 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after
2893 # because in practice they seem to contain classes required to be in the 2911 # because in practice they seem to contain classes required to be in the
2894 # classpath. 2912 # classpath.
2895 deps += _subjar_targets 2913 deps += _subjar_targets
2896 } 2914 }
2897 if (defined(_res_target_name)) { 2915 if (defined(_res_target_name)) {
2898 deps += [ ":$_res_target_name" ] 2916 deps += [ ":$_res_target_name" ]
2899 } 2917 }
2900 } 2918 }
2901 } 2919 }
2902 } 2920 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698