@@ -27,26 +27,6 @@ fileprivate func shouldColorDiagnostics() -> Bool {
27
27
return TerminalController . isTTY ( stderrStream)
28
28
}
29
29
30
- extension VirtualPath {
31
- // Given a virtual path pointing into a toolchain/SDK/platform, produce the
32
- // path to `swift-plugin-server`.
33
- fileprivate var pluginServerPath : VirtualPath {
34
- self . appending ( components: " usr " , " swift-plugin-server " )
35
- }
36
-
37
- // Given a virtual path pointing into a toolchain/SDK/platform, produce the
38
- // path to the plugins.
39
- fileprivate var pluginPath : VirtualPath {
40
- self . appending ( components: " lib " , " swift " , " host " , " plugins " )
41
- }
42
-
43
- // Given a virtual path pointing into a toolchain/SDK/platform, produce the
44
- // path to the plugins.
45
- fileprivate var localPluginPath : VirtualPath {
46
- self . appending ( component: " local " ) . pluginPath
47
- }
48
- }
49
-
50
30
extension Driver {
51
31
/// How the bridging header should be handled.
52
32
enum BridgingHeaderHandling {
@@ -283,48 +263,9 @@ extension Driver {
283
263
284
264
// Emit user-provided plugin paths, in order.
285
265
if isFrontendArgSupported ( . externalPluginPath) {
286
- try commandLine. appendAll ( . pluginPath, . externalPluginPath, from: & parsedOptions)
266
+ try commandLine. appendAll ( . pluginPath, . externalPluginPath, . loadPluginLibrary , . loadPluginExecutable , from: & parsedOptions)
287
267
} else if isFrontendArgSupported ( . pluginPath) {
288
- try commandLine. appendAll ( . pluginPath, from: & parsedOptions)
289
- }
290
-
291
- if isFrontendArgSupported ( . externalPluginPath) , let sdkPath = frontendTargetInfo. sdkPath? . path {
292
- // Default paths for compiler plugins found within an SDK (accessed via
293
- // that SDK's plugin server).
294
- let sdkPathRoot = VirtualPath . lookup ( sdkPath) . appending ( components: " usr " )
295
- commandLine. appendFlag ( . externalPluginPath)
296
- commandLine. appendFlag ( " \( sdkPathRoot. pluginServerPath. name. spm_shellEscaped ( ) ) # \( sdkPathRoot. pluginPath. name) " )
297
-
298
- commandLine. appendFlag ( . externalPluginPath)
299
- commandLine. appendFlag ( " \( sdkPathRoot. pluginServerPath. name. spm_shellEscaped ( ) ) # \( sdkPathRoot. localPluginPath. name) " )
300
-
301
- // Default paths for compiler plugins within the platform (accessed via that
302
- // platform's plugin server).
303
- let platformPathRoot = VirtualPath . lookup ( sdkPath)
304
- . parentDirectory
305
- . parentDirectory
306
- . parentDirectory
307
- . appending ( components: " Developer " , " usr " )
308
- commandLine. appendFlag ( . externalPluginPath)
309
- commandLine. appendFlag ( " \( platformPathRoot. pluginServerPath. name. spm_shellEscaped ( ) ) # \( platformPathRoot. pluginPath. name) " )
310
-
311
- commandLine. appendFlag ( . externalPluginPath)
312
- commandLine. appendFlag ( " \( platformPathRoot. pluginServerPath. name. spm_shellEscaped ( ) ) # \( platformPathRoot. localPluginPath. name) " )
313
- }
314
-
315
- if isFrontendArgSupported ( . pluginPath) {
316
- // Default paths for compiler plugins found within the toolchain
317
- // (loaded as shared libraries).
318
- let pluginPathRoot = VirtualPath . absolute ( try toolchain. executableDir. parentDirectory)
319
- commandLine. appendFlag ( . pluginPath)
320
- commandLine. appendPath ( pluginPathRoot. pluginPath)
321
-
322
- commandLine. appendFlag ( . pluginPath)
323
- commandLine. appendPath ( pluginPathRoot. localPluginPath)
324
- }
325
-
326
- if isFrontendArgSupported ( . externalPluginPath) {
327
- try commandLine. appendAll ( . externalPluginPath, from: & parsedOptions)
268
+ try commandLine. appendAll ( . pluginPath, . loadPluginLibrary, from: & parsedOptions)
328
269
}
329
270
330
271
if isFrontendArgSupported ( . blockListFile) {
@@ -442,6 +383,18 @@ extension Driver {
442
383
inputs: & inputs,
443
384
frontendTargetInfo: frontendTargetInfo,
444
385
driver: & self )
386
+
387
+ // Platform-agnostic options that need to happen after platform-specific ones.
388
+ if isFrontendArgSupported ( . pluginPath) {
389
+ // Default paths for compiler plugins found within the toolchain
390
+ // (loaded as shared libraries).
391
+ let pluginPathRoot = VirtualPath . absolute ( try toolchain. executableDir. parentDirectory)
392
+ commandLine. appendFlag ( . pluginPath)
393
+ commandLine. appendPath ( pluginPathRoot. pluginPath)
394
+
395
+ commandLine. appendFlag ( . pluginPath)
396
+ commandLine. appendPath ( pluginPathRoot. localPluginPath)
397
+ }
445
398
}
446
399
447
400
mutating func addFrontendSupplementaryOutputArguments( commandLine: inout [ Job . ArgTemplate ] ,
0 commit comments