Reduce concurrency of scalafmtCheck

Ref scalameta/scalafmt#1399
This commit is contained in:
Eugene Yokota 2019-05-17 14:51:07 -04:00
parent 2376de63d1
commit 08c49358c7
2 changed files with 25 additions and 1 deletions

View File

@ -10,6 +10,8 @@ ThisBuild / version := {
val v = "1.3.0-SNAPSHOT"
nightlyVersion.getOrElse(v)
}
ThisBuild / scalafmtOnCompile := !(Global / insideCI).value
ThisBuild / Test / scalafmtOnCompile := !(Global / insideCI).value
// ThisBuild settings take lower precedence,
// but can be shared across the multi projects.
@ -43,7 +45,6 @@ def buildLevelSettings: Seq[Setting[_]] =
homepage := Some(url("https://github.com/sbt/sbt")),
scmInfo := Some(ScmInfo(url("https://github.com/sbt/sbt"), "git@github.com:sbt/sbt.git")),
resolvers += Resolver.mavenLocal,
scalafmtOnCompile := true,
)
)

View File

@ -0,0 +1,23 @@
import sbt._
import Keys._
import org.scalafmt.sbt.ScalafmtPlugin
import ScalafmtPlugin.autoImport._
object FixScalafmtPlugin extends AutoPlugin {
override def requires = ScalafmtPlugin
override def trigger = allRequirements
val ScalaFmtTag = ConcurrentRestrictions.Tag("scalafmt")
override def globalSettings: Seq[Def.Setting[_]] =
Seq(
concurrentRestrictions += Tags.limit(ScalaFmtTag, 1)
)
override def projectSettings: Seq[Def.Setting[_]] =
Seq(
scalafmtCheckAll := (scalafmtCheckAll.tag(ScalaFmtTag)).value,
Compile / scalafmtCheck := ((Compile / scalafmtCheck).tag(ScalaFmtTag)).value,
Test / scalafmtCheck := ((Test / scalafmtCheck).tag(ScalaFmtTag)).value,
)
}