Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: tools/gn/xcode_writer.cc

Issue 2594033002: Configure xctest build settings to prevent Xcode from linking objects. (Closed)
Patch Set: Rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698