diff --git a/lib/cocoapods-binary/Prebuild.rb b/lib/cocoapods-binary/Prebuild.rb index 77bc834..429629c 100644 --- a/lib/cocoapods-binary/Prebuild.rb +++ b/lib/cocoapods-binary/Prebuild.rb @@ -123,7 +123,14 @@ def prebuild_frameworks! output_path = sandbox.framework_folder_path_for_target_name(target.name) output_path.mkpath unless output_path.exist? - Pod::Prebuild.build(sandbox_path, target, output_path, bitcode_enabled, Podfile::DSL.custom_build_options, Podfile::DSL.custom_build_options_simulator) + + min_deployment_target = aggregate_targets + .select { |t| t.pod_targets.include?(target) } + .map(&:platform) + .map(&:deployment_target) + .max + + Pod::Prebuild.build(sandbox_path, target, min_deployment_target, output_path, bitcode_enabled, Podfile::DSL.custom_build_options, Podfile::DSL.custom_build_options_simulator) # save the resource paths for later installing if target.static_framework? and !target.resource_paths.empty? diff --git a/lib/cocoapods-binary/rome/build_framework.rb b/lib/cocoapods-binary/rome/build_framework.rb index 10c8571..0648e99 100644 --- a/lib/cocoapods-binary/rome/build_framework.rb +++ b/lib/cocoapods-binary/rome/build_framework.rb @@ -10,19 +10,18 @@ # @param [PodTarget] target # a specific pod target # -def build_for_iosish_platform(sandbox, - build_dir, +def build_for_iosish_platform(sandbox, + build_dir, output_path, - target, - device, + target, + deployment_target, + device, simulator, bitcode_enabled, custom_build_options = [], # Array custom_build_options_simulator = [] # Array ) - deployment_target = target.platform.deployment_target.to_s - target_label = target.label # name with platform if it's used in multiple platforms Pod::UI.puts "Prebuilding #{target_label}..." @@ -46,14 +45,14 @@ def build_for_iosish_platform(sandbox, device_binary = device_framework_path + "/#{module_name}" simulator_binary = simulator_framework_path + "/#{module_name}" return unless File.file?(device_binary) && File.file?(simulator_binary) - + # the device_lib path is the final output file path # combine the binaries tmp_lipoed_binary_path = "#{build_dir}/#{target_name}" lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_binary} #{simulator_binary}` - puts lipo_log unless File.exist?(tmp_lipoed_binary_path) + Pod::UI.puts lipo_log unless File.exist?(tmp_lipoed_binary_path) FileUtils.mv tmp_lipoed_binary_path, device_binary, :force => true - + # collect the swiftmodule file for various archs. device_swiftmodule_path = device_framework_path + "/Modules/#{module_name}.swiftmodule" simulator_swiftmodule_path = simulator_framework_path + "/Modules/#{module_name}.swiftmodule" @@ -127,7 +126,7 @@ def xcodebuild(sandbox, target, sdk='macosx', deployment_target=nil, other_optio raise "shouldn't be handle by xcpretty" end rescue - puts log.red + Pod::UI.puts log.red end end [is_succeed, log] @@ -149,7 +148,7 @@ class Prebuild # [Pathname] output_path # output path for generated frameworks # - def self.build(sandbox_root_path, target, output_path, bitcode_enabled = false, custom_build_options=[], custom_build_options_simulator=[]) + def self.build(sandbox_root_path, target, min_deployment_target, output_path, bitcode_enabled = false, custom_build_options=[], custom_build_options_simulator=[]) return if target.nil? @@ -159,7 +158,7 @@ def self.build(sandbox_root_path, target, output_path, bitcode_enabled = false, # -- build the framework case target.platform.name - when :ios then build_for_iosish_platform(sandbox, build_dir, output_path, target, 'iphoneos', 'iphonesimulator', bitcode_enabled, custom_build_options, custom_build_options_simulator) + when :ios then build_for_iosish_platform(sandbox, build_dir, output_path, target, min_deployment_target, 'iphoneos', 'iphonesimulator', bitcode_enabled, custom_build_options, custom_build_options_simulator) when :osx then xcodebuild(sandbox, target.label, 'macosx', nil, custom_build_options) # when :tvos then build_for_iosish_platform(sandbox, build_dir, target, 'appletvos', 'appletvsimulator') when :watchos then build_for_iosish_platform(sandbox, build_dir, output_path, target, 'watchos', 'watchsimulator', true, custom_build_options, custom_build_options_simulator) @@ -188,7 +187,7 @@ def self.build(sandbox_root_path, target, output_path, bitcode_enabled = false, def self.remove_build_dir(sandbox_root) path = build_dir(sandbox_root) - path.rmtree if path.exist? + # path.rmtree if path.exist? end private