Skip to content

Commit 503eff0

Browse files
committed
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 <pyaskevich@apple.com> (cherry picked from commit ee9d0b2) # Conflicts: # Sources/PackageModel/UserToolchain.swift
1 parent bb7f039 commit 503eff0

25 files changed

+927
-154
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 & 1 deletion
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

0 commit comments

Comments
 (0)