Skip to content

Commit bc0f680

Browse files
Fix build issue with minimal deployment target
This commit is a copy of the one made in this pull request : leavez#73 (reference).
1 parent 95fd232 commit bc0f680

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

lib/cocoapods-binary/Prebuild.rb

+8-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,14 @@ def prebuild_frameworks!
123123

124124
output_path = sandbox.framework_folder_path_for_target_name(target.name)
125125
output_path.mkpath unless output_path.exist?
126-
Pod::Prebuild.build(sandbox_path, target, output_path, bitcode_enabled, Podfile::DSL.custom_build_options, Podfile::DSL.custom_build_options_simulator)
126+
127+
min_deployment_target = aggregate_targets
128+
.select { |t| t.pod_targets.include?(target) }
129+
.map(&:platform)
130+
.map(&:deployment_target)
131+
.max
132+
133+
Pod::Prebuild.build(sandbox_path, target, min_deployment_target, output_path, bitcode_enabled, Podfile::DSL.custom_build_options, Podfile::DSL.custom_build_options_simulator)
127134

128135
# save the resource paths for later installing
129136
if target.static_framework? and !target.resource_paths.empty?

lib/cocoapods-binary/rome/build_framework.rb

+11-12
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,18 @@
1010
# @param [PodTarget] target
1111
# a specific pod target
1212
#
13-
def build_for_iosish_platform(sandbox,
14-
build_dir,
13+
def build_for_iosish_platform(sandbox,
14+
build_dir,
1515
output_path,
16-
target,
17-
device,
16+
target,
17+
deployment_target,
18+
device,
1819
simulator,
1920
bitcode_enabled,
2021
custom_build_options = [], # Array<String>
2122
custom_build_options_simulator = [] # Array<String>
2223
)
2324

24-
deployment_target = target.platform.deployment_target.to_s
25-
2625
target_label = target.label # name with platform if it's used in multiple platforms
2726
Pod::UI.puts "Prebuilding #{target_label}..."
2827

@@ -46,14 +45,14 @@ def build_for_iosish_platform(sandbox,
4645
device_binary = device_framework_path + "/#{module_name}"
4746
simulator_binary = simulator_framework_path + "/#{module_name}"
4847
return unless File.file?(device_binary) && File.file?(simulator_binary)
49-
48+
5049
# the device_lib path is the final output file path
5150
# combine the binaries
5251
tmp_lipoed_binary_path = "#{build_dir}/#{target_name}"
5352
lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_binary} #{simulator_binary}`
54-
puts lipo_log unless File.exist?(tmp_lipoed_binary_path)
53+
Pod::UI.puts lipo_log unless File.exist?(tmp_lipoed_binary_path)
5554
FileUtils.mv tmp_lipoed_binary_path, device_binary, :force => true
56-
55+
5756
# collect the swiftmodule file for various archs.
5857
device_swiftmodule_path = device_framework_path + "/Modules/#{module_name}.swiftmodule"
5958
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
127126
raise "shouldn't be handle by xcpretty"
128127
end
129128
rescue
130-
puts log.red
129+
Pod::UI.puts log.red
131130
end
132131
end
133132
[is_succeed, log]
@@ -149,7 +148,7 @@ class Prebuild
149148
# [Pathname] output_path
150149
# output path for generated frameworks
151150
#
152-
def self.build(sandbox_root_path, target, output_path, bitcode_enabled = false, custom_build_options=[], custom_build_options_simulator=[])
151+
def self.build(sandbox_root_path, target, min_deployment_target, output_path, bitcode_enabled = false, custom_build_options=[], custom_build_options_simulator=[])
153152

154153
return if target.nil?
155154

@@ -159,7 +158,7 @@ def self.build(sandbox_root_path, target, output_path, bitcode_enabled = false,
159158

160159
# -- build the framework
161160
case target.platform.name
162-
when :ios then build_for_iosish_platform(sandbox, build_dir, output_path, target, 'iphoneos', 'iphonesimulator', bitcode_enabled, custom_build_options, custom_build_options_simulator)
161+
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)
163162
when :osx then xcodebuild(sandbox, target.label, 'macosx', nil, custom_build_options)
164163
# when :tvos then build_for_iosish_platform(sandbox, build_dir, target, 'appletvos', 'appletvsimulator')
165164
when :watchos then build_for_iosish_platform(sandbox, build_dir, output_path, target, 'watchos', 'watchsimulator', true, custom_build_options, custom_build_options_simulator)

0 commit comments

Comments
 (0)