From 5d93a97915ac8492667e3fbedfc26f606e1d1099 Mon Sep 17 00:00:00 2001 From: sdefresne Date: Mon, 13 Mar 2017 01:47:07 -0700 Subject: [PATCH] Include "public" source files in generated Xcode project. Targets can restrict the list of public headers by using "public" property in addition to "sources". Include them in the generated Xcode project as any other source file. BUG=None Review-Url: https://codereview.chromium.org/2740123003 Cr-Commit-Position: refs/heads/master@{#456339} --- tools/gn/xcode_writer.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/gn/xcode_writer.cc b/tools/gn/xcode_writer.cc index 41af6289bd6010..8b96db49cbbfd2 100644 --- a/tools/gn/xcode_writer.cc +++ b/tools/gn/xcode_writer.cc @@ -404,7 +404,7 @@ void XcodeWriter::CreateProductsProject( new PBXProject("products", config_name, source_path, attributes)); SourceDir source_dir("//"); - // Add all source files for indexing. + // Add all source files for indexing, both private and public. std::vector sources; for (const Target* target : all_targets) { for (const SourceFile& source : target->sources()) { @@ -413,6 +413,16 @@ void XcodeWriter::CreateProductsProject( sources.push_back(source); } + + if (target->all_headers_public()) + continue; + + for (const SourceFile& source : target->public_headers()) { + if (IsStringInOutputDir(build_settings->build_dir(), source.value())) + continue; + + sources.push_back(source); + } } // Sort sources to ensure determinisn of the project file generation and