[Refactor Xcode Objects] Allow extra attributes for native targets.

This CL refactors xcode objects to allow specifying extra attributes for native
targets, which enables configuring the build settings.

BUG=614818

Review-Url: https://codereview.chromium.org/2591893002
Cr-Original-Commit-Position: refs/heads/master@{#440184}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 67e8c60e4b189e0fe6ca3e3699d0b6bed00a4e12
diff --git a/tools/gn/xcode_object.cc b/tools/gn/xcode_object.cc
index 4f1dcbe..eeae7e4 100644
--- a/tools/gn/xcode_object.cc
+++ b/tools/gn/xcode_object.cc
@@ -679,7 +679,8 @@
                                  const std::string& type,
                                  const std::string& output_name,
                                  const std::string& output_type,
-                                 const std::string& shell_script) {
+                                 const std::string& shell_script,
+                                 const PBXAttributes& extra_attributes) {
   base::StringPiece ext = FindExtension(&output_name);
   PBXFileReference* product = static_cast<PBXFileReference*>(
       products_->AddChild(base::MakeUnique<PBXFileReference>(
@@ -691,7 +692,7 @@
                                  ? output_name.substr(0, ext_offset - 1)
                                  : output_name;
 
-  PBXAttributes attributes;
+  PBXAttributes attributes = extra_attributes;
   attributes["CODE_SIGNING_REQUIRED"] = "NO";
   attributes["CONFIGURATION_BUILD_DIR"] = ".";
   attributes["PRODUCT_NAME"] = product_name;
diff --git a/tools/gn/xcode_object.h b/tools/gn/xcode_object.h
index 22be61e..3454e85 100644
--- a/tools/gn/xcode_object.h
+++ b/tools/gn/xcode_object.h
@@ -297,7 +297,8 @@
                        const std::string& type,
                        const std::string& output_name,
                        const std::string& output_type,
-                       const std::string& shell_script);
+                       const std::string& shell_script,
+                       const PBXAttributes& extra_attributes = PBXAttributes());
 
   void SetProjectDirPath(const std::string& project_dir_path);
   void SetProjectRoot(const std::string& project_root);