realm / SwiftLint

A tool to enforce Swift style and conventions.
https://realm.github.io/SwiftLint
MIT License
18.46k stars 2.2k forks source link

Conflict with other macro package #5533

Closed Kyle-Ye closed 1 month ago

Kyle-Ye commented 2 months ago

New Issue Checklist

Describe the bug

We are some existing package dependency(eg. swift-testing and swift-power-assert) which has a dependency on swift-syntax.

eg. .from("509.0.0") .from("510.0.1")

But the latest version of SwiftLint has a exact version dependency on "swift-syntax".

eg. SwiftLint 0.54.0 has a exact "509.0.2"

https://github.com/realm/SwiftLint/blob/f17a4f9dfb6a6afb0408426354e4180daaf49cee/Package.swift#L19

This will cause a package resolution failing due to conflicting requirement.

Solution

Use more flexible requirement of "from" and adapt the diff API internally so that both swift-syntax 509 and 510 will work here.

(eg. #if canImport(SwiftSyntax509) and #if canImport(SwiftSyntax510))

https://github.com/apple/swift-syntax/blob/728e2f6d5f9fd4a8e45eab6e52e86ad1519a7e2a/Sources/SwiftSyntax/Documentation.docc/Macro%20Versioning.md?plain=1#L9-L33

Kyle-Ye commented 2 months ago

There is a blog post explaining the detail here.

https://www.pointfree.co/blog/posts/116-being-a-good-citizen-in-the-land-of-swiftsyntax