Skip to content
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

Cannot use latest version of SwiftLint with SFSymbolsMacro due to conflicting swift syntax versions #4

Open
BrentMifsud opened this issue Jun 7, 2024 · 4 comments

Comments

@BrentMifsud
Copy link

Failed to resolve dependencies Dependencies could not be resolved because root depends on 'sfsymbolsmacro' 0.5.2..<1.0.0 and root depends on 'swiftlint' 0.55.1..<1.0.0.
'swiftlint' is incompatible with 'sfsymbolsmacro' because 'sfsymbolsmacro' 0.5.2 depends on 'swift-syntax' 509.1.1..<510.0.0 and no versions of 'sfsymbolsmacro' match the requirement 0.5.3..<1.0.0.
'swiftlint' >= 0.55.1 practically depends on 'swift-syntax' 510.0.2..<511.0.0 because 'swiftlint' 0.55.1 depends on 'swift-syntax' 510.0.2..<511.0.0 and no versions of 'swiftlint' match the requirement 0.55.2..<1.0.0.

@hi2gage
Copy link
Contributor

hi2gage commented Aug 8, 2024

Hey @BrentMifsud can you share how to reproduce this? could you provide a repo with a Package.swift or .xcodeproj that I could look at?

@BrentMifsud
Copy link
Author

BrentMifsud commented Aug 8, 2024

Its fairly easy to repro:

  1. make a new Xcode project
  2. add SwiftLint as a dependency
  3. add SFSymbolsMacro as a dependency
  4. Xcode will give you a package resolution error

you can do step 2 and 3 in the opposite order as well to reproduce the problem. Essentially SwiftLint and SFSymbolsMacro both depend on SwiftSyntax, but are likely pinned to different versions.

here's a project with the repro:

SwiftSyntaxConflict.zip

@hi2gage
Copy link
Contributor

hi2gage commented Aug 9, 2024

The provided project does not include the dependencies that you are using.

But I was able to reproduce by directly depending on the SwiftLint repository which is not recommended
See README.md

Note

Consuming the plugins directly from the SwiftLint repository comes
with several drawbacks. To avoid them and reduce the overhead imposed, it's
highly recommended to consume the plugins from the dedicated
SwiftLintPlugins repository,
even though plugins from the SwiftLint repository are also absolutely
functional. If the plugins from SwiftLint are preferred, just use the URL
https://github.com/realm/SwiftLint in the package declarations above.

However, SwiftLintPlugins
facilitates plugin adoption massively. It lists some of the reasons that
drive the plugins as provided by SwiftLint itself very troublesome. Since
the plugin code and the releases are kept in sync, there is no difference
in functionality between the two, but you spare yourself a lot of time and
trouble using the dedicated plugins repository.

This document assumes you're relying on SwiftLintPlugins.

are you using https://github.com/SimplyDanny/SwiftLintPlugins or https://github.com/realm/SwiftLint for your project?

Switching to SwiftLintPlugins everything should work since it's precompiled and does not require a dependency on swift-syntax

Screenshot 2024-08-08 at 8 35 03 PM

Once 600.0.0 is out of prerelease I can update our dependency to match SwiftLint

Let me know if you have any other questions!

@BrentMifsud
Copy link
Author

Thanks for the heads up. I didn't realize they had a separate plugin package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants