-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.sbt
241 lines (220 loc) · 9.87 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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* license agreements; and to You under the Apache License, version 2.0:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* This file is part of the Apache Pekko project, which was derived from Akka.
*/
import net.bzzt.reproduciblebuilds.ReproducibleBuildsPlugin.reproducibleBuildsCheckResolver
import org.apache.pekko.projections.Dependencies
ThisBuild / versionScheme := Some(VersionScheme.SemVerSpec)
sourceDistName := "apache-pekko-projection"
sourceDistIncubating := false
ThisBuild / resolvers += Resolver.ApacheMavenSnapshotsRepo
ThisBuild / reproducibleBuildsCheckResolver := Resolver.ApacheMavenStagingRepo
lazy val core =
Project(id = "core", base = file("core"))
.configs(IntegrationTest)
.enablePlugins(ReproducibleBuildsPlugin)
.settings(headerSettings(IntegrationTest))
.settings(Defaults.itSettings)
.settings(Dependencies.core)
.settings(AutomaticModuleName.settings("pekko.projection.core"))
.settings(name := "pekko-projection-core")
.settings(Protobuf.settings)
lazy val coreTest =
Project(id = "core-test", base = file("core-test"))
.configs(IntegrationTest)
.settings(headerSettings(IntegrationTest))
.disablePlugins(MimaPlugin)
.settings(Defaults.itSettings)
.settings(Dependencies.coreTest)
.settings(
name := "pekko-projection-core-test")
.settings(publish / skip := true)
.dependsOn(core)
.dependsOn(testkit % Test)
lazy val testkit =
Project(id = "testkit", base = file("testkit"))
.configs(IntegrationTest)
.enablePlugins(ReproducibleBuildsPlugin)
.settings(headerSettings(IntegrationTest))
.settings(Defaults.itSettings)
.settings(Dependencies.testKit)
.settings(AutomaticModuleName.settings("pekko.projection.testkit"))
.settings(name := "pekko-projection-testkit")
.dependsOn(core)
// provides offset storage backed by a JDBC table
lazy val jdbc =
Project(id = "jdbc", base = file("jdbc"))
.configs(IntegrationTest.extend(Test))
.enablePlugins(ReproducibleBuildsPlugin)
.settings(headerSettings(IntegrationTest))
.settings(Defaults.itSettings)
.settings(Dependencies.jdbc)
.settings(AutomaticModuleName.settings("pekko.projection.jdbc"))
.settings(name := "pekko-projection-jdbc")
.dependsOn(core)
.dependsOn(coreTest % "test->test")
.dependsOn(testkit % Test)
// provides offset storage backed by a JDBC (Slick) table
lazy val slick =
Project(id = "slick", base = file("slick"))
.configs(IntegrationTest.extend(Test))
.enablePlugins(ReproducibleBuildsPlugin)
.settings(headerSettings(IntegrationTest))
.settings(Defaults.itSettings)
.settings(
// Transitive dependency `scala-reflect` to avoid `NoClassDefFoundError`.
// See: https://github.com/slick/slick/issues/2933
libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) => Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value)
case _ => Nil
}))
.settings(Dependencies.slick)
.settings(AutomaticModuleName.settings("pekko.projection.slick"))
.settings(
name := "pekko-projection-slick",
versionScheme := None)
.dependsOn(jdbc)
.dependsOn(core)
.dependsOn(coreTest % "test->test")
.dependsOn(testkit % Test)
// provides offset storage backed by a Cassandra table
lazy val cassandra =
Project(id = "cassandra", base = file("cassandra"))
.configs(IntegrationTest)
.enablePlugins(ReproducibleBuildsPlugin)
.settings(headerSettings(IntegrationTest))
.settings(Defaults.itSettings)
.settings(Dependencies.cassandra)
.settings(AutomaticModuleName.settings("pekko.projection.cassandra"))
.settings(name := "pekko-projection-cassandra")
.dependsOn(core)
// strictly speaking it is not needed to have test->test here.
// Cassandra module doesn't have tests, only integration tests
// however, without it the generated pom.xml doesn't get this test dependencies
.dependsOn(coreTest % "test->test;it->test")
.dependsOn(testkit % "test->compile;it->compile")
// provides source providers for pekko-persistence-query
lazy val eventsourced =
Project(id = "eventsourced", base = file("eventsourced"))
.enablePlugins(ReproducibleBuildsPlugin)
.settings(Dependencies.eventsourced)
.settings(AutomaticModuleName.settings("pekko.projection.eventsourced"))
.settings(name := "pekko-projection-eventsourced")
.dependsOn(core)
.dependsOn(testkit % Test)
// provides offset storage backed by Kafka managed offset commits
lazy val kafka =
Project(id = "kafka", base = file("kafka"))
.enablePlugins(ReproducibleBuildsPlugin)
.settings(Dependencies.kafka)
.settings(AutomaticModuleName.settings("pekko.projection.kafka"))
.settings(name := "pekko-projection-kafka")
.dependsOn(core)
lazy val kafkaTest =
Project(id = "kafka-test", base = file("kafka-test"))
.configs(IntegrationTest)
.enablePlugins(ReproducibleBuildsPlugin)
.disablePlugins(MimaPlugin)
.settings(headerSettings(IntegrationTest))
.settings(Defaults.itSettings)
.settings(Dependencies.kafkaTest)
.settings(
name := "pekko-projection-kafka-test",
publish / skip := true)
.dependsOn(kafka)
.dependsOn(testkit % Test)
.dependsOn(slick % "test->test;it->it")
// provides source providers for durable state changes
lazy val `durable-state` =
Project(id = "durable-state", base = file("durable-state"))
.configs(IntegrationTest)
.enablePlugins(ReproducibleBuildsPlugin)
.settings(Dependencies.state)
.settings(AutomaticModuleName.settings("pekko.projection.durable-state"))
.settings(name := "pekko-projection-durable-state")
.dependsOn(core)
.dependsOn(testkit % Test)
lazy val userProjects: Seq[ProjectReference] = List[ProjectReference](
core, jdbc, slick, cassandra, eventsourced, kafka, `durable-state`, testkit)
lazy val examples = project
.configs(IntegrationTest.extend(Test))
.settings(headerSettings(IntegrationTest))
.enablePlugins(ReproducibleBuildsPlugin)
.disablePlugins(MimaPlugin)
.settings(Defaults.itSettings)
.settings(Dependencies.examples)
.dependsOn(slick % "test->test")
.dependsOn(jdbc % "test->test")
.dependsOn(cassandra % "test->test;test->it")
.dependsOn(eventsourced)
.dependsOn(`durable-state`)
.dependsOn(kafkaTest % "test->test")
.dependsOn(testkit % Test)
.settings(publish / skip := true, scalacOptions += "-feature", javacOptions += "-parameters")
lazy val docs = project
.enablePlugins(PekkoParadoxPlugin, ParadoxPlugin, ParadoxSitePlugin, PreprocessPlugin)
.disablePlugins(MimaPlugin)
.dependsOn(core, testkit)
.settings(
name := "Apache Pekko Projections",
pekkoParadoxGithub := Some("https://github.com/apache/pekko-projection"),
publish / skip := true,
makeSite := makeSite.dependsOn(LocalRootProject / ScalaUnidoc / doc).value,
previewPath := (Paradox / siteSubdirName).value,
Preprocess / siteSubdirName := s"api/pekko-projection/${projectInfoVersion.value}",
Preprocess / sourceDirectory := (LocalRootProject / ScalaUnidoc / unidoc / target).value,
Paradox / siteSubdirName := s"docs/pekko-projection/${projectInfoVersion.value}",
Compile / paradoxProperties ++= Map(
"project.url" -> "https://pekko.apache.org/docs/pekko-projection/current/",
"canonical.base_url" -> "https://pekko.apache.org/docs/pekko-projection/current",
"github.base_url" -> "https://github.com/apache/pekko-projection",
"pekko.version" -> Dependencies.Versions.pekko,
// Pekko
"extref.pekko.base_url" -> s"https://pekko.apache.org/docs/pekko/${Dependencies.PekkoVersionInDocs}/%s",
"scaladoc.pekko.base_url" -> s"https://pekko.apache.org/api/pekko/${Dependencies.PekkoVersionInDocs}/",
"javadoc.pekko.base_url" -> s"https://pekko.apache.org/japi/pekko/${Dependencies.PekkoVersionInDocs}/",
"javadoc.pekko.link_style" -> "direct",
// Java
"javadoc.base_url" -> "https://docs.oracle.com/javase/8/docs/api/",
// Scala
"scaladoc.scala.base_url" -> s"https://www.scala-lang.org/api/${scalaBinaryVersion.value}.x/",
"scaladoc.pekko.projection.base_url" -> s"/${(Preprocess / siteSubdirName).value}/",
"javadoc.pekko.projection.base_url" -> ""),
paradoxGroups := Map("Language" -> Seq("Java", "Scala")),
paradoxRoots := List("index.html", "getting-started/event-generator-app.html"),
apidocRootPackage := "org.apache.pekko",
Global / pekkoParadoxIncubatorNotice := None,
Compile / paradoxMarkdownToHtml / sourceGenerators += Def.taskDyn {
val targetFile = (Compile / paradox / sourceManaged).value / "license-report.md"
(LocalRootProject / dumpLicenseReportAggregate).map { dir =>
IO.copy(List(dir / "pekko-projection-root-licenses.md" -> targetFile)).toList
}
}.taskValue)
lazy val billOfMaterials = Project("bill-of-materials", file("bill-of-materials"))
.enablePlugins(BillOfMaterialsPlugin)
.disablePlugins(MimaPlugin, SitePlugin)
.settings(
name := "pekko-projection-bom",
licenses := List(License.Apache2),
bomIncludeProjects := userProjects,
description := s"${description.value} (depending on Scala ${CrossVersion.binaryScalaVersion(scalaVersion.value)})")
lazy val root = Project(id = "projection", base = file("."))
.aggregate(userProjects: _*)
.aggregate(billOfMaterials, coreTest, kafkaTest, examples, docs)
.settings(
publish / skip := true,
name := "pekko-projection-root")
.enablePlugins(ScalaUnidocPlugin)
.disablePlugins(SitePlugin, MimaPlugin)
// check format and headers
TaskKey[Unit]("verifyCodeFmt") := {
javafmtCheckAll.all(ScopeFilter(inAnyProject)).result.value.toEither.left.foreach { _ =>
throw new MessageOnlyException(
"Unformatted Java code found. Please run 'javafmtAll' and commit the reformatted code")
}
}
addCommandAlias("verifyCodeStyle", "headerCheckAll; verifyCodeFmt")