forked from atomicobject/objection
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
83 lines (70 loc) · 2.91 KB
/
Rakefile
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
PROJECT_NAME = "Objection"
CONFIGURATION = "Debug"
SPECS_TARGET_NAME = "Specs-OSX"
UI_SPECS_TARGET_NAME = "Specs-iOS"
IOS_VERSION = "6.1"
SDK_DIR = "iphonesimulator#{IOS_VERSION}"
def xcodebuild_executable
ENV['XCODEBUILD'] || "xcodebuild"
end
def build_dir(effective_platform_name)
File.join(File.dirname(__FILE__), "build", CONFIGURATION + effective_platform_name)
end
def system_or_exit(cmd, stdout = nil)
puts "Executing #{cmd}"
cmd += " >#{stdout}" if stdout
system(cmd) or raise "******** Build failed ********"
end
task :default => ["specs:ios", "specs:osx"]
task :cruise do
Rake::Task[:clean].invoke
Rake::Task[:build_all].invoke
Rake::Task[:specs].invoke
Rake::Task[:uispecs].invoke
end
namespace :artifact do
desc "Build OSX Framework"
task :osx => :clean do
system_or_exit(%Q[#{xcodebuild_executable} -project #{PROJECT_NAME}.xcodeproj -target Objection -configuration Release build], nil)
end
desc "Build iOS Framework"
task :ios => :clean do
system_or_exit(%Q[#{xcodebuild_executable} -project #{PROJECT_NAME}.xcodeproj -target Objection-iOS -configuration Release build], nil)
end
require 'rake/clean'
CLEAN.include("pkg")
CLEAN.include("build")
desc "Build package containing OS X and iOS frameworks"
task :package => [:clean, :osx, :ios] do
version = %x|/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" Objection-Info.plist|.strip
mkdir_p "pkg"
cp_r "build/Release-iphoneuniversal/Objection-iOS.framework", "pkg"
cp_r "build/Release/Objection.framework", "pkg"
cd "pkg" do
sh "tar cvzf Objection-#{version}.tar.gz Objection-iOS.framework Objection.framework"
end
end
end
task :clean do
stdout = File.join(ENV['CC_BUILD_ARTIFACTS'], "clean.output") if (ENV['IS_CI_BOX'])
system_or_exit(%Q[#{xcodebuild_executable} -project #{PROJECT_NAME}.xcodeproj -alltargets -configuration #{CONFIGURATION} clean], stdout)
end
task :build_all do
stdout = File.join(ENV['CC_BUILD_ARTIFACTS'], "build_all.output") if (ENV['IS_CI_BOX'])
system_or_exit(%Q[#{xcodebuild_executable} -project #{PROJECT_NAME}.xcodeproj -alltargets -configuration #{CONFIGURATION} build], stdout)
end
namespace :specs do
desc "All Specs"
task :all => [:osx, :ios]
desc "OS X Specs"
task :osx do
stdout = File.join(ENV['CC_BUILD_ARTIFACTS'], "build_specs.output") if (ENV['IS_CI_BOX'])
system_or_exit(%Q[#{xcodebuild_executable} test -project #{PROJECT_NAME}.xcodeproj -scheme #{SPECS_TARGET_NAME} -configuration #{CONFIGURATION}], stdout)
end
desc "iOS Specs"
task :ios do
stdout = File.join(ENV['CC_BUILD_ARTIFACTS'], "build_uispecs.output") if (ENV['IS_CI_BOX'])
ENV["TEST_AFTER_BUILD"] = "Yes"
system_or_exit(%Q[#{xcodebuild_executable} test -project #{PROJECT_NAME}.xcodeproj -scheme #{UI_SPECS_TARGET_NAME} -sdk #{SDK_DIR} -destination OS=#{IOS_VERSION},name=iPhone -configuration #{CONFIGURATION}], stdout)
end
end