From 455379ff095bbab01b705bdb7e03cd5aac953709 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Mon, 13 May 2019 03:45:35 -0400 Subject: [PATCH] Reduce concurrency of scalafmtCheck Ref https://github.com/scalameta/scalafmt/issues/1399 --- project/FixScalafmtPlugin.scala | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 project/FixScalafmtPlugin.scala diff --git a/project/FixScalafmtPlugin.scala b/project/FixScalafmtPlugin.scala new file mode 100644 index 0000000000..35291e473f --- /dev/null +++ b/project/FixScalafmtPlugin.scala @@ -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, + ) +}