-
Notifications
You must be signed in to change notification settings - Fork 81
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
fix!: Rename package to match name inferred from git URL #678
Conversation
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.
lgtm deferring to @ganeshnj though since this is a breaking change
When we do the release with this change, we must create a discussion with code snippet to show how to migrate from old package name to |
You mean in the release notes for the release? |
This reverts commit 8cd9328.
Issue #
Fixes #680
Description of changes
Since the introduction of SPM, a package manifest has included a field for providing a "declared" name (i.e. set in the
name
property of thePackage
structure) that is used in other manifests to identify a package as a dependency.In SE-0226, Swift package naming was altered to derive the name from the Git URL for the package. While the preferred way to identify a dependency is by the inferred name,
Package
retained the declared name field to provide backward compatibility with dependencies declared before this improvement. (Note that referring to a package by its declared name is now deprecated, but use of deprecated APIs in a package manifest does not throw warnings.)The rationale for this change is that it allows the package manager to resolve what dependencies it needs for a specific target without resorting to downloading every dependency referenced in a manifest to see what name is declared in each dependency's own manifest. In our case, the name that is inferred from this package's URL is
aws-sdk-swift
(essentially the last path component with extensions dropped).Most other Swift packages have moved to (or been created with) a declared package name that matches the inferred name. While latest Swift tools allow a manifest to identify a package by either name, consistent naming brings the following advantages:
swift package edit
with the--path
extension (which is used by Swift-VSCode's GUI package management tools), break when the declared name and the inferred name do not match.This will cause a breaking change but the update to requiring package manifests will be trivial; package manifests need only require this package by the new/inferred name. I do not expect our Git URL to change, so this name will be permanent unless SPM changes naming conventions again.
Tested with:
smithy-swift
andaws-crt-swift
.smithy-swift
(se PR above).Specific changes:
codegen/Package.swift
updated to use inferred namingscripts/generatePackageSwift.swift
updated to render manifest with inferred namingimport
statements which were importing by package name (which worked by coincidence until this name change)New/existing dependencies impact assessment, if applicable
No new dependencies were added to this change.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.