Installing Cocoa Pod dependency without one of it's sub dependency

Viewed 98
pod 'RxGoogleMaps'

I am trying to install the above library without one of it's subspecs s.dependency 'GoogleMaps', '~> 3'

This is because due to the nature of our architecture (iOS modular architecture) I had to link GoogleMaps manually (because which is a static library)

Now when I try to install RxGoogleMaps , CocoaPods is trying to install GoogleMaps as a sub dependency and getting an error since it's already there and linked.

Is there a way to stop this sub dependency from installing?

1 Answers

You can't really avoid it being downloaded, but you can strip it from the xcconfig file, to avoid it being linked, by adding a post-install script to your Podfile

Something like this:

require 'fileutils'

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            if config.base_configuration_reference
                xcconfig_path = config.base_configuration_reference.real_path
                xcconfig = File.read(xcconfig_path)
                new_xcconfig = xcconfig.sub("-framework \"GoogleMaps\"", "")
                File.open(xcconfig_path, "w") { |file| file << new_xcconfig }
            end
        end
    end
end
Related