neo-sbt-scalafmt
neo-sbt-scalafmt copied to clipboard
Shared files in cross-building setup are not reformated
Hi!
I followed this setup for my project: http://www.scala-js.org/doc/project/cross-build.html With this, I can build for both the JVM and Scala.js, and have common source files along with target-dedicated source files.
Then I added the latest neo-sbt-scalafmt
(1.14
), and the following config in build.sbt
:
lazy val foo = crossProject.in(file(".")).
settings(
scalafmtVersion in ThisBuild := "1.3.0",
scalafmtOnCompile in ThisBuild := true,
scalafmtTestOnCompile in ThisBuild := true,
ignoreErrors in (ThisBuild, scalafmt) := false,
// other settings
).
jvmSettings(
// other settings
).
jsSettings(
// other settings
)
And here is my .scalafmt.conf
file:
style = defaultWithAlign
maxColumn = 80
docstrings = JavaDoc
project.excludeFilters = [
"build\\.sbt$"
]
When I do scalafmt
in my SBT console, scalafmt runs correctly on files located in jvm/src
and js/src
, but not in shared/src
!
Do you have any idea on how to change this behavior? (Or how to investigate more deeply what happens)
Having the same issue, I was able to go around it by adding the shared folder to sourceDirectories
:
lazy val shared = (crossProject.crossType(CrossType.Pure) in file("shared"))
.settings(commonSettings ++ Seq(
sourceDirectories in (Compile, scalafmt) += file("shared").getAbsoluteFile / "src" / "main" / "scala"
))