Commit 7e5894a9 authored by liaoyuke's avatar liaoyuke Committed by Commit bot

Configure xctest build settings to prevent Xcode from linking objects.

Test files need to be known to Xcode for proper indexing and for discovery of
tests function for XCTest, but the compilation is done via ninja, which causes
Xcode fail find object files when trying to link.

This CL configures the build settings of XCTest targets to trick Xcode to
blindly return success when trying to link object files.

BUG=614818

Review-Url: https://codereview.chromium.org/2594033002
Cr-Commit-Position: refs/heads/master@{#441500}
parent 787a1e7a
......@@ -432,10 +432,21 @@ void XcodeWriter::CreateProductsProject(
env.get()));
break;
case Target::CREATE_BUNDLE:
case Target::CREATE_BUNDLE: {
if (target->bundle_data().product_type().empty())
continue;
// Test files need to be known to Xcode for proper indexing and for
// discovery of tests function for XCTest, but the compilation is done
// via ninja and thus must prevent Xcode from linking object files via
// this hack.
PBXAttributes extra_attributes;
if (IsXCTestModuleTarget(target)) {
extra_attributes["OTHER_LDFLAGS"] = "-help";
extra_attributes["ONLY_ACTIVE_ARCH"] = "YES";
extra_attributes["DEBUG_INFORMATION_FORMAT"] = "dwarf";
}
main_project->AddNativeTarget(
target->label().name(), std::string(),
RebasePath(target->bundle_data()
......@@ -443,9 +454,10 @@ void XcodeWriter::CreateProductsProject(
.value(),
build_settings->build_dir()),
target->bundle_data().product_type(),
GetBuildScript(target->label().name(), ninja_extra_args,
env.get()));
GetBuildScript(target->label().name(), ninja_extra_args, env.get()),
extra_attributes);
break;
}
default:
break;
......
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