Skip to content

Commit a3a1bfb

Browse files
committed
dump-symbol-graph: drop -emit-extension-block-symbols and -omit-extension-block-symbols flags for unsupported compiler versions
1 parent 137b508 commit a3a1bfb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Sources/Commands/Utilities/SymbolGraphExtract.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import PackageGraph
1616
import PackageModel
1717
import SPMBuildCore
1818
import TSCBasic
19+
import DriverSupport
1920

2021
/// A wrapper for swift-symbolgraph-extract tool.
2122
public struct SymbolGraphExtract {
@@ -71,11 +72,14 @@ public struct SymbolGraphExtract {
7172
if includeSPISymbols {
7273
commandLine += ["-include-spi-symbols"]
7374
}
74-
if emitExtensionBlockSymbols {
75-
commandLine += ["-emit-extension-block-symbols"]
75+
76+
let extensionBlockSymbolsFlag = emitExtensionBlockSymbols ? "-emit-extension-block-symbols" : "-omit-extension-block-symbols"
77+
if DriverSupport.checkSupportedFrontendFlags(flags: [extensionBlockSymbolsFlag.trimmingCharacters(in: ["-"])], fileSystem: fileSystem) {
78+
commandLine += [extensionBlockSymbolsFlag]
7679
} else {
77-
commandLine += ["-omit-extension-block-symbols"]
80+
print("warning: dropped \(extensionBlockSymbolsFlag) flag because it is not supported by this compiler version")
7881
}
82+
7983
switch outputFormat {
8084
case .json(let pretty):
8185
if pretty {

0 commit comments

Comments
 (0)