@@ -84,12 +84,13 @@ extension Driver {
84
84
break
85
85
}
86
86
87
+ let isPlanJobForExplicitModule = parsedOptions. contains ( . driverExplicitModuleBuild) &&
88
+ moduleDependencyGraphUse == . computed
87
89
let jobNeedPathRemap : Bool
88
90
// If in ExplicitModuleBuild mode and the dependency graph has been computed, add module
89
91
// dependencies.
90
92
// May also be used for generation of the dependency graph itself in ExplicitModuleBuild mode.
91
- if ( parsedOptions. contains ( . driverExplicitModuleBuild) &&
92
- moduleDependencyGraphUse == . computed) {
93
+ if isPlanJobForExplicitModule {
93
94
switch kind {
94
95
case . generatePCH:
95
96
try addExplicitPCHBuildArguments ( inputs: & inputs, commandLine: & commandLine)
@@ -344,10 +345,12 @@ extension Driver {
344
345
}
345
346
346
347
// Emit user-provided plugin paths, in order.
347
- if isFrontendArgSupported ( . externalPluginPath) {
348
- try commandLine. appendAll ( . pluginPath, . externalPluginPath, . loadPluginLibrary, . loadPluginExecutable, from: & parsedOptions)
349
- } else if isFrontendArgSupported ( . pluginPath) {
350
- try commandLine. appendAll ( . pluginPath, . loadPluginLibrary, from: & parsedOptions)
348
+ if !isPlanJobForExplicitModule {
349
+ if isFrontendArgSupported ( . externalPluginPath) {
350
+ try commandLine. appendAll ( . pluginPath, . externalPluginPath, . loadPluginLibrary, . loadPluginExecutable, from: & parsedOptions)
351
+ } else if isFrontendArgSupported ( . pluginPath) {
352
+ try commandLine. appendAll ( . pluginPath, . loadPluginLibrary, from: & parsedOptions)
353
+ }
351
354
}
352
355
353
356
if isFrontendArgSupported ( . blockListFile) {
@@ -563,19 +566,22 @@ extension Driver {
563
566
. appending ( components: frontendTargetInfo. target. triple. platformName ( ) ?? " " , " Swift.swiftmodule " )
564
567
let hasToolchainStdlib = try fileSystem. exists ( toolchainStdlibPath)
565
568
569
+ let skipMacroOptions = isPlanJobForExplicitModule && isFrontendArgSupported ( . loadResolvedPlugin)
566
570
// If the resource directory has the standard library, prefer the toolchain's plugins
567
571
// to the platform SDK plugins.
568
- if hasToolchainStdlib {
572
+ // For explicit module build, the resolved plugins are provided by scanner.
573
+ if hasToolchainStdlib, !skipMacroOptions {
569
574
try addPluginPathArguments ( commandLine: & commandLine)
570
575
}
571
576
572
577
try toolchain. addPlatformSpecificCommonFrontendOptions ( commandLine: & commandLine,
573
578
inputs: & inputs,
574
579
frontendTargetInfo: frontendTargetInfo,
575
- driver: & self )
580
+ driver: & self ,
581
+ skipMacroOptions: skipMacroOptions)
576
582
577
583
// Otherwise, prefer the platform's plugins.
578
- if !hasToolchainStdlib {
584
+ if !hasToolchainStdlib, !skipMacroOptions {
579
585
try addPluginPathArguments ( commandLine: & commandLine)
580
586
}
581
587
0 commit comments