Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying no default subspec #584

Closed
kylefleming opened this issue Aug 29, 2019 · 3 comments · Fixed by #605
Closed

Allow specifying no default subspec #584

kylefleming opened this issue Aug 29, 2019 · 3 comments · Fixed by #605

Comments

@kylefleming
Copy link
Contributor

I would like to be able to have the ability specify in a podspec that the pod defaults to only the root spec and does not auto-include any of the subspecs as dependencies. (the equivalent of s.default_subspecs = [])

Given that you can make a pod with no subspecs, it seems logical that a pod should be able to specify that only the root spec should be included by default. This would allow pod authors to add optional functionality as subspecs without needing to create a dummy subspec to set as the default_subspec.

@dnkoutso
Copy link
Contributor

dnkoutso commented Aug 29, 2019

Yes! Sounds like a good enhancement. Will mark it for 1.9.0 for now. Hopefully should be fairly easy to add.

@dnkoutso
Copy link
Contributor

dnkoutso commented Aug 29, 2019

Seems like CocoaPods does:

    def subspec_dependencies(platform = nil)
      specs = if default_subspecs.empty?
                subspecs.compact.reject(&:non_library_specification?)
              else
                default_subspecs.map do |subspec_name|
                  root.subspec_by_name("#{name}/#{subspec_name}")
                end
              end
      if platform
        specs = specs.select { |s| s.supported_on_platform?(platform) }
      end
      specs.map { |s| Dependency.new(s.name, version) }
    end

So setting s.default_subspecs = [] is possible but has a different effect than the issue description here intends to accomplish. We might be better off introducing a s.default_subspecs = :root or s.default_subspecs = :none or maybe s.default_subspecs = nil which for some reason the last one seems to me a bad idea :)

@dnkoutso
Copy link
Contributor

At the very least we should ensure this change does not break the existing expected behavior unless the pod author explicitly updates their podspec to designate that all subspecs are "optional". I am also curious and want to ensure pod consumers are given a choice today which I think they do with pod 'PodA', :subspecs => [...] option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants