swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.65k stars 1.31k forks source link

[Traits] Add experimental flags to enable specific or all traits, disable default traits #7694

Closed FranzBusch closed 1 week ago

FranzBusch commented 1 week ago

Motivation

When building, testing or running a root package we want users to be able to change the traits enabled in the packages. This allows them to build binaries with different traits enabled or run tests with different traits.

Modification

This PR adds trait options to a few commands and wires them through to the ModuleGraph loading and the build description caching. The latter is important to trigger rebuilds when the trait configuration has changed. Along the way I refactored the GraphLoadingNode and externalised the logic to calculate traits since I need slightly different logic for the root nodes and for the dependency nodes.

Result

swift build/run now support passing trait configuration.

FranzBusch commented 1 week ago

@swift-ci please test

FranzBusch commented 1 week ago

@swift-ci please test

FranzBusch commented 1 week ago

@swift-ci test windows

MaxDesiatov commented 1 week ago

@swift-ci test windows