fermoya / cocoapods-catalyst-support

Ruby extensions to help you configure your pods project so that pods not compiled for Catalyst can still be used for iOS devices
MIT License
111 stars 18 forks source link

[BUG] Unable to run `pod catalyst` #34

Closed nysander closed 2 years ago

nysander commented 2 years ago

Describe the bug I try to prepare cocoapods for Mac catalyst and as a result i have:

% pod catalyst init
Done! Checkout your Podfile to start configuring your macCatalyst dependencies
% pod catalyst validate
Congratulations! Your catalyst configuration is valid.
% pod catalyst         
Analyzing dependencies
Downloading dependencies
Generating Pods project

#### Configuring macos dependencies ####

#### Unsupported Libraries ####
[]
[!] An error occurred while processing the post-install hook of the Podfile.

undefined method `resolve_build_setting' for nil:NilClass

/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-catalyst-support-0.2.0/lib/cocoapods-catalyst-support/xcodeproj/abstract_target.rb:96:in `other_linker_flags_dependencies'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-catalyst-support-0.2.0/lib/cocoapods-catalyst-support/pod/installer.rb:49:in `block in remove_dependencies'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-catalyst-support-0.2.0/lib/cocoapods-catalyst-support/pod/installer.rb:49:in `each'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-catalyst-support-0.2.0/lib/cocoapods-catalyst-support/pod/installer.rb:49:in `reduce'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-catalyst-support-0.2.0/lib/cocoapods-catalyst-support/pod/installer.rb:49:in `remove_dependencies'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-catalyst-support-0.2.0/lib/cocoapods-catalyst-support/pod/installer.rb:10:in `configure_catalyst'
/Users/SOMEUSER/Developer/APP/Podfile:235:in `block (2 levels) in from_ruby'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-core-1.11.2/lib/cocoapods-core/podfile.rb:196:in `post_install!'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:945:in `run_podfile_post_install_hook'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:933:in `block in run_podfile_post_install_hooks'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-1.11.2/lib/cocoapods/user_interface.rb:149:in `message'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:932:in `run_podfile_post_install_hooks'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:331:in `block (2 levels) in create_and_save_projects'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-1.11.2/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in `write!'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:330:in `block in create_and_save_projects'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-1.11.2/lib/cocoapods/user_interface.rb:64:in `section'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:309:in `create_and_save_projects'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:301:in `generate_pods_project'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:180:in `integrate'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:167:in `install!'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-1.11.2/lib/cocoapods/command/install.rb:52:in `run'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in `run'
/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-1.11.2/bin/pod:55:in `<top (required)>'
/Users/SOMEUSER/.gem/ruby/2.7.5/bin/pod:25:in `load'
/Users/SOMEUSER/.gem/ruby/2.7.5/bin/pod:25:in `<main>'

Podfile

require 'cocoapods-catalyst-support'

platform :ios, '14.0'
use_frameworks!

source 'private/cocoapods-specs.git'
source 'private/ABTO-VoIP-SDK-for-iOS-Swift'
source 'https://cdn.cocoapods.org/'

workspace 'APP'
project 'APP'
install! 'cocoapods', :deterministic_uuids => false

#...

# Configure your macCatalyst dependencies
catalyst_configuration do
    # Uncomment the next line for a verbose output
    verbose!

  ios 'Cocoapod-Jitsi' # This dependency will only be available for iOS
  ios 'Cocoapod-WebRTC'
  ios 'AbtoVoipSDK'

    # ios '<pod_name>' # This dependency will only be available for iOS
    # macos '<pod_name>' # This dependency will only be available for macOS
end

post_install do |installer|
    installer.configure_catalyst

  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'
#      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
      config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
  end

  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end

Environment

Additional context I run macOS Monterey 12.2 on M1 Mac

thanks in advance for help

fermoya commented 2 years ago

Hi @nysander , sorry for the late response. The plug-in is failing to retrieve those dependencies that shouldn't be removed and for some reason it's not finding the <SomeModule>.xcconfig file.

Can you try going to the file in the error:

/Users/SOMEUSER/.gem/ruby/2.7.5/gems/cocoapods-catalyst-support-0.2.0/lib/cocoapods-catalyst-support/xcodeproj/abstract_target.rb

And change likes 95-96 as:

config = build_configurations.filter do |config| not config.base_configuration_reference.nil? end.first
return [] if config.nil?  # new addition
other_ldflags = config.resolve_build_setting 'OTHER_LDFLAGS'

And run it again?

fermoya commented 2 years ago

Fixed on 0.2.1