Skip to content

[SwiftBuild] Exclude implicit executable plugin tools from package product reporting in SwiftPM #775

Description

@kateinoigakukun

Description

Follow-up from #773.

SwiftPM currently surfaces implicit executable products that exist only to satisfy build-tool plugin dependencies as if they were ordinary package products. That pollutes package product reporting and can cause aggregate destination builds to try to build host-only plugin helper executables as wasm artifacts.

The minimum reproducer targets the related command-plugin built-artifact selection path. It has a small Runner library with a test target and a DumpTests command plugin that asks SwiftPM to build the umbrella test product RunnerReproPackageTests. With SwiftBuild, that request fails while the native/control build succeeds.

Expected behavior

Internal helper executables used by plugins should remain implementation details and should not be serialized or reported as user-facing package products.

In this reproducer:

  • --build-system native dump-tests should build the umbrella test product and report the built test runner artifact.
  • --build-system swiftbuild dump-tests should do the same, without looking for a non-existent SDK named webassembly.
  • Command plugin flows should still find the artifacts they need.

Actual behavior

Using the requested 2026-06-12 Linux snapshot and swift-DEVELOPMENT-SNAPSHOT-2026-06-12-a_wasm SDK:

  • --build-system native exits 0 and reports succeeded: true and Build of product 'RunnerReproPackageTests' complete!.
  • --build-system swiftbuild exits 1 and reports:
error: unable to find sdk 'webassembly'
error: Build failed
succeeded: false

Steps to reproduce

Download the existing minimum reproducer zip from the issue comment:

https://gist.githubusercontent.com/kateinoigakukun/ba21c654a675032aa77906877c906e53/raw/49009ab10eede7013f079a9efc54114912dd589b/775-plugin-product-reporting.zip

Then run:

unzip 775-plugin-product-reporting.zip
cd 775-plugin-product-reporting

env \
  TOOLCHAIN=/home/ubuntu/.local/share/swiftly/toolchains/main-snapshot-2026-06-12 \
  TOOLCHAINS=/home/ubuntu/.local/share/swiftly/toolchains/main-snapshot-2026-06-12 \
  SWIFT_SDK_ID=swift-DEVELOPMENT-SNAPSHOT-2026-06-12-a_wasm \
  bash ./repro.sh

The script itself was not edited for the Linux verification. The environment overrides select the requested Linux Swift toolchain and SDK instead of the script's macOS/2026-05-27 defaults.

Swift Package Manager version/commit hash

Swift Package Manager - Swift 6.5.0-dev

Swift & OS version (output of swift --version ; uname -a)

Swift version 6.5-dev (LLVM 18d2bfb70c14d89, Swift c13d82e5987aecb)
Target: x86_64-unknown-linux-gnu
Build config: +assertions
Linux swift-dev.fugu.katei.dev 6.8.0-94-generic #96-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan  9 20:36:55 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions