feat(cli): Add packageManager to iOS config #8321
Open
+116
−74
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When bundler support was added, it broke a lot of things.
First of all, Capacitor already had bundler support, but by using an executable that would run the
bundle exec podcommand instead ofpodcommand.The PR shouldn't have repurposed
podPathas it was for pointing to the executable path, but in that PR it was changed to contain the command to run, which breaks some checks likeisInstalled(podPath), and also doesn't really work if passed torunCommandas it only expects one command and that would passbundle exec podif using bundler. (no bug here since we were reading the value and manually calling justbundleand thenexecandpodas params.Also added a bunch of
checkBundler()calls which cause issues and race conditions when not using bundler.So, this PR adds a new
packageManagerproperty to the iOS config, which gets the value from a newdeterminePackageManagerfunction with a similar logic to whatdetermineGemfileOrCocoapodPathused to have (including a SPM check and only sets the value to bundler if installed.The values can be
bundler,CocoapodsorSPMThen uses that property to only run
checkBundler()if using bundler and only runcheckCocoaPods()if using CocoaPods, and no checks at all if using SPM.So it closes #8127
determineGemfileOrCocoapodPathhas been deleted since it wasn't exported, so I don't think it's a breaking change.Added a new
determineCocoapodPathwith the original logic that was removed on the mentioned bundler PR, so it only checks if theCAPACITOR_COCOAPODS_PATHenv variable is defined or not.Deprecated
checkPackageManagerandupdateCheckssince those were exported and removing them would be a breaking change.We can delete them on main, but this should be cherry picked into 7.x and 8.x, so can't be deleted yet.
Changed some checks from
== 'Cocoapods'to!== 'SPM'sincebundlerandCocoapodsare basically the same, except on a few places where I explicitly check forbundler.Removes some
isInstalled('bundler')andisInstalled('pod')since those are tested beforehand, and forpodit shouldn't check that butisInstalled(podPath)in casepodPathwas set to an executable path.