Skip to content

Commit 9154926

Browse files
committed
Disable adding '-external-plugin-path' in integrated driver mode
rdar://109060298
1 parent 661d59f commit 9154926

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
@@ -6776,6 +6776,7 @@ final class SwiftDriverTests: XCTestCase {
67766776

67776777
try withTemporaryDirectory { tmpDir in
67786778
var driver = try Driver(args: ["swiftc", "-typecheck", "foo.swift"],
6779+
integratedDriver: false,
67796780
compilerExecutableDir: tmpDir)
67806781
guard driver.isFrontendArgSupported(.externalPluginPath) else {
67816782
return
@@ -6818,6 +6819,27 @@ final class SwiftDriverTests: XCTestCase {
68186819
}
68196820
}
68206821

6822+
func testExternalPluginPathsDisabled() throws {
6823+
#if !os(macOS)
6824+
throw XCTSkip("Supported only in macOS")
6825+
#endif
6826+
6827+
try withTemporaryDirectory { tmpDir in
6828+
var driver = try Driver(args: ["swiftc", "-typecheck", "foo.swift"],
6829+
integratedDriver: true,
6830+
compilerExecutableDir: tmpDir)
6831+
guard driver.isFrontendArgSupported(.externalPluginPath) else {
6832+
return
6833+
}
6834+
6835+
let jobs = try driver.planBuild().removingAutolinkExtractJobs()
6836+
XCTAssertEqual(jobs.count, 1)
6837+
let job = jobs.first!
6838+
6839+
XCTAssertFalse(job.commandLine.contains(.flag("-external-plugin-path")))
6840+
}
6841+
}
6842+
68216843
func testClangModuleValidateOnce() throws {
68226844
let flagTest = try Driver(args: ["swiftc", "-typecheck", "foo.swift"])
68236845
guard flagTest.isFrontendArgSupported(.clangBuildSessionFile),

0 commit comments

Comments
 (0)