File tree 3 files changed +11
-5
lines changed 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -797,15 +797,15 @@ public class SwiftTool<Options: ToolOptions> {
797
797
/// Lazily compute the destination toolchain.
798
798
private lazy var _destinationToolchain : Result < UserToolchain , Swift . Error > = {
799
799
var destination : Destination
800
+ let hostDestination : Destination
800
801
do {
802
+ hostDestination = try self . _hostToolchain. get ( ) . destination
801
803
// Create custom toolchain if present.
802
804
if let customDestination = self . options. customCompileDestination {
803
805
destination = try Destination ( fromFile: customDestination)
804
806
} else {
805
807
// Otherwise use the host toolchain.
806
- destination = try Destination . hostDestination (
807
- originalWorkingDirectory: self . originalWorkingDirectory
808
- )
808
+ destination = hostDestination
809
809
}
810
810
} catch {
811
811
return . failure( error)
@@ -820,6 +820,12 @@ public class SwiftTool<Options: ToolOptions> {
820
820
if let sdk = self . options. customCompileSDK {
821
821
destination. sdk = sdk
822
822
}
823
+
824
+ // Check if we ended up with the host toolchain.
825
+ if hostDestination == destination {
826
+ return self . _hostToolchain
827
+ }
828
+
823
829
return Result ( catching: { try UserToolchain ( destination: destination) } )
824
830
} ( )
825
831
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ import TSCBasic
18
18
/// @see Destination.target
19
19
/// @see https://github.com/apple/swift-llvm/blob/stable/include/llvm/ADT/Triple.h
20
20
///
21
- public struct Triple : Encodable {
21
+ public struct Triple : Encodable , Equatable {
22
22
public let tripleString : String
23
23
24
24
public let arch : Arch
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ extension DestinationError: CustomStringConvertible {
23
23
}
24
24
25
25
/// The compilation destination, has information about everything that's required for a certain destination.
26
- public struct Destination : Encodable {
26
+ public struct Destination : Encodable , Equatable {
27
27
28
28
/// The clang/LLVM triple describing the target OS and architecture.
29
29
///
You can’t perform that action at this time.
0 commit comments