forked from atomicobject/objection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
67 lines (56 loc) · 2.54 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
PROJECT_NAME = "Objection"
CONFIGURATION = "Debug"
SPECS_TARGET_NAME = "Specs"
UI_SPECS_TARGET_NAME = "UISpecs"
SDK_DIR = "/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk"
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, :uispecs]
task :cruise do
Rake::Task[:clean].invoke
Rake::Task[:build_all].invoke
Rake::Task[:specs].invoke
Rake::Task[:uispecs].invoke
end
task :clean do
stdout = File.join(ENV['CC_BUILD_ARTIFACTS'], "clean.output") if (ENV['IS_CI_BOX'])
system_or_exit(%Q[xcodebuild -project #{PROJECT_NAME}.xcodeproj -alltargets -configuration #{CONFIGURATION} clean], stdout)
end
task :build_specs do
stdout = File.join(ENV['CC_BUILD_ARTIFACTS'], "build_specs.output") if (ENV['IS_CI_BOX'])
system_or_exit(%Q[xcodebuild -project #{PROJECT_NAME}.xcodeproj -target #{SPECS_TARGET_NAME} -configuration #{CONFIGURATION} build], stdout)
end
task :build_uispecs do
stdout = File.join(ENV['CC_BUILD_ARTIFACTS'], "build_uispecs.output") if (ENV['IS_CI_BOX'])
system_or_exit(%Q[xcodebuild -project #{PROJECT_NAME}.xcodeproj -target #{UI_SPECS_TARGET_NAME} -configuration #{CONFIGURATION} build], 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 -project #{PROJECT_NAME}.xcodeproj -alltargets -configuration #{CONFIGURATION} build], stdout)
end
task :specs => :build_specs do
build_dir = build_dir("")
ENV["DYLD_FRAMEWORK_PATH"] = build_dir
system_or_exit(File.join(build_dir, SPECS_TARGET_NAME))
end
require 'tmpdir'
task :uispecs => :build_uispecs do
ENV["DYLD_ROOT_PATH"] = SDK_DIR
ENV["IPHONE_SIMULATOR_ROOT"] = SDK_DIR
ENV["CFFIXED_USER_HOME"] = Dir.tmpdir
ENV["CEDAR_HEADLESS_SPECS"] = "1"
system_or_exit(%Q[#{File.join(build_dir("-iphonesimulator"), "#{UI_SPECS_TARGET_NAME}.app", UI_SPECS_TARGET_NAME)} -RegisterForSystemEvents]);
end
desc "Run the Clang static analyzer against the codebase"
task :clang do
raise 'No "scan-build" found, you need Clang: http://clang-analyzer.llvm.org' unless
File.exist?(`which scan-build`.strip)
sh "xcodebuild -configuration Debug -sdk iphonesimulator4.2 -target Objection-StaticLib clean"
sh "scan-build -k -V xcodebuild -configuration Debug -sdk iphonesimulator4.2 -target Objection-StaticLib"
end