| Index: tools/gn/xcode_writer.cc
|
| diff --git a/tools/gn/xcode_writer.cc b/tools/gn/xcode_writer.cc
|
| index ffdbf5782d5b5739f6a603aefd46d61b0df4a5f0..5030b5abbb4e9f6947f0d7e708b174cc83c709da 100644
|
| --- a/tools/gn/xcode_writer.cc
|
| +++ b/tools/gn/xcode_writer.cc
|
| @@ -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;
|
|
|