-
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
sbt 1.4.0 #168
sbt 1.4.0 #168
Conversation
scalafix := scalafixInputTask(config).evaluated, | ||
scalafix := { | ||
// force detection of usage of `scalafixCaching` to workaround https://github.com/sbt/sbt/issues/5647 | ||
val _ = scalafixCaching.?.value |
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.
val cachingRequested = scalafixCaching.or(scalafixOnCompile).value |
sbt inspect
(as of sbt 1.4.0), so this makes a dummy lookup for the sake of materializing the usage
sbt:sbt-scalafix> inspect actual scalafixCaching
[info] Setting: Boolean = true
[info] Description:
[info] Cache scalafix invocations (off by default, on if scalafixOnCompile := true).
[info] Provided by:
[info] ProjectRef(uri("file:/home/bjaglin/git/projects/sbt-scalafix/"), "sbt-scalafix") / scalafixCaching
[info] Defined at:
[info] /home/bjaglin/git/projects/sbt-scalafix/build.sbt:48
+[info] Reverse dependencies:
+[info] Test / scalafix
+[info] Compile / scalafix
[info] Delegates:
[info] scalafixCaching
[info] ThisBuild / scalafixCaching
[info] Global / scalafixCaching
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.
This seems legitimate.
I wonder if this workaround is still needed though:
sbt-scalafix/src/main/scala/scalafix/sbt/ScalafixPlugin.scala
Lines 324 to 328 in 5238ad7
// workaround https://github.com/sbt/sbt/issues/3572 by invoking directly what Def.inputTaskDyn would via macro | |
InputTask | |
.createDyn(InputTask.initParserAsInput(scalafixCompletions(_.parser)))( | |
Def.task(shellArgs => scalafixTask(shellArgs, config)) | |
) |
The task graph would be simplified with a single level of dynamicity instead of two.
Unfortunately, even if it was fixed in 1.4.0 (I don't think it is), we would still need to keep the hack for compatibility with older 1.x clients. The first commit bumps the version of sbt for this build, but the sbt API build against and the runtime we run scripted with remains unchanged, see: Lines 53 to 66 in 5238ad7
|
The second commit works around sbt/sbt#5647, which can be observed when the client uses sbt 1.4.0 (independently of the version we build with/against here) and defines
scalafixCaching
.