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

Shared files in cross-building setup are not reformated #59

Open
dsferruzza opened this issue Oct 27, 2017 · 1 comment
Open

Shared files in cross-building setup are not reformated #59

dsferruzza opened this issue Oct 27, 2017 · 1 comment

Comments

@dsferruzza
Copy link

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)

@dribba
Copy link

dribba commented Feb 28, 2018

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"
  ))

xuwei-k added a commit to scalapb-json/scalapb-circe that referenced this issue Apr 2, 2018
xuwei-k added a commit to scalapb-json/scalapb-circe that referenced this issue Sep 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants