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

ExplicitResultTypes can't easily be used with projects using sbt-projectmatrix #1592

Closed
bjaglin opened this issue Apr 10, 2022 · 3 comments · Fixed by scalacenter/sbt-scalafix#419

Comments

@bjaglin
Copy link
Collaborator

bjaglin commented Apr 10, 2022

As scalafixScalaBinaryVersion must be set at the ThisBuild level (say 2.13 for an example) and ExplicitResultTypes requires the binary version of each project to match the one used in Scalafix, an aggregating scalafixAll run will fail on 2.11 and 2.12 projects. There is no easy way in sbt-projectmatrix or sbt-scalafix to run scalafixAll only on 2.13 projects.

More generally, usage of sbt-projectmatrix with sbt-scalafix is non-optimal at best, dangerous at worst, as an aggregating scalafixAll runs rewrites across each axis in parallel. The same applies for scalafmt I believe.

@bjaglin
Copy link
Collaborator Author

bjaglin commented Apr 10, 2022

Workaround:

private def configSettings: Seq[Def.Setting[_]] = List(
// Workaround for https://github.com/scalacenter/scalafix/issues/1592:
// effectively skip scalafix[All] on 2.x projects not matching scalafixScalaBinaryVersion
scalafix / unmanagedSources := {
val prev = (scalafix / unmanagedSources).value
if (
Seq(scalafixScalaBinaryVersion.value, "3")
.contains(scalaBinaryVersion.value)
) {
prev
} else {
Seq()
}
},
scalafixConfig := {
if (scalaBinaryVersion.value.startsWith("2"))
Some(file(".scalafix-scala2.conf"))
else
Some(file(".scalafix-scala3.conf"))
}
)

@bjaglin
Copy link
Collaborator Author

bjaglin commented Jun 2, 2023

Somewhat related: #1747

@bjaglin
Copy link
Collaborator Author

bjaglin commented Feb 5, 2024

#1583 would solve this

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

Successfully merging a pull request may close this issue.

1 participant