Add support for Swift package manager#3788
Conversation
Signed-off-by: Keshav Priyadarshi <[email protected]>
Signed-off-by: Keshav Priyadarshi <[email protected]>
Signed-off-by: Keshav Priyadarshi <[email protected]>
Signed-off-by: Keshav Priyadarshi <[email protected]>
Signed-off-by: Keshav Priyadarshi <[email protected]>
686c0ab to
b1f17bc
Compare
pombredanne
left a comment
There was a problem hiding this comment.
Thanks! here are a few feedbacks for you consideration
There are likely a few extra things to consider:
.package.resolvedfiles like in https://github.com/stripe/stripe-ios/blob/ec051a63435807b6c2ab7fbd6efd35f1173325b9/.package.resolved#L2 are created when using only XCode.- there may be some older legacy format that look like this for the version 1 https://github.com/fastlane/fastlane/blob/806c80c39754034c3dfcdade6beb51bb55c7f3b1/Package.resolved#L2
- and also version 3 https://github.com/Brightify/Cuckoo/blob/b1ff0383512f0ab954e673718098c6c68bdf57b1/.package.resolved#L122C1-L122C16 from xcode?
Unrelated this https://github.com/tuist/tuist/tree/25d90e3a3d613caf6a740a03ea4d195a685a0feb/fixtures/app_with_spm_dependencies/Tuist has some interesting things:
- a workspace
- development dependencies (they cannot be tagged as such anywhere in Swift syntax)
| datasource_id=cls.datasource_id, | ||
| type=cls.default_package_type, | ||
| primary_language=cls.default_primary_language, | ||
| namespace=None, |
There was a problem hiding this comment.
@pombredanne We don't have a namespace for the top-level package in the Package.swift manifest.
There was a problem hiding this comment.
ok, how does this look like when installed?
Is there any trace of where it came from?
https://github.com/mapbox/mapbox-maps-ios/blob/main/Package.swift has some possible base URL. BUT when I see https://github.com/map-ir/mapir-ios-maps-sdk/blob/cfca260d03ab8f0d1889795ec012adae1d3bfbd8/Package.swift#L20 or https://github.com/mapbox/mapbox-navigation-ios/blob/b9c235e665ea2d3b7cd096e9c6128e97c1d4f00c/Package.swift#L27 it is clear that the actual name is one thing and the "package name" is another thing and seem to be resolved only when interpreting a Package.swift for dependencies.
So IMHO we cannot get that actual correct PURL name short of matching or have this used as a dependency. Just create a follow up issue for this so we can address it later.
There was a problem hiding this comment.
ok, how does this look like when installed?
Is there any trace of where it came from?
Yes, we can trace the source of an already installed package from the .build directory.
Tracking this issue here #3793
The PURL for a Swift package depends on where the package is hosted, and given that
Package.swiftdoes not contain the repository URL for the top-level package, it is not possible to infer the correct PURL for the top-level package solely from thePackage.swiftmanifest.
We can use https://swiftpackageindex.com/ to get the correct PURL, but this may not work for all packages since Swift Package Index is not authoritative in nature, i.e. a Swift package may exist, and the author may choose not to add their package to Swift Package Index. https://swiftpackageindex.com/add-a-package
tests/packagedcode/data/swift/packages/mapboxmaps_manifest/Package.swift.json
Show resolved
Hide resolved
Signed-off-by: Keshav Priyadarshi <[email protected]> Co-authored-by: Philippe Ombredanne <[email protected]>
Signed-off-by: Keshav Priyadarshi <[email protected]> Co-authored-by: Philippe Ombredanne <[email protected]>
Signed-off-by: Keshav Priyadarshi <[email protected]> Co-authored-by: Philippe Ombredanne <[email protected]>
Signed-off-by: Keshav Priyadarshi <[email protected]> Co-authored-by: Philippe Ombredanne <[email protected]>
Signed-off-by: Keshav Priyadarshi <[email protected]> Co-authored-by: Philippe Ombredanne <[email protected]>
Signed-off-by: Keshav Priyadarshi <[email protected]> Co-authored-by: Philippe Ombredanne <[email protected]>
- Use the last segment as name and the rest as namespace Signed-off-by: Keshav Priyadarshi <[email protected]>
Signed-off-by: Keshav Priyadarshi <[email protected]>
Signed-off-by: Keshav Priyadarshi <[email protected]>
|
Thanks @pombredanne, addressed all your feedback. |
Tasks
Run tests locally to check for errors.