Skip to content

[Package/Build] Remove SwiftTarget.toolsSwiftVersion in favor of a build setting #7557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

xedin
Copy link
Contributor

@xedin xedin commented May 14, 2024

Follow-up to #7544 and associated discussion related to how tools version doesn't mean what it used to with introduction of per-target swift version settings.

Motivation:

Unify handling of swift language version setting to make it harder for users to make mistakes when selected one.

Modifications:

  • Add a way to specify a default setting assignment

    This setting is going to be used if there are no non-default
    assignments that match build environment conditions.

  • Remove toolsSwiftVersion from SwiftTarget in favor of a build setting

    Start using "default" assignments to represent tools version
    based swift language version setting that is going to be produced
    by BuildSettings.Scope if no other assignments match build
    environment conditions.

    This removes ambiguity from -swift-version selection for
    downstream clients.

  • [PIF] Re-implement swift language version handling

    Since toolSwiftVersion is gone and swift language version is
    now handled by the build settings we need to adjust PIFBuilder
    to handle that properly.

    PIF build settings can handle per-target platform specific settings
    which are now expressible in SwiftPM via .swiftLanguageVersion
    build setting, handling of such settings is implemented in this commit

Result:

Swift language version is handled uniformly as a build setting.

xedin added 3 commits May 13, 2024 14:54
This setting is going to be used if there are no non-default
assignments that match build environment conditions.
…of a build setting

Start using "default" assignments to represent tools version
based swift language version setting that is going to be produced
by `BuildSettings.Scope` if no other assignments match build
environment conditions.

This removes ambiguity from `-swift-version` selection for
downstream clients.
Since `toolSwiftVersion` is gone and swift language version is
now handled by the build settings we need to adjust `PIFBuilder`
to handle that properly.

PIF build settings can handle per-target platform specific settings
which are now expressible in SwiftPM via `.swiftLanguageVersion`
build setting, handling of such settings is implemented in this commit.
@xedin
Copy link
Contributor Author

xedin commented May 14, 2024

@swift-ci please test

@xedin xedin merged commit 3793551 into swiftlang:main May 14, 2024
5 checks passed
xedin added a commit that referenced this pull request May 16, 2024
- Explanation:

Implementation of SE-0435 proposal.

Add a new Swift target setting API, similar to `enable{Upcoming,
Experimental}Feature`,
to specify a Swift language version that should be used to build the
target, if such
version is not specified, fallback to the current language version
determination logic.

- Scope: TargetDescription API and build system.

- Main Branch PRs:
#7439,
#7544,
#7550,
#7557

- Radar: rdar://125732014

- Risk: Low

- Reviewed By: @MaxDesiatov @bnbarham 

- Testing: Added new test-cases to the test suite.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants