Skip to content

build: Elide NIOEmbedded for WASI platforms only#3484

Merged
Lukasa merged 1 commit intoapple:mainfrom
PassiveLogic:build/elideNIOEmbeddedFromWasmBuilds
Jan 22, 2026
Merged

build: Elide NIOEmbedded for WASI platforms only#3484
Lukasa merged 1 commit intoapple:mainfrom
PassiveLogic:build/elideNIOEmbeddedFromWasmBuilds

Conversation

@scottmarchant
Copy link
Copy Markdown
Contributor

@scottmarchant scottmarchant commented Jan 19, 2026

Motivation:

Packages that consume NIOEmbedded should be able to compile to WASI platforms without special configurations. This change elides the NIOEmbedded source from WASI platforms to simplify configuration.

Without this change:

dependencies: [
    // Without this PR, downstream packages must maintain exhaustive platform list to exclude `.wasi`:
    .product(
        name: "NIOEmbedded",
        package: "swift-nio",
        condition: .when(platforms: [
            .macOS,
            .macCatalyst,
            .iOS,
            .tvOS,
            .watchOS,
            .visionOS,
            .driverKit,
            .linux,
            .windows,
            .android,
            .openbsd,
            // .wasi // <-- Need to exclude this, because there is no exclusion list api for SPM conditionals
        ])
    ),
]

With this change:

dependencies: [
    // Without this PR, downstream packages can consume NIOEmbedded simply:
    .product(name: "NIOEmbedded", package: "swift-nio"),
]

Modifications:

  • Fix compiler directive using in AsyncTestingChannel.swift to include an extension

Result:

Packages can compile to wasm without manually excluding the NIOEmbedded dependency.

Testing performed

  • Verified swift build --swift-sdk wasm32-unknown-wasip1 --target NIOEmbedded compiles, which demonstrates proper elision of source files in NIOEmbedded that aren't wasm-ready.
  • Confirmed GitHub checks pass.

@scottmarchant scottmarchant marked this pull request as ready for review January 19, 2026 21:45
@Lukasa Lukasa added the 🔨 semver/patch No public API change. label Jan 22, 2026
Copy link
Copy Markdown
Contributor

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, LGTM.

…y. This simplifies dependency chain consumption of NIOEmbedded and NIOAsyncRuntime side-by-side. Eliminates the need for downstream packages to use compilation conditions.
@scottmarchant scottmarchant force-pushed the build/elideNIOEmbeddedFromWasmBuilds branch from 00e1500 to c92ef92 Compare January 22, 2026 18:00
@Lukasa Lukasa enabled auto-merge (squash) January 22, 2026 18:36
@Lukasa Lukasa merged commit 3f80264 into apple:main Jan 22, 2026
54 checks passed
@scottmarchant scottmarchant deleted the build/elideNIOEmbeddedFromWasmBuilds branch January 22, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants