Replace import Foundation with FoundationEssentials#897
Replace import Foundation with FoundationEssentials#897madsodgaard wants to merge 16 commits intoswift-server:mainfrom
import Foundation with FoundationEssentials#897Conversation
|
One option could be to vendor / copy the percent encoding from |
|
@t089 Yeah, that is similar to what I did for |
|
Feels like we should create a swift-percent-encoding nano package ... if only there was a package that could host such foundational essentials ... |
|
Unfortunately the |
|
Created swiftlang/swift-foundation#1796 |
This is based off the test included in swift-server/async-http-client#897 by @Mads
* Include LinkageTest to avoid accidentally linking Foundation This is based off the test included in swift-server/async-http-client#897 by @Mads * try simplified linkage test and install java before it * work on env var * JAVA_HOME detection in LinkageTest * fix typo
| .package(url: "https://github.com/apple/swift-distributed-tracing.git", from: "1.3.0"), | ||
| .package(url: "https://github.com/apple/swift-configuration.git", from: "1.0.0"), | ||
| // Disable all traits to prevent linking Foundation | ||
| .package(url: "https://github.com/apple/swift-configuration.git", from: "1.0.0", traits: []), |
There was a problem hiding this comment.
Nope, since AHC wasn't using any of the API that's guarded by the default traits.
|
Hey, just wanted to follow up on this. Anything missing from my end? Would be great to move this along, it's one of the final things missing for us to remove full Foundation dependency👍 |
Replaces all the foundation imports.
One issue is that
HTTPClient.init?(httpsURLWithSocketPath socketPath: String, uri: String = "/")usesaddingPercentEncoding()from Foundation. So instead, we use a pure Swift impl. that does the same.We also need to disable default traits from
swift-configurationto prevent linking Foundation, because theJSONtrait does that.This also adds a linkage test to prevent regressions to CI.