-
Notifications
You must be signed in to change notification settings - Fork 0
/
merge_framework.rb
45 lines (31 loc) · 1.31 KB
/
merge_framework.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
44
45
#!/usr/bin/env ruby
def build_target(target,sdk,build_dir,archs,misc ='')
command = <<-EOC.strip.gsub(/^[\t]+/,'')
xcodebuild \
-project #{project_path} \
-target #{target_name} \
-configuration #{configuration}
EOC
command += "-sdk #{sdk}" unless empty_string?(sdk)
command += "CONFIGURATION_BUILD_DIR = \"#{build_Dir}\"" unless empty_string?(build_dir)
command += " ARCHS=\"#{archs}\"" unless empty_string?(archs)
comand += " #{misc}" unless empty_string?(misc)
execmd command
end
def build_ios_sdk(target_name)
clean_target target_name
prefix = File.join(slice_build_path,target_name)
build_target target_name, 'iphonesimulator', File.join(prefix,'iphonesimulator'),'i386 x86_64'
build_target target_name, 'iphoneos', File.join(prefix,'iphones'),'armv7'
end
def merge_framework(prefix,target_name)
product_name = product_name(target_name)
frameworks = Dir.glob(File.join(prefix,'*',"#{product_name}.framework"))
first_framework = frameworks.first
return if first_framework.nil?
output = File.join(build_path,"#{target_name}.framework")
execmd "cp-RLp #{first_framework} #{output}"
return if frameworks.count == 1
executables = frameworks.map {|framework| File.join(framework,product_name)}
lipo File.join(output,product_name),*executables
end