Description
Description
When using SE-0362's upcomingFeatures
, a package becomes ineligible for use as a dependency.
This isn't explicitly called out in the evolution proposal, but I believe it runs contrary to the intent. After all, what use is the ability to enable (eg) bare slash regular expressions for my own convenience, if nobody can use my library because of it?
Expected behavior
upcomingFeatures
should not be treated as "unsafe", and other packages should be able to depend on my package if I use these (experimental features is much more of a gray area, and might require deeper consideration!)
Steps to reproduce
Here's a failing test you can add to PackageGraphTests.swift
:
func testDependencyOnUpcomingFeatures() throws {
let fs = InMemoryFileSystem(emptyFiles:
"/Foo/Sources/Foo/foo.swift",
"/Foo/Sources/Foo2/foo.swift",
"/Bar/Sources/Bar/bar.swift",
"/Bar/Sources/Bar2/bar.swift",
"/Bar/Sources/Bar3/bar.swift",
"/Bar/Sources/TransitiveBar/bar.swift",
"<end>"
)
let observability = ObservabilitySystem.makeForTesting()
_ = try loadPackageGraph(
fileSystem: fs,
manifests: [
Manifest.createRootManifest(
name: "Foo",
path: .init(path: "/Foo"),
dependencies: [
.localSourceControl(path: .init(path: "/Bar"), requirement: .upToNextMajor(from: "1.0.0")),
],
targets: [
TargetDescription(name: "Foo", dependencies: ["Bar"]),
TargetDescription(name: "Foo2", dependencies: ["TransitiveBar"]),
]),
Manifest.createFileSystemManifest(
name: "Bar",
path: .init(path: "/Bar"),
products: [
ProductDescription(name: "Bar", type: .library(.automatic), targets: ["Bar", "Bar2", "Bar3"]),
ProductDescription(name: "TransitiveBar", type: .library(.automatic), targets: ["TransitiveBar"]),
],
targets: [
TargetDescription(
name: "Bar",
settings: [
.init(tool: .swift, kind: .upcomingFeatures(["ConciseMagicFile"])),
]
),
TargetDescription(
name: "Bar2",
settings: [
.init(tool: .swift, kind: .upcomingFeatures(["UnknownToTheseTools"])),
]
),
TargetDescription(
name: "Bar3",
settings: [
.init(tool: .swift, kind: .upcomingFeatures(["ExistentialAny", "UnknownToTheseTools"])),
]
),
TargetDescription(
name: "TransitiveBar",
dependencies: ["Bar2"]
),
]),
],
observabilityScope: observability.topScope
)
XCTAssertEqual(observability.diagnostics.count, 0)
}
Swift Package Manager version/commit hash
Swift & OS version (output of swift --version && uname -a
)
Swift version 5.7 (swift-5.7-RELEASE)
Target: x86_64-unknown-linux-gnu
Linux GGPC 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux