From 262510f0da2524047a5f7dec0068f2d83ff1c04d Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Tue, 21 Jan 2025 16:56:47 -0800 Subject: [PATCH 1/2] Revert "Support background indexing when cross-compiling" --- .../SwiftPMBuildSystem.swift | 9 ---- Sources/SKTestSupport/SkipUnless.swift | 28 ----------- .../BackgroundIndexingTests.swift | 47 ------------------- 3 files changed, 84 deletions(-) diff --git a/Sources/BuildSystemIntegration/SwiftPMBuildSystem.swift b/Sources/BuildSystemIntegration/SwiftPMBuildSystem.swift index 5ef9cee89..358ac637e 100644 --- a/Sources/BuildSystemIntegration/SwiftPMBuildSystem.swift +++ b/Sources/BuildSystemIntegration/SwiftPMBuildSystem.swift @@ -616,15 +616,6 @@ package actor SwiftPMBuildSystem: BuiltInBuildSystem { if let configuration = options.swiftPMOrDefault.configuration { arguments += ["-c", configuration.rawValue] } - if let triple = options.swiftPMOrDefault.triple { - arguments += ["--triple", triple] - } - if let swiftSDKsDirectory = options.swiftPMOrDefault.swiftSDKsDirectory { - arguments += ["--swift-sdks-path", swiftSDKsDirectory] - } - if let swiftSDK = options.swiftPMOrDefault.swiftSDK { - arguments += ["--swift-sdk", swiftSDK] - } arguments += options.swiftPMOrDefault.cCompilerFlags?.flatMap { ["-Xcc", $0] } ?? [] arguments += options.swiftPMOrDefault.cxxCompilerFlags?.flatMap { ["-Xcxx", $0] } ?? [] arguments += options.swiftPMOrDefault.swiftCompilerFlags?.flatMap { ["-Xswiftc", $0] } ?? [] diff --git a/Sources/SKTestSupport/SkipUnless.swift b/Sources/SKTestSupport/SkipUnless.swift index 002af5c96..dbde6a3a9 100644 --- a/Sources/SKTestSupport/SkipUnless.swift +++ b/Sources/SKTestSupport/SkipUnless.swift @@ -478,34 +478,6 @@ package actor SkipUnless { } } - package static func canSwiftPMCompileForIOS( - file: StaticString = #filePath, - line: UInt = #line - ) async throws { - return try await shared.skipUnlessSupported(allowSkippingInCI: true, file: file, line: line) { - #if os(macOS) - let project = try await SwiftPMTestProject(files: [ - "MyFile.swift": """ - public func foo() {} - """ - ]) - do { - try await SwiftPMTestProject.build( - at: project.scratchDirectory, - extraArguments: [ - "--swift-sdk", "arm64-apple-ios", - ] - ) - return .featureSupported - } catch { - return .featureUnsupported(skipMessage: "Cannot build for iOS: \(error)") - } - #else - return .featureUnsupported(skipMessage: "Cannot build for iOS outside macOS by default") - #endif - } - } - package static func canCompileForWasm( file: StaticString = #filePath, line: UInt = #line diff --git a/Tests/SourceKitLSPTests/BackgroundIndexingTests.swift b/Tests/SourceKitLSPTests/BackgroundIndexingTests.swift index 03ca692ab..a8b5d71f1 100644 --- a/Tests/SourceKitLSPTests/BackgroundIndexingTests.swift +++ b/Tests/SourceKitLSPTests/BackgroundIndexingTests.swift @@ -1018,53 +1018,6 @@ final class BackgroundIndexingTests: XCTestCase { ) } - func testUseSwiftSDKFlagsDuringPreparation() async throws { - try await SkipUnless.canSwiftPMCompileForIOS() - - var options = SourceKitLSPOptions.testDefault() - options.swiftPMOrDefault.swiftSDK = "arm64-apple-ios" - let project = try await SwiftPMTestProject( - files: [ - "Lib/Lib.swift": """ - #if os(iOS) - public func foo() -> Int { 1 } - #endif - """, - "Client/Client.swift": """ - import Lib - - func test() -> String { - return foo() - } - """, - ], - manifest: """ - let package = Package( - name: "MyLibrary", - targets: [ - .target(name: "Lib"), - .target(name: "Client", dependencies: ["Lib"]), - ] - ) - """, - options: options, - enableBackgroundIndexing: true - ) - - // Check that we get an error about the return type of `foo` (`Int`) not being convertible to the return type of - // `test` (`String`), which indicates that `Lib` had `foo` and was thus compiled for iOS - let (uri, _) = try project.openDocument("Client.swift") - let diagnostics = try await project.testClient.send( - DocumentDiagnosticsRequest(textDocument: TextDocumentIdentifier(uri)) - ) - XCTAssert( - (diagnostics.fullReport?.items ?? []).contains(where: { - $0.message == "Cannot convert return expression of type 'Int' to return type 'String'" - }), - "Did not get expected diagnostic: \(diagnostics)" - ) - } - func testLibraryUsedByExecutableTargetAndPackagePlugin() async throws { try await SkipUnless.swiftPMStoresModulesForTargetAndHostInSeparateFolders() let project = try await SwiftPMTestProject( From bedb4f5e9288bb5bfa952a351c7dc666caf96bac Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Tue, 21 Jan 2025 22:35:01 -0800 Subject: [PATCH 2/2] Revert "Temporaily disable two crashing test cases" This reverts commit f0adee56b60d021885b6a5a081142faf93c76f40. --- Tests/SourceKitLSPTests/CodeActionTests.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/Tests/SourceKitLSPTests/CodeActionTests.swift b/Tests/SourceKitLSPTests/CodeActionTests.swift index 221d89af9..99642afae 100644 --- a/Tests/SourceKitLSPTests/CodeActionTests.swift +++ b/Tests/SourceKitLSPTests/CodeActionTests.swift @@ -583,7 +583,6 @@ final class CodeActionTests: XCTestCase { } func testPackageManifestEditingCodeActionResult() async throws { - try XCTSkipIf(true, "Temporarily disable while investigating rdar://143336492") let testClient = try await TestSourceKitLSPClient(capabilities: clientCapabilitiesWithCodeActionSupport) let uri = DocumentURI(for: .swift) let positions = testClient.openDocument( @@ -658,7 +657,6 @@ final class CodeActionTests: XCTestCase { } func testPackageManifestEditingCodeActionNoTestResult() async throws { - try XCTSkipIf(true, "Temporarily disable while investigating rdar://143336492") let testClient = try await TestSourceKitLSPClient(capabilities: clientCapabilitiesWithCodeActionSupport) let uri = DocumentURI(for: .swift) let positions = testClient.openDocument(