Skip to content

Conversation

@MaxDesiatov
Copy link
Contributor

@MaxDesiatov MaxDesiatov commented Apr 23, 2024

Cherry-pick of #7483.

Explanation: Behavior of --toolchain regressed in https://github.com/apple/swift-package-manager/pull/7296/files by preferring the first match in toolset root paths: when swiftc is available in the same directory next to the SwiftPM binary being invoked, that became preferred with --toolchain value ignored.
Scope: limited to cross-compilation and infrequent builds that utilize this option.
Risk: low due to limited scope, merged to main for a week with no regressions discovered.
Testing: A newly added test verifies that the behavior is fixed. For that we had to inject FileSystem and EnvironmentVariables in a lot more places, with an added benefit of making our tests more consistent and isolated from an arbitrary build environment.
Issue: rdar://126095653
Reviewer: @bnbarham

@MaxDesiatov MaxDesiatov added the swift 6.0 Related to Swift 6.0 release branch label Apr 23, 2024
@MaxDesiatov
Copy link
Contributor Author

@swift-ci test

@MaxDesiatov MaxDesiatov marked this pull request as draft April 23, 2024 11:47
Behavior of `--toolchain` regressed in
#7296 by
preferring the first match in toolset root paths: when `swiftc` is
available in the same directory next to the SwiftPM binary being
invoked, that became preferred with `--toolchain` value ignored.

This is now fixed by slightly tweaking where custom toolchain gets added
- it's prepended.

A newly added test verifies that the behavior is fixed. For that we had
to inject `FileSystem` and `EnvironmentVariables` in a lot more places,
with an added benefit of making our tests more consistent and isolated
from an arbitrary build environment.

Resolves: rdar://126095653

---------

Co-authored-by: Pavel Yaskevich <[email protected]>
(cherry picked from commit ee9d0b2)

# Conflicts:
#	Sources/PackageModel/UserToolchain.swift
@MaxDesiatov MaxDesiatov force-pushed the maxd/test-toolchain-argument-6.0 branch from 968bde4 to 503eff0 Compare June 12, 2024 11:40
@MaxDesiatov MaxDesiatov changed the title [6.0] Cover –-toolchain argument in SwiftCommandStateTests [6.0] Fix –-toolchain value shadowed by local executables Jun 12, 2024
@MaxDesiatov
Copy link
Contributor Author

@swift-ci test

@MaxDesiatov MaxDesiatov removed the request for review from tomerd June 12, 2024 14:24
@MaxDesiatov
Copy link
Contributor Author

@swift-ci test

@MaxDesiatov
Copy link
Contributor Author

@swift-ci test windows

@MaxDesiatov MaxDesiatov marked this pull request as ready for review June 13, 2024 17:17
@MaxDesiatov MaxDesiatov requested a review from a team as a code owner June 13, 2024 17:17
@MaxDesiatov MaxDesiatov enabled auto-merge (squash) June 13, 2024 18:36
@MaxDesiatov MaxDesiatov merged commit 616edfd into release/6.0 Jun 13, 2024
@MaxDesiatov MaxDesiatov deleted the maxd/test-toolchain-argument-6.0 branch June 13, 2024 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command-line interface cross-compilation swift 6.0 Related to Swift 6.0 release branch test suite improvements to SwiftPM test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants