Skip to content

Instantly share code, notes, and snippets.

@lukeredpath
Created August 31, 2010 18:16
Show Gist options
  • Save lukeredpath/559464 to your computer and use it in GitHub Desktop.
Save lukeredpath/559464 to your computer and use it in GitHub Desktop.
Rakefile.rb
require 'rake/tasklib'
TARGET_NAME = "libLROAuth2Client"
module XcodeBuild
class TaskBuilder < Rake::TaskLib
attr_accessor :target, :configuration
def initialize(name)
@name = name
@configuration = "Debug"
yield self if block_given?
define
end
def define
raise "Xcode build target must be defined (in task: #{@name})" if target.nil?
desc "Build the #{target} target in #{configuration}"
task @name do
system("xcodebuild -target #{target} -configuration #{configuration} build")
end
end
end
def self.clean!
system("xcodebuild clean")
end
end
def xcodebuild(name, &block)
XcodeBuild::TaskBuilder.new(name, &block)
end
namespace :build do
xcodebuild :device do |t|
t.target = "#{TARGET_NAME}-Device"
t.configuration = "Release"
end
xcodebuild :simulator do |t|
t.target = "#{TARGET_NAME}-Simulator"
t.configuration = "Release"
end
desc "Build the combined static library"
task :combined => [:device, :simulator] do
system("Scripts/CombineLibs.sh")
end
desc "Package up the framework for release"
task :framework => :combined do
system("Scripts/iPhoneFramework.sh")
end
desc "Clean the build directory"
task :clean do
XcodeBuild.clean!
end
end
task :default => "build:framework"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment