Skip to content

Commit 6d1e5d2

Browse files
authored
Merge pull request #1616 from rintaro/in-process-plugin-server
Add In-process plugin server path
2 parents 7eb6a10 + 2e9f154 commit 6d1e5d2

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift

+10-1
Original file line numberDiff line numberDiff line change
@@ -790,10 +790,19 @@ extension Driver {
790790
guard isFrontendArgSupported(.pluginPath) else {
791791
return
792792
}
793+
let pluginPathRoot = VirtualPath.absolute(try toolchain.executableDir.parentDirectory)
794+
795+
if isFrontendArgSupported(.inProcessPluginServerPath) {
796+
commandLine.appendFlag(.inProcessPluginServerPath)
797+
#if os(Windows)
798+
commandLine.appendPath(pluginPathRoot.appending(components: "bin", sharedLibraryName("SwiftInProcPluginServer")))
799+
#else
800+
commandLine.appendPath(pluginPathRoot.appending(components: "lib", "swift", "host", sharedLibraryName("libSwiftInProcPluginServer")))
801+
#endif
802+
}
793803

794804
// Default paths for compiler plugins found within the toolchain
795805
// (loaded as shared libraries).
796-
let pluginPathRoot = VirtualPath.absolute(try toolchain.executableDir.parentDirectory)
797806
commandLine.appendFlag(.pluginPath)
798807
commandLine.appendPath(pluginPathRoot.pluginPath)
799808

Sources/SwiftOptions/Options.swift

+2
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,7 @@ extension Option {
553553
public static let importPrescan: Option = Option("-import-prescan", .flag, attributes: [.frontend, .noDriver], helpText: "When performing a dependency scan, only identify all imports of the main Swift module sources")
554554
public static let importUnderlyingModule: Option = Option("-import-underlying-module", .flag, attributes: [.frontend, .noInteractive], helpText: "Implicitly imports the Objective-C half of a module")
555555
public static let inPlace: Option = Option("-in-place", .flag, attributes: [.noInteractive, .noBatch, .indent], helpText: "Overwrite input file with formatted file.", group: .codeFormatting)
556+
public static let inProcessPluginServerPath: Option = Option("-in-process-plugin-server-path", .separate, attributes: [.frontend, .argumentIsPath], helpText: "Path to dynamic library plugin server")
556557
public static let includeSpiSymbols: Option = Option("-include-spi-symbols", .flag, attributes: [.helpHidden, .frontend, .noInteractive, .supplementaryOutput], helpText: "Add symbols with SPI information to the symbol graph")
557558
public static let incremental: Option = Option("-incremental", .flag, attributes: [.helpHidden, .noInteractive, .doesNotAffectIncrementalBuild], helpText: "Perform an incremental build if possible")
558559
public static let indentSwitchCase: Option = Option("-indent-switch-case", .flag, attributes: [.noInteractive, .noBatch, .indent], helpText: "Indent cases in switch statements.", group: .codeFormatting)
@@ -1416,6 +1417,7 @@ extension Option {
14161417
Option.importPrescan,
14171418
Option.importUnderlyingModule,
14181419
Option.inPlace,
1420+
Option.inProcessPluginServerPath,
14191421
Option.includeSpiSymbols,
14201422
Option.incremental,
14211423
Option.indentSwitchCase,

0 commit comments

Comments
 (0)