-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sbt
136 lines (102 loc) · 3.9 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import com.typesafe.sbt.GitPlugin.autoImport._
import com.typesafe.sbt.GitVersioning
import com.gilcloud.sbt.gitlab.{GitlabCredentials,GitlabPlugin}
organization := "com.agilogy"
name := "simple-db"
scalaVersion := "2.12.13"
crossScalaVersions := Seq("2.11.12","2.12.13")
parallelExecution in Test := false
resolvers += "Agilogy GitLab" at "https://gitlab.com/api/v4/groups/583742/-/packages/maven"
libraryDependencies ++= Seq(
"com.agilogy" %% "groupable" % "1.2",
"com.agilogy" %% "srdb-core" % "2.2",
"com.agilogy" %% "srdb-tx" % "1.2",
"com.agilogy" %% "srdb-types" % "2.2.1",
"org.postgresql" % "postgresql" % "9.3-1103-jdbc41" % "test,it",
"log4j" % "log4j" % "1.2.17" % "test,it",
"c3p0" % "c3p0" % "0.9.1.2" % "test,it",
"com.googlecode.flyway" % "flyway-core" % "2.0" % "test,it",
"org.scalatest" %% "scalatest" % "3.0.1" % "test,it",
"com.github.nscala-time" %% "nscala-time" % "2.20.0"
)
// --> 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"
)
scalacOptions in (Compile,doc) ++= Seq("-groups", "-implicits", "-diagrams", "-skip-packages","")
// 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
def withTests(p: Project) =
p.configs(IntegrationTest)
.settings(inConfig(IntegrationTest)(Defaults.testTasks): _*)
.settings(
testOptions in Test := Seq(Tests.Filter(unitFilter)),
testOptions in IntegrationTest := Seq(Tests.Filter(itFilter)),
parallelExecution in IntegrationTest := false
)
def itFilter(name: String): Boolean = (name startsWith "it.") || (name startsWith "system.")
def unitFilter(name: String): Boolean = !itFilter(name)
lazy val IntegrationTest = config("it") extend (Test)
lazy val simpledb = withTests(Project(
id = "simple-db",
base = file(".")))
// <-- Linters
// Reformat at every compile.
// See https://github.com/sbt/sbt-scalariform
coverageExcludedPackages := "<empty>"
coverageHighlighting := false
enablePlugins(spray.boilerplate.BoilerplatePlugin)
// --> 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