Commit 9b6813f5 authored by Marius Rackwitz's avatar Marius Rackwitz

[Rakefile] Iteratively build all Examples

parent b99ce415
...@@ -221,26 +221,39 @@ begin ...@@ -221,26 +221,39 @@ begin
desc "Build all examples" desc "Build all examples"
task :build do task :build do
Dir.chdir("examples/AFNetworking Example") do require 'xcodeproj'
puts "Installing Pods" Dir['examples/*'].each do |dir|
# pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/sandbox-pod' Dir.chdir(dir) do
# TODO: The sandbox is blocking local git repos making bundler crash puts "Example: #{dir}"
pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/pod'
puts " Installing Pods"
execute_command "rm -rf Pods" # pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/sandbox-pod'
execute_command "#{pod_command} install --verbose --no-repo-update" # TODO: The sandbox is blocking local git repos making bundler crash
pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/pod'
puts "Building example: AFNetworking Mac Example"
execute_command "xcodebuild -workspace 'AFNetworking Examples.xcworkspace' -scheme 'AFNetworking Example' clean build" execute_command "rm -rf Pods"
execute_command "#{pod_command} install --verbose --no-repo-update"
puts "Building example: AFNetworking iOS Example"
xcode_version = `xcodebuild -version`.scan(/Xcode (.*)\n/).first.first workspace_path = 'Examples.xcworkspace'
major_version = xcode_version.split('.').first.to_i workspace = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
# Specifically build against the simulator SDK so we don't have to deal with code signing. workspace.schemes.each do |scheme_name, project_path|
if major_version > 5 next if scheme_name == 'Pods'
execute_command "xcodebuild -workspace 'AFNetworking Examples.xcworkspace' -scheme 'AFNetworking iOS Example' clean build ONLY_ACTIVE_ARCH=NO -destination 'platform=iOS Simulator,name=iPhone 6'" puts " Building scheme: #{scheme_name}"
else
execute_command "xcodebuild -workspace 'AFNetworking Examples.xcworkspace' -scheme 'AFNetworking iOS Example' clean build ONLY_ACTIVE_ARCH=NO -destination 'platform=iOS Simulator,name=iPhone Retina (4-inch)'" project = Xcodeproj::Project.open(project_path)
target = project.targets.first
case target
when :osx
execute_command "xcodebuild -workspace '#{workspace_path}' -scheme '#{scheme_name}' clean build"
when :ios
xcode_version = `xcodebuild -version`.scan(/Xcode (.*)\n/).first.first
major_version = xcode_version.split('.').first.to_i
# Specifically build against the simulator SDK so we don't have to deal with code signing.
simulator_name = major_version > 5 ? 'iPhone 6' : 'iPhone Retina (4-inch)'
execute_command "xcodebuild -workspace '#{workspace_path}' -scheme '#{scheme_name}' clean build ONLY_ACTIVE_ARCH=NO -destination 'platform=iOS Simulator,name=#{simulator_name}"
end
end
end end
end end
end end
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
xcodeproj "AFNetworking Mac Example.xcodeproj" xcodeproj "AFNetworking Mac Example.xcodeproj"
#### ####
workspace 'AFNetworking Examples.xcworkspace' workspace 'Examples.xcworkspace'
target "AFNetworking Example" do target "AFNetworking Example" do
platform :osx, '10.8' platform :osx, '10.8'
......
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