Skip to content

Commit 2938a1d

Browse files
authored
Merge pull request #1357 from rintaro/5.9-external-plugin-path-rdar109060298
[5.9] Disable adding '-external-plugin-path' in integrated driver mode
2 parents a52f544 + 74223ef commit 2938a1d

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

Sources/SwiftDriver/Toolchains/DarwinToolchain.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ public final class DarwinToolchain: Toolchain {
376376
// Pass -external-plugin-path if the current toolchain is not a Xcode
377377
// default toolchain.
378378
if
379+
!driver.integratedDriver,
379380
driver.isFrontendArgSupported(.externalPluginPath),
380381
let xcodeDir = try self.findCurrentSelectedXcodeDir(),
381382
try !self.executableDir.isDescendant(of: xcodeDir),

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6734,6 +6734,7 @@ final class SwiftDriverTests: XCTestCase {
67346734

67356735
try withTemporaryDirectory { tmpDir in
67366736
var driver = try Driver(args: ["swiftc", "-typecheck", "foo.swift"],
6737+
integratedDriver: false,
67376738
compilerExecutableDir: tmpDir)
67386739
guard driver.isFrontendArgSupported(.externalPluginPath) else {
67396740
return
@@ -6776,6 +6777,27 @@ final class SwiftDriverTests: XCTestCase {
67766777
}
67776778
}
67786779

6780+
func testExternalPluginPathsDisabled() throws {
6781+
#if !os(macOS)
6782+
throw XCTSkip("Supported only in macOS")
6783+
#endif
6784+
6785+
try withTemporaryDirectory { tmpDir in
6786+
var driver = try Driver(args: ["swiftc", "-typecheck", "foo.swift"],
6787+
integratedDriver: true,
6788+
compilerExecutableDir: tmpDir)
6789+
guard driver.isFrontendArgSupported(.externalPluginPath) else {
6790+
return
6791+
}
6792+
6793+
let jobs = try driver.planBuild().removingAutolinkExtractJobs()
6794+
XCTAssertEqual(jobs.count, 1)
6795+
let job = jobs.first!
6796+
6797+
XCTAssertFalse(job.commandLine.contains(.flag("-external-plugin-path")))
6798+
}
6799+
}
6800+
67796801
func testClangModuleValidateOnce() throws {
67806802
let flagTest = try Driver(args: ["swiftc", "-typecheck", "foo.swift"])
67816803
guard flagTest.isFrontendArgSupported(.clangBuildSessionFile),

0 commit comments

Comments
 (0)