OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 # ============================================================================== | 5 # ============================================================================== |
6 # TEST SETUP | 6 # TEST SETUP |
7 # ============================================================================== | 7 # ============================================================================== |
8 | 8 |
9 # Define a test as an executable (or apk on Android) with the "testonly" flag | 9 # Define a test as an executable (or apk on Android) with the "testonly" flag |
10 # set. | 10 # set. |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 deps = [ | 103 deps = [ |
104 ":$library_name", | 104 ":$library_name", |
105 ":$apk_name", | 105 ":$apk_name", |
106 ] | 106 ] |
107 } | 107 } |
108 } else if (is_ios) { | 108 } else if (is_ios) { |
109 if (is_ios) { | 109 if (is_ios) { |
110 import("//build/config/ios/rules.gni") | 110 import("//build/config/ios/rules.gni") |
111 } | 111 } |
112 | 112 |
113 target__sources_name = "${target_name}__sources" | |
114 if (defined(invoker.sources)) { | |
115 source_set(target__sources_name) { | |
116 sources = invoker.sources | |
117 testonly = true | |
118 | |
119 configs = [] # Prevent list overwriting warning. | |
120 configs += invoker.configs | |
121 | |
122 forward_variables_from(invoker, | |
123 [ | |
124 "cflags", | |
125 "cflags_c", | |
126 "cflags_cc", | |
127 "cflags_objc", | |
128 "cflags_objcc", | |
129 "data", | |
130 "data_deps", | |
131 "datadeps", | |
132 "defines", | |
133 "deps", | |
134 "include_dirs", | |
135 "includes", | |
136 ]) | |
137 } | |
138 } | |
139 | |
140 ios_app(target_name) { | 113 ios_app(target_name) { |
141 # TODO(GYP): Make this configurable and only provide a default | 114 # TODO(GYP): Make this configurable and only provide a default |
142 # that can be overridden. | 115 # that can be overridden. |
143 info_plist = "//testing/gtest_ios/unittest-Info.plist" | 116 info_plist = "//testing/gtest_ios/unittest-Info.plist" |
144 app_name = target_name | 117 app_name = target_name |
145 entitlements_path = "//testing/gtest_ios" | 118 entitlements_path = "//testing/gtest_ios" |
146 code_signing_identity = "" | 119 code_signing_identity = "" |
147 testonly = true | 120 testonly = true |
148 | 121 |
149 # See above call. | 122 # See above call. |
150 set_sources_assignment_filter([]) | 123 set_sources_assignment_filter([]) |
151 | 124 |
152 forward_variables_from(invoker, | 125 forward_variables_from(invoker, |
153 [ | 126 [ |
154 "all_dependent_configs", | 127 "all_dependent_configs", |
155 "allow_circular_includes_from", | 128 "allow_circular_includes_from", |
156 "cflags", | 129 "cflags", |
157 "cflags_c", | 130 "cflags_c", |
158 "cflags_cc", | 131 "cflags_cc", |
159 "cflags_objc", | 132 "cflags_objc", |
160 "cflags_objcc", | 133 "cflags_objcc", |
161 "check_includes", | 134 "check_includes", |
| 135 "configs", |
| 136 "data", |
| 137 "data_deps", |
| 138 "defines", |
162 "forward_dependent_configs_from", | 139 "forward_dependent_configs_from", |
| 140 "include_dirs", |
163 "ldflags", | 141 "ldflags", |
164 "libs", | 142 "libs", |
165 "output_extension", | 143 "output_extension", |
166 "output_name", | 144 "output_name", |
167 "public", | 145 "public", |
168 "public_configs", | 146 "public_configs", |
169 "public_deps", | 147 "public_deps", |
| 148 "sources", |
170 "visibility", | 149 "visibility", |
171 ]) | 150 ]) |
172 | 151 |
173 if (defined(invoker.deps)) { | 152 if (defined(invoker.deps)) { |
174 deps = invoker.deps | 153 deps = invoker.deps |
175 } else { | 154 } else { |
176 deps = [] | 155 deps = [] |
177 } | 156 } |
178 deps += [ | 157 deps += [ |
179 # All shared libraries must have the sanitizer deps to properly link in | 158 # All shared libraries must have the sanitizer deps to properly link in |
180 # asan mode (this target will be empty in other cases). | 159 # asan mode (this target will be empty in other cases). |
181 "//build/config/sanitizers:deps", | 160 "//build/config/sanitizers:deps", |
182 ] | 161 ] |
183 | |
184 if (defined(invoker.sources)) { | |
185 deps += [ ":${target__sources_name}" ] | |
186 } | |
187 } | 162 } |
188 } else { | 163 } else { |
189 executable(target_name) { | 164 executable(target_name) { |
190 forward_variables_from(invoker, "*") | 165 forward_variables_from(invoker, "*") |
191 | 166 |
192 testonly = true | 167 testonly = true |
193 | 168 |
194 if (!defined(invoker.deps)) { | 169 if (!defined(invoker.deps)) { |
195 deps = [] | 170 deps = [] |
196 } | 171 } |
197 deps += [ | 172 deps += [ |
198 # All shared libraries must have the sanitizer deps to properly link in | 173 # All shared libraries must have the sanitizer deps to properly link in |
199 # asan mode (this target will be empty in other cases). | 174 # asan mode (this target will be empty in other cases). |
200 "//build/config/sanitizers:deps", | 175 "//build/config/sanitizers:deps", |
201 | 176 |
202 # Give tests the default manifest on Windows (a no-op elsewhere). | 177 # Give tests the default manifest on Windows (a no-op elsewhere). |
203 "//build/win:default_exe_manifest", | 178 "//build/win:default_exe_manifest", |
204 ] | 179 ] |
205 } | 180 } |
206 } | 181 } |
207 } | 182 } |
OLD | NEW |