-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.sbt
124 lines (110 loc) · 4.71 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
import scala.io.AnsiColor._
import de.heikoseeberger.sbtheader.HeaderPlugin
Global / onLoad := {
println(s"""$GREEN
|$GREEN ____
|$GREEN ,--, ,' , `.
|$GREEN ,----,,--.'| ,-+-,.' _ |
|$GREEN .' .`|| |, ,-+-. ; , ||
|$GREEN .' .' .'`--'_ ,--.'|' | ||
|$GREEN ,---, ' ./ ,' ,'| | | ,', | |,
|$GREEN ; | .' / ' | | | | / | |--'
|$GREEN `---' / ;--,| | : | : | | ,
|$GREEN / / / .`|' : |__ | : | |/
|$GREEN ./__; .' | | '.'|| | |`-'
|$GREEN ; | .' ; : ;| ;/
|$GREEN `---' | , / '---'
|$GREEN ---`-'
|$RESET v.${version.value}
|""".stripMargin)
(Global / onLoad).value
}
ThisBuild / resolvers ++= Seq(
"New snapshots" at "https://s01.oss.sonatype.org/content/repositories/snapshots/"
) ++ Resolver.sonatypeOssRepos("snapshots")
// sbt-assembly, not support build docker image by sbt task, so we use sbt-native-packager
//lazy val assemblySettings = Seq(
// ThisBuild / assemblyMergeStrategy := {
// case "application.conf" => MergeStrategy.concat
// case x if x.endsWith(".txt") || x.endsWith(".proto") => MergeStrategy.first
// case x if x.endsWith("module-info.class") => MergeStrategy.first
// case x if x.endsWith(".properties") => MergeStrategy.deduplicate
// case x =>
// val oldStrategy = (ThisBuild / assemblyMergeStrategy).value
// oldStrategy(x)
// }
//)
lazy val commonConfiguration: Project => Project =
_.settings(Information.value)
.settings(ProjectSetting.value)
.settings(ProjectSetting.noPublish)
.settings(commands ++= Commands.value)
// .settings(assemblySettings)
lazy val zim = (project in file("."))
.settings(name := "zim")
.aggregate(
`zim-server`,
`zim-domain`,
`zim-cache-api`,
`zim-api`,
`zim-auth`,
`zim-infra`,
`zim-cache-redis4cats`,
`zim-cache-redis4zio`
)
.configure(commonConfiguration)
lazy val `zim-server` = (project in file("modules/zim-server"))
.settings(
libraryDependencies ++= Dependencies.serverDeps,
Compile / scalacOptions ++= List("-Ymacro-annotations"),
Docker / packageName := "liguobin/zim",
Docker / version := version.value,
dockerBaseImage := "openjdk",
dockerExposedVolumes ++= Seq("/opt/docker"),
dockerExposedPorts := Seq(9000),
Compile / mainClass := Some("org.bitlap.zim.server.ZimServer"),
dockerEntrypoint := Seq(
"/opt/docker/bin/zim-server",
"--privileged=true"
)
)
// .settings(assembly / mainClass := Some("org.bitlap.zim.server.ZimServer"))
.configure(commonConfiguration)
.enablePlugins(ScalafmtPlugin, HeaderPlugin, JavaServerAppPackaging, DockerPlugin)
.dependsOn(`zim-auth`, `zim-infra`, `zim-cache-redis4cats`, `zim-cache-redis4zio`)
lazy val `zim-infra` = (project in file("modules/zim-infra"))
.settings(
libraryDependencies ++= Dependencies.infrastructureDeps
)
.configure(commonConfiguration)
.enablePlugins(ScalafmtPlugin, HeaderPlugin)
.dependsOn(`zim-api`)
lazy val `zim-domain` = (project in file("modules/zim-domain"))
.settings(BuildInfoSettings.value)
.settings(libraryDependencies ++= Dependencies.domainDeps)
.configure(commonConfiguration)
.enablePlugins(GitVersioning, BuildInfoPlugin, ScalafmtPlugin, HeaderPlugin)
lazy val `zim-cache-api` = (project in file("modules/zim-cache-api"))
.settings(libraryDependencies ++= Dependencies.cacheApiDeps)
.configure(commonConfiguration)
.enablePlugins(ScalafmtPlugin, HeaderPlugin)
lazy val `zim-api` = (project in file("modules/zim-api"))
.settings(libraryDependencies ++= Dependencies.apiDeps)
.configure(commonConfiguration)
.enablePlugins(ScalafmtPlugin, HeaderPlugin)
.dependsOn(`zim-domain`)
lazy val `zim-auth` = (project in file("modules/zim-auth"))
.settings(libraryDependencies ++= Dependencies.domainDeps)
.configure(commonConfiguration)
.enablePlugins(ScalafmtPlugin, HeaderPlugin)
.dependsOn(`zim-domain`)
lazy val `zim-cache-redis4cats` = (project in file("modules/zim-cache-redis4cats"))
.settings(libraryDependencies ++= Dependencies.cacheRedis4catsDeps)
.configure(commonConfiguration)
.enablePlugins(ScalafmtPlugin, HeaderPlugin)
.dependsOn(`zim-cache-api`)
lazy val `zim-cache-redis4zio` = (project in file("modules/zim-cache-redis4zio"))
.settings(libraryDependencies ++= Dependencies.cacheRedis4zioDeps)
.configure(commonConfiguration)
.enablePlugins(ScalafmtPlugin, HeaderPlugin)
.dependsOn(`zim-cache-api`)