Skip to content

Instantly share code, notes, and snippets.

@duncanmak
Created October 23, 2012 21:12
Show Gist options
  • Save duncanmak/3941603 to your computer and use it in GitHub Desktop.
Save duncanmak/3941603 to your computer and use it in GitHub Desktop.
checkout-monotouch
require '../../helpers'
class CheckoutMonoTouch
include Helpers
def CheckoutMonoForAndroid.main
options = {}
optparse = OptionParser.new do |opt|
opts.banner = "Usage: checkout-monotouch.rb [options]"
options[:commit] = nil
opts.on("-c", "--commit COMMIT", "") do |commit|
options[:commit] = commit
end
options[:lane_name] = nil
opts.on("-l", "--lane-name NAME", "") do |name|
options[:lane_name] = name
end
options[:source_cache] = nil
opts.on("-s", "--source-cache DIR", "") do |dir|
options[:source_cache] = dir
end
end
optparse.parse!
raise "Lane name, commit, source cache and output dir are mandatory" if options.values.any?(&:nil?)
lane = options[:lane_name].replace('windows', 'mac')
commit = options[:commit]
bundle_url = "http://storage.bos.xamarin.com/#{lane}/#{commit[0,2]}/#{commit}/bundle.zip"
branch = lane.split('-').drop(2).join('-')
workspace = "/tmp/build"
app = CheckoutMonoForAndroid.new(workspace, options[:source_cache])
app.checkout(commit, branch, bundle)
end
def initialize(workspace, source_cache)
@workspace = workspace
@source_cache = source_cache
end
def verify_mdaddins(monotouch)
# Check that the md-addins hash in the README corresponds to the submodule
end
def _checkout(url, hashes, id)
checkout(url, @source_cache, hashes[id][:branch], hashes[id][:commit], @workspace)
end
def checkout(monotouch_commit, branch, bundle_url)
monotouch = checkout('git@github.com:xamarin/monotouch', @source_cache, branch, monotouch_commit, @workspace)
hashes = extract_hashes(File.join(monotouch, "README"))
verify_mdaddins(monotouch)
xamarin_vs = _checkout('git@github.com:xamarin/XamarinVS', hashes, :xamarinvs)
cecil = _checkout("git@github.com:mono/cecil", hashes, :cecil)
mdaddins = _checkout("git@github.com:mono/md-addins", hashes, :mdaddins)
bundle = download(bundle_url, "bundle.zip")
unzip_bundle(bundle, File.join(xamarin_vs, "Mono.IOS.VisualStudio", "lib"))
end
end
CheckoutMonoForAndroid.main if __FILE__ == $PROGRAM_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment