forked from jsuereth/scala-arm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCompiler.scala
54 lines (51 loc) · 1.44 KB
/
Compiler.scala
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import sbt.Keys._
import sbt._
import sbt.plugins.JvmPlugin
object Compiler extends AutoPlugin {
override def trigger = allRequirements
override def requires = JvmPlugin
override def projectSettings = Seq(
scalacOptions in Compile ++= Seq(
"-encoding", "UTF-8",
"-target:jvm-1.8",
"-unchecked",
"-deprecation",
"-feature",
"-Xfatal-warnings",
"-Xlint",
"-g:vars"
),
scalacOptions in Compile ++= {
if ((scalaVersion in Compile).value startsWith "2.12.") {
Seq(
"-Ywarn-numeric-widen",
"-Ywarn-infer-any",
"-Ywarn-dead-code",
"-Ywarn-unused",
"-Ywarn-unused-import",
"-Ywarn-value-discard")
} else {
Seq.empty[String]
}
},
scalacOptions in (Compile, console) ~= {
_.filterNot { opt => opt.startsWith("-X") || opt.startsWith("-Y") }
},
scalacOptions in (Test, console) ~= {
_.filterNot { opt => opt.startsWith("-X") || opt.startsWith("-Y") }
},
scalacOptions in Test ++= Seq("-Yrangepos"),
scalacOptions ~= (_.filterNot(_ == "-Xfatal-warnings")),
libraryDependencies ++= {
if (scalaVersion.value startsWith "2.10.") {
Seq.empty[ModuleID]
} else {
val ver = "1.4.1"
Seq(
compilerPlugin(
"com.github.ghik" %% "silencer-plugin" % ver),
"com.github.ghik" %% "silencer-lib" % ver % Provided)
}
}
)
}