-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscapegoat.sbt
35 lines (31 loc) · 1.06 KB
/
scapegoat.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
scapegoatVersion in ThisBuild := "1.3.4"
val scapegoatAvailable = Def.setting {
val versions = "sbt " + sbtVersion.value +
", cross-sbt " + (sbtVersion in pluginCrossBuild).value +
", scala " + scalaVersion.value +
", scala-binary " + scalaBinaryVersion.value
CrossVersion.partialVersion(scalaBinaryVersion.value) match {
case Some((2, 11)) => (true, versions)
case Some((2, 12)) => (true, versions)
case _ => (false, versions)
}
}
libraryDependencies --= libraryDependencies.value.filter(_.name.startsWith("scalac-scapegoat-plugin"))
libraryDependencies ++= {
if (scapegoatAvailable.value._1) {
Seq(
"com.sksamuel.scapegoat" % ("scalac-scapegoat-plugin" + "_" + scalaBinaryVersion.value) % scapegoatVersion.value % "provided"
)
} else {
Seq.empty
}
}
scapegoat := Def.taskDyn {
val default = scapegoat.taskValue
if (scapegoatAvailable.value._1) Def.task(default.value)
else
Def.task {
val log = streams.value.log
log.warn(s"scapegoat not supported (${scapegoatAvailable.value._2})")
}
}.value