-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
103 lines (84 loc) · 3.01 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
import Dependencies._
ThisBuild / organization := "net.hogerheijde.taxonomy-provider"
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / scalaVersion := "2.12.8"
ThisBuild / name := "taxonomy-store"
ThisBuild / libraryDependencies ++= scalatest
// -----------------------------------------------------------------------------
// Compile & Analysis
// See: Toward a safer Scala
// http://downloads.typesafe.com/website/presentations/ScalaDaysSF2015/Toward%20a%20Safer%20Scala%20@%20Scala%20Days%20SF%202015.pdf
lazy val minimalScalacOptions = Seq(
"-target:jvm-1.8",
"-unchecked",
"-deprecation",
"-feature",
"-Ywarn-unused:imports,privates,locals,implicits",
"-Xlint:_"
)
lazy val strictScalacOptions = minimalScalacOptions ++ Seq("-Xfatal-warnings")
// We do not want any fatal warnings in the IDE when imports are unused.
// System property lenient is needed to communicate that to this build script.
// In IntelliJ, under SBT settings, you can set VM parameters to contain "-Dlenient=true"
ThisBuild / scalacOptions ++= {
sys.props.getOrElse("lenient", "false").toBoolean match {
case true => minimalScalacOptions
case _ => strictScalacOptions
}
}
(ThisBuild / scalastyleConfig in Compile) := baseDirectory.value / "scalastyle_config.xml"
(ThisBuild / scalastyleConfig in Test) := baseDirectory.value / "scalastyle_config.xml"
lazy val common = project
.in(file("common"))
.disablePlugins(AssemblyPlugin)
lazy val api = project
.in(file("api"))
.disablePlugins(AssemblyPlugin)
.settings(
name := "api",
libraryDependencies ++= protobuf,
PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value
)
)
lazy val client = project
.dependsOn(api, common)
.disablePlugins(AssemblyPlugin)
.in(file("client"))
.settings(
name := "client",
libraryDependencies ++= grpc,
libraryDependencies ++= logging, // FIXME Client should not have logging configured like this
libraryDependencies ++= Seq(
tqa,
saxon,
),
)
lazy val server = project
.dependsOn(api, common)
.in(file("server"))
.enablePlugins(
UniversalPlugin, // FIXME not sure if we need this one explicitly
JavaAppPackaging, // Creates runnable jar
DockerPlugin, // Package runnable jar in Docker image
).settings(
name := "server",
libraryDependencies ++= grpc,
libraryDependencies ++= logging,
libraryDependencies ++= Seq(
tqa,
typesafeConfig,
),
assemblyMergeStrategy in assembly := {
case PathList("META-INF", "native", xs @ _*) => MergeStrategy.first
case PathList("META-INF", xs @ _*) => MergeStrategy.discard
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
},
mainClass in assembly := Some("net.hogerheijde.taxonomystore.server.TaxonomyStoreServer"),
(maintainer in Docker) := "[email protected]",
dockerBaseImage := "openjdk:11-jre",
dockerExposedPorts := Seq(50051),
dockerLabels := Map("0.0.1" -> "0.0.1")
)