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

Side by Side Diff: tools/gn/xcode_object.cc

Issue 2591893002: [Refactor Xcode Objects] Allow extra attributes for native targets. (Closed)
Patch Set: Addressed feedback Created 3 years, 12 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 unified diff | Download patch
« no previous file with comments | « tools/gn/xcode_object.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 targets_.push_back(base::MakeUnique<PBXNativeTarget>( 660 targets_.push_back(base::MakeUnique<PBXNativeTarget>(
661 name_, std::string(), config_name_, attributes, product_type, name_, 661 name_, std::string(), config_name_, attributes, product_type, name_,
662 product_reference)); 662 product_reference));
663 target_for_indexing_ = static_cast<PBXNativeTarget*>(targets_.back().get()); 663 target_for_indexing_ = static_cast<PBXNativeTarget*>(targets_.back().get());
664 } 664 }
665 665
666 void PBXProject::AddNativeTarget(const std::string& name, 666 void PBXProject::AddNativeTarget(const std::string& name,
667 const std::string& type, 667 const std::string& type,
668 const std::string& output_name, 668 const std::string& output_name,
669 const std::string& output_type, 669 const std::string& output_type,
670 const std::string& shell_script) { 670 const std::string& shell_script,
671 const PBXAttributes& extra_attributes) {
671 base::StringPiece ext = FindExtension(&output_name); 672 base::StringPiece ext = FindExtension(&output_name);
672 PBXFileReference* product = static_cast<PBXFileReference*>( 673 PBXFileReference* product = static_cast<PBXFileReference*>(
673 products_->AddChild(base::MakeUnique<PBXFileReference>( 674 products_->AddChild(base::MakeUnique<PBXFileReference>(
674 std::string(), output_name, 675 std::string(), output_name,
675 type.empty() ? GetSourceType(ext) : type))); 676 type.empty() ? GetSourceType(ext) : type)));
676 677
677 size_t ext_offset = FindExtensionOffset(output_name); 678 size_t ext_offset = FindExtensionOffset(output_name);
678 std::string product_name = ext_offset != std::string::npos 679 std::string product_name = ext_offset != std::string::npos
679 ? output_name.substr(0, ext_offset - 1) 680 ? output_name.substr(0, ext_offset - 1)
680 : output_name; 681 : output_name;
681 682
682 PBXAttributes attributes; 683 PBXAttributes attributes = extra_attributes;
683 attributes["CODE_SIGNING_REQUIRED"] = "NO"; 684 attributes["CODE_SIGNING_REQUIRED"] = "NO";
684 attributes["CONFIGURATION_BUILD_DIR"] = "."; 685 attributes["CONFIGURATION_BUILD_DIR"] = ".";
685 attributes["PRODUCT_NAME"] = product_name; 686 attributes["PRODUCT_NAME"] = product_name;
686 687
687 targets_.push_back(base::MakeUnique<PBXNativeTarget>( 688 targets_.push_back(base::MakeUnique<PBXNativeTarget>(
688 name, shell_script, config_name_, attributes, output_type, product_name, 689 name, shell_script, config_name_, attributes, output_type, product_name,
689 product)); 690 product));
690 } 691 }
691 692
692 void PBXProject::SetProjectDirPath(const std::string& project_dir_path) { 693 void PBXProject::SetProjectDirPath(const std::string& project_dir_path) {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 const std::string indent_str(indent, '\t'); 878 const std::string indent_str(indent, '\t');
878 const IndentRules rules = {false, indent + 1}; 879 const IndentRules rules = {false, indent + 1};
879 out << indent_str << Reference() << " = {\n"; 880 out << indent_str << Reference() << " = {\n";
880 PrintProperty(out, rules, "isa", ToString(Class())); 881 PrintProperty(out, rules, "isa", ToString(Class()));
881 PrintProperty(out, rules, "buildConfigurations", configurations_); 882 PrintProperty(out, rules, "buildConfigurations", configurations_);
882 PrintProperty(out, rules, "defaultConfigurationIsVisible", 1u); 883 PrintProperty(out, rules, "defaultConfigurationIsVisible", 1u);
883 PrintProperty(out, rules, "defaultConfigurationName", 884 PrintProperty(out, rules, "defaultConfigurationName",
884 configurations_[0]->Name()); 885 configurations_[0]->Name());
885 out << indent_str << "};\n"; 886 out << indent_str << "};\n";
886 } 887 }
OLDNEW
« no previous file with comments | « tools/gn/xcode_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698