Closed fthomas closed 7 years ago
It seems that https://github.com/sbt/sbt-scalariform/issues/32#issuecomment-175375785 also suggests to use unmanagedSourceDirectories
instead of scalaSource
.
@fthomas looks like you moved on to scalafmt
.
Since Scalariform has been updated to 0.2.0 it makes sense to publish a new release for Sbt-Scalariform as well. Did you encounter any problems after submitting this PR, or were things stable wrt to addressing the scala/scala.js issue?
As far as I remember there where no problems. I did a similar change in the old scalafmt sbt plugin and it didn't caused any trouble there: https://github.com/scalameta/scalafmt/pull/229
sourceDirectories in scalariformFormat
is currently initialized withList(scalaSource.value)
which means that sbt-scalariform only looks into one source directory per project. But a typical Scala.js cross project has at least two source directories: js/ and shared/ or jvm/ and shared/. In other projects there are multiple source directories for different Scala versions.This change initializes
sourceDirectories in scalariformFormat
withunmanagedSourceDirectories
which contains all source directories with manually created sources. This setting always includesscalaSource
because sbt defines it as:Here are for example both settings for typelevel/cats:
And since cats has no sources in cats/core/.jvm/src/main/scala (all sources are in cats/core/src/main/scala), sbt-scalariform won't format anything.
This change has been tested successfully with one of my projects and allowed to get rid of this workaround to pick up all relevant source directories.