Skip to content

Implement a version of SwiftSyntaxMacrosTestsSupport that is framework agnostic #2647

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 7 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
32 changes: 31 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ let package = Package(
.library(name: "SwiftSyntaxMacros", targets: ["SwiftSyntaxMacros"]),
.library(name: "SwiftSyntaxMacroExpansion", targets: ["SwiftSyntaxMacroExpansion"]),
.library(name: "SwiftSyntaxMacrosTestSupport", targets: ["SwiftSyntaxMacrosTestSupport"]),
.library(
name: "SwiftSyntaxMacrosGenericTestSupport",
targets: ["SwiftSyntaxMacrosGenericTestSupport"]
),
],
targets: [
// MARK: - Internal helper targets
Expand All @@ -40,7 +44,18 @@ let package = Package(

.target(
name: "_SwiftSyntaxTestSupport",
dependencies: ["SwiftBasicFormat", "SwiftSyntax", "SwiftSyntaxBuilder", "SwiftSyntaxMacroExpansion"]
dependencies: [
"_SwiftSyntaxGenericTestSupport",
"SwiftBasicFormat",
"SwiftSyntax",
"SwiftSyntaxBuilder",
"SwiftSyntaxMacroExpansion",
]
),

.target(
name: "_SwiftSyntaxGenericTestSupport",
dependencies: []
),

.testTarget(
Expand Down Expand Up @@ -212,6 +227,21 @@ let package = Package(
"SwiftIDEUtils",
"SwiftParser",
"SwiftSyntaxMacros",
"SwiftSyntaxMacrosGenericTestSupport",
"SwiftSyntaxMacroExpansion",
]
),

// MARK: SwiftSyntaxMacrosGenericTestSupport

.target(
name: "SwiftSyntaxMacrosGenericTestSupport",
dependencies: [
"_SwiftSyntaxGenericTestSupport",
"SwiftDiagnostics",
"SwiftIDEUtils",
"SwiftParser",
"SwiftSyntaxMacros",
"SwiftSyntaxMacroExpansion",
]
),
Expand Down
4 changes: 4 additions & 0 deletions Release Notes/600.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@
- Description: `Range<AbsolutePosition>` gained a few convenience functions inspired from `ByteSourceRange`: `init(position:length:)`, `length`, `overlapsOrTouches`
- Pull request: https://github.com/apple/swift-syntax/pull/2587

- `SwiftSyntaxMacrosGenericTestSupport`
- Description: A version of the `SwiftSyntaxMacrosTestSupport` module that doesn't depend on `Foundation` or `XCTest` and can thus be used to write macro tests using `swift-testing`. Since swift-syntax can't depend on swift-testing (which would incur a circular dependency since swift-testing depends on swift-syntax), users need to manually specify a failure handler like the following, that fails the swift-testing test: `Issue.record("\($0.message)", fileID: $0.location.fileID, filePath: $0.location.filePath, line: $0.location.line, column: $0.location.column)`
- Pull request: https://github.com/apple/swift-syntax/pull/2647

## API Behavior Changes

## Deprecations
Expand Down
Loading