-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
204 lines (152 loc) · 7.57 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
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
/*
* Copyright (c) 2011-2017 Interfaculty Department of Geoinformatics, University of
* Salzburg (Z_GIS) & Institute of Geological and Nuclear Sciences Limited (GNS Science)
* in the SMART Aquifer Characterisation (SAC) programme funded by the New Zealand
* Ministry of Business, Innovation and Employment (MBIE)
*
* 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.
*/
import com.typesafe.sbt.packager.archetypes.JavaAppPackaging
import com.typesafe.sbt.packager.docker._
import com.sksamuel.scapegoat.sbt._
import com.sksamuel.scapegoat.sbt.ScapegoatSbtPlugin.autoImport._
import scoverage.ScoverageKeys._
import java.util.Date
name := """smart-portal-backend"""
version := "1.0-SNAPSHOT"
// new sbt-site 1.0.0 config SiteScaladocPlugin incompatible with activator sbt-site bundle 0.8.1
lazy val root = (project in file(".")).enablePlugins(PlayScala, BuildInfoPlugin, SiteScaladocPlugin, JavaAppPackaging, DockerPlugin, GhpagesPlugin)
scalaVersion := "2.11.12"
val googleVersion = "1.22.0"
val googleCloudVersion = "0.8.0"
val postgresDriver = "9.4.1211.jre7"
val akkaVersion = "2.4.11"
// google-cloud versions 0.8.0 ... 0.8.3-beta
libraryDependencies ++= Seq(
jdbc,
evolutions,
cache,
ws,
filters,
"info.smart-project" %% "smart-owc-geojson" % "1.1.0",
"com.sendgrid" % "sendgrid-java" % "3.1.0",
"com.typesafe.play" %% "anorm" % "2.5.2",
"org.postgresql" % "postgresql" % postgresDriver,
// "com.vividsolutions" % "jts-core" % "1.14.0",
"org.locationtech.spatial4j" % "spatial4j" % "0.6",
// "org.noggit" % "noggit" % "0.7",
// the xlsx stuff
"com.norbitltd" %% "spoiwo" % "1.2.0",
// depends on apache poi anyways org.apache.poi:poi:3.14:jar
"org.apache.poi" % "poi" % "3.14",
"org.apache.poi" % "poi-ooxml" % "3.14",
"com.google.oauth-client" % "google-oauth-client" % googleVersion,
"com.google.oauth-client" % "google-oauth-client-java6" % googleVersion,
"com.google.http-client" % "google-http-client" % googleVersion,
"com.google.http-client" % "google-http-client-jackson2" % googleVersion,
"com.google.api-client" % "google-api-client" % googleVersion,
"com.google.cloud" % "google-cloud" % "0.8.0" excludeAll(ExclusionRule(organization = "io.netty")),
"com.typesafe.akka" %% "akka-http-core" % akkaVersion,
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % Test,
"com.typesafe.akka" %% "akka-stream-testkit" % akkaVersion % Test,
"org.scalatestplus.play" %% "scalatestplus-play" % "1.5.1" % Test,
specs2 % Test,
"de.leanovate.play-mockws" %% "play-mockws" % "2.5.1" % Test
)
resolvers += Resolver.bintrayRepo("hmrc", "releases")
resolvers += Resolver.bintrayIvyRepo("allixender", "ivy2")
scalacOptions in ThisBuild ++= Seq(
"-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-unused-import", // Warn when imports are unused
"-Ywarn-unused", // Warn when local and private vals, vars, defs, and types are unused
"-Ywarn-numeric-widen", // Warn when numerics are widened, Int and Double, for instance
"-Ywarn-inaccessible", // Warn about inaccessible types in method signatures.
"-Ywarn-dead-code", // Warn when dead code is identified
"-Ywarn-infer-any", // Warn when a type argument is inferred to be `Any`
"-Ywarn-nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
"-Ywarn-nullary-unit", // Warn when nullary methods return Unit
"-language:reflectiveCalls",
"-language:postfixOps" // too lazy?
)
fork in run := true
javaOptions in Test +="-Dlogger.resource=logback-stdout-test.xml"
// -----------------
// coverage, style and dependency checks
val genSiteDir = "src/site/generated"
// Scala style task for compile, config file is scalastyle-config.xml
// lazy val compileScalastyle = taskKey[Unit]("compileScalastyle")
// compileScalastyle := org.scalastyle.sbt.ScalastylePlugin.scalastyle.in(Compile).toTask("").value
// (compile in Compile) <<= (compile in Compile) dependsOn compileScalastyle
// Scala style task to run with tests
lazy val testScalastyle = taskKey[Unit]("testScalastyle")
testScalastyle := org.scalastyle.sbt.ScalastylePlugin.scalastyle.in(Test).toTask("").value
(test in Test) <<= (test in Test) dependsOn testScalastyle
scapegoatVersion := "1.2.1"
scapegoatOutputPath := genSiteDir + "/scapegoat"
// scalacOptions only for the scapegoat task
scalacOptions in Scapegoat ++= Seq("-P:scapegoat:overrideLevels:TraversableHead=Warning:OptionGet=Warning")
// disabling coverage for standard tasks, call explicit in test runs / publish site
// coverageEnabled := true
lazy val coverageCopyTask = TaskKey[Unit]("copy-coverage")
coverageCopyTask := {
println(s"Copying: ./target/scala-2.11/scoverage-report/ to $genSiteDir")
val result = Seq("cp", "-r", "./target/scala-2.11/scoverage-report", genSiteDir) !!
}
// sbt-dependency-graph
dependencyCheckOutputDirectory := Some(file(genSiteDir + "/dep-sec"))
// Use e.g. yEd to format the graph
dependencyGraphMLFile := file(genSiteDir + "/dep-sec/dependencies.graphml")
// Use e.g.graphviz to render
dependencyDotFile := file(genSiteDir + "/dep-sec/dependencies.dot")
// updates of libs and dependencies
dependencyUpdatesFilter -= moduleFilter(organization = "org.scala-lang")
dependencyUpdatesReportFile := file(genSiteDir + "/dep-sec/dependency-updates.txt")
// -----------------
// publish docs on github
// new sbt-site 1.0.0 config incompatible with activator sbt-site bundle 0.8.1
includeFilter in makeSite := "*.txt" | "*.html" | "*.md" | "*.css" | "*.png" | "*.jpg" | "*.gif" | "*.js"
// will automatically be included with makeSite
// Puts Scaladoc output in `target/site/api/latest`
siteSubdirName in SiteScaladoc := "api/latest"
previewLaunchBrowser := false
git.remoteRepo := "[email protected]:ZGIS/smart-portal-backend.git"
// -----------------
// packaging options
val buildNumber = sys.props.getOrElse("buildNumber", default = System.currentTimeMillis().toString)
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion, "buildNumber" -> buildNumber)
buildInfoPackage := "utils"
buildInfoObject := "BuildInfo"
version in Docker := version.value
maintainer in Docker := "[email protected]"
dockerBaseImage in Docker := "java:8-jre"
dockerBaseImage := "java:8-jre"
sources in (Compile, doc) := Seq.empty
publishArtifact in (Compile, packageDoc) := false
javaOptions in Universal ++= Seq(
// others will be added as app parameters
// "-DapplyEvolutions.default=true",
"-Dplay.evolutions.db.default.autoApply=true",
"-Dplay.evolutions.db.default.autoApplyDowns=true",
"-Dconfig.resource=application.conf",
"-Dlogger.resource=logback-stdout.xml",
"-Dhttp.address=0.0.0.0",
"-Dhttp.port=9000"
//"-Dapplication.base_url=http://test.smart-project.info/"
)