-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.sbt
168 lines (147 loc) · 6.25 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
name := """plant-simulator"""
version := "1.0-SNAPSHOT"
ThisBuild / versionScheme := Some("early-semver")
ThisBuild / evictionErrorLevel := Level.Info
lazy val root = (project in file("."))
.enablePlugins(PlayScala, DockerPlugin)
scalaVersion := "2.13.2"
scalacOptions ++= Seq(
// Warnings propogates as errors
"-Xfatal-warnings",
"-language:implicitConversions",
// turns all warnings into errors ;-)
"-target:jvm-1.8",
"-language:reflectiveCalls",
"-Xfatal-warnings",
// possibly old/deprecated linter options
"-unchecked",
"-deprecation",
"-feature",
//"-Ywarn-adapted-args",
"-Ywarn-dead-code",
//"-Ywarn-inaccessible",
//"-Ywarn-nullary-override",
//"-Ywarn-nullary-unit",
"-Xlog-free-terms",
// enables linter options
"-Xlint:adapted-args", // warn if an argument list is modified to match the receiver
"-Xlint:nullary-unit", // warn when nullary methods return Unit
"-Xlint:inaccessible", // warn about inaccessible types in method signatures
"-Xlint:nullary-override", // warn when non-nullary `def f()' overrides nullary `def f'
"-Xlint:infer-any", // warn when a type argument is inferred to be `Any`
"-Xlint:-missing-interpolator", // disables missing interpolator warning
"-Xlint:doc-detached", // a ScalaDoc comment appears to be detached from its element
"-Xlint:private-shadow", // a private field (or class parameter) shadows a superclass field
"-Xlint:type-parameter-shadow", // a local type parameter shadows a type already in scope
"-Xlint:poly-implicit-overload", // parameterized overloaded implicit methods are not visible as view bounds
"-Xlint:option-implicit", // Option.apply used implicit view
"-Xlint:delayedinit-select", // Selecting member of DelayedInit
//"-Xlint:by-name-right-associative", // By-name parameter of right associative operator
"-Xlint:package-object-classes", // Class or object defined in package object
//"-Xlint:unsound-match" // Pattern match may not be typesafe
)
Test / scalacOptions ++= Seq("-Yrangepos")
wartremoverWarnings in (Compile, compile) ++= Warts.allBut(
Wart.ImplicitParameter,
Wart.ImplicitConversion,
Wart.Var, // Bloody, because of Play Routes
Wart.ToString,
Wart.StringPlusAny,
Wart.JavaSerializable,
Wart.AsInstanceOf,
Wart.Overloading,
Wart.Product,
Wart.ListAppend,
Wart.NonUnitStatements,
Wart.ExplicitImplicitTypes,
Wart.Serializable,
Wart.Equals,
Wart.Recursion,
Wart.DefaultArguments,
Wart.Nothing,
Wart.Any
)
javacOptions ++= Seq(
"-Xlint:unchecked",
"-Xlint:deprecation"
)
logLevel := Level.Info
// use logback.xml when running unit tests
Test / javaOptions += "-Dlogger.file=conf/logback-test.xml"
// Docker container configurations
// We will use alpine os as out base image
dockerBaseImage := "anapsix/alpine-java:8_server-jre_unlimited"
// These values will be assigned the docker image name
Docker / maintainer := "https://github.com/joesan"
Docker / packageName := s"joesan/${name.value}"
Docker / version := version.value
import com.typesafe.sbt.packager.docker._
dockerCommands ++= Seq(
Cmd("ENV", "configEnv", "default"), // This will be overridden when running!
// This is the entry point where we can run the application against different environments
ExecCmd("ENTRYPOINT",
"sh",
"-c",
"bin/" + s"${executableScriptName.value}" + " -Denv=$configEnv")
)
// Scala formatter settings
ThisBuild / scalafmtOnCompile := true // all projects
scalafmtOnCompile := true // current project
Compile / scalafmtOnCompile := true // current project, specific configuration
ThisBuild / scalafmtTestOnCompile := true // all projects
scalafmtTestOnCompile := true // current project
Compile / scalafmtTestOnCompile := true // current project, specific configuration
resolvers += "sonatype-releases" at "https://oss.sonatype.org/content/repositories/public/"
val akkaVersion = "2.6.20"
val slickVersion = "3.4.1"
val dropWizardMetricsVersion = "4.2.15"
val playJsonVersion = "2.9.3"
val mySQLConnectorVersion = "8.0.31"
val h2DatabaseVersion = "1.4.186"
val typesafeConfigVersion = "1.4.2"
val scalaLoggingVersion = "3.9.5"
val scalaAsyncVersion = "0.9.7"
val scalaTestVersion = "3.2.15"
val awaitilityVersion = "4.2.0"
libraryDependencies ++= Seq(
ws,
// Our streaming library
"io.monix" %% "monix" % "3.4.1",
// Dependencies needed for Slick
"com.typesafe.slick" %% "slick" % slickVersion,
"com.typesafe.slick" %% "slick-hikaricp" % slickVersion,
// For application Metrics
"io.dropwizard.metrics" % "metrics-core" % dropWizardMetricsVersion,
"io.dropwizard.metrics" % "metrics-jvm" % dropWizardMetricsVersion,
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"org.scala-lang.modules" % "scala-async_2.11" % scalaAsyncVersion,
"com.typesafe" % "config" % typesafeConfigVersion,
// For JSON parsing
"com.typesafe.play" %% "play-json" % playJsonVersion,
"com.typesafe.play" %% "play-json-joda" % playJsonVersion,
// JDBC driver for MySQL & H2
"mysql" % "mysql-connector-java" % mySQLConnectorVersion,
"com.h2database" % "h2" % h2DatabaseVersion,
// Swagger UI API Docs
//"io.swagger" %% "swagger-play2" % "1.6.0",
//"org.webjars" %% "webjars-play" % "2.6.0-M1",
//"org.webjars" % "swagger-ui" % "2.2.0",
// Test dependencies
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % Test,
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion % Test,
"com.typesafe.akka" %% "akka-protobuf-v3" % akkaVersion % Test,
"com.typesafe.akka" %% "akka-serialization-jackson" % akkaVersion % Test,
"com.typesafe.akka" %% "akka-stream" % akkaVersion % Test,
"com.typesafe.akka" %% "akka-actor-typed" % akkaVersion % Test,
"org.scalatest" %% "scalatest" % scalaTestVersion % Test,
"org.awaitility" % "awaitility" % awaitilityVersion % Test,
"org.scalatestplus.play" %% "scalatestplus-play" % "5.1.0" % Test exclude ("org.slf4j", "slf4j-simple"),
"com.github.andyglow" %% "websocket-scala-client" % "0.4.0" % Test exclude ("org.slf4j", "slf4j-simple")
)
// Assembly of the fat jar file
assembly / mainClass := Some("play.core.server.ProdServerStart")
assembly / fullClasspath += Attributed.blank(PlayKeys.playPackageAssets.value)
assemblyMergeStrategy in assembly := {
case PathList("META-INF", xs @ _*) => MergeStrategy.discard
case x => MergeStrategy.first
}