Skip to content

Instantly share code, notes, and snippets.

@siemensikkema
Last active April 15, 2021 14:06
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save siemensikkema/57ef1ce3340e32b72dc59e44bc37b477 to your computer and use it in GitHub Desktop.
Save siemensikkema/57ef1ce3340e32b72dc59e44bc37b477 to your computer and use it in GitHub Desktop.
Post processing script for generated vapor Xcode project
#!/usr/bin/env ruby
require 'xcodeproj'
project_path = ARGV[0]
project = Xcodeproj::Project.open(project_path)
project.targets.each do |target|
# suppress warnings
if [
"Configs",
"Console",
"CSQLite",
"FluentTester",
"FrameAddress",
"Meta",
"MySQL",
"MySQLDriver",
"MySQLProvider",
"Sockets",
"SQLite",
"Sugar",
"Validation",
"Vapor"
].include? target.name
target.build_configurations.each do |config|
config.build_settings['SWIFT_SUPPRESS_WARNINGS'] = 'YES'
config.build_settings['GCC_WARN_INHIBIT_ALL_WARNINGS'] = 'YES'
end
end
end
project.save()
@siemensikkema
Copy link
Author

siemensikkema commented Oct 20, 2017

Requires: xcodeproj

$ [sudo] gem install xcodeproj

Nice to haves:

  • silence message about converting to Swift 4
  • add run scripts (eg. swiftlint)
  • make configurable

@truemetal
Copy link

A great script, thanks a lot!

My minor change to this is for line 5:
project_path = ARGV[0] || Dir.glob("./*.xcodeproj")[0]

This helps to run it without passing xcodeproj name (but in this case, it's probably a good idea to have just one project in a folder - which is exactly my case)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment