-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sbt
More file actions
165 lines (128 loc) · 5.46 KB
/
build.sbt
File metadata and controls
165 lines (128 loc) · 5.46 KB
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
import java.io.File
import sbt._
import sbtrelease._
import sbtrelease.ReleaseStateTransformations._
val projectName = "org.dcs.web"
name := projectName
lazy val UNIT = sbt.config("unit") extend Test
lazy val IT = sbt.config("it") extend Test
lazy val web = Project("web", file(".")).
enablePlugins(PlayScala, BuildInfoPlugin, GitVersioning, GitBranchPrompt).
configs(IT).
settings(inConfig(IT)(Defaults.testTasks): _*).
settings(testOptions in IT := Seq(Tests.Argument("-n", "IT"))).
configs(UNIT).
settings(inConfig(UNIT)(Defaults.testTasks): _*).
settings(testOptions in UNIT := Seq(
Tests.Argument("-l", "IT"),
Tests.Argument("-l", "E2E")
)
)
scalaVersion := "2.11.7"
updateOptions := updateOptions.value.withCachedResolution(true)
crossPaths := false
Common.commonSettings
resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"
libraryDependencies ++= Seq(
jdbc,
cache,
ws,
filters,
"org.dcs" % "org.dcs.commons" % "0.3.0",
"org.dcs" % "org.dcs.api" % "0.4.0",
"org.dcs" % "org.dcs.remote" % "0.4.0",
"org.dcs" % "org.dcs.flow" % "0.4.0",
"org.webjars" %% "webjars-play" % "2.5.0",
"io.jsonwebtoken" % "jjwt" % "0.7.0",
"org.keycloak" % "keycloak-authz-client" % "2.4.0.Final",
"org.scalatestplus.play" %% "scalatestplus-play" % "1.5.1" % Test,
"org.mockito" % "mockito-core" % "2.2.1" % Test
)
publish <<= (publish) dependsOn dist
publishLocal <<= (publishLocal) dependsOn dist
publishM2 <<= (publishM2) dependsOn dist
val publishDist = TaskKey[File]("publishDist", "Publish dist zip file")
artifact in publishDist ~= { (art: Artifact) => art.copy(`type` = "zip", extension = "zip") }
val publishDistSettings = Seq[Setting[_]] (
publishDist <<= (target in Universal, normalizedName, version) map { (targetDir, id, version) =>
val packageName = "%s-%s" format(id, version)
targetDir / (packageName + ".zip")
}) ++ Seq(addArtifact(artifact in publishDist, publishDist).settings: _*)
Seq(publishDistSettings: _*)
scalacOptions in ThisBuild ++= Seq(
"-target:jvm-1.8",
"-encoding", "UTF-8",
"-deprecation", // warning and location for usages of deprecated APIs
"-feature", // warning and location for usages of features that should be imported explicitly
"-unchecked", // additional warnings where generated code depends on assumptions
"-Xlint", // recommended additional warnings
"-Ywarn-adapted-args", // Warn if an argument list is modified to match the receiver
"-Ywarn-value-discard", // Warn when non-Unit expression results are unused
"-Ywarn-inaccessible",
"-Ywarn-dead-code",
"-language:reflectiveCalls"
)
fork in run := true
headerLicense := Some(HeaderLicense.Custom(
"""Copyright (c) 2017-2018 brewlabs SAS
|
|Licensed under the Apache License, Version 2.0 (the "License");
|you may not use this file except in compliance with the License.
|You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
|Unless required by applicable law or agreed to in writing, software
|distributed under the License is distributed on an "AS IS" BASIS,
|WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|See the License for the specific language governing permissions and
|limitations under the License.
|
|""".stripMargin
))
// ------- Versioning , Release Section --------
// Build Info
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion)
buildInfoPackage := projectName
// Git
showCurrentGitBranch
git.useGitDescribe := true
git.baseVersion := "0.0.0"
val VersionRegex = "v([0-9]+.[0-9]+.[0-9]+)-?(.*)?".r
git.gitTagToVersionNumber := {
case VersionRegex(v,"SNAPSHOT") => Some(s"$v-SNAPSHOT")
case VersionRegex(v,"") => Some(v)
case VersionRegex(v,s) => Some(s"$v-$s-SNAPSHOT")
case v => None
}
lazy val bumpVersion = settingKey[String]("Version to bump - should be one of \"None\", \"Major\", \"Patch\"")
bumpVersion := "None"
releaseVersion := {
ver => bumpVersion.value.toLowerCase match {
case "none" => Version(ver).
map(_.withoutQualifier.string).
getOrElse(versionFormatError)
case "major" => Version(ver).
map(_.withoutQualifier).
map(_.bump(sbtrelease.Version.Bump.Major).string).
getOrElse(versionFormatError)
case "patch" => Version(ver).
map(_.withoutQualifier).
map(_.bump(sbtrelease.Version.Bump.Bugfix).string).
getOrElse(versionFormatError)
case _ => sys.error("Unknown bump version - should be one of \"None\", \"Major\", \"Patch\"")
}
}
releaseVersionBump := sbtrelease.Version.Bump.Minor
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies, // : ReleaseStep
inquireVersions, // : ReleaseStep
runTest, // : ReleaseStep
setReleaseVersion, // : ReleaseStep
commitReleaseVersion, // : ReleaseStep, performs the initial git checks
tagRelease, // : ReleaseStep
ReleaseStep(releaseStepTask(publish in Universal)),
setNextVersion, // : ReleaseStep
commitNextVersion, // : ReleaseStep
pushChanges // : ReleaseStep, also checks that an upstream branch is properly configured
)