-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Description
Description
I have a package that needs to alias a dependency’s module due to conflicting module names.
Currently, I am doing this at the product level like so:
.product(name: "MessagePack", package: "MessagePack", moduleAliases: [
"MessagePack": "FlightSchoolMessagePack",
]),This works, but I would like to do the alias at the package level like so:
let flightSchoolMessagePackDependency: PackageDescription.Package.Dependency =
.package(url: "https://github.com/Flight-School/MessagePack.git", from: "1.2.4")
flightSchoolMessagePackDependency.moduleAliases = ["MessagePack": "FlightSchoolMessagePack"]
let package = Package(
…
dependencies: [
flightSchoolMessagePackDependency,
…
)Expected behavior
I expect the package-level module alias to be applied, similar to the product-level module alias.
Actual behavior
The package manager returns an error:
multiple targets named 'MessagePack' in: 'messagepack', 'msgpack-swift'; consider using the
moduleAliasesparameter in manifest to provide unique names
Steps to reproduce
- Download my package.
- Switch to the
with-flight-school-depbranch. - Replace the dependency
.package(url: "https://github.com/Flight-School/MessagePack.git", from: "1.2.4")with a similar dependency that has themoduleAliasesproperty specified. - Remove the
moduleAliasesparameter from.product(name: "MessagePack", package: "MessagePack", moduleAliases: …). swift build
Swift Package Manager version/commit hash
swift-5.8.1-RELEASE
Swift & OS version (output of swift --version ; uname -a)
swift-driver version: 1.75.2 Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)
Target: arm64-apple-macosx13.0
Darwin Darrens-Mac.momahome 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul 5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000 arm64