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

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

Issue 2767613002: Expose resources in Robolectric/JUnit tests. (Closed)
Patch Set: Rough draft for using build_config to find resources. 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 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 # grd_file = "foo_strings.grd" 882 # grd_file = "foo_strings.grd"
883 # } 883 # }
884 template("java_strings_grd") { 884 template("java_strings_grd") {
885 set_sources_assignment_filter([]) 885 set_sources_assignment_filter([])
886 forward_variables_from(invoker, [ "testonly" ]) 886 forward_variables_from(invoker, [ "testonly" ])
887 887
888 base_path = "$target_gen_dir/$target_name" 888 base_path = "$target_gen_dir/$target_name"
889 resources_zip = base_path + ".resources.zip" 889 resources_zip = base_path + ".resources.zip"
890 build_config = base_path + ".build_config" 890 build_config = base_path + ".build_config"
891 891
892 write_build_config("${target_name}__build_config") {
893 type = "android_resources"
894 }
895
896 # Put grit files into this subdirectory of target_gen_dir. 892 # Put grit files into this subdirectory of target_gen_dir.
897 extra_output_path = target_name + "_grit_output" 893 extra_output_path = target_name + "_grit_output"
898 894
899 grit_target_name = "${target_name}__grit" 895 grit_target_name = "${target_name}__grit"
900 grit_output_dir = "$target_gen_dir/$extra_output_path" 896 grit_output_dir = "$target_gen_dir/$extra_output_path"
897
898 write_build_config("${target_name}__build_config") {
899 type = "android_resources"
900 resource_dirs = [ grit_output_dir]
901 }
902
901 grit(grit_target_name) { 903 grit(grit_target_name) {
902 forward_variables_from(invoker, [ "deps" ]) 904 forward_variables_from(invoker, [ "deps" ])
903 grit_flags = [ 905 grit_flags = [
904 "-E", 906 "-E",
905 "ANDROID_JAVA_TAGGED_ONLY=false", 907 "ANDROID_JAVA_TAGGED_ONLY=false",
906 ] 908 ]
907 output_dir = grit_output_dir 909 output_dir = grit_output_dir
908 resource_ids = "" 910 resource_ids = ""
909 source = invoker.grd_file 911 source = invoker.grd_file
910 outputs = invoker.outputs 912 outputs = invoker.outputs
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 testonly = true 1058 testonly = true
1057 1059
1058 _java_binary_target_name = "${target_name}__java_binary" 1060 _java_binary_target_name = "${target_name}__java_binary"
1059 _test_runner_target_name = "${target_name}__test_runner_script" 1061 _test_runner_target_name = "${target_name}__test_runner_script"
1060 1062
1061 test_runner_script(_test_runner_target_name) { 1063 test_runner_script(_test_runner_target_name) {
1062 test_name = invoker.target_name 1064 test_name = invoker.target_name
1063 test_suite = invoker.target_name 1065 test_suite = invoker.target_name
1064 test_type = "junit" 1066 test_type = "junit"
1065 ignore_all_data_deps = true 1067 ignore_all_data_deps = true
1068 forward_variables_from(invoker,
1069 [
1070 "android_manifest_path",
1071 # "resource_dirs",
1072 "resource_deps",
1073 "package_name",
1074 ])
1066 } 1075 }
1067 1076
1068 java_binary(_java_binary_target_name) { 1077 java_binary(_java_binary_target_name) {
1069 deps = [] 1078 deps = []
1070 output_name = invoker.target_name 1079 output_name = invoker.target_name
1071 forward_variables_from(invoker, "*") 1080 forward_variables_from(invoker, "*")
1072 testonly = true 1081 testonly = true
1073 bypass_platform_checks = true 1082 bypass_platform_checks = true
1074 main_class = "org.chromium.testing.local.JunitTestMain" 1083 main_class = "org.chromium.testing.local.JunitTestMain"
1075 wrapper_script_name = "helper/$target_name" 1084 wrapper_script_name = "helper/$target_name"
(...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after
2893 # because in practice they seem to contain classes required to be in the 2902 # because in practice they seem to contain classes required to be in the
2894 # classpath. 2903 # classpath.
2895 deps += _subjar_targets 2904 deps += _subjar_targets
2896 } 2905 }
2897 if (defined(_res_target_name)) { 2906 if (defined(_res_target_name)) {
2898 deps += [ ":$_res_target_name" ] 2907 deps += [ ":$_res_target_name" ]
2899 } 2908 }
2900 } 2909 }
2901 } 2910 }
2902 } 2911 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698