-
Notifications
You must be signed in to change notification settings - Fork 223
/
Rakefile
91 lines (76 loc) · 3.26 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
84
85
86
87
88
89
90
91
PROJECT_NAME = "Objection"
CONFIGURATION = "Debug"
SPECS_TARGET_NAME = "Specs-OSX"
UI_SPECS_TARGET_NAME = "Specs-iOS"
IOS_VERSION = "7.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[set -o pipefail; #{xcodebuild_executable} -project #{PROJECT_NAME}.xcodeproj -target Objection -configuration Release build | xcpretty -c], nil)
end
desc "Build iOS Framework"
task :ios => :clean do
system_or_exit(%Q[set -o pipefail; #{xcodebuild_executable} -project #{PROJECT_NAME}.xcodeproj -target Objection-iOS -configuration Release build | xcpretty -c] , 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[set -o pipefail; #{xcodebuild_executable} -project #{PROJECT_NAME}.xcodeproj -alltargets -configuration #{CONFIGURATION} clean | xcpretty -c], 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[set -o pipefail; #{xcodebuild_executable} -project #{PROJECT_NAME}.xcodeproj -alltargets -configuration #{CONFIGURATION} build | xcpretty -c], stdout)
end
namespace :pod do
desc "Publish CocoaPod"
task :publish do
system_or_exit %Q[pod trunk push Objection.podspec --allow-warnings]
end
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[set -o pipefail; #{xcodebuild_executable} test -project #{PROJECT_NAME}.xcodeproj -scheme #{SPECS_TARGET_NAME} -configuration #{CONFIGURATION} | xcpretty -c], 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[set -o pipefail; #{xcodebuild_executable} -project #{PROJECT_NAME}.xcodeproj -scheme #{UI_SPECS_TARGET_NAME} -sdk iphonesimulator -configuration #{CONFIGURATION} -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' test | xcpretty -c], stdout)
end
end