Skip to content

Commit 378b62d

Browse files
committed
Fix warnings when building sourcekit-lsp
1 parent 35f07f5 commit 378b62d

File tree

5 files changed

+22
-17
lines changed

5 files changed

+22
-17
lines changed

Sources/LSPTestSupport/Assertions.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ extension XCTestCase {
135135
// At the same time that XCTWaiter.fulfillment was introduced `XCTWaiter.wait` was deprecated in async contexts.
136136
// This means that we can't write code that compiles without warnings with both the macOS 13.3 and any previous SDK.
137137
// Accepting the warning here when compiling with macOS 13.3 or later is the only thing that I know of that we can do here.
138-
let started = XCTWaiter.wait(for: expectations, timeout: timeout, enforceOrder: enforceOrderOfFulfillment)
138+
let started = await XCTWaiter.fulfillment(
139+
of: expectations,
140+
timeout: timeout,
141+
enforceOrder: enforceOrderOfFulfillment
142+
)
139143
if started != .completed {
140144
throw ExpectationNotFulfilledError(expecatations: expectations)
141145
}

Sources/SKSwiftPMWorkspace/SwiftPMWorkspace.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ extension SwiftPMWorkspace {
217217
)
218218

219219
let plan = try BuildPlan(
220-
buildParameters: buildParameters,
220+
productsBuildParameters: buildParameters,
221+
toolsBuildParameters: buildParameters,
221222
graph: packageGraph,
222223
fileSystem: fileSystem,
223224
observabilityScope: observabilitySystem.topScope

Sources/SKTestSupport/SwiftPMTestWorkspace.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ public class SwiftPMTestWorkspace: MultiFileTestWorkspace {
8383
"-Xswiftc", "-index-ignore-system-modules",
8484
"-Xcc", "-index-ignore-system-symbols",
8585
]
86-
var environment = ProcessEnv.vars
86+
var environment = ProcessEnv.block
8787
// FIXME: SwiftPM does not index-while-building on non-Darwin platforms for C-family files (rdar://117744039).
8888
// Force-enable index-while-building with the environment variable.
8989
environment["SWIFTPM_ENABLE_CLANG_INDEX_STORE"] = "1"
90-
try await Process.checkNonZeroExit(arguments: arguments, environment: environment)
90+
try await Process.checkNonZeroExit(arguments: arguments, environmentBlock: environment)
9191
}
9292
}

Sources/SourceKitLSP/Swift/SwiftLanguageServer.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -790,14 +790,14 @@ extension SwiftLanguageServer {
790790
}
791791

792792
public func documentDiagnostic(_ req: DocumentDiagnosticsRequest) async throws -> DocumentDiagnosticReport {
793-
let snapshot = try documentManager.latestSnapshot(req.textDocument.uri)
794-
let buildSettings = await self.buildSettings(for: req.textDocument.uri)
795-
let diagnosticReport = try await self.diagnosticReportManager.diagnosticReport(
796-
for: snapshot,
797-
buildSettings: buildSettings
798-
)
799793
do {
800-
return try await .full(diagnosticReport)
794+
let snapshot = try documentManager.latestSnapshot(req.textDocument.uri)
795+
let buildSettings = await self.buildSettings(for: req.textDocument.uri)
796+
let diagnosticReport = try await self.diagnosticReportManager.diagnosticReport(
797+
for: snapshot,
798+
buildSettings: buildSettings
799+
)
800+
return .full(diagnosticReport)
801801
} catch {
802802
// VS Code does not request diagnostics again for a document if the diagnostics request failed.
803803
// Since sourcekit-lsp usually recovers from failures (e.g. after sourcekitd crashes), this is undesirable.

Tests/SKSwiftPMWorkspaceTests/SwiftPMWorkspaceTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ final class SwiftPMWorkspaceTests: XCTestCase {
130130
)
131131

132132
let aswift = packageRoot.appending(components: "Sources", "lib", "a.swift")
133-
let hostTriple = await ws.buildParameters.targetTriple
133+
let hostTriple = await ws.buildParameters.triple
134134
let build = buildPath(root: packageRoot, platform: hostTriple.platformBuildPathComponent)
135135

136136
assertEqual(await ws.buildPath, build)
@@ -198,7 +198,7 @@ final class SwiftPMWorkspaceTests: XCTestCase {
198198
)
199199

200200
let aswift = packageRoot.appending(components: "Sources", "lib", "a.swift")
201-
let hostTriple = await ws.buildParameters.targetTriple
201+
let hostTriple = await ws.buildParameters.triple
202202
let build = buildPath(root: packageRoot, config: config, platform: hostTriple.platformBuildPathComponent)
203203

204204
assertEqual(await ws.buildPath, build)
@@ -409,7 +409,7 @@ final class SwiftPMWorkspaceTests: XCTestCase {
409409
let acxx = packageRoot.appending(components: "Sources", "lib", "a.cpp")
410410
let bcxx = packageRoot.appending(components: "Sources", "lib", "b.cpp")
411411
let header = packageRoot.appending(components: "Sources", "lib", "include", "a.h")
412-
let hostTriple = await ws.buildParameters.targetTriple
412+
let hostTriple = await ws.buildParameters.triple
413413
let build = buildPath(root: packageRoot, platform: hostTriple.platformBuildPathComponent)
414414

415415
assertEqual(await ws.buildPath, build)
@@ -488,7 +488,7 @@ final class SwiftPMWorkspaceTests: XCTestCase {
488488
let aswift = packageRoot.appending(components: "Sources", "lib", "a.swift")
489489
let arguments = try await ws.buildSettings(for: aswift.asURI, language: .swift)!.compilerArguments
490490
assertArgumentsContain("-target", arguments: arguments) // Only one!
491-
let hostTriple = await ws.buildParameters.targetTriple
491+
let hostTriple = await ws.buildParameters.triple
492492

493493
#if os(macOS)
494494
assertArgumentsContain(
@@ -697,7 +697,7 @@ final class SwiftPMWorkspaceTests: XCTestCase {
697697
]
698698
)
699699
let packageRoot = tempDir.appending(component: "pkg")
700-
let tr = await ToolchainRegistry.forTesting
700+
let tr = ToolchainRegistry.forTesting
701701
let ws = try await SwiftPMWorkspace(
702702
workspacePath: packageRoot,
703703
toolchainRegistry: tr,
@@ -706,7 +706,7 @@ final class SwiftPMWorkspaceTests: XCTestCase {
706706
)
707707

708708
let aswift = packageRoot.appending(components: "Plugins", "MyPlugin", "a.swift")
709-
let hostTriple = await ws.buildParameters.targetTriple
709+
let hostTriple = await ws.buildParameters.triple
710710
let build = buildPath(root: packageRoot, platform: hostTriple.platformBuildPathComponent)
711711

712712
assertEqual(await ws.buildPath, build)

0 commit comments

Comments
 (0)