Commit 15522bc8 authored by Mirko Bonadei's avatar Mirko Bonadei Committed by Commit Bot

[ios] - Add possibility to configure xctest on a build target basis.

This CL will allow projects (like WebRTC, see [1]) to configure whether
to use XCtest or not on a target by target basis instead of doing it at
build level with the GN arg 'enable_run_ios_unittests_with_xctest'.

[1] - https://webrtc-review.googlesource.com/c/src/+/184360

Bug: webrtc:11937
Change-Id: Ia227b2f5eb268dc59cfbe5617dbfc4836e6ae372
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2414169Reviewed-by: default avatarDirk Pranke <dpranke@google.com>
Commit-Queue: Mirko Bonadei <mbonadei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807647}
parent 90f1cd34
...@@ -45,7 +45,14 @@ if ((is_linux && !is_chromeos) || is_mac || is_win || ...@@ -45,7 +45,14 @@ if ((is_linux && !is_chromeos) || is_mac || is_win ||
# use_raw_android_executable: Use executable() rather than android_apk(). # use_raw_android_executable: Use executable() rather than android_apk().
# use_native_activity: Test implements ANativeActivity_onCreate(). # use_native_activity: Test implements ANativeActivity_onCreate().
# win_test_enable_cfi_linker: (Win) Enable CFI linker for this test binary. # win_test_enable_cfi_linker: (Win) Enable CFI linker for this test binary.
# is_xctest: (iOS, optional) whether to build the executable as XCTest.
# Similar to the GN arg 'enable_run_ios_unittests_with_xctest' but
# for build targets.
template("test") { template("test") {
if (!is_ios) {
assert(!defined(invoker.is_xctest) || !invoker.is_xctest,
"is_xctest can be set only for iOS builds")
}
if (is_android) { if (is_android) {
assert(!defined(invoker.use_xvfb) || !invoker.use_xvfb) assert(!defined(invoker.use_xvfb) || !invoker.use_xvfb)
...@@ -293,7 +300,10 @@ template("test") { ...@@ -293,7 +300,10 @@ template("test") {
outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ] outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
} }
if (enable_run_ios_unittests_with_xctest) { force_xctest = enable_run_ios_unittests_with_xctest ||
(defined(invoker.is_xctest) && invoker.is_xctest)
if (force_xctest) {
ios_test_target_type = "ios_xctest_test" ios_test_target_type = "ios_xctest_test"
} else { } else {
ios_test_target_type = "ios_app_bundle" ios_test_target_type = "ios_app_bundle"
...@@ -302,7 +312,7 @@ template("test") { ...@@ -302,7 +312,7 @@ template("test") {
target(ios_test_target_type, _test_target) { target(ios_test_target_type, _test_target) {
testonly = true testonly = true
if (enable_run_ios_unittests_with_xctest && build_with_chromium) { if (force_xctest && build_with_chromium) {
xctest_module_target = "//base/test:google_test_runner" xctest_module_target = "//base/test:google_test_runner"
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment