Revert "Don't depend on NIOFoundationCompat in NIOTransportServices on Linux (#209)" (#210)

This reverts commit 40ffcdef46 in PR #209.

Unfortunately, Swift's behaviour around imports tends to be somewhat
"leaky". In this case, the leak is that the dependency on the
Package.swift allows downstream projects to import `NIOFoundationCompat`
without needing to actually specify the package dependency. This has
affected Hummingbird, which we noticed on our internal integration
testing functionality:

```
hummingbird/Sources/Hummingbird/Codable/JSON/JSONCoding.swift:18:8: error: no such module 'NIOFoundationCompat'
import NIOFoundationCompat
       ^
```

cc @Joannis @adam-fowler for the Hummingbird report.

Unfortunately, we can't make this change until we're willing to use a
semver major to achieve it. There may be some argument for doing that
now, as the semver major will be very cheap to adopt across the
ecosystem. But we'll need to do this in a considered way.

@Cyberbeni please feel free to reopen your PR targetting main, where we
can discuss whether this is worth issuing a semver major for.
This commit is contained in:
Cory Benfield 2024-10-14 09:01:34 +01:00 committed by GitHub
parent 40ffcdef46
commit fc398db673
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 7 deletions

View File

@ -15,12 +15,6 @@
import PackageDescription import PackageDescription
#if compiler(>=5.9)
let applePlatforms: [Platform] = [.iOS, .macOS, .tvOS, .watchOS, .macCatalyst, .driverKit, .visionOS]
#else
let applePlatforms: [Platform] = [.iOS, .macOS, .tvOS, .watchOS, .macCatalyst, .driverKit]
#endif
let package = Package( let package = Package(
name: "swift-nio-transport-services", name: "swift-nio-transport-services",
products: [ products: [
@ -36,7 +30,7 @@ let package = Package(
dependencies: [ dependencies: [
.product(name: "NIO", package: "swift-nio"), .product(name: "NIO", package: "swift-nio"),
.product(name: "NIOCore", package: "swift-nio"), .product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOFoundationCompat", package: "swift-nio", condition: .when(platforms: applePlatforms)), .product(name: "NIOFoundationCompat", package: "swift-nio"),
.product(name: "NIOTLS", package: "swift-nio"), .product(name: "NIOTLS", package: "swift-nio"),
.product(name: "Atomics", package: "swift-atomics"), .product(name: "Atomics", package: "swift-atomics"),
]), ]),