Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix The deployment target used to find the right simulator to compile the binaries #73

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib/cocoapods-binary/Prebuild.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def prebuild_frameworks!
targets = root_names_to_update.map do |pod_name|
tars = Pod.fast_get_targets_for_pod_name(pod_name, self.pod_targets, cache)
if tars.nil? || tars.empty?
raise "There's no target named (#{pod_name}) in Pod.xcodeproj.\n #{self.pod_targets.map(&:name)}" if t.nil?
raise "There's no target named (#{pod_name}) in Pods.xcodeproj.\n #{self.pod_targets.map(&:name)}" if t.nil?
end
tars
end.flatten
Expand All @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion lib/cocoapods-binary/helper/target_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def self.check_one_pod_should_have_only_one_target(prebuilt_targets)
raw_names = targets_have_different_platforms.map(&:name)
message = "Oops, you came across a limitation of cocoapods-binary.

The plugin requires that one pod should have ONLY ONE target in the 'Pod.xcodeproj'. There are mainly 2 situations \
The plugin requires that one pod should have ONLY ONE target in the 'Pods.xcodeproj'. There are mainly 2 situations \
causing this problem:

1. One pod integrates in 2 or more different platforms' targets. e.g.
Expand Down
13 changes: 6 additions & 7 deletions lib/cocoapods-binary/rome/build_framework.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ def build_for_iosish_platform(sandbox,
build_dir,
output_path,
target,
deployment_target,
device,
simulator,
bitcode_enabled,
custom_build_options = [], # Array<String>
custom_build_options_simulator = [] # Array<String>
)

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}..."
Expand Down Expand Up @@ -51,7 +50,7 @@ def build_for_iosish_platform(sandbox,
# 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.
Expand Down Expand Up @@ -124,10 +123,10 @@ def xcodebuild(sandbox, target, sdk='macosx', deployment_target=nil, other_optio
printer.pretty_print(line)
end
else
raise "shouldn't be handle by xcpretty"
raise "shouldn't be handled by xcpretty"
end
rescue
puts log.red
Pod::UI.puts log.red
end
end
[is_succeed, log]
Expand All @@ -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?

Expand All @@ -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)
Expand Down