@@ -3,6 +3,7 @@ package scalafix.sbt
3
3
import java .nio .file .Path
4
4
5
5
import com .geirsson .coursiersmall .Repository
6
+ import sbt .KeyRanks .Invisible
6
7
import sbt .Keys ._
7
8
import sbt .internal .sbtscalafix .{Compat , JLineAccess }
8
9
import sbt .plugins .JvmPlugin
@@ -44,7 +45,13 @@ object ScalafixPlugin extends AutoPlugin {
44
45
45
46
def scalafixConfigSettings (config : Configuration ): Seq [Def .Setting [_]] =
46
47
Seq (
47
- scalafix := scalafixInputTask(config).evaluated
48
+ scalafix := scalafixInputTask(config).evaluated,
49
+ // In some cases (I haven't been able to understand when/why, but this also happens for bgRunMain while
50
+ // fgRunMain is fine), there is no specific streams attached to InputTasks, so we they end up sharing the
51
+ // global streams, causing issues for cache storage. This does not happen for Tasks, so we define a dummy one
52
+ // to acquire a distinct streams instance for each InputTask.
53
+ scalafixDummyTask := (()),
54
+ streams.in(scalafix) := streams.in(scalafixDummyTask).value
48
55
)
49
56
50
57
@ deprecated(" This setting is no longer used" , " 0.6.0" )
@@ -67,6 +74,13 @@ object ScalafixPlugin extends AutoPlugin {
67
74
68
75
import autoImport ._
69
76
77
+ private val scalafixDummyTask : TaskKey [Unit ] =
78
+ TaskKey (
79
+ " scalafixDummyTask" ,
80
+ " Implementation detail - do not use" ,
81
+ Invisible
82
+ )
83
+
70
84
override lazy val projectSettings : Seq [Def .Setting [_]] =
71
85
Seq (Compile , Test ).flatMap(c => inConfig(c)(scalafixConfigSettings(c)))
72
86
0 commit comments