From 3952f68f81b7956b2724543c77078342496985d1 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Tue, 18 Jun 2024 08:35:40 -0700 Subject: [PATCH] Try linking again SwiftSyntax in `SkipUnless.canBuildMacroUsingSwiftSyntaxFromSourceKitLSPBuild` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I don’t remember the exact failure scenario but there were issues where the modules could be found but linking against the swift-syntax libraries from the sourcekit-lsp build failed. If this happens, skip any macro tests. --- Sources/SKTestSupport/SkipUnless.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Sources/SKTestSupport/SkipUnless.swift b/Sources/SKTestSupport/SkipUnless.swift index e6d0f20a9..df66957a0 100644 --- a/Sources/SKTestSupport/SkipUnless.swift +++ b/Sources/SKTestSupport/SkipUnless.swift @@ -436,10 +436,11 @@ public actor SkipUnless { let project = try await SwiftPMTestProject( files: [ "MyMacros/MyMacros.swift": #""" - import SwiftCompilerPlugin - import SwiftSyntax - import SwiftSyntaxBuilder - import SwiftSyntaxMacros + import SwiftParser + + func test() { + _ = Parser.parse(source: "let a") + } """#, "MyMacroClient/MyMacroClient.swift": """ """, @@ -453,6 +454,9 @@ public actor SkipUnless { skipMessage: """ Skipping because macro could not be built using build artifacts in the sourcekit-lsp build directory. \ This usually happens if sourcekit-lsp was built using a different toolchain than the one used at test-time. + + Reason: + \(error) """ ) }