Skip to content

Commit

Permalink
Fix for CocoaPods 1.10.0 (#2)
Browse files Browse the repository at this point in the history
Co-authored-by: alexander-vorobyev-corp-mail <73995640+alexander-vorobyev-corp-mail@users.noreply.github.com>
  • Loading branch information
muukii and alexander-vorobyev-corp-mail authored Dec 6, 2020
1 parent 7aa1880 commit f42d797
Showing 1 changed file with 75 additions and 1 deletion.
76 changes: 75 additions & 1 deletion lib/cocoapods-binary/Integration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,78 @@ class EmbedFrameworksScript
end
end
end
end
end

module Pod
module Generator
class CopydSYMsScript
old_method = instance_method(:generate)
define_method(:generate) do
script = old_method.bind(self).()
script = script.gsub(/-av/, "-r -L -p -t -g -o -D -v")
end
end
end
end

module Pod
module Generator
class CopyXCFrameworksScript
old_method = instance_method(:script)
define_method(:script) do
script = old_method.bind(self).()
script = script.gsub(/-av/, "-r -L -p -t -g -o -D -v")
end
end
end
end

Pod::Installer::Xcode::PodsProjectGenerator::PodTargetInstaller.define_singleton_method(:dsym_paths) do |target|
dsym_paths = target.framework_paths.values.flatten.reject { |fmwk_path| fmwk_path.dsym_path.nil? }.map(&:dsym_path)
dsym_paths.concat(target.xcframeworks.values.flatten.flat_map { |xcframework| xcframework_dsyms(xcframework.path) })
dsym_paths.uniq
end

module Pod
class Installer
class Xcode
class PodsProjectGenerator
class PodTargetIntegrator
old_method = instance_method(:add_copy_xcframeworks_script_phase)
define_method(:add_copy_xcframeworks_script_phase) do |native_target|
script_path = "${PODS_ROOT}/#{target.copy_xcframeworks_script_path.relative_path_from(target.sandbox.root)}"

input_paths_by_config = {}
output_paths_by_config = {}

xcframeworks = target.xcframeworks.values.flatten

if use_input_output_paths? && !xcframeworks.empty?
input_file_list_path = target.copy_xcframeworks_script_input_files_path
input_file_list_relative_path = "${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}"
input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)
input_paths = input_paths_by_config[input_paths_key] = []

framework_paths = xcframeworks.map { |xcf| "${PODS_ROOT}/#{xcf.path.relative_path_from(target.sandbox.root)}" }
input_paths.concat framework_paths

output_file_list_path = target.copy_xcframeworks_script_output_files_path
output_file_list_relative_path = "${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}"
output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)
output_paths_by_config[output_paths_key] = xcframeworks.map do |xcf|
"#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.name}"
end
end

if xcframeworks.empty?
UserProjectIntegrator::TargetIntegrator.remove_copy_xcframeworks_script_phase_from_target(native_target)
else
UserProjectIntegrator::TargetIntegrator.create_or_update_copy_xcframeworks_script_phase_to_target(
native_target, script_path, input_paths_by_config, output_paths_by_config)
end
end
end
end
end
end
end

0 comments on commit f42d797

Please sign in to comment.