Set expected values by Xcode 11.4

If those values are not set, Xcode 11.4 consider the project as
requiring updating and it displays a warning to the user.

It can confuse developers experienced with having Xcode the source
of truth (i.e. experienced iOS developers but new to Chrome). As
the values are not used in anyway, set them so that Xcode does not
display a warning to developers.

Bug: chromium/1071055
Change-Id: Ia349daf6f6913e63990902ef87b92a6d6057c53b
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/8085
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: Brett Wilson <brettw@chromium.org>
diff --git a/src/gn/xcode_object.cc b/src/gn/xcode_object.cc
index de00523..de2975c 100644
--- a/src/gn/xcode_object.cc
+++ b/src/gn/xcode_object.cc
@@ -734,8 +734,6 @@
                        const std::string& source_path,
                        const PBXAttributes& attributes)
     : name_(name), config_name_(config_name), target_for_indexing_(nullptr) {
-  attributes_["BuildIndependentTargetsInParallel"] = "YES";
-
   main_group_.reset(new PBXGroup);
   main_group_->set_autosorted(false);
 
@@ -777,6 +775,8 @@
 void PBXProject::AddAggregateTarget(const std::string& name,
                                     const std::string& shell_script) {
   PBXAttributes attributes;
+  attributes["CLANG_ENABLE_OBJC_WEAK"] = "YES";
+  attributes["CODE_SIGN_IDENTITY"] = "-";
   attributes["CODE_SIGNING_REQUIRED"] = "NO";
   attributes["CONFIGURATION_BUILD_DIR"] = ".";
   attributes["PRODUCT_NAME"] = name;
@@ -788,6 +788,9 @@
 void PBXProject::AddIndexingTarget() {
   DCHECK(!target_for_indexing_);
   PBXAttributes attributes;
+  attributes["CLANG_ENABLE_OBJC_WEAK"] = "YES";
+  attributes["CODE_SIGN_IDENTITY"] = "-";
+  attributes["CODE_SIGNING_REQUIRED"] = "NO";
   attributes["EXECUTABLE_PREFIX"] = "";
   attributes["HEADER_SEARCH_PATHS"] = sources_->path();
   attributes["PRODUCT_NAME"] = "sources";
@@ -829,8 +832,9 @@
                                  : output_basename;
 
   PBXAttributes attributes = extra_attributes;
+  attributes["CLANG_ENABLE_OBJC_WEAK"] = "YES";
+  attributes["CODE_SIGN_IDENTITY"] = "-";
   attributes["CODE_SIGNING_REQUIRED"] = "NO";
-
   attributes["CONFIGURATION_BUILD_DIR"] = output_dir;
   attributes["PRODUCT_NAME"] = product_name;
 
@@ -892,9 +896,10 @@
   PrintProperty(out, rules, "attributes", attributes_);
   PrintProperty(out, rules, "buildConfigurationList", configurations_);
   PrintProperty(out, rules, "compatibilityVersion", "Xcode 3.2");
-  PrintProperty(out, rules, "developmentRegion", "English");
+  PrintProperty(out, rules, "developmentRegion", "en");
   PrintProperty(out, rules, "hasScannedForEncodings", 1u);
-  PrintProperty(out, rules, "knownRegions", std::vector<std::string>({"en"}));
+  PrintProperty(out, rules, "knownRegions",
+                std::vector<std::string>({"en", "Base"}));
   PrintProperty(out, rules, "mainGroup", main_group_);
   PrintProperty(out, rules, "projectDirPath", project_dir_path_);
   PrintProperty(out, rules, "projectRoot", project_root_);
diff --git a/src/gn/xcode_writer.cc b/src/gn/xcode_writer.cc
index 4c3e285..2593514 100644
--- a/src/gn/xcode_writer.cc
+++ b/src/gn/xcode_writer.cc
@@ -368,6 +368,39 @@
       break;
   }
 
+  // Xcode complains that the project needs to be upgraded if those keys are
+  // not set. Since the generated Xcode project is only used for debugging
+  // and the source of truth for build settings is the .gn files themselves,
+  // we can safely set them in the project as they won't be used by "ninja".
+  attributes["CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED"] = "YES";
+  attributes["CLANG_WARN__DUPLICATE_METHOD_MATCH"] = "YES";
+  attributes["CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING"] = "YES";
+  attributes["CLANG_WARN_BOOL_CONVERSION"] = "YES";
+  attributes["CLANG_WARN_COMMA"] = "YES";
+  attributes["CLANG_WARN_CONSTANT_CONVERSION"] = "YES";
+  attributes["CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS"] = "YES";
+  attributes["CLANG_WARN_EMPTY_BODY"] = "YES";
+  attributes["CLANG_WARN_ENUM_CONVERSION"] = "YES";
+  attributes["CLANG_WARN_INFINITE_RECURSION"] = "YES";
+  attributes["CLANG_WARN_INT_CONVERSION"] = "YES";
+  attributes["CLANG_WARN_NON_LITERAL_NULL_CONVERSION"] = "YES";
+  attributes["CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF"] = "YES";
+  attributes["CLANG_WARN_OBJC_LITERAL_CONVERSION"] = "YES";
+  attributes["CLANG_WARN_RANGE_LOOP_ANALYSIS"] = "YES";
+  attributes["CLANG_WARN_STRICT_PROTOTYPES"] = "YES";
+  attributes["CLANG_WARN_SUSPICIOUS_MOVE"] = "YES";
+  attributes["CLANG_WARN_UNREACHABLE_CODE"] = "YES";
+  attributes["ENABLE_STRICT_OBJC_MSGSEND"] = "YES";
+  attributes["ENABLE_TESTABILITY"] = "YES";
+  attributes["GCC_NO_COMMON_BLOCKS"] = "YES";
+  attributes["GCC_WARN_64_TO_32_BIT_CONVERSION"] = "YES";
+  attributes["GCC_WARN_ABOUT_RETURN_TYPE"] = "YES";
+  attributes["GCC_WARN_UNDECLARED_SELECTOR"] = "YES";
+  attributes["GCC_WARN_UNINITIALIZED_AUTOS"] = "YES";
+  attributes["GCC_WARN_UNUSED_FUNCTION"] = "YES";
+  attributes["GCC_WARN_UNUSED_VARIABLE"] = "YES";
+  attributes["ONLY_ACTIVE_ARCH"] = "YES";
+
   return attributes;
 }