-
-
Notifications
You must be signed in to change notification settings - Fork 566
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
Add support for Swift package manager #3788
Conversation
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
686c0ab
to
b1f17bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! here are a few feedbacks for you consideration
There are likely a few extra things to consider:
.package.resolved
files 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add namespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pombredanne We don't have a namespace for the top-level package in the Package.swift manifest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.swift
does 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.swift
manifest.
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 <git@keshav.space> Co-authored-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Keshav Priyadarshi <git@keshav.space> Co-authored-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Keshav Priyadarshi <git@keshav.space> Co-authored-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Keshav Priyadarshi <git@keshav.space> Co-authored-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Keshav Priyadarshi <git@keshav.space> Co-authored-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Keshav Priyadarshi <git@keshav.space> Co-authored-by: Philippe Ombredanne <pombredanne@nexb.com>
- Use the last segment as name and the rest as namespace Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Thanks @pombredanne, addressed all your feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good. Please merge.
Tasks
Run tests locally to check for errors.