Skip to content

[Traits] Add tests to assert trait-guarded target dependencies are omitted from linking #8626

Open
@bripeticca

Description

@bripeticca

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.

Description

As per a discussion on the Swift Forums, the latest release of swift (which is 6.1 currently) had an issue with traits and the way they were guarding target dependencies in the resulting binary. Trait-guarded dependencies ended up being included in the linking stage, which shouldn't occur.

Testing this on the release/6.1 branch of swift-package-manager confirmed this issue is present.

As of the latest main it doesn't seem like this is an issue anymore, however there should be some tests asserting the omission of trait-guarded target dependencies so that we can track that this is working as expected.

Expected behavior

We should have some tests that check for the way traits guard against target dependencies and how it affects the resulting build graph + linking.

Actual behavior

No response

Steps to reproduce

No response

Swift Package Manager version/commit hash

No response

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

No response

Metadata

Metadata

Assignees

Labels

bugtest suiteimprovements to SwiftPM test suite

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions