فهرست منبع

Add fix-project-settings.rb back (#695)

Motivation:

The fix-project-settings.rb script was prematurely removed.

Modifications:

Add it back.

Result:

Happier .xcodeproj generation.
George Barnett 6 سال پیش
والد
کامیت
103d61d2f4
2فایلهای تغییر یافته به همراه27 افزوده شده و 1 حذف شده
  1. 1 1
      Makefile
  2. 26 0
      scripts/fix-project-settings.rb

+ 1 - 1
Makefile

@@ -47,7 +47,7 @@ project: ${XCODEPROJ}
 
 ${XCODEPROJ}:
 	${SWIFT_PACKAGE} generate-xcodeproj --output $@
-	@-ruby fix-project-settings.rb GRPC.xcodeproj || \
+	@-ruby scripts/fix-project-settings.rb GRPC.xcodeproj || \
 		echo "Consider running 'sudo gem install xcodeproj' to automatically set correct indentation settings for the generated project."
 
 # Generates LinuxMain.swift, only on macOS.

+ 26 - 0
scripts/fix-project-settings.rb

@@ -0,0 +1,26 @@
+require 'xcodeproj'
+project_path = ARGV[0]
+project = Xcodeproj::Project.open(project_path)
+
+# Fix indentation settings.
+project.main_group.uses_tabs = '0'
+project.main_group.tab_width = '2'
+project.main_group.indent_width = '2'
+
+# Set the `CURRENT_PROJECT_VERSION` variable for each config to ensure
+# that the generated frameworks pass App Store validation (#291).
+project.build_configurations.each do |config|
+  config.build_settings["CURRENT_PROJECT_VERSION"] = "1.0"
+end
+
+# Set each target's iOS deployment target to 10.0
+project.targets.each do |target|
+  target.build_configurations.each do |config|
+    config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "10.0"
+    if config.build_settings["PRODUCT_BUNDLE_IDENTIFIER"] then
+      config.build_settings["PRODUCT_BUNDLE_IDENTIFIER"] = "io.grpc." + config.build_settings["PRODUCT_BUNDLE_IDENTIFIER"]
+    end
+  end
+end
+
+project.save