-
Notifications
You must be signed in to change notification settings - Fork 43
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
Support several scalafixScalaBinaryVersion within a build #380
Conversation
I don't think I fully appreciate the goals of this PR, but just based on the title, can't this already achieved something like this? scalafixConfig := {
if (scalaBinaryVersion.value == "3")
Some(file(".scalafix-3.conf"))
else
Some(file(".scalafix-2.conf"))
} |
So, just changing the
The reason it fails is you MUST set a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! As a follow up to the discussion above, I would suggest renaming it to "Support several scalafixScalaBinaryVersion within a build" to better carry the intent; being able to have a different configuration file to disable ExplicitResultTypes on scala3 is a related feature, which is indeed already available.
src/sbt-test/sbt-scalafix/cross-build-advanced/project/plugins.sbt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @zarthross, this will be a great addition! I'll open a PR shortly to update the docs.
For the record, I am planning to do a release some time next month, in sync with the scala 2.x patch releases. Until then, you can try the snapshots.
@@ -0,0 +1,3 @@ | |||
rules = [DisableSyntax, OrganizeImports, ExplicitResultTypes] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DisableSyntax seems unexercised, but it doesn't hurt to keep a syntactic rule here I guess
aa0e7f9
to
c964674
Compare
c964674
to
348e132
Compare
Because the
scalafixInterfaceProvider
was getting its scala versions from theThisBuild
level, scalafix would not use a different binary version for each scala version when running with++scalafix
. This limited users ability to use scala 2.13 only rules AND use scalafix on scala 3.This change would make it possible to run the appropriate scalafix binary as the scala version changes during cross building (because
ThisBuild / scalaVersion
does not change during cross building), making it possible to dynamically update the scalafix.conf file for each scala version. In the future a sbt key could be added to point at different scalafix.conf files for different scala versions if that functionality is desired.