Skip to content

Commit ee9d0b2

Browse files
MaxDesiatovxedin
andauthored
Fix –-toolchain value shadowed by local executables (#7483)
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]>
1 parent 517b1ce commit ee9d0b2

25 files changed

+927
-155
lines changed

Sources/Basics/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ add_library(Basics
2929
Errors.swift
3030
FileSystem/AbsolutePath.swift
3131
FileSystem/FileSystem+Extensions.swift
32+
FileSystem/InMemoryFileSystem.swift
3233
FileSystem/NativePathExtensions.swift
3334
FileSystem/RelativePath.swift
3435
FileSystem/TemporaryFile.swift

Sources/Basics/FileSystem/FileSystem+Extensions.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift open source project
44
//
5-
// Copyright (c) 2020-2021 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2020-2024 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See http://swift.org/LICENSE.txt for license information
@@ -21,7 +21,6 @@ import class TSCBasic.FileLock
2121
import enum TSCBasic.FileMode
2222
import protocol TSCBasic.FileSystem
2323
import enum TSCBasic.FileSystemAttribute
24-
import class TSCBasic.InMemoryFileSystem
2524
import var TSCBasic.localFileSystem
2625
import protocol TSCBasic.WritableByteStream
2726

0 commit comments

Comments
 (0)