-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.sbt
149 lines (135 loc) · 5.14 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
import com.softwaremill.SbtSoftwareMillCommon.commonSmlBuildSettings
import com.softwaremill.Publish.ossPublishSettings
import com.softwaremill.Publish.updateDocs
import com.softwaremill.UpdateVersionInDocs
import sbt.Def
val http4sVersion = "0.23.28"
val circeVersion = "0.14.4"
val circeYamlVersion = "0.14.2"
val tapirVersion = "1.1.2"
val sttpClientVersion = "3.10.1"
val declineVersion = "2.4.1"
val jsonDependencies = Seq(
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-generic-extras" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
"com.softwaremill.sttp.tapir" %% "tapir-json-circe" % tapirVersion
)
val loggingDependencies = Seq(
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.5",
"ch.qos.logback" % "logback-classic" % "1.5.11",
"org.typelevel" %% "log4cats-slf4j" % "2.7.0"
)
val apiDocsDependencies = Seq(
"com.softwaremill.sttp.tapir" %% "tapir-openapi-docs" % tapirVersion,
"com.softwaremill.sttp.apispec" %% "openapi-circe-yaml" % "0.2.1",
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-bundle" % tapirVersion
)
lazy val dockerSettings = Seq(
dockerExposedPorts := Seq(7070),
dockerBaseImage := "openjdk:8u212-jdk-stretch",
dockerUsername := Some("softwaremill"),
Docker / packageName := "sttp.livestub",
dockerUpdateLatest := true,
Docker / version := { version.value.replace("+", "_") }
)
lazy val commonSettings: Seq[Def.Setting[_]] = commonSmlBuildSettings ++ ossPublishSettings ++ Seq(
organization := "com.softwaremill.sttp.livestub",
scalaVersion := "2.13.15",
scalafmtOnCompile := false,
scmInfo := Some(
ScmInfo(
url("https://github.com/softwaremill/livestub"),
"[email protected]:softwaremill/livestub.git"
)
),
updateDocs := Def.taskDyn {
val files1 =
UpdateVersionInDocs(sLog.value, organization.value, version.value, List(file("docs-sources") / "README.md"))
Def.task {
(docs / mdoc).toTask("").value
files1 ++ Seq(file("generated-docs"), file("README.md"))
}
}.value
)
lazy val app: Project = (project in file("app"))
.settings(commonSettings)
.enablePlugins(DockerPlugin)
.enablePlugins(JavaServerAppPackaging)
.settings(dockerSettings)
.settings(
name := "livestub-app",
libraryDependencies ++= Seq(
"com.softwaremill.sttp.client3" %% "core" % sttpClientVersion,
"org.http4s" %% "http4s-dsl" % http4sVersion,
"org.http4s" %% "http4s-blaze-server" % "0.23.16",
"com.softwaremill.sttp.tapir" %% "tapir-http4s-server" % tapirVersion,
"com.monovore" %% "decline" % declineVersion,
"com.monovore" %% "decline-effect" % declineVersion,
"com.softwaremill.common" %% "tagging" % "2.3.5",
"org.typelevel" %% "cats-core" % "2.12.0",
"org.scalatest" %% "scalatest" % "3.2.19" % Test,
"org.typelevel" %% "cats-effect-testing-scalatest" % "1.5.0" % Test
) ++ loggingDependencies ++ apiDocsDependencies
)
.dependsOn(api, openapi)
lazy val api: Project = (project in file("api"))
.settings(commonSettings)
.settings(
name := "livestub-api",
libraryDependencies ++= Seq(
"com.softwaremill.sttp.tapir" %% "tapir-core" % tapirVersion,
"com.softwaremill.sttp.tapir" %% "tapir-cats" % tapirVersion,
"org.scalatest" %% "scalatest" % "3.2.3" % Test
) ++ jsonDependencies
)
lazy val sdk: Project = (project in file("sdk"))
.settings(commonSettings)
.settings(
name := "livestub-sdk",
libraryDependencies ++= Seq(
"com.softwaremill.sttp.client3" %% "core" % sttpClientVersion,
"com.softwaremill.sttp.tapir" %% "tapir-sttp-client" % tapirVersion,
"org.scalatest" %% "scalatest" % "3.2.19" % Test,
"org.typelevel" %% "cats-effect" % "3.5.4",
"com.softwaremill.sttp.client3" %% "async-http-client-backend-cats" % sttpClientVersion % Test,
"org.typelevel" %% "cats-effect-testing-scalatest" % "1.5.0" % Test
)
)
.dependsOn(api, app % Test)
val compileDocumentation: TaskKey[Unit] = taskKey[Unit]("Compiles documentation throwing away its output")
compileDocumentation := {
(docs / mdoc).toTask(" --out target/generated-doc").value
}
lazy val docs = project
.in(file("generated-docs")) // important: it must not be docs/
.settings(commonSettings)
.enablePlugins(MdocPlugin)
.settings(
publishArtifact := false,
name := "docs",
mdocIn := file("docs-sources"),
moduleName := "livestub-docs",
mdocVariables := Map(
"VERSION" -> version.value
),
libraryDependencies += "com.softwaremill.sttp.client3" %% "async-http-client-backend-cats" % sttpClientVersion,
mdocOut := file(".")
)
.dependsOn(sdk, app)
lazy val openapi = project
.in(file("openapi"))
.settings(commonSettings)
.settings(
name := "openapi",
libraryDependencies ++= Seq(
"io.circe" %% "circe-yaml" % circeYamlVersion,
"com.softwaremill.diffx" %% "diffx-scalatest-should" % "0.9.0" % Test,
"org.scalatest" %% "scalatest" % "3.2.19" % Test
) ++ jsonDependencies
)
lazy val rootProject = (project in file("."))
.settings(commonSettings)
.settings(publishArtifact := false, name := "livestub")
.aggregate(app, api, sdk, docs, openapi)