Commit 9ecf4c74 authored by Fabio Pelosin's avatar Fabio Pelosin

[Rakefile] Examples robustness for future versions of Xcode

parent efdedaa6
...@@ -331,9 +331,16 @@ namespace :examples do ...@@ -331,9 +331,16 @@ namespace :examples do
command = "xcodebuild -workspace '#{example.basename}.xcworkspace' -scheme '#{example.basename}'" command = "xcodebuild -workspace '#{example.basename}.xcworkspace' -scheme '#{example.basename}'"
if (example + 'Podfile').read.include?('platform :ios') if (example + 'Podfile').read.include?('platform :ios')
# Specifically build against the simulator SDK so we don't have to deal with code signing. # Specifically build against the simulator SDK so we don't have to deal with code signing.
xcode_version = `xcodebuild -version`.scan(/Xcode (.*)\n/).first.first
major_version = xcode_version.split('.').first.to_i
destination_flag_supported = major_version > 4
if destination_flag_supported
command << " -destination 'platform=iOS Simulator,name=iPhone'"
else
command << " -sdk " command << " -sdk "
command << Dir.glob("#{`xcode-select -print-path`.chomp}/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator*.sdk").last command << Dir.glob("#{`xcode-select -print-path`.chomp}/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator*.sdk").last
end end
end
execute_command(command) execute_command(command)
end end
end end
...@@ -379,3 +386,4 @@ def title(title) ...@@ -379,3 +386,4 @@ def title(title)
puts "-" * 80 puts "-" * 80
puts puts
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment