OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "tools/gn/xcode_writer.h" | 5 #include "tools/gn/xcode_writer.h" |
6 | 6 |
7 #include <iomanip> | 7 #include <iomanip> |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 const std::string& source_path, | 397 const std::string& source_path, |
398 const std::string& config_name, | 398 const std::string& config_name, |
399 const std::string& root_target, | 399 const std::string& root_target, |
400 const std::string& ninja_extra_args, | 400 const std::string& ninja_extra_args, |
401 const BuildSettings* build_settings, | 401 const BuildSettings* build_settings, |
402 TargetOsType target_os) { | 402 TargetOsType target_os) { |
403 std::unique_ptr<PBXProject> main_project( | 403 std::unique_ptr<PBXProject> main_project( |
404 new PBXProject("products", config_name, source_path, attributes)); | 404 new PBXProject("products", config_name, source_path, attributes)); |
405 SourceDir source_dir("//"); | 405 SourceDir source_dir("//"); |
406 | 406 |
407 // Add all source files for indexing. | 407 // Add all source files for indexing, both private and public. |
408 std::vector<SourceFile> sources; | 408 std::vector<SourceFile> sources; |
409 for (const Target* target : all_targets) { | 409 for (const Target* target : all_targets) { |
410 for (const SourceFile& source : target->sources()) { | 410 for (const SourceFile& source : target->sources()) { |
411 if (IsStringInOutputDir(build_settings->build_dir(), source.value())) | 411 if (IsStringInOutputDir(build_settings->build_dir(), source.value())) |
412 continue; | 412 continue; |
413 | 413 |
414 sources.push_back(source); | 414 sources.push_back(source); |
415 } | 415 } |
| 416 |
| 417 if (target->all_headers_public()) |
| 418 continue; |
| 419 |
| 420 for (const SourceFile& source : target->public_headers()) { |
| 421 if (IsStringInOutputDir(build_settings->build_dir(), source.value())) |
| 422 continue; |
| 423 |
| 424 sources.push_back(source); |
| 425 } |
416 } | 426 } |
417 | 427 |
418 // Sort sources to ensure determinisn of the project file generation and | 428 // Sort sources to ensure determinisn of the project file generation and |
419 // remove duplicate reference to the source files (can happen due to the | 429 // remove duplicate reference to the source files (can happen due to the |
420 // bundle_data targets). | 430 // bundle_data targets). |
421 std::sort(sources.begin(), sources.end()); | 431 std::sort(sources.begin(), sources.end()); |
422 sources.erase(std::unique(sources.begin(), sources.end()), sources.end()); | 432 sources.erase(std::unique(sources.begin(), sources.end()), sources.end()); |
423 | 433 |
424 for (const SourceFile& source : sources) { | 434 for (const SourceFile& source : sources) { |
425 std::string source_file = RebasePath(source.value(), source_dir, | 435 std::string source_file = RebasePath(source.value(), source_dir, |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 for (auto* object : pair.second) { | 606 for (auto* object : pair.second) { |
597 object->Print(out, 2); | 607 object->Print(out, 2); |
598 } | 608 } |
599 out << "/* End " << ToString(pair.first) << " section */\n"; | 609 out << "/* End " << ToString(pair.first) << " section */\n"; |
600 } | 610 } |
601 | 611 |
602 out << "\t};\n" | 612 out << "\t};\n" |
603 << "\trootObject = " << project->Reference() << ";\n" | 613 << "\trootObject = " << project->Reference() << ";\n" |
604 << "}\n"; | 614 << "}\n"; |
605 } | 615 } |
OLD | NEW |