@@ -29,24 +29,34 @@ def build_for_iosish_platform(sandbox,
2929 xcodebuild ( sandbox , target_label , device , deployment_target , other_options )
3030 xcodebuild ( sandbox , target_label , simulator , deployment_target , other_options + [ 'ARCHS=x86_64' , 'ONLY_ACTIVE_ARCH=NO' ] )
3131
32+ # paths
3233 root_name = target . pod_name
3334 module_name = target . product_module_name
34-
35- executable_path = "#{ build_dir } /#{ root_name } "
36- device_lib = "#{ build_dir } /#{ CONFIGURATION } -#{ device } /#{ root_name } /#{ module_name } .framework/#{ module_name } "
37- device_framework_lib = File . dirname ( device_lib )
38- simulator_lib = "#{ build_dir } /#{ CONFIGURATION } -#{ simulator } /#{ root_name } /#{ module_name } .framework/#{ module_name } "
39-
40- return unless File . file? ( device_lib ) && File . file? ( simulator_lib )
35+ device_framwork_path = "#{ build_dir } /#{ CONFIGURATION } -#{ device } /#{ root_name } /#{ module_name } .framework"
36+ simulator_framwork_path = "#{ build_dir } /#{ CONFIGURATION } -#{ simulator } /#{ root_name } /#{ module_name } .framework"
4137
42- lipo_log = `lipo -create -output #{ executable_path } #{ device_lib } #{ simulator_lib } `
43- puts lipo_log unless File . exist? ( executable_path )
38+ device_binary = device_framwork_path + "/#{ module_name } "
39+ simulator_binary = simulator_framwork_path + "/#{ module_name } "
40+ return unless File . file? ( device_binary ) && File . file? ( simulator_binary )
41+
42+ # the device_lib path is the final output file path
43+ # combine the bianries
44+ tmp_lipoed_binary_path = "#{ build_dir } /#{ root_name } "
45+ lipo_log = `lipo -create -output #{ tmp_lipoed_binary_path } #{ device_binary } #{ simulator_binary } `
46+ puts lipo_log unless File . exist? ( tmp_lipoed_binary_path )
47+ FileUtils . mv tmp_lipoed_binary_path , device_binary , :force => true
48+
49+ # collect the swiftmodule file for various archs.
50+ device_swiftmodule_path = device_framwork_path + "/Modules/#{ module_name } .swiftmodule"
51+ simulator_swiftmodule_path = simulator_framwork_path + "/Modules/#{ module_name } .swiftmodule"
52+ if File . exist? ( device_swiftmodule_path )
53+ FileUtils . cp_r simulator_swiftmodule_path + "/." , device_swiftmodule_path
54+ end
4455
45- FileUtils . mv executable_path , device_lib , :force => true
56+ # output
4657 output_path . mkpath unless output_path . exist?
47- FileUtils . mv device_framework_lib , output_path , :force => true
48- FileUtils . rm simulator_lib if File . file? ( simulator_lib )
49- FileUtils . rm device_lib if File . file? ( device_lib )
58+ FileUtils . mv device_framwork_path , output_path , :force => true
59+
5060end
5161
5262def xcodebuild ( sandbox , target , sdk = 'macosx' , deployment_target = nil , other_options = [ ] )
0 commit comments