Repository navigation
Conversation
theproducer
left a comment
There was a problem hiding this comment.
With this change,
capacitor/cli/src/util/cordova-ios.ts
Line 501 in 7c2e75f
might rewrite apache/cordova-ios.git to ionic-team/capacitor-ios.git which will obviously won't work.
| for (const name of previousNames) { | ||
| if (remainingNames.has(name)) { | ||
| continue; | ||
| } | ||
| rewritten = rewritten.replace( | ||
| new RegExp(`(package:\\s*)"${escapeRegExp(name)}"`, 'gi'), | ||
| `$1"${SOURCE_PACKAGE_IDENTITY}"`, | ||
| ); | ||
| } |
There was a problem hiding this comment.
This could edit text inside comments and strings, not sure if that's intended or not.
There was a problem hiding this comment.
Good question. I think it's unlikely that these will be in comments? So we're probably ok?
Swift Package Manager accepts either name for a dependency in .product(package:): the name: it was given, or the identity it gets from the end of its path or URL. The old code recorded only one name per dependency, so I replaced packageReferenceName with packageReferenceNames, which returns both. This has two effects: - Other dependencies keep their products. When the code checks which names still belong to other dependencies, it now records both names, and it skips the Capacitor entries themselves. So `.package(name: "SentryCapacitor", path: "../../@sentry/capacitor") protects package: "capacitor", and Sentry’s products are no longer renamed to capacitor-ios. A second bug is fixed too. When collecting Capacitor’s old names, the code now takes both. Before this, a plugin with .package(name: "CapacitorSwiftPM", url: ".../capacitor-swift-pm.git") would have kept .product(..., package: "capacitor-swift-pm"), which no longer resolves.
OS-pedrogustavobilro
left a comment
There was a problem hiding this comment.
Overall me and Claude tested and seems to be working fine with different combination of plugin Package.swift files.
Leaving a few non-blocker comments.
There was a problem hiding this comment.
We usually consider this kind of template changes to be in a new major as a "breaking change". I personally don't mind this because it's in a file that gets regenerated by the CLI when doing cap sync anyway, but just wanna highlight it to make sure we're "okay" with it.
| const SOURCE_PACKAGE_URL = 'https://github.com/ionic-team/capacitor'; | ||
| export const SOURCE_PACKAGE_IDENTITY = 'capacitor'; | ||
| const SOURCE_PACKAGE_NAME = new RegExp(`name:\\s*"${SOURCE_PACKAGE_IDENTITY}"`); | ||
| export const SOURCE_PACKAGE_IDENTITY = 'capacitor-ios'; |
There was a problem hiding this comment.
Unrelated to this PR specifically: we should tweak the docs entry with this new identity https://github.com/ionic-team/capacitor-docs/blob/f5de151948208d132c1a76f5eee3f2cd44d45a27/docs/main/updating/9-0.md#capacitor-builds-from-node_modules
I suppose this can be done in ionic-team/capacitor-docs#639
There was a problem hiding this comment.
Yeah, I'll do it in ionic-team/capacitor-docs#639, but good catch.
Description
Closes #8734 by changing capacitor to capacitor-ios in all places the cli fixes things
Change Type
Platforms Affected
Notes / Comments
Claude helped on this one, to find some of the weird corner cases and to fix the tests.