Skip to content

Disable adding '-external-plugin-path' in integrated driver mode #1356

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 2 commits into from
May 9, 2023
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
1 change: 1 addition & 0 deletions Sources/SwiftDriver/Toolchains/DarwinToolchain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ public final class DarwinToolchain: Toolchain {
// Pass -external-plugin-path if the current toolchain is not a Xcode
// default toolchain.
if
!driver.integratedDriver,
driver.isFrontendArgSupported(.externalPluginPath),
let xcodeDir = try self.findCurrentSelectedXcodeDir(),
try !self.executableDir.isDescendant(of: xcodeDir),
Expand Down
22 changes: 22 additions & 0 deletions Tests/SwiftDriverTests/SwiftDriverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6776,6 +6776,7 @@ final class SwiftDriverTests: XCTestCase {

try withTemporaryDirectory { tmpDir in
var driver = try Driver(args: ["swiftc", "-typecheck", "foo.swift"],
integratedDriver: false,
compilerExecutableDir: tmpDir)
guard driver.isFrontendArgSupported(.externalPluginPath) else {
return
Expand Down Expand Up @@ -6818,6 +6819,27 @@ final class SwiftDriverTests: XCTestCase {
}
}

func testExternalPluginPathsDisabled() throws {
#if !os(macOS)
throw XCTSkip("Supported only in macOS")
#endif

try withTemporaryDirectory { tmpDir in
var driver = try Driver(args: ["swiftc", "-typecheck", "foo.swift"],
integratedDriver: true,
compilerExecutableDir: tmpDir)
guard driver.isFrontendArgSupported(.externalPluginPath) else {
return
}

let jobs = try driver.planBuild().removingAutolinkExtractJobs()
XCTAssertEqual(jobs.count, 1)
let job = jobs.first!

XCTAssertFalse(job.commandLine.contains(.flag("-external-plugin-path")))
}
}

func testClangModuleValidateOnce() throws {
let flagTest = try Driver(args: ["swiftc", "-typecheck", "foo.swift"])
guard flagTest.isFrontendArgSupported(.clangBuildSessionFile),
Expand Down