forked from cfpb/hmda-platform
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
161 lines (147 loc) · 4.73 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
import Dependencies._
import BuildSettings._
import com.lucidchart.sbt.scalafmt.ScalafmtCorePlugin.autoImport._
import sbt.librarymanagement.Resolver
lazy val commonDeps = Seq(logback, scalaTest, scalaCheck)
lazy val authDeps = Seq(
keycloakAdapter,
keycloak,
jbossLogging,
httpClient
)
lazy val akkaDeps = Seq(
akkaSlf4J,
akkaCluster,
akkaTyped,
akkaClusterTyped,
akkaStream,
akkaStreamTyped,
akkaManagement,
akkaManagementClusterBootstrap,
akkaServiceDiscoveryDNS,
akkaServiceDiscoveryKubernetes,
akkaClusterHttpManagement,
akkaClusterHttpManagement,
akkaTestkitTyped,
akkaCors,
akkaClusterDowning,
akkaKafkaStreams
)
lazy val akkaPersistenceDeps =
Seq(akkaPersistence,
akkaClusterSharding,
akkaPersistenceTyped,
akkaClusterShardingTyped,
akkaPersistenceCassandra,
cassandraLauncher,
kafkaLauncher)
lazy val akkaHttpDeps = Seq(akkaHttp, akkaHttpTestkit, akkaHttpCirce)
lazy val circeDeps = Seq(circe, circeGeneric, circeParser)
lazy val slickDeps = Seq(slick, slickHikaryCP, postgres, h2)
lazy val scalafmtSettings = Seq(
scalafmtOnCompile in ThisBuild := true,
scalafmtTestOnCompile in ThisBuild := true
)
lazy val dockerSettings = Seq(
Docker / maintainer := "Juan Marin Otero",
dockerBaseImage := "openjdk:jre-alpine",
dockerRepository := Some("hmda")
)
lazy val packageSettings = Seq(
// removes all jar mappings in universal and appends the fat jar
mappings in Universal := {
// universalMappings: Seq[(File,String)]
val universalMappings = (mappings in Universal).value
val fatJar = (assembly in Compile).value
// removing means filtering
val filtered = universalMappings filter {
case (_, fileName) => !fileName.endsWith(".jar")
}
// add the fat jar
filtered :+ (fatJar -> ("lib/" + fatJar.getName))
},
// the bash scripts classpath only needs the fat jar
scriptClasspath := Seq((assemblyJarName in assembly).value)
)
lazy val `hmda-root` = (project in file("."))
.settings(hmdaBuildSettings: _*)
.aggregate(common, `hmda-platform`, `check-digit`, `institutions-api`)
lazy val common = (project in file("common"))
.settings(hmdaBuildSettings: _*)
.settings(
PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value
),
Seq(
libraryDependencies ++= commonDeps ++ authDeps ++ akkaDeps ++ akkaPersistenceDeps ++ akkaHttpDeps ++ circeDeps ++ slickDeps
)
)
lazy val `hmda-platform` = (project in file("hmda"))
.enablePlugins(JavaServerAppPackaging,
sbtdocker.DockerPlugin,
AshScriptPlugin)
.settings(hmdaBuildSettings: _*)
.settings(
Seq(
mainClass in Compile := Some("hmda.HmdaPlatform"),
assemblyJarName in assembly := "hmda2.jar",
assemblyMergeStrategy in assembly := {
case "application.conf" => MergeStrategy.concat
case "META-INF/io.netty.versions.properties" => MergeStrategy.concat
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
),
scalafmtSettings,
dockerSettings,
packageSettings
)
.dependsOn(common % "compile->compile;test->test")
lazy val `check-digit` = (project in file("check-digit"))
.enablePlugins(JavaServerAppPackaging,
sbtdocker.DockerPlugin,
AshScriptPlugin)
.settings(hmdaBuildSettings: _*)
.settings(
Seq(
assemblyJarName in assembly := {
s"${name.value}.jar"
},
assemblyMergeStrategy in assembly := {
case "application.conf" => MergeStrategy.concat
case "META-INF/io.netty.versions.properties" => MergeStrategy.concat
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
),
scalafmtSettings,
dockerSettings,
packageSettings
)
.dependsOn(common % "compile->compile;test->test")
lazy val `institutions-api` = (project in file("institutions-api"))
.enablePlugins(JavaServerAppPackaging,
sbtdocker.DockerPlugin,
AshScriptPlugin)
.settings(hmdaBuildSettings: _*)
.settings(
Seq(
mainClass in Compile := Some("hmda.institution.HmdaInstitutionApi"),
assemblyMergeStrategy in assembly := {
case "application.conf" => MergeStrategy.concat
case "META-INF/io.netty.versions.properties" => MergeStrategy.concat
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
},
assemblyJarName in assembly := {
s"${name.value}.jar"
}
),
scalafmtSettings,
dockerSettings,
packageSettings
)
.dependsOn(common % "compile->compile;test->test")