trinhngocthuyen / cocoapods-spm

A CocoaPods plugin to add SPM dependencies to CocoaPods-based projects
MIT License
50 stars 8 forks source link

[Bug] NoMethodError - undefined method `filter_map' #108

Closed housecode closed 1 month ago

housecode commented 2 months ago

What happened?

I am using MacBook Air M1 with macOS Sonoma 14.6.1 and this is my Podfile

# Uncomment the next line to define a global platform for your project
platform :ios, '15.0'
use_frameworks!

def shared_pods
    spm_pkg "SkeletonUI", :url => "https://github.com/CSolanaM/SkeletonUI", :tag => "2.0.2"
    spm_pkg "SwiftUIDatePickerDialog", :url => "https://github.com/globulus/swiftui-date-picker-dialog", :tag => "1.0.0"
end

target 'TestProject' do
    shared_pods
end

And tested to fresh new project, after executing pod install:

Error

NoMethodError - undefined method `filter_map' for #<Array:0x000000015adf5808>
Did you mean?  filter
/Library/Ruby/Gems/2.6.0/gems/cocoapods-spm-0.1.4/lib/cocoapods-spm/hooks/post_integrate/5.update_settings.rb:91:in `modulemap_args_for_target'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-spm-0.1.4/lib/cocoapods-spm/hooks/post_integrate/5.update_settings.rb:49:in `block in update_modulemap_flags'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-spm-0.1.4/lib/cocoapods-spm/hooks/base.rb:66:in `block in perform_settings_update'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-spm-0.1.4/lib/cocoapods-spm/hooks/base.rb:84:in `block (2 levels) in perform_settings_update'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-spm-0.1.4/lib/cocoapods-spm/hooks/base.rb:82:in `each_key'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-spm-0.1.4/lib/cocoapods-spm/hooks/base.rb:82:in `block in perform_settings_update'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-spm-0.1.4/lib/cocoapods-spm/hooks/base.rb:81:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-spm-0.1.4/lib/cocoapods-spm/hooks/base.rb:81:in `perform_settings_update'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-spm-0.1.4/lib/cocoapods-spm/hooks/post_integrate/5.update_settings.rb:46:in `update_modulemap_flags'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-spm-0.1.4/lib/cocoapods-spm/hooks/post_integrate/5.update_settings.rb:10:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-spm-0.1.4/lib/cocoapods-spm/hooks/base.rb:53:in `block (2 levels) in run_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:149:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-spm-0.1.4/lib/cocoapods-spm/hooks/base.rb:52:in `block in run_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-spm-0.1.4/lib/cocoapods-spm/hooks/base.rb:48:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-spm-0.1.4/lib/cocoapods-spm/hooks/base.rb:48:in `run_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-spm-0.1.4/lib/cocoapods-spm/patch/installer.rb:53:in `run_spm_post_integrate_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-spm-0.1.4/lib/cocoapods-spm/patch/installer.rb:34:in `block in <class:Installer>'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:170:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

CocoaPods environment

Stack

   CocoaPods : 1.15.2
        Ruby : ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin23]
    RubyGems : 3.0.3.1
        Host : macOS 14.6.1 (23G93)
       Xcode : 15.3 (15E204a)
         Git : git version 2.39.3 (Apple Git-146)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Plugins

cocoapods-art         : 1.1.1
cocoapods-deintegrate : 1.0.5
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.1
cocoapods-spm         : 0.1.4
cocoapods-trunk       : 1.6.0
cocoapods-try         : 1.2.0

Podfile

# Uncomment the next line to define a global platform for your project
platform :ios, '15.0'
use_frameworks!

def shared_pods
    spm_pkg "SkeletonUI", :url => "https://github.com/CSolanaM/SkeletonUI", :tag => "2.0.2"
    spm_pkg "SwiftUIDatePickerDialog", :url => "https://github.com/globulus/swiftui-date-picker-dialog", :tag => "1.0.0"
end

target 'TestProject' do
    shared_pods
end

Anything else?

No response

MahmoudHemaid commented 2 months ago

I have same issue

trinhngocthuyen commented 2 months ago

Hi there, sorry for the very late response. Regarding filter_map, it was introduced since ruby 2.7. I'd suggest upgrading your ruby version to get it fixed. Thank you!

housecode commented 1 month ago

Hi @trinhngocthuyen , yeah it worked using ruby 2.7 or latest is there any way to keep using cocoapod-spm with ruby 2.6 ?

trinhngocthuyen commented 1 month ago

I've added the backward compatibility for ruby 2.6 in #111