Skip to content

Commit abb6015

Browse files
authored
Merge pull request #42 from owenv/direct-invoke-frontend-fix
Fix direct invocation of non-compiler driver kinds
2 parents 432e5ec + af16569 commit abb6015

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

Sources/SwiftDriver/Driver/Driver.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ extension Driver {
548548
// We just need to invoke the corresponding tool if the kind isn't Swift compiler.
549549
guard driverKind.isSwiftCompiler else {
550550
let swiftCompiler = try getSwiftCompilerPath()
551-
return try exec(path: swiftCompiler.pathString, args: ["swift"] + parsedOptions.commandLine)
551+
return try exec(path: swiftCompiler.pathString, args: driverKind.usageArgs + parsedOptions.commandLine)
552552
}
553553

554554
if parsedOptions.contains(.help) || parsedOptions.contains(.helpHidden) {

Sources/SwiftDriver/Driver/DriverKind.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,28 @@ extension DriverKind {
4848
}
4949
}
5050

51+
public var usageArgs: [String] {
52+
switch self {
53+
case .autolinkExtract:
54+
return ["swift-autolink-extract"]
55+
56+
case .batch:
57+
return ["swiftc"]
58+
59+
case .frontend:
60+
return ["swift", "-frontend"]
61+
62+
case .indent:
63+
return ["swift-indent"]
64+
65+
case .interactive:
66+
return ["swift"]
67+
68+
case .moduleWrap:
69+
return ["swift-modulewrap"]
70+
}
71+
}
72+
5173
public var title: String {
5274
switch self {
5375
case .autolinkExtract:

0 commit comments

Comments
 (0)