Skip to content

Make tests pass with Xcode 15.4 #1371

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 1 commit into from
May 31, 2024
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
3 changes: 3 additions & 0 deletions Sources/SKSwiftPMWorkspace/SwiftPMBuildSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ extension SwiftPMBuildSystem: SKCore.BuildSystem {
private func compilerArguments(for file: URL, in buildTarget: any SwiftBuildTarget) async throws -> [String] {
let compileArguments = try buildTarget.compileArguments(for: file)

#if compiler(>=6.1)
#warning("When we drop support for Swift 5.10 we no longer need to adjust compiler arguments for the Modules move")
#endif
// Fix up compiler arguments that point to a `/Modules` subdirectory if the Swift version in the toolchain is less
// than 6.0 because it places the modules one level higher up.
let toolchainVersion = await orLog("Getting Swift version") { try await toolchainRegistry.default?.swiftVersion }
Expand Down
3 changes: 3 additions & 0 deletions Tests/SourceKitLSPTests/DependencyTrackingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ final class DependencyTrackingTests: XCTestCase {
// Semantic analysis: expect module import error.
XCTAssertEqual(initialDiags.diagnostics.count, 1)
if let diagnostic = initialDiags.diagnostics.first {
#if compiler(>=6.1)
#warning("When we drop support for Swift 5.10 we no longer need to check for the Objective-C error message")
#endif
XCTAssert(
diagnostic.message.contains("Could not build Objective-C module")
|| diagnostic.message.contains("No such module"),
Expand Down
9 changes: 8 additions & 1 deletion Tests/SourceKitLSPTests/PublishDiagnosticsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,14 @@ final class PublishDiagnosticsTests: XCTestCase {

_ = try project.openDocument("LibB.swift")
let diagnosticsBeforeBuilding = try await project.testClient.nextDiagnosticsNotification()
XCTAssert(diagnosticsBeforeBuilding.diagnostics.contains(where: { $0.message == "No such module 'LibA'" }))
XCTAssert(
diagnosticsBeforeBuilding.diagnostics.contains(where: {
#if compiler(>=6.1)
#warning("When we drop support for Swift 5.10 we no longer need to check for the Objective-C error message")
#endif
return $0.message == "No such module 'LibA'" || $0.message == "Could not build Objective-C module 'LibA'"
})
)

try await SwiftPMTestProject.build(at: project.scratchDirectory)

Expand Down
9 changes: 8 additions & 1 deletion Tests/SourceKitLSPTests/PullDiagnosticsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,14 @@ final class PullDiagnosticsTests: XCTestCase {
XCTFail("Expected full diagnostics report")
return
}
XCTAssert(fullReportBeforeBuilding.items.contains(where: { $0.message == "No such module 'LibA'" }))
XCTAssert(
fullReportBeforeBuilding.items.contains(where: {
#if compiler(>=6.1)
#warning("When we drop support for Swift 5.10 we no longer need to check for the Objective-C error message")
#endif
return $0.message == "No such module 'LibA'" || $0.message == "Could not build Objective-C module 'LibA'"
})
)

let diagnosticsRefreshRequestReceived = self.expectation(description: "DiagnosticsRefreshRequest received")
project.testClient.handleSingleRequest { (request: DiagnosticsRefreshRequest) in
Expand Down