Skip to content

Commit 4f82cbd

Browse files
Merge pull request #1948 from cachemeifyoucan/eng/PR-154780122-6.2
[6.2][Macro] Do not drop `in-process-plugin-server-path` option
2 parents 4b37647 + 8c67298 commit 4f82cbd

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -566,23 +566,23 @@ extension Driver {
566566
.appending(components: frontendTargetInfo.target.triple.platformName() ?? "", "Swift.swiftmodule")
567567
let hasToolchainStdlib = try fileSystem.exists(toolchainStdlibPath)
568568

569-
let skipMacroOptions = isPlanJobForExplicitModule && isFrontendArgSupported(.loadResolvedPlugin)
569+
let skipMacroSearchPath = isPlanJobForExplicitModule && isFrontendArgSupported(.loadResolvedPlugin)
570570
// If the resource directory has the standard library, prefer the toolchain's plugins
571571
// to the platform SDK plugins.
572572
// For explicit module build, the resolved plugins are provided by scanner.
573-
if hasToolchainStdlib, !skipMacroOptions {
574-
try addPluginPathArguments(commandLine: &commandLine)
573+
if hasToolchainStdlib {
574+
try addPluginPathArguments(commandLine: &commandLine, skipMacroSearchPath: skipMacroSearchPath)
575575
}
576576

577577
try toolchain.addPlatformSpecificCommonFrontendOptions(commandLine: &commandLine,
578578
inputs: &inputs,
579579
frontendTargetInfo: frontendTargetInfo,
580580
driver: &self,
581-
skipMacroOptions: skipMacroOptions)
581+
skipMacroOptions: skipMacroSearchPath)
582582

583583
// Otherwise, prefer the platform's plugins.
584-
if !hasToolchainStdlib, !skipMacroOptions {
585-
try addPluginPathArguments(commandLine: &commandLine)
584+
if !hasToolchainStdlib {
585+
try addPluginPathArguments(commandLine: &commandLine, skipMacroSearchPath: skipMacroSearchPath)
586586
}
587587

588588
if let passPluginPath = parsedOptions.getLastArgument(.loadPassPluginEQ),
@@ -937,7 +937,7 @@ extension Driver {
937937
try explicitDependencyBuildPlanner?.resolveBridgingHeaderDependencies(inputs: &inputs, commandLine: &commandLine)
938938
}
939939

940-
mutating func addPluginPathArguments(commandLine: inout [Job.ArgTemplate]) throws {
940+
mutating func addPluginPathArguments(commandLine: inout [Job.ArgTemplate], skipMacroSearchPath: Bool) throws {
941941
guard isFrontendArgSupported(.pluginPath) else {
942942
return
943943
}
@@ -952,6 +952,10 @@ extension Driver {
952952
#endif
953953
}
954954

955+
guard !skipMacroSearchPath else {
956+
return
957+
}
958+
955959
// Default paths for compiler plugins found within the toolchain
956960
// (loaded as shared libraries).
957961
commandLine.appendFlag(.pluginPath)

Tests/SwiftDriverTests/CachingBuildTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,9 @@ final class CachingBuildTests: XCTestCase {
939939
})
940940
/// command-line that compiles swift should contains -cache-replay-prefix-map
941941
XCTAssertTrue(command.contains { $0 == "-cache-replay-prefix-map" })
942+
if job.kind == .compile {
943+
XCTAssertTrue(command.contains { $0 == "-in-process-plugin-server-path" })
944+
}
942945
XCTAssertFalse(command.contains { $0 == "-plugin-path" || $0 == "-external-plugin-path" ||
943946
$0 == "-load-plugin-library" || $0 == "-load-plugin-executable" })
944947
}

0 commit comments

Comments
 (0)