Skip to content

Commit cc40831

Browse files
committed
Merge buildAndIndexWithSystemSymbols with buildAndIndex
1 parent fcdf0d4 commit cc40831

File tree

2 files changed

+13
-22
lines changed

2 files changed

+13
-22
lines changed

Sources/SKTestSupport/SKSwiftPMTestWorkspace.swift

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -120,34 +120,25 @@ extension SKSwiftPMTestWorkspace {
120120

121121
public func testLoc(_ name: String) -> TestLocation { sources.locations[name]! }
122122

123-
public func buildAndIndex() throws {
124-
try build()
123+
public func buildAndIndex(withSystemSymbols: Bool = false) throws {
124+
try build(withSystemSymbols: withSystemSymbols)
125125
index.pollForUnitChangesAndWait()
126126
}
127127

128-
public func buildAndIndexWithSystemSymbols() throws {
129-
try buildWithSystemSymbols()
130-
index.pollForUnitChangesAndWait()
131-
}
132-
133-
func build() throws {
134-
try TSCBasic.Process.checkNonZeroExit(arguments: [
135-
toolchain.swift!.pathString,
136-
"build",
137-
"--package-path", sources.rootDirectory.path,
138-
"--scratch-path", buildDir.path,
139-
"-Xswiftc", "-index-ignore-system-modules",
140-
"-Xcc", "-index-ignore-system-symbols",
141-
])
142-
}
143-
144-
func buildWithSystemSymbols() throws {
145-
try TSCBasic.Process.checkNonZeroExit(arguments: [
128+
func build(withSystemSymbols: Bool = false) throws {
129+
var arguments = [
146130
toolchain.swift!.pathString,
147131
"build",
148132
"--package-path", sources.rootDirectory.path,
149133
"--scratch-path", buildDir.path,
150-
])
134+
]
135+
if !withSystemSymbols {
136+
arguments.append(contentsOf: [
137+
"-Xswiftc", "-index-ignore-system-modules",
138+
"-Xcc", "-index-ignore-system-symbols",
139+
])
140+
}
141+
try TSCBasic.Process.checkNonZeroExit(arguments: arguments)
151142
}
152143
}
153144

Tests/SourceKitLSPTests/SwiftInterfaceTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ final class SwiftInterfaceTests: XCTestCase {
116116

117117
func testDefinitionInSystemModuleInterface() throws {
118118
guard let ws = try staticSourceKitSwiftPMWorkspace(name: "SwiftPMPackage") else { return }
119-
try ws.buildAndIndexWithSystemSymbols()
119+
try ws.buildAndIndex(withSystemSymbols: true)
120120
let stringRef = ws.testLoc("Lib.a.string")
121121
try ws.openDocument(stringRef.url, language: .swift)
122122
let definition = try ws.sk.sendSync(DefinitionRequest(

0 commit comments

Comments
 (0)