diff --git a/Sources/SKSwiftPMWorkspace/SwiftPMBuildSystem.swift b/Sources/SKSwiftPMWorkspace/SwiftPMBuildSystem.swift index 8abbf5d07..5438dfacc 100644 --- a/Sources/SKSwiftPMWorkspace/SwiftPMBuildSystem.swift +++ b/Sources/SKSwiftPMWorkspace/SwiftPMBuildSystem.swift @@ -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 } diff --git a/Tests/SourceKitLSPTests/DependencyTrackingTests.swift b/Tests/SourceKitLSPTests/DependencyTrackingTests.swift index 2780cf765..5262ef07c 100644 --- a/Tests/SourceKitLSPTests/DependencyTrackingTests.swift +++ b/Tests/SourceKitLSPTests/DependencyTrackingTests.swift @@ -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"), diff --git a/Tests/SourceKitLSPTests/PublishDiagnosticsTests.swift b/Tests/SourceKitLSPTests/PublishDiagnosticsTests.swift index 22e8d86df..8535ca5cd 100644 --- a/Tests/SourceKitLSPTests/PublishDiagnosticsTests.swift +++ b/Tests/SourceKitLSPTests/PublishDiagnosticsTests.swift @@ -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) diff --git a/Tests/SourceKitLSPTests/PullDiagnosticsTests.swift b/Tests/SourceKitLSPTests/PullDiagnosticsTests.swift index b68ec59c7..98b3039b0 100644 --- a/Tests/SourceKitLSPTests/PullDiagnosticsTests.swift +++ b/Tests/SourceKitLSPTests/PullDiagnosticsTests.swift @@ -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