-
Notifications
You must be signed in to change notification settings - Fork 12
/
buildall.rb
43 lines (34 loc) · 1018 Bytes
/
buildall.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require 'fileutils'
include FileUtils
def die(*x)
STDERR.puts x
exit 1
end
if ARGV.size != 1
die "Usage: #{__FILE__} <output-directory>"
end
out_dir = ARGV.first
if !File.exist?(out_dir) or !File.directory?(out_dir)
die "Given #{out_dir} doesn't exist or is not a directory"
end
tmp_dir = '/tmp/macruby_samples'
rm_rf tmp_dir
mkdir_p tmp_dir
succeeded, failed = [], []
Dir.glob('*/**/*.xcodeproj').each do |sampleDir|
name = File.dirname(sampleDir)
puts "Building #{name}..."
Dir.chdir name do
ary = system("xcodebuild SYMROOT=#{tmp_dir} >& /dev/null") ? succeeded : failed
ary << name
end
end
Dir.glob(File.join(tmp_dir, '**/*.app')).each do |app|
cp_r app, out_dir
app_name = File.basename(app)
executable_name = app_name.gsub('.app', '')
chmod 0755, File.join(out_dir, app_name, 'Contents', 'MacOS', executable_name)
end
[succeeded, failed].each { |a| a << 'None' if a.empty? }
puts "Successfully built: #{succeeded.join(', ')}"
puts "Failed to build: #{failed.join(', ')}"