Skip to content

[6.2][Macro] Do not drop in-process-plugin-server-path option #1948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -566,23 +566,23 @@ extension Driver {
.appending(components: frontendTargetInfo.target.triple.platformName() ?? "", "Swift.swiftmodule")
let hasToolchainStdlib = try fileSystem.exists(toolchainStdlibPath)

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

try toolchain.addPlatformSpecificCommonFrontendOptions(commandLine: &commandLine,
inputs: &inputs,
frontendTargetInfo: frontendTargetInfo,
driver: &self,
skipMacroOptions: skipMacroOptions)
skipMacroOptions: skipMacroSearchPath)

// Otherwise, prefer the platform's plugins.
if !hasToolchainStdlib, !skipMacroOptions {
try addPluginPathArguments(commandLine: &commandLine)
if !hasToolchainStdlib {
try addPluginPathArguments(commandLine: &commandLine, skipMacroSearchPath: skipMacroSearchPath)
}

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

mutating func addPluginPathArguments(commandLine: inout [Job.ArgTemplate]) throws {
mutating func addPluginPathArguments(commandLine: inout [Job.ArgTemplate], skipMacroSearchPath: Bool) throws {
guard isFrontendArgSupported(.pluginPath) else {
return
}
Expand All @@ -952,6 +952,10 @@ extension Driver {
#endif
}

guard !skipMacroSearchPath else {
return
}

// Default paths for compiler plugins found within the toolchain
// (loaded as shared libraries).
commandLine.appendFlag(.pluginPath)
Expand Down
3 changes: 3 additions & 0 deletions Tests/SwiftDriverTests/CachingBuildTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,9 @@ final class CachingBuildTests: XCTestCase {
})
/// command-line that compiles swift should contains -cache-replay-prefix-map
XCTAssertTrue(command.contains { $0 == "-cache-replay-prefix-map" })
if job.kind == .compile {
XCTAssertTrue(command.contains { $0 == "-in-process-plugin-server-path" })
}
XCTAssertFalse(command.contains { $0 == "-plugin-path" || $0 == "-external-plugin-path" ||
$0 == "-load-plugin-library" || $0 == "-load-plugin-executable" })
}
Expand Down