[iOS XCUITest] Link XCUITest targets with host application target.
This CL links XCUITest target with the host application target by
specifying the relationship via the TEST_TARGET_NAME attribute and
adding the application target as a dependency target in the generated
Xcode project.
Bug: 709289
Change-Id: I24c5c6b2da849c9279bc95dec0f499f4c07e0e53
Reviewed-on: https://chromium-review.googlesource.com/564078
Commit-Queue: Yuke Liao <liaoyuke@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#495195}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 2a757db179b70f03920f6441f96ecebc50949eaf
diff --git a/tools/gn/xcode_writer.cc b/tools/gn/xcode_writer.cc
index 73924d9..78c41d9 100644
--- a/tools/gn/xcode_writer.cc
+++ b/tools/gn/xcode_writer.cc
@@ -158,14 +158,14 @@
dependent_pbxtarget->AddDependency(std::move(dependency));
}
-// Adds the corresponding test rig application target as dependency of xctest
-// module target in the generated Xcode project.
-void AddDependencyTargetForXCModuleTargets(
+// Adds the corresponding test application target as dependency of xctest or
+// xcuitest module target in the generated Xcode project.
+void AddDependencyTargetForTestModuleTargets(
const std::vector<const Target*>& targets,
const TargetToPBXTarget& bundle_target_to_pbxtarget,
const PBXProject* project) {
for (const Target* target : targets) {
- if (!IsXCTestModuleTarget(target))
+ if (!IsXCTestModuleTarget(target) && !IsXCUITestModuleTarget(target))
continue;
const Target* test_application_target = FindApplicationTargetByName(
@@ -560,11 +560,10 @@
}
}
- // For XCTest, tests are compiled into the application bundle, thus adding
- // the corresponding test rig application target as a dependency of xctest
- // module target in the generated Xcode project so that the application target
- // is re-compiled when compiling the xctest module target.
- AddDependencyTargetForXCModuleTargets(
+ // Adding the corresponding test application target as a dependency of xctest
+ // or xcuitest module target in the generated Xcode project so that the
+ // application target is re-compiled when compiling the test module target.
+ AddDependencyTargetForTestModuleTargets(
bundle_targets, bundle_target_to_pbxtarget, main_project.get());
projects_.push_back(std::move(main_project));