Open fumoboy007 opened 9 months ago
@elsh @tomerd My wildly uninformed guess would be: this is caused by a bug that depends on a specific dictionary/set iteration order and the bug is only triggered some of the time because the Swift dictionary/set iteration order is randomized per process. 😀
I don't think swift package clean
actually deletes the build directory; you might have to add rm -rf .build
to get a more consistent behavior.
I don't think
swift package clean
actually deletes the build directory; you might have to addrm -rf .build
to get a more consistent behavior.
Oh, TIL! swift package reset
deletes the .build
directory (which includes caches) whereas swift package clean
only deletes build artifacts.
Both swift package clean
and swift package reset
reproduce the issue for me though.
It is interesting that this flakiness issue is reproducible with just swift package clean
. I wouldn’t have thought it was related to build artifacts. Maybe that’s a good clue to help investigate the root cause?
@Elsh, I am also struggling with using moduleAliases and I would be incredibly thankful if you could take a look at this.
I have three packages, A & B and C.
Both A and B have a target named X.
C has both A and B as dependency, and because both A and B have a target named X, there is the 'Multiple targets named...' error in Xcode.
The following is in C's Package.swift.
extension Target.Dependency {
static let A: Self = .product(
name: "X",
package: "A",
moduleAliases: [
"X" : "X_one",
]
)
static let B: Self = .product(
name: "X",
package: "B",
moduleAliases: [
"X" : "X_two",
]
)
}
However, this doesn't fix the issue and the error ('multiple targets..') persists. Could you please help me identify where I'm going wrong?
Description
My package has a target named
MessagePack
. I am writing benchmarks to compare my package with other packages, so I need to add those other packages as dependencies of my package.One of those dependencies also has a target named
MessagePack
. To avoid the naming conflict, I am attempting to use themoduleAliases
feature to rename the dependency’sMessagePack
target toFlightSchoolMessagePack
:This works sometimes but other times, Swift package manager complains about duplicate target names:
Expected behavior
The feature should work 100% of the time.
Actual behavior
The feature is flaky.
Steps to reproduce
with-flight-school-dep
branch.reproduce-duplicate-targets-issue.sh
script.Example result:
Swift Package Manager version/commit hash
swift-5.8.1-RELEASE
Swift & OS version (output of
swift --version ; uname -a
)