-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sbt
98 lines (74 loc) · 2.62 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
import com.gilcloud.sbt.gitlab.{GitlabCredentials,GitlabPlugin}
organization := "com.agilogy"
name := "srdb-core"
scalaVersion := "2.12.6"
crossScalaVersions := Seq("2.11.7","2.12.6")
libraryDependencies ++= Seq(
"org.postgresql" % "postgresql" % "9.3-1102-jdbc41" % "test",
"org.scalatest" %% "scalatest" % "3.0.5" % "test",
"org.scalamock" %% "scalamock-scalatest-support" % "3.6.0" % "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
coverageExcludedPackages := "<empty>"
// --> gitlab
GitlabPlugin.autoImport.gitlabGroupId := None
GitlabPlugin.autoImport.gitlabProjectId := Some(26236490)
GitlabPlugin.autoImport.gitlabDomain := "gitlab.com"
GitlabPlugin.autoImport.gitlabCredentials := {
val token = sys.env.get("GITLAB_DEPLOY_TOKEN") match {
case Some(token) => token
case None =>
sLog.value.warn(s"Environment variable GITLAB_DEPLOY_TOKEN is undefined, 'publish' will fail.")
""
}
Some(GitlabCredentials("Deploy-Token", token))
}
// <-- gitlab
enablePlugins(GitVersioning)
git.useGitDescribe := true