Closed Stannieman closed 1 month ago
Hey, there. Thank for the contribution!
Actually, one of the design principle of this plugin is to align with how CocoaPods is handling dependencies. And with CocoaPods, a pod, regardless of whether it's being explicitly declared in Podfile, or being included as a dependency of another, is still being linked to the main target. Therefore, the current behavior for SPM packages is still consistent with how pods are treated.
Yet, I do agree with you that we should be given the option to opt out for the linking to the main target (as we should have been, in case of pods). So, yes, I'm good with the idea in this PR.
The change LGTM. Could you help fix the lint errors https://github.com/trinhngocthuyen/cocoapods-spm/actions/runs/11349092343/job/31564389693?pr=117?
You can run make format
to format the code (or make the suggested changes as in the GH action runs)
Let's say you have a target A that depends on pod B. In B you want to use somePackage from SPM. To do this you add the
spm_pkg => 'somePackage'
and so on to the target in the Podfile. an then spm_dependency 'somePackage' to B's podspec. If pods are built as frameworks, this means that somePackage will be linked into pod B's framework and also to target A, even if target A does not need it. This needlessly increases A's binary size.I added an option to not link somePackage to A.
It works, but it is of course possible I added this at the wrong level in code cause I don't fully know what I'm doing.