aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlad <vlad@driver.xyz>2017-05-01 22:58:28 -0700
committervlad <vlad@driver.xyz>2017-05-01 22:58:28 -0700
commitd1eedcdfbd44609e321ea4a2f615cd0f84d1adbb (patch)
tree9a0fd22b0962b0de79708d5b3ab650b96f0c1ea6
parent76975417b4a7c33071fc79f98ad01f390a82e6ee (diff)
downloadsbt-settings-d1eedcdfbd44609e321ea4a2f615cd0f84d1adbb.tar.gz
sbt-settings-d1eedcdfbd44609e321ea4a2f615cd0f84d1adbb.tar.bz2
sbt-settings-d1eedcdfbd44609e321ea4a2f615cd0f84d1adbb.zip
Generating scalastyle-config.xml before running scalastyle ;)
-rw-r--r--src/main/scala/xyz.driver.sbt/SbtSettings.scala21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/main/scala/xyz.driver.sbt/SbtSettings.scala b/src/main/scala/xyz.driver.sbt/SbtSettings.scala
index 7602bd2..36d2a1b 100644
--- a/src/main/scala/xyz.driver.sbt/SbtSettings.scala
+++ b/src/main/scala/xyz.driver.sbt/SbtSettings.scala
@@ -49,8 +49,6 @@ object SbtSettings extends AutoPlugin {
resourceGenerators in Compile += generateScalafmtConfTask.taskValue,
resourceGenerators in Compile += generateScalafmtTask.taskValue,
scalafmtTest := {
- // "curl -L -o coursier https://git.io/vgvpD && chmod +x coursier".!
- // "coursier bootstrap com.geirsson:scalafmt-cli_2.11:0.7.0-RC1 --main org.scalafmt.cli.Cli -o scalafmt".!
s"chmod +x ${baseDirectory.value.getPath}/scalafmt".!
s"${baseDirectory.value.getPath}/scalafmt --test".!
},
@@ -65,17 +63,22 @@ object SbtSettings extends AutoPlugin {
lazy val testScalastyle = taskKey[Unit]("testScalastyle")
- lazy val scalastyleSettings = Seq(
- resourceGenerators in Compile += Def.task {
+ lazy val scalastyleSettings = {
+ val generateScalastyleConfTask = Def.task {
val stream = getClass.getClassLoader.getResourceAsStream("scalastyle-config.xml")
val styleFile = file("scalastyle-config.xml")
IO.write(styleFile, IO.readBytes(stream))
Seq(styleFile)
- }.taskValue,
- scalastyleConfig := file("scalastyle-config.xml"),
- testScalastyle := scalastyle.in(Compile).toTask("").value,
- testExecution in (Test, test) <<=
- testExecution in (Test, test) dependsOn (testScalastyle in Compile, testScalastyle in Test))
+ }
+ Seq(
+ resourceGenerators in Compile += generateScalastyleConfTask.taskValue,
+ scalastyleConfig := file("scalastyle-config.xml"),
+ testScalastyle := scalastyle.in(Compile).toTask("").value,
+ testScalastyle in (Test, test) <<=
+ (testScalastyle in (Test, test)) dependsOn generateScalastyleConfTask,
+ testExecution in(Test, test) <<=
+ testExecution in(Test, test) dependsOn(generateScalastyleConfTask, testScalastyle in Compile, testScalastyle in Test))
+ }
lazy val wartRemoverSettings = Seq(
wartremoverErrors in (Compile, compile) ++= Warts.allBut(