-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.sbt
208 lines (189 loc) · 5.76 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
import java.nio.file.Files
import java.nio.file.StandardCopyOption
import LibraryDependencies._
import org.scalajs.linker.interface.ESVersion
import org.scalajs.sbtplugin.Stage
lazy val `kinesis-mock` = projectMatrix
.enablePlugins(DockerImagePlugin, NoPublishPlugin)
.settings(
description := "A Mock API for AWS Kinesis",
libraryDependencies ++= Seq(
Borer.circe.value,
Borer.core.value,
Cats.core.value,
Cats.effect.value,
Circe.core.value,
Circe.parser.value,
Circe.fs2.value,
Ciris.core.value,
Enumeratum.cats.value,
Enumeratum.core.value,
Enumeratum.circe.value,
Http4s.emberServer.value,
Http4s.circe.value,
Http4s.dsl.value,
Log4Cats.core.value,
Ciris.core.value,
FS2.core.value,
FS2.io.value,
ScodecBits.value
),
assembly / test := {},
assembly / assemblyMergeStrategy := {
case PathList("module-info.class", _ @_*) => MergeStrategy.discard
case x => MergeStrategy.defaultMergeStrategy(x)
},
assembly / assemblyOutputPath := file(
s"docker/image/lib/${name.value}.jar"
),
Compile / mainClass := Some("kinesis.mock.KinesisMockService")
)
.settings(DockerImagePlugin.settings)
.jvmPlatform(Seq(Scala213))
.jsPlatform(Seq(Scala213))
lazy val `kinesis-mock-js` =
`kinesis-mock`
.js(Scala213)
.enablePlugins(NpmPackagePlugin)
.settings(
Compile / fastLinkJS / scalaJSLinkerOutputDirectory := file(
"docker/image/lib"
),
Compile / fullLinkJS / scalaJSLinkerOutputDirectory := file(
"docker/image/lib"
),
scalaJSUseMainModuleInitializer := true,
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) },
scalaJSLinkerConfig ~= {
_.withESFeatures(_.withESVersion(ESVersion.ES2018))
},
npmPackageName := "kinesis-local",
npmPackageAuthor := "Eric Meisel",
npmPackageDescription := description.value,
npmPackageLicense := Some("MIT"),
npmPackageRepository := Some(
"https://github.com/etspaceman/kinesis-mock"
),
npmPackageBinaryEnable := true,
npmPackageStage := Stage.FullOpt,
npmPackageKeywords := Seq(
"kinesis mock",
"kinesis-mock",
"kinesis",
"aws kinesis",
"aws kinesis mock",
"aws-kinesis-mock"
),
npmExtraFiles := Seq(
file("LICENSE"),
file("kinesis-mock/src/main/resources/server.json")
),
Compile / npmCopyExtraFiles := Def.task {
val targetDir = (Compile / npmPackageOutputDirectory).value
val log = streams.value.log
if (Files.exists(targetDir.toPath())) ()
else Files.createDirectories(targetDir.toPath())
npmExtraFiles.value.foreach { f =>
val targetPath = (targetDir / f.name).toPath
Files.copy(
f.toPath,
targetPath,
StandardCopyOption.REPLACE_EXISTING
)
log.info(s"Wrote $f to $targetPath")
}
}.value,
Compile / npmPackage := {
val b = (Compile / npmPackagePackageJson).value
val a = (Compile / npmPackageOutputJS).value
val c = (Compile / npmPackageWriteREADME).value
val d = (Compile / npmCopyExtraFiles).value
void(a, b, c, d)
}
)
lazy val testkit = projectMatrix
.enablePlugins(NoPublishPlugin)
.settings(libraryDependencies ++= testDependencies.value)
.jvmPlatform(Seq(Scala213))
.jsPlatform(Seq(Scala213))
.dependsOn(`kinesis-mock`)
lazy val `testkit-js` = testkit
.js(Scala213)
.settings(
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) },
scalaJSLinkerConfig ~= {
_.withESFeatures(_.withESVersion(ESVersion.ES2018))
}
)
lazy val `unit-tests` = projectMatrix
.enablePlugins(NoPublishPlugin)
.jvmPlatform(Seq(Scala213))
.jsPlatform(Seq(Scala213))
.dependsOn(testkit % Test)
lazy val `unit-tests-js` = `unit-tests`
.js(Scala213)
.settings(
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) },
scalaJSLinkerConfig ~= {
_.withESFeatures(_.withESVersion(ESVersion.ES2018))
}
)
lazy val `integration-tests` = projectMatrix
.enablePlugins(NoPublishPlugin)
.settings(
libraryDependencies ++= Seq(
Aws.kinesis % Test,
Aws.cloudwatch % Test,
Aws.kpl % Test,
Aws.kcl % Test,
Log4Cats.slf4j % Test,
Logback % Test
),
Test / parallelExecution := false
)
.jvmPlatform(Seq(Scala213))
.dependsOn(testkit % Test)
lazy val allProjects = Seq(
`kinesis-mock`,
testkit,
`unit-tests`,
`integration-tests`
)
lazy val functionalTestProjects = List(`kinesis-mock`).map(_.js(Scala213))
def commonRootSettings: Seq[Setting[_]] =
DockerComposePlugin.settings(true, functionalTestProjects) ++ Seq(
name := "kinesis-mock-root",
ThisBuild / mergifyLabelPaths ++= allProjects.map { x =>
x.id -> x.base
}.toMap
)
lazy val root = project
.in(file("."))
.enablePlugins(NoPublishPlugin)
.settings(commonRootSettings)
.aggregate(allProjects.flatMap(_.projectRefs): _*)
lazy val `root-jvm-213` = project
.enablePlugins(NoPublishPlugin)
.settings(commonRootSettings)
.aggregate(
allProjects.flatMap(
_.filterProjects(
Seq(VirtualAxis.jvm, VirtualAxis.ScalaVersionAxis(Scala213, "2.13"))
).map(_.project)
): _*
)
lazy val `root-js-213` = project
.enablePlugins(NoPublishPlugin)
.settings(commonRootSettings)
.aggregate(
allProjects.flatMap(
_.filterProjects(
Seq(VirtualAxis.js, VirtualAxis.ScalaVersionAxis(Scala213, "2.13"))
).map(_.project)
): _*
)
lazy val rootProjects = List(
`root-jvm-213`,
`root-js-213`
).map(_.id)
ThisBuild / githubWorkflowBuildMatrixAdditions += "project" -> rootProjects