-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
130 lines (112 loc) · 4.18 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
import sbt.Keys._
import sbtassembly.AssemblyPlugin.autoImport._
lazy val versions = new {
val finatra = "2.8.0"
val guice = "4.0"
val logback = "1.2.2"
val slf4j = "1.7.22"
val slick = "3.2.0-M2"
val h2 = "1.4.193"
val flyway = "4.1.0"
val hikaricp = "2.4.5"
val finagle = "6.42.0"
}
lazy val commonSettings = Seq(
libraryDependencies ++= Seq(
"com.twitter" %% "finatra-http" % versions.finatra
, "com.twitter" %% "finatra-httpclient" % versions.finatra
, "com.twitter" %% "finagle-serversets" % versions.finagle excludeAll(ExclusionRule(organization = "org.slf4j"), ExclusionRule(organization = "log4j"))
, "com.typesafe.slick" %% "slick" % versions.slick
, "com.h2database" % "h2" % versions.h2
, "com.zaxxer" % "HikariCP" % versions.hikaricp
, "org.flywaydb" % "flyway-core" % versions.flyway
, "com.typesafe" % "config" % "1.3.1"
, "ch.qos.logback" % "logback-classic" % versions.logback
, "net.logstash.logback" % "logstash-logback-encoder" % "4.9"
)
)
lazy val commonTestSettings = Seq(
libraryDependencies ++= Seq(
"com.twitter" %% "finatra-http" % versions.finatra % "test"
, "com.twitter" %% "finatra-jackson" % versions.finatra % "test"
, "com.twitter" %% "inject-server" % versions.finatra % "test"
, "com.twitter" %% "inject-app" % versions.finatra % "test"
, "com.twitter" %% "inject-core" % versions.finatra % "test"
, "com.twitter" %% "inject-modules" % versions.finatra % "test"
, "com.google.inject.extensions" % "guice-testlib" % versions.guice % "test"
, "com.twitter" %% "finatra-http" % versions.finatra % "test" classifier "tests"
, "com.twitter" %% "finatra-jackson" % versions.finatra % "test" classifier "tests"
, "com.twitter" %% "inject-server" % versions.finatra % "test" classifier "tests"
, "com.twitter" %% "inject-app" % versions.finatra % "test" classifier "tests"
, "com.twitter" %% "inject-core" % versions.finatra % "test" classifier "tests"
, "com.twitter" %% "inject-modules" % versions.finatra % "test" classifier "tests"
, "org.mockito" % "mockito-core" % "1.9.5" % "test"
, "org.scalacheck" %% "scalacheck" % "1.13.4" % "test"
, "org.scalatest" %% "scalatest" % "3.0.0" % "test"
, "org.specs2" %% "specs2-mock" % "2.4.17" % "test"
)
)
lazy val scalaVersionSettings = Seq(
scalaVersion := "2.11.8"
)
lazy val noPackageSettings = Seq(
Keys.`package` := file(""),
packageBin in Global := file(""),
packagedArtifacts := Map()
)
lazy val dockerPackageSettings = Seq(
test in assembly := {},
sbt.Keys.`package` := {
assembly.value
docker.value
file("")
},
dockerfile in docker := {
val artifact: File = assembly.value
val artifactTargetPath = s"/app/${artifact.name}"
new Dockerfile {
from("java")
add(artifact, artifactTargetPath)
entryPoint("java", "-jar", artifactTargetPath)
expose(8888)
expose(9990)
}
},
imageNames in docker := Seq(
ImageName(s"scalatalk/${name.value}:latest")
),
assembly := {
(compile in Compile).value
assembly.value
},
assemblyMergeStrategy in assembly := {
case PathList("javax", "annotation", xs@_*) => MergeStrategy.last
case "BUILD" => MergeStrategy.discard
case x if x.endsWith("io.netty.versions.properties") => MergeStrategy.discard
case other => MergeStrategy.defaultMergeStrategy(other)
}
)
lazy val common = project.in(file("common"))
.settings(scalaVersionSettings)
.settings(commonSettings)
.settings(commonTestSettings)
.settings(noPackageSettings)
lazy val `talk-service` = project.in(file("talk-service"))
.settings(scalaVersionSettings)
.settings(dockerPackageSettings)
.dependsOn(common % "compile->compile;test->test")
.enablePlugins(DockerPlugin)
lazy val `speaker-service` = project.in(file("speaker-service"))
.settings(scalaVersionSettings)
.settings(dockerPackageSettings)
.dependsOn(common % "compile->compile;test->test")
.enablePlugins(DockerPlugin)
lazy val `event-service` = project.in(file("event-service"))
.settings(scalaVersionSettings)
.settings(dockerPackageSettings)
.dependsOn(common % "compile->compile;test->test")
.enablePlugins(DockerPlugin)
lazy val root = project.in(file("."))
.settings(scalaVersionSettings)
.settings(noPackageSettings)
.aggregate(common, `talk-service`, `speaker-service`, `event-service`)