From 95fd2327d206a625ab2d7baf474c052cef83481b Mon Sep 17 00:00:00 2001 From: Brendan Guegan Date: Mon, 16 Nov 2020 09:33:17 +0100 Subject: [PATCH 1/2] Fix issue with IRGen During debugging session, with the use of pods installed via Cocoapods-binary, the console in Xcode displays error messages while executing following expression: `po self` The error looks the following one: ``` Printing description of self: expression produced error: error: virtual filesystem overlay file '/path/to/project/Pods/build/Pods.build/Release-iphoneos/Charts.build/all-product-headers.yaml' not found error: couldn't IRGen expression. Please check the above error messages for possible root causes. ``` The issue is not related to Charts pod, but to every pod used. To fix the issue, I just removed the line that delete the build folder generated during the precompiling of pods. THis folder contains for each pod, the `all-product-headers.yaml` expected by Xcode. --- lib/cocoapods-binary/rome/build_framework.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cocoapods-binary/rome/build_framework.rb b/lib/cocoapods-binary/rome/build_framework.rb index 10c8571..44e217e 100644 --- a/lib/cocoapods-binary/rome/build_framework.rb +++ b/lib/cocoapods-binary/rome/build_framework.rb @@ -188,7 +188,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 From bc0f680e9f3cab015691b667dfce762255f77ac3 Mon Sep 17 00:00:00 2001 From: Brendan Guegan Date: Mon, 18 Oct 2021 15:16:23 +0200 Subject: [PATCH 2/2] Fix build issue with minimal deployment target This commit is a copy of the one made in this pull request : https://github.com/leavez/cocoapods-binary/pull/73#ref-pullrequest-982595115. --- lib/cocoapods-binary/Prebuild.rb | 9 +++++++- lib/cocoapods-binary/rome/build_framework.rb | 23 ++++++++++---------- 2 files changed, 19 insertions(+), 13 deletions(-) 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 44e217e..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)