You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?
Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.
Description
Dependency resolution with registry identity substitution does not work correctly if any of the packages in the graph use a tools-version >= 5.8.
Example error:
error: 'swiftpackagemanagerbug': product 'Alamofire' required by package 'swiftpackagemanagerbug' target 'SwiftPackageManagerBug' not found in package 'Alamofire'. Did you mean 'Alamofire'?
With the aliasing rules introduced in 5.8, SPM uses package identities instead of the names, but generates an invalid package graph when trying to apply registry lookup rules. However, I'm not using aliasing feature in this case and do not know how it would impact this particular issue.
Additional issues can be caused when specifying Target.Dependency using a string literal, but I don't know when this feature was introduced.
Please note that different commands can exhibit different behaviors. In my testing, swift package show-dependencies is most susceptible to these issues. swift build, swift package resolve, and swift package update are less impacted for some reason.
--use-registry-identity-for-scm and --replace-scm-with-registry are also not impacted in the same way, but I need to do more testing here.
I believe these issue where missed because the relevant tests only run against tools-version < 5.8. I will open a PR with some of these tests update to reproduce the problem.
Expected behavior
Output with tools-version 5.7
$ swift package show-dependencies --use-registry-identity-for-scm
Updating https://github.com/Alamofire/Alamofire.git
Updated https://github.com/Alamofire/Alamofire.git (0.29s)
Computing version for https://github.com/Alamofire/Alamofire.git
Computed https://github.com/Alamofire/Alamofire.git at 5.9.1 (0.01s)
Removing https://github.com/Alamofire/Alamofire.git
Fetching https://github.com/Alamofire/Alamofire.git from cache
Fetched https://github.com/Alamofire/Alamofire.git from cache (0.00s)
Creating working copy for https://github.com/Alamofire/Alamofire.git
Working copy of https://github.com/Alamofire/Alamofire.git resolved at 5.9.1
.
└── default.alamofire<https://github.com/Alamofire/Alamofire.git@5.9.1>
Actual behavior
Output with tools-version 5.8
$ swift package show-dependencies --use-registry-identity-for-scm
error: 'swiftpackagemanagerbug': product 'Alamofire' required by package 'swiftpackagemanagerbug' target 'SwiftPackageManagerBug' not found in package 'Alamofire'. Did you mean 'Alamofire'?
Steps to reproduce
Reproduction steps
Publish Alamofire 5.9.1 to registry (I used AWS CodeArtifact) with package-metadata.json below
Create package with the Package.swift file below
Set registry locally for package or globally
Run swift package show-dependencies --use-registry-identity-for-scm
Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Swift & OS version (output of swift --version ; uname -a)
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0
Darwin nalendar.local 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:46 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6031 arm64
The text was updated successfully, but these errors were encountered:
Is it reproducible with SwiftPM command-line tools:
swift build
,swift test
,swift package
etc?swift build
,swift test
,swift package
etc.Description
Dependency resolution with registry identity substitution does not work correctly if any of the packages in the graph use a tools-version >= 5.8.
Example error:
With the aliasing rules introduced in 5.8, SPM uses package identities instead of the names, but generates an invalid package graph when trying to apply registry lookup rules. However, I'm not using aliasing feature in this case and do not know how it would impact this particular issue.
Additional issues can be caused when specifying
Target.Dependency
using a string literal, but I don't know when this feature was introduced.Please note that different commands can exhibit different behaviors. In my testing,
swift package show-dependencies
is most susceptible to these issues.swift build
,swift package resolve
, andswift package update
are less impacted for some reason.--use-registry-identity-for-scm
and--replace-scm-with-registry
are also not impacted in the same way, but I need to do more testing here.I believe these issue where missed because the relevant tests only run against tools-version < 5.8. I will open a PR with some of these tests update to reproduce the problem.
Expected behavior
Output with tools-version 5.7
Actual behavior
Output with tools-version 5.8
Steps to reproduce
Reproduction steps
swift package show-dependencies --use-registry-identity-for-scm
Package.swift
package-metadata.json
Swift Package Manager version/commit hash
Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Swift & OS version (output of
swift --version ; uname -a
)swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0
Darwin nalendar.local 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:46 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6031 arm64
The text was updated successfully, but these errors were encountered: