Skip to content

Commit

Permalink
Include "public" source files in generated Xcode project.
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
sdefresne authored and Commit bot committed Mar 13, 2017
1 parent a328b46 commit 5d93a97
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tools/gn/xcode_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<SourceFile> sources;
for (const Target* target : all_targets) {
for (const SourceFile& source : target->sources()) {
Expand All @@ -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
Expand Down

0 comments on commit 5d93a97

Please sign in to comment.