| 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_object.h" | 5 #include "tools/gn/xcode_object.h" |
| 6 | 6 |
| 7 #include <iomanip> | 7 #include <iomanip> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/files/file_path.h" | |
| 12 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/macros.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "tools/gn/filesystem_utils.h" |
| 15 | 16 |
| 16 // Helper methods ------------------------------------------------------------- | 17 // Helper methods ------------------------------------------------------------- |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 struct IndentRules { | 20 struct IndentRules { |
| 20 bool one_line; | 21 bool one_line; |
| 21 unsigned level; | 22 unsigned level; |
| 22 }; | 23 }; |
| 23 | 24 |
| 24 std::vector<std::unique_ptr<PBXObject>> EmptyPBXObjectVector() { | 25 std::vector<std::unique_ptr<PBXObject>> EmptyPBXObjectVector() { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } else { | 83 } else { |
| 83 if (c == '"' || c == '\\') | 84 if (c == '"' || c == '\\') |
| 84 buffer << '\\'; | 85 buffer << '\\'; |
| 85 buffer << c; | 86 buffer << c; |
| 86 } | 87 } |
| 87 } | 88 } |
| 88 buffer << '"'; | 89 buffer << '"'; |
| 89 return buffer.str(); | 90 return buffer.str(); |
| 90 } | 91 } |
| 91 | 92 |
| 92 const char* GetSourceType(const base::FilePath::StringType& ext) { | 93 struct SourceTypeForExt { |
| 93 std::map<base::FilePath::StringType, const char*> extension_map = { | 94 const char* ext; |
| 94 {FILE_PATH_LITERAL(".a"), "archive.ar"}, | 95 const char* source_type; |
| 95 {FILE_PATH_LITERAL(".app"), "wrapper.application"}, | 96 }; |
| 96 {FILE_PATH_LITERAL(".bdic"), "file"}, | |
| 97 {FILE_PATH_LITERAL(".bundle"), "wrapper.cfbundle"}, | |
| 98 {FILE_PATH_LITERAL(".c"), "sourcecode.c.c"}, | |
| 99 {FILE_PATH_LITERAL(".cc"), "sourcecode.cpp.cpp"}, | |
| 100 {FILE_PATH_LITERAL(".cpp"), "sourcecode.cpp.cpp"}, | |
| 101 {FILE_PATH_LITERAL(".css"), "text.css"}, | |
| 102 {FILE_PATH_LITERAL(".cxx"), "sourcecode.cpp.cpp"}, | |
| 103 {FILE_PATH_LITERAL(".dart"), "sourcecode"}, | |
| 104 {FILE_PATH_LITERAL(".dylib"), "compiled.mach-o.dylib"}, | |
| 105 {FILE_PATH_LITERAL(".framework"), "wrapper.framework"}, | |
| 106 {FILE_PATH_LITERAL(".h"), "sourcecode.c.h"}, | |
| 107 {FILE_PATH_LITERAL(".hxx"), "sourcecode.cpp.h"}, | |
| 108 {FILE_PATH_LITERAL(".icns"), "image.icns"}, | |
| 109 {FILE_PATH_LITERAL(".java"), "sourcecode.java"}, | |
| 110 {FILE_PATH_LITERAL(".js"), "sourcecode.javascript"}, | |
| 111 {FILE_PATH_LITERAL(".kext"), "wrapper.kext"}, | |
| 112 {FILE_PATH_LITERAL(".m"), "sourcecode.c.objc"}, | |
| 113 {FILE_PATH_LITERAL(".mm"), "sourcecode.cpp.objcpp"}, | |
| 114 {FILE_PATH_LITERAL(".nib"), "wrapper.nib"}, | |
| 115 {FILE_PATH_LITERAL(".o"), "compiled.mach-o.objfile"}, | |
| 116 {FILE_PATH_LITERAL(".pdf"), "image.pdf"}, | |
| 117 {FILE_PATH_LITERAL(".pl"), "text.script.perl"}, | |
| 118 {FILE_PATH_LITERAL(".plist"), "text.plist.xml"}, | |
| 119 {FILE_PATH_LITERAL(".pm"), "text.script.perl"}, | |
| 120 {FILE_PATH_LITERAL(".png"), "image.png"}, | |
| 121 {FILE_PATH_LITERAL(".py"), "text.script.python"}, | |
| 122 {FILE_PATH_LITERAL(".r"), "sourcecode.rez"}, | |
| 123 {FILE_PATH_LITERAL(".rez"), "sourcecode.rez"}, | |
| 124 {FILE_PATH_LITERAL(".s"), "sourcecode.asm"}, | |
| 125 {FILE_PATH_LITERAL(".storyboard"), "file.storyboard"}, | |
| 126 {FILE_PATH_LITERAL(".strings"), "text.plist.strings"}, | |
| 127 {FILE_PATH_LITERAL(".swift"), "sourcecode.swift"}, | |
| 128 {FILE_PATH_LITERAL(".ttf"), "file"}, | |
| 129 {FILE_PATH_LITERAL(".xcassets"), "folder.assetcatalog"}, | |
| 130 {FILE_PATH_LITERAL(".xcconfig"), "text.xcconfig"}, | |
| 131 {FILE_PATH_LITERAL(".xcdatamodel"), "wrapper.xcdatamodel"}, | |
| 132 {FILE_PATH_LITERAL(".xcdatamodeld"), "wrapper.xcdatamodeld"}, | |
| 133 {FILE_PATH_LITERAL(".xib"), "file.xib"}, | |
| 134 {FILE_PATH_LITERAL(".y"), "sourcecode.yacc"}, | |
| 135 }; | |
| 136 | 97 |
| 137 const auto& iter = extension_map.find(ext); | 98 const SourceTypeForExt kSourceTypeForExt[] = { |
| 138 if (iter != extension_map.end()) { | 99 {".a", "archive.ar"}, |
| 139 return iter->second; | 100 {".app", "wrapper.application"}, |
| 101 {".bdic", "file"}, |
| 102 {".bundle", "wrapper.cfbundle"}, |
| 103 {".c", "sourcecode.c.c"}, |
| 104 {".cc", "sourcecode.cpp.cpp"}, |
| 105 {".cpp", "sourcecode.cpp.cpp"}, |
| 106 {".css", "text.css"}, |
| 107 {".cxx", "sourcecode.cpp.cpp"}, |
| 108 {".dart", "sourcecode"}, |
| 109 {".dylib", "compiled.mach-o.dylib"}, |
| 110 {".framework", "wrapper.framework"}, |
| 111 {".h", "sourcecode.c.h"}, |
| 112 {".hxx", "sourcecode.cpp.h"}, |
| 113 {".icns", "image.icns"}, |
| 114 {".java", "sourcecode.java"}, |
| 115 {".js", "sourcecode.javascript"}, |
| 116 {".kext", "wrapper.kext"}, |
| 117 {".m", "sourcecode.c.objc"}, |
| 118 {".mm", "sourcecode.cpp.objcpp"}, |
| 119 {".nib", "wrapper.nib"}, |
| 120 {".o", "compiled.mach-o.objfile"}, |
| 121 {".pdf", "image.pdf"}, |
| 122 {".pl", "text.script.perl"}, |
| 123 {".plist", "text.plist.xml"}, |
| 124 {".pm", "text.script.perl"}, |
| 125 {".png", "image.png"}, |
| 126 {".py", "text.script.python"}, |
| 127 {".r", "sourcecode.rez"}, |
| 128 {".rez", "sourcecode.rez"}, |
| 129 {".s", "sourcecode.asm"}, |
| 130 {".storyboard", "file.storyboard"}, |
| 131 {".strings", "text.plist.strings"}, |
| 132 {".swift", "sourcecode.swift"}, |
| 133 {".ttf", "file"}, |
| 134 {".xcassets", "folder.assetcatalog"}, |
| 135 {".xcconfig", "text.xcconfig"}, |
| 136 {".xcdatamodel", "wrapper.xcdatamodel"}, |
| 137 {".xcdatamodeld", "wrapper.xcdatamodeld"}, |
| 138 {".xib", "file.xib"}, |
| 139 {".y", "sourcecode.yacc"}, |
| 140 }; |
| 141 |
| 142 const char* GetSourceType(const base::StringPiece& ext) { |
| 143 for (size_t i = 0; i < arraysize(kSourceTypeForExt); ++i) { |
| 144 if (kSourceTypeForExt[i].ext == ext) |
| 145 return kSourceTypeForExt[i].source_type; |
| 140 } | 146 } |
| 141 | 147 |
| 142 return "text"; | 148 return "text"; |
| 143 } | 149 } |
| 144 | 150 |
| 145 bool HasExplicitFileType(const base::FilePath::StringType& ext) { | 151 bool HasExplicitFileType(const base::StringPiece& ext) { |
| 146 return ext == FILE_PATH_LITERAL(".dart"); | 152 return ext == ".dart"; |
| 147 } | 153 } |
| 148 | 154 |
| 149 bool IsSourceFileForIndexing(const base::FilePath::StringType& ext) { | 155 bool IsSourceFileForIndexing(const base::StringPiece& ext) { |
| 150 return ext == FILE_PATH_LITERAL(".c") || ext == FILE_PATH_LITERAL(".cc") || | 156 return ext == ".c" || ext == ".cc" || ext == ".cpp" || ext == ".cxx" || |
| 151 ext == FILE_PATH_LITERAL(".cpp") || ext == FILE_PATH_LITERAL(".cxx") || | 157 ext == ".m" || ext == ".mm"; |
| 152 ext == FILE_PATH_LITERAL(".m") || ext == FILE_PATH_LITERAL(".mm"); | |
| 153 } | 158 } |
| 154 | 159 |
| 155 void PrintValue(std::ostream& out, IndentRules rules, unsigned value) { | 160 void PrintValue(std::ostream& out, IndentRules rules, unsigned value) { |
| 156 out << value; | 161 out << value; |
| 157 } | 162 } |
| 158 | 163 |
| 159 void PrintValue(std::ostream& out, IndentRules rules, const char* value) { | 164 void PrintValue(std::ostream& out, IndentRules rules, const char* value) { |
| 160 out << EncodeString(value); | 165 out << EncodeString(value); |
| 161 } | 166 } |
| 162 | 167 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 void PBXFileReference::Print(std::ostream& out, unsigned indent) const { | 409 void PBXFileReference::Print(std::ostream& out, unsigned indent) const { |
| 405 const std::string indent_str(indent, '\t'); | 410 const std::string indent_str(indent, '\t'); |
| 406 const IndentRules rules = {true, 0}; | 411 const IndentRules rules = {true, 0}; |
| 407 out << indent_str << Reference() << " = {"; | 412 out << indent_str << Reference() << " = {"; |
| 408 PrintProperty(out, rules, "isa", ToString(Class())); | 413 PrintProperty(out, rules, "isa", ToString(Class())); |
| 409 | 414 |
| 410 if (!type_.empty()) { | 415 if (!type_.empty()) { |
| 411 PrintProperty(out, rules, "explicitFileType", type_); | 416 PrintProperty(out, rules, "explicitFileType", type_); |
| 412 PrintProperty(out, rules, "includeInIndex", 0u); | 417 PrintProperty(out, rules, "includeInIndex", 0u); |
| 413 } else { | 418 } else { |
| 414 const base::FilePath::StringType ext = | 419 base::StringPiece ext = FindExtension(&path_); |
| 415 base::FilePath::FromUTF8Unsafe(path_).Extension(); | |
| 416 | |
| 417 if (HasExplicitFileType(ext)) | 420 if (HasExplicitFileType(ext)) |
| 418 PrintProperty(out, rules, "explicitFileType", GetSourceType(ext)); | 421 PrintProperty(out, rules, "explicitFileType", GetSourceType(ext)); |
| 419 else | 422 else |
| 420 PrintProperty(out, rules, "lastKnownFileType", GetSourceType(ext)); | 423 PrintProperty(out, rules, "lastKnownFileType", GetSourceType(ext)); |
| 421 } | 424 } |
| 422 | 425 |
| 423 if (name_ != path_ && !name_.empty()) | 426 if (name_ != path_ && !name_.empty()) |
| 424 PrintProperty(out, rules, "name", name_); | 427 PrintProperty(out, rules, "name", name_); |
| 425 | 428 |
| 426 PrintProperty(out, rules, "path", path_); | 429 PrintProperty(out, rules, "path", path_); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 out << indent_str << "};\n"; | 535 out << indent_str << "};\n"; |
| 533 } | 536 } |
| 534 | 537 |
| 535 // PBXNativeTarget ------------------------------------------------------------ | 538 // PBXNativeTarget ------------------------------------------------------------ |
| 536 | 539 |
| 537 PBXNativeTarget::PBXNativeTarget(const std::string& name, | 540 PBXNativeTarget::PBXNativeTarget(const std::string& name, |
| 538 const std::string& shell_script, | 541 const std::string& shell_script, |
| 539 const std::string& config_name, | 542 const std::string& config_name, |
| 540 const PBXAttributes& attributes, | 543 const PBXAttributes& attributes, |
| 541 const std::string& product_type, | 544 const std::string& product_type, |
| 545 const std::string& product_name, |
| 542 const PBXFileReference* product_reference) | 546 const PBXFileReference* product_reference) |
| 543 : PBXTarget(name, shell_script, config_name, attributes), | 547 : PBXTarget(name, shell_script, config_name, attributes), |
| 544 product_reference_(product_reference), | 548 product_reference_(product_reference), |
| 545 product_type_(product_type) { | 549 product_type_(product_type), |
| 550 product_name_(product_name) { |
| 546 DCHECK(product_reference_); | 551 DCHECK(product_reference_); |
| 547 build_phases_.push_back(base::WrapUnique(new PBXSourcesBuildPhase)); | 552 build_phases_.push_back(base::WrapUnique(new PBXSourcesBuildPhase)); |
| 548 source_build_phase_ = | 553 source_build_phase_ = |
| 549 static_cast<PBXSourcesBuildPhase*>(build_phases_.back().get()); | 554 static_cast<PBXSourcesBuildPhase*>(build_phases_.back().get()); |
| 550 | 555 |
| 551 build_phases_.push_back(base::WrapUnique(new PBXFrameworksBuildPhase)); | 556 build_phases_.push_back(base::WrapUnique(new PBXFrameworksBuildPhase)); |
| 552 } | 557 } |
| 553 | 558 |
| 554 PBXNativeTarget::~PBXNativeTarget() {} | 559 PBXNativeTarget::~PBXNativeTarget() {} |
| 555 | 560 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 567 void PBXNativeTarget::Print(std::ostream& out, unsigned indent) const { | 572 void PBXNativeTarget::Print(std::ostream& out, unsigned indent) const { |
| 568 const std::string indent_str(indent, '\t'); | 573 const std::string indent_str(indent, '\t'); |
| 569 const IndentRules rules = {false, indent + 1}; | 574 const IndentRules rules = {false, indent + 1}; |
| 570 out << indent_str << Reference() << " = {\n"; | 575 out << indent_str << Reference() << " = {\n"; |
| 571 PrintProperty(out, rules, "isa", ToString(Class())); | 576 PrintProperty(out, rules, "isa", ToString(Class())); |
| 572 PrintProperty(out, rules, "buildConfigurationList", configurations_); | 577 PrintProperty(out, rules, "buildConfigurationList", configurations_); |
| 573 PrintProperty(out, rules, "buildPhases", build_phases_); | 578 PrintProperty(out, rules, "buildPhases", build_phases_); |
| 574 PrintProperty(out, rules, "buildRules", EmptyPBXObjectVector()); | 579 PrintProperty(out, rules, "buildRules", EmptyPBXObjectVector()); |
| 575 PrintProperty(out, rules, "dependencies", EmptyPBXObjectVector()); | 580 PrintProperty(out, rules, "dependencies", EmptyPBXObjectVector()); |
| 576 PrintProperty(out, rules, "name", name_); | 581 PrintProperty(out, rules, "name", name_); |
| 577 PrintProperty(out, rules, "productName", name_); | 582 PrintProperty(out, rules, "productName", product_name_); |
| 578 PrintProperty(out, rules, "productReference", product_reference_); | 583 PrintProperty(out, rules, "productReference", product_reference_); |
| 579 PrintProperty(out, rules, "productType", product_type_); | 584 PrintProperty(out, rules, "productType", product_type_); |
| 580 out << indent_str << "};\n"; | 585 out << indent_str << "};\n"; |
| 581 } | 586 } |
| 582 | 587 |
| 583 // PBXProject ----------------------------------------------------------------- | 588 // PBXProject ----------------------------------------------------------------- |
| 584 | 589 |
| 585 PBXProject::PBXProject(const std::string& name, | 590 PBXProject::PBXProject(const std::string& name, |
| 586 const std::string& config_name, | 591 const std::string& config_name, |
| 587 const std::string& source_path, | 592 const std::string& source_path, |
| 588 const PBXAttributes& attributes) | 593 const PBXAttributes& attributes) |
| 589 : name_(name), config_name_(config_name), target_for_indexing_(nullptr) { | 594 : name_(name), config_name_(config_name), target_for_indexing_(nullptr) { |
| 590 attributes_["BuildIndependentTargetsInParallel"] = "YES"; | 595 attributes_["BuildIndependentTargetsInParallel"] = "YES"; |
| 591 | 596 |
| 592 main_group_.reset(new PBXGroup); | 597 main_group_.reset(new PBXGroup); |
| 593 sources_ = static_cast<PBXGroup*>(main_group_->AddChild( | 598 sources_ = static_cast<PBXGroup*>(main_group_->AddChild( |
| 594 base::WrapUnique(new PBXGroup(source_path, "Source")))); | 599 base::WrapUnique(new PBXGroup(source_path, "Source")))); |
| 595 products_ = static_cast<PBXGroup*>(main_group_->AddChild( | 600 products_ = static_cast<PBXGroup*>(main_group_->AddChild( |
| 596 base::WrapUnique(new PBXGroup(std::string(), "Product")))); | 601 base::WrapUnique(new PBXGroup(std::string(), "Product")))); |
| 597 main_group_->AddChild(base::WrapUnique(new PBXGroup(std::string(), "Build"))); | 602 main_group_->AddChild(base::WrapUnique(new PBXGroup(std::string(), "Build"))); |
| 598 | 603 |
| 599 configurations_.reset(new XCConfigurationList(config_name, attributes, this)); | 604 configurations_.reset(new XCConfigurationList(config_name, attributes, this)); |
| 600 } | 605 } |
| 601 | 606 |
| 602 PBXProject::~PBXProject() {} | 607 PBXProject::~PBXProject() {} |
| 603 | 608 |
| 604 void PBXProject::AddSourceFile(const std::string& source_path) { | 609 void PBXProject::AddSourceFile(const std::string& source_path) { |
| 605 PBXFileReference* file_reference = sources_->AddSourceFile(source_path); | 610 PBXFileReference* file_reference = sources_->AddSourceFile(source_path); |
| 606 const base::FilePath::StringType ext = | 611 base::StringPiece ext = FindExtension(&source_path); |
| 607 base::FilePath::FromUTF8Unsafe(source_path).Extension(); | |
| 608 if (!IsSourceFileForIndexing(ext)) | 612 if (!IsSourceFileForIndexing(ext)) |
| 609 return; | 613 return; |
| 610 | 614 |
| 611 if (!target_for_indexing_) { | 615 if (!target_for_indexing_) { |
| 612 PBXAttributes attributes; | 616 PBXAttributes attributes; |
| 613 attributes["EXECUTABLE_PREFIX"] = ""; | 617 attributes["EXECUTABLE_PREFIX"] = ""; |
| 614 attributes["HEADER_SEARCH_PATHS"] = sources_->path(); | 618 attributes["HEADER_SEARCH_PATHS"] = sources_->path(); |
| 615 attributes["PRODUCT_NAME"] = name_; | 619 attributes["PRODUCT_NAME"] = name_; |
| 616 | 620 |
| 617 PBXFileReference* product_reference = static_cast<PBXFileReference*>( | 621 PBXFileReference* product_reference = static_cast<PBXFileReference*>( |
| 618 products_->AddChild(base::WrapUnique(new PBXFileReference( | 622 products_->AddChild(base::WrapUnique(new PBXFileReference( |
| 619 std::string(), name_, "compiled.mach-o.executable")))); | 623 std::string(), name_, "compiled.mach-o.executable")))); |
| 620 | 624 |
| 621 const char product_type[] = "com.apple.product-type.tool"; | 625 const char product_type[] = "com.apple.product-type.tool"; |
| 622 targets_.push_back(base::WrapUnique( | 626 targets_.push_back(base::WrapUnique( |
| 623 new PBXNativeTarget(name_, std::string(), config_name_, attributes, | 627 new PBXNativeTarget(name_, std::string(), config_name_, attributes, |
| 624 product_type, product_reference))); | 628 product_type, name_, product_reference))); |
| 625 target_for_indexing_ = static_cast<PBXNativeTarget*>(targets_.back().get()); | 629 target_for_indexing_ = static_cast<PBXNativeTarget*>(targets_.back().get()); |
| 626 } | 630 } |
| 627 | 631 |
| 628 DCHECK(target_for_indexing_); | 632 DCHECK(target_for_indexing_); |
| 629 target_for_indexing_->AddFileForIndexing(file_reference); | 633 target_for_indexing_->AddFileForIndexing(file_reference); |
| 630 } | 634 } |
| 631 | 635 |
| 632 void PBXProject::AddAggregateTarget(const std::string& name, | 636 void PBXProject::AddAggregateTarget(const std::string& name, |
| 633 const std::string& shell_script) { | 637 const std::string& shell_script) { |
| 634 PBXAttributes attributes; | 638 PBXAttributes attributes; |
| 635 attributes["CODE_SIGNING_REQUIRED"] = "NO"; | 639 attributes["CODE_SIGNING_REQUIRED"] = "NO"; |
| 636 attributes["CONFIGURATION_BUILD_DIR"] = "."; | 640 attributes["CONFIGURATION_BUILD_DIR"] = "."; |
| 637 attributes["PRODUCT_NAME"] = name; | 641 attributes["PRODUCT_NAME"] = name; |
| 638 | 642 |
| 639 targets_.push_back(base::WrapUnique( | 643 targets_.push_back(base::WrapUnique( |
| 640 new PBXAggregateTarget(name, shell_script, config_name_, attributes))); | 644 new PBXAggregateTarget(name, shell_script, config_name_, attributes))); |
| 641 } | 645 } |
| 642 | 646 |
| 643 void PBXProject::AddNativeTarget(const std::string& name, | 647 void PBXProject::AddNativeTarget(const std::string& name, |
| 644 const std::string& type, | 648 const std::string& type, |
| 645 const std::string& output_name, | 649 const std::string& output_name, |
| 646 const std::string& output_type, | 650 const std::string& output_type, |
| 647 const std::string& shell_script) { | 651 const std::string& shell_script) { |
| 648 const base::FilePath::StringType ext = | 652 base::StringPiece ext = FindExtension(&output_name); |
| 649 base::FilePath::FromUTF8Unsafe(output_name).Extension(); | 653 PBXFileReference* product = |
| 654 static_cast<PBXFileReference*>(products_->AddChild(base::WrapUnique( |
| 655 new PBXFileReference(std::string(), output_name, |
| 656 type.empty() ? GetSourceType(ext) : type)))); |
| 650 | 657 |
| 651 PBXFileReference* product = static_cast<PBXFileReference*>( | 658 size_t ext_offset = FindExtensionOffset(output_name); |
| 652 products_->AddChild(base::WrapUnique(new PBXFileReference( | 659 std::string product_name = ext_offset != std::string::npos |
| 653 name, output_name, type.empty() ? GetSourceType(ext) : type)))); | 660 ? output_name.substr(0, ext_offset - 1) |
| 661 : output_name; |
| 654 | 662 |
| 655 PBXAttributes attributes; | 663 PBXAttributes attributes; |
| 656 attributes["CODE_SIGNING_REQUIRED"] = "NO"; | 664 attributes["CODE_SIGNING_REQUIRED"] = "NO"; |
| 657 attributes["CONFIGURATION_BUILD_DIR"] = "."; | 665 attributes["CONFIGURATION_BUILD_DIR"] = "."; |
| 658 attributes["PRODUCT_NAME"] = name; | 666 attributes["PRODUCT_NAME"] = product_name; |
| 659 | 667 |
| 660 targets_.push_back(base::WrapUnique(new PBXNativeTarget( | 668 targets_.push_back(base::WrapUnique( |
| 661 name, shell_script, config_name_, attributes, output_type, product))); | 669 new PBXNativeTarget(name, shell_script, config_name_, attributes, |
| 670 output_type, product_name, product))); |
| 662 } | 671 } |
| 663 | 672 |
| 664 void PBXProject::SetProjectDirPath(const std::string& project_dir_path) { | 673 void PBXProject::SetProjectDirPath(const std::string& project_dir_path) { |
| 665 DCHECK(!project_dir_path.empty()); | 674 DCHECK(!project_dir_path.empty()); |
| 666 project_dir_path_.assign(project_dir_path); | 675 project_dir_path_.assign(project_dir_path); |
| 667 } | 676 } |
| 668 | 677 |
| 669 void PBXProject::SetProjectRoot(const std::string& project_root) { | 678 void PBXProject::SetProjectRoot(const std::string& project_root) { |
| 670 DCHECK(!project_root.empty()); | 679 DCHECK(!project_root.empty()); |
| 671 project_root_.assign(project_root); | 680 project_root_.assign(project_root); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 const std::string indent_str(indent, '\t'); | 858 const std::string indent_str(indent, '\t'); |
| 850 const IndentRules rules = {false, indent + 1}; | 859 const IndentRules rules = {false, indent + 1}; |
| 851 out << indent_str << Reference() << " = {\n"; | 860 out << indent_str << Reference() << " = {\n"; |
| 852 PrintProperty(out, rules, "isa", ToString(Class())); | 861 PrintProperty(out, rules, "isa", ToString(Class())); |
| 853 PrintProperty(out, rules, "buildConfigurations", configurations_); | 862 PrintProperty(out, rules, "buildConfigurations", configurations_); |
| 854 PrintProperty(out, rules, "defaultConfigurationIsVisible", 1u); | 863 PrintProperty(out, rules, "defaultConfigurationIsVisible", 1u); |
| 855 PrintProperty(out, rules, "defaultConfigurationName", | 864 PrintProperty(out, rules, "defaultConfigurationName", |
| 856 configurations_[0]->Name()); | 865 configurations_[0]->Name()); |
| 857 out << indent_str << "};\n"; | 866 out << indent_str << "};\n"; |
| 858 } | 867 } |
| OLD | NEW |