-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
105 lines (76 loc) · 2.76 KB
/
build.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import scalariform.formatter.preferences._
organization := "com.agilogy"
name := "uris"
scalaVersion := "2.12.6"
crossScalaVersions := Seq("2.11.7", "2.12.6")
libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.1"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.13.4" % "test"
// --> Linters
// See tinyurl.com/sd15lint
// https://tpolecat.github.io/2014/04/11/scalac-flags.html
scalacOptions ++= Seq(
"-deprecation",
"-encoding", "UTF-8", // yes, this is 2 args
"-feature",
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-unchecked",
"-Xlint",
"-Yno-adapted-args",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-Xfuture"
)
// Execute static analysis via `lint:compile`
val LintTarget = config("lint").extend(Compile)
inConfig(LintTarget) {
Defaults.compileSettings ++
Seq(
sources in LintTarget := {
val lintSources = (sources in LintTarget).value
lintSources ++ (sources in Compile).value
},
scalacOptions in LintTarget ++= Seq(
"-Xfatal-warnings",
"-Ywarn-unused-import",
"-Ywarn-dead-code",
"-P:linter:disable:PreferIfToBooleanMatch"
),
wartremoverErrors ++= Warts.allBut(Wart.DefaultArguments, Wart.MutableDataStructures)
)
}
scalacOptions in Compile := (scalacOptions in Compile).value filterNot { switch =>
switch.startsWith("-P:wartremover:") ||
"^-Xplugin:.*/org[.]brianmckenna/.*wartremover.*[.]jar$".r.pattern.matcher(switch).find ||
switch.startsWith("-P:linter:") ||
"^-Xplugin:.*/com[.]foursquare[.]lint/.*linter.*[.]jar$".r.pattern.matcher(switch).find
}
resolvers += "Linter Repository" at "https://hairyfotr.github.io/linteRepo/releases"
addCompilerPlugin("org.psywerx.hairyfotr" %% "linter" % "0.1.17")
scalastyleFailOnError := true
// <-- Linters
// Reformat at every compile.
// See https://github.com/sbt/sbt-scalariform
val preferences =
ScalariformKeys.preferences := ScalariformKeys.preferences.value
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DoubleIndentConstructorArguments, true)
.setPreference(DanglingCloseParenthesis, Preserve)
Seq(preferences)
// --> bintray
bintrayRepository := "scala"
bintrayOrganization := Some("agilogy")
bintrayPackageLabels := Seq("scala")
licenses += ("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.html"))
// <-- bintray
enablePlugins(GitVersioning)
git.useGitDescribe := true
publishMavenStyle := isSnapshot.value
publishTo := {
val nexus = "http://188.166.95.201:8081/content/repositories/snapshots"
if (isSnapshot.value) Some("snapshots" at nexus)
else publishTo.value
}