Fix Linux build: declare swift-nio as an explicit dependency for NIOFoundationCompat#56
Merged
Merged
Conversation
AsyncHTTPClientAdapter.swift imports NIOFoundationCompat (used for Data(buffer:) ByteBuffer conversion), but swift-nio was not declared as an explicit dependency in Package.swift. On Linux, NIOFoundationCompat is not re-exported through async-http-client, so the module cannot be found. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jamesrochabrun
approved these changes
Apr 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Building a package that depends on SwiftAnthropic on Linux currently fails with:
AsyncHTTPClientAdapter.swiftimportsNIOFoundationCompatto useData(buffer:)for converting theByteBufferreturned byasync-http-clientinto Foundation'sData. However,swift-nio— the package that providesNIOFoundationCompat— is not declared as an explicit dependency inPackage.swift.async-http-clientdepends onswift-niointernally, but does not re-exportNIOFoundationCompatas a product. Swift Package Manager does not guarantee that modules from transitive dependencies are importable, and in practice this build fails on Linux regardless of Swift version or runner environment.Fix
Add
swift-nioas an explicit package dependency and addNIOFoundationCompatas a Linux-conditional target dependency — matching the pattern already used forAsyncHTTPClient.The
from: "2.81.0"lower bound matches the minimumswift-nioversion already required byasync-http-client1.25.2+, so this introduces no new version constraints in practice.Verification
Tested against a minimal Swift 6.2 CLI package depending on SwiftAnthropic, built on
ubuntu-latestusing the officialswift:latestDocker container. The build fails onmainand passes with this fix applied.