@@ -126,6 +126,9 @@ public struct Driver {
126
126
frontendTargetInfo. targetVariant? . triple
127
127
}
128
128
129
+ /// `true` if the driver should use the static resource directory.
130
+ let useStaticResourceDir : Bool
131
+
129
132
/// The kind of driver.
130
133
let driverKind : DriverKind
131
134
@@ -342,12 +345,21 @@ public struct Driver {
342
345
try Self . applyWorkingDirectory ( workingDirectory, to: & self . parsedOptions)
343
346
}
344
347
348
+ let staticExecutable = parsedOptions. hasFlag ( positive: . staticExecutable,
349
+ negative: . noStaticExecutable,
350
+ default: false )
351
+ let staticStdlib = parsedOptions. hasFlag ( positive: . staticStdlib,
352
+ negative: . noStaticStdlib,
353
+ default: false )
354
+ self . useStaticResourceDir = staticExecutable || staticStdlib
355
+
345
356
// Build the toolchain and determine target information.
346
357
( self . toolchain, self . frontendTargetInfo, self . swiftCompilerPrefixArgs) =
347
358
try Self . computeToolchain (
348
359
& self . parsedOptions, diagnosticsEngine: diagnosticEngine,
349
360
compilerMode: self . compilerMode, env: env,
350
- executor: self . executor, fileSystem: fileSystem)
361
+ executor: self . executor, fileSystem: fileSystem,
362
+ useStaticResourceDir: self . useStaticResourceDir)
351
363
352
364
// Classify and collect all of the input files.
353
365
let inputFiles = try Self . collectInputFiles ( & self . parsedOptions)
@@ -1933,7 +1945,8 @@ extension Driver {
1933
1945
compilerMode: CompilerMode ,
1934
1946
env: [ String : String ] ,
1935
1947
executor: DriverExecutor ,
1936
- fileSystem: FileSystem
1948
+ fileSystem: FileSystem ,
1949
+ useStaticResourceDir: Bool
1937
1950
) throws -> ( Toolchain , FrontendTargetInfo , [ String ] ) {
1938
1951
let explicitTarget = ( parsedOptions. getLastArgument ( . target) ? . asSingle)
1939
1952
. map {
@@ -1952,16 +1965,6 @@ extension Driver {
1952
1965
resourceDirPath = nil
1953
1966
}
1954
1967
1955
- var useStaticResourceDir = false
1956
- if parsedOptions. hasFlag ( positive: . staticExecutable,
1957
- negative: . noStaticExecutable,
1958
- default: false ) ||
1959
- parsedOptions. hasFlag ( positive: . staticStdlib,
1960
- negative: . noStaticStdlib,
1961
- default: false ) {
1962
- useStaticResourceDir = true
1963
- }
1964
-
1965
1968
let toolchainType = try explicitTarget? . toolchainType ( diagnosticsEngine) ??
1966
1969
defaultToolchainType
1967
1970
// Find tools directory and pass it down to the toolchain
0 commit comments