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

[Rakefile] Examples robustness for future versions of Xcode

parent efdedaa6
...@@ -329,11 +329,18 @@ namespace :examples do ...@@ -329,11 +329,18 @@ namespace :examples do
execute_command "rm -rf Pods DerivedData" execute_command "rm -rf Pods DerivedData"
execute_command "#{'../../bin/' unless ENV['FROM_GEM']}sandbox-pod install --verbose --no-repo-update" execute_command "#{'../../bin/' unless ENV['FROM_GEM']}sandbox-pod install --verbose --no-repo-update"
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.
command << " -sdk " xcode_version = `xcodebuild -version`.scan(/Xcode (.*)\n/).first.first
command << Dir.glob("#{`xcode-select -print-path`.chomp}/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator*.sdk").last major_version = xcode_version.split('.').first.to_i
end destination_flag_supported = major_version > 4
if destination_flag_supported
command << " -destination 'platform=iOS Simulator,name=iPhone'"
else
command << " -sdk "
command << Dir.glob("#{`xcode-select -print-path`.chomp}/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator*.sdk").last
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