@@ -126,13 +126,16 @@ public final class UserToolchain: Toolchain {
126
126
fileSystem: any FileSystem
127
127
) throws -> AbsolutePath {
128
128
let executableName = " \( name) \( hostExecutableSuffix) "
129
+ print ( " getTool: \( executableName) in \( binDirectories) " )
129
130
var toolPath : AbsolutePath ?
130
131
131
132
for dir in binDirectories {
132
133
let path = dir. appending ( component: executableName)
133
134
guard fileSystem. isExecutableFile ( path) else {
135
+ print ( " Trying \( path) ... not executable file " )
134
136
continue
135
137
}
138
+ print ( " Trying \( path) ... SUCCESS " )
136
139
toolPath = path
137
140
// Take the first match.
138
141
break
@@ -230,19 +233,25 @@ public final class UserToolchain: Toolchain {
230
233
searchPaths: [ AbsolutePath ] ,
231
234
fileSystem: any FileSystem
232
235
) throws -> SwiftCompilers {
236
+ print ( " Determining swift compilers with binDirectories: \( binDirectories) , searchPaths: \( searchPaths) " )
233
237
func validateCompiler( at path: AbsolutePath ? ) throws {
238
+ print ( " Validating compiler at \( path) " )
234
239
guard let path else { return }
235
240
guard fileSystem. isExecutableFile ( path) else {
236
241
throw InvalidToolchainDiagnostic (
237
242
" could not find the `swiftc \( hostExecutableSuffix) ` at expected path \( path) "
238
243
)
239
244
}
245
+ print ( " VALID " )
240
246
}
241
247
242
248
let lookup = { UserToolchain . lookup ( variable: $0, searchPaths: searchPaths, environment: environment) }
243
249
// Get overrides.
244
250
let SWIFT_EXEC_MANIFEST = lookup ( " SWIFT_EXEC_MANIFEST " )
245
251
let SWIFT_EXEC = lookup ( " SWIFT_EXEC " )
252
+
253
+ print ( " SWIFT_EXEC: \( SWIFT_EXEC) " )
254
+ print ( " SWIFT_EXEC_MANIFEST: \( SWIFT_EXEC_MANIFEST) " )
246
255
247
256
// Validate the overrides.
248
257
try validateCompiler ( at: SWIFT_EXEC)
@@ -254,6 +263,7 @@ public final class UserToolchain: Toolchain {
254
263
if let SWIFT_EXEC {
255
264
resolvedBinDirCompiler = SWIFT_EXEC
256
265
} else if let binDirCompiler = try ? UserToolchain . getTool ( " swiftc " , binDirectories: binDirectories, fileSystem: fileSystem) {
266
+ print ( " Resolved directly to \( binDirCompiler) " )
257
267
resolvedBinDirCompiler = binDirCompiler
258
268
} else {
259
269
// Try to lookup swift compiler on the system which is possible when
@@ -264,6 +274,7 @@ public final class UserToolchain: Toolchain {
264
274
useXcrun: useXcrun,
265
275
fileSystem: fileSystem
266
276
)
277
+ print ( " Resolved eventually to \( resolvedBinDirCompiler) " )
267
278
}
268
279
269
280
// The compiler for compilation tasks is SWIFT_EXEC or the bin dir compiler.
@@ -541,12 +552,14 @@ public final class UserToolchain: Toolchain {
541
552
pathString: environment [ . path] ,
542
553
currentWorkingDirectory: fileSystem. currentWorkingDirectory
543
554
)
555
+ print ( " Default search strategy envSearchPaths= \( envSearchPaths) " )
544
556
self . useXcrun = true
545
557
case . custom( let searchPaths, let useXcrun) :
546
558
self . envSearchPaths = searchPaths
559
+ print ( " Custom search strategy envSearchPaths= \( envSearchPaths) " )
547
560
self . useXcrun = useXcrun
548
561
}
549
-
562
+ print ( " Toolset known tools: \( swiftSDK . toolset . knownTools ) " )
550
563
let swiftCompilers = try UserToolchain . determineSwiftCompilers (
551
564
binDirectories: swiftSDK. toolset. rootPaths,
552
565
useXcrun: self . useXcrun,
0 commit comments