| /* |
| * 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 com.github.sbt.junit.jupiter.sbt.Import.JupiterKeys |
| import net.bzzt.reproduciblebuilds.ReproducibleBuildsPlugin.reproducibleBuildsCheckResolver |
| import org.apache.pekko.projections.Dependencies |
| |
| ThisBuild / versionScheme := Some(VersionScheme.SemVerSpec) |
| sourceDistName := "apache-pekko-projection" |
| sourceDistIncubating := false |
| |
| ThisBuild / evictionErrorLevel := Level.Info |
| ThisBuild / resolvers += Resolver.ApacheMavenSnapshotsRepo |
| ThisBuild / reproducibleBuildsCheckResolver := Resolver.ApacheMavenStagingRepo |
| ThisBuild / javafmtFormatterCompatibleJavaVersion := 17 |
| |
| ThisBuild / JupiterKeys.junitJupiterVersion := "6.1.0" |
| ThisBuild / JupiterKeys.junitPlatformVersion := "6.1.0" |
| Global / excludeLintKeys ++= Set(JupiterKeys.junitJupiterVersion, JupiterKeys.junitPlatformVersion) |
| |
| lazy val core = |
| Project(id = "core", base = file("core")) |
| .enablePlugins(ReproducibleBuildsPlugin) |
| .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")) |
| .disablePlugins(MimaPlugin) |
| .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")) |
| .enablePlugins(ReproducibleBuildsPlugin) |
| .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")) |
| .enablePlugins(ReproducibleBuildsPlugin) |
| .settings(Dependencies.jdbc) |
| .settings(AutomaticModuleName.settings("pekko.projection.jdbc")) |
| .settings(name := "pekko-projection-jdbc") |
| .dependsOn(core) |
| .dependsOn(coreTest % "test->test") |
| .dependsOn(testkit % Test) |
| |
| lazy val jdbcIntTest = |
| Project(id = "jdbc-int-test", base = file("jdbc-int-test")) |
| .disablePlugins(MimaPlugin) |
| .settings(Dependencies.jdbc) |
| .settings( |
| name := "pekko-projection-jdbc-int-test", |
| publish / skip := true, |
| Test / parallelExecution := false) |
| .dependsOn(jdbc % "test->test") |
| .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")) |
| .enablePlugins(ReproducibleBuildsPlugin) |
| .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) |
| |
| lazy val slickIntTest = |
| Project(id = "slick-int-test", base = file("slick-int-test")) |
| .disablePlugins(MimaPlugin) |
| .settings(Dependencies.slick) |
| .settings( |
| name := "pekko-projection-slick-int-test", |
| versionScheme := None, |
| publish / skip := true, |
| Test / parallelExecution := false) |
| .dependsOn(slick % "test->test") |
| .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")) |
| .enablePlugins(ReproducibleBuildsPlugin) |
| .settings(Dependencies.cassandra) |
| .settings(AutomaticModuleName.settings("pekko.projection.cassandra")) |
| .settings(name := "pekko-projection-cassandra") |
| .dependsOn(core) |
| |
| lazy val cassandraTest = |
| Project(id = "cassandra-test", base = file("cassandra-test")) |
| .disablePlugins(MimaPlugin) |
| .settings(Dependencies.cassandra) |
| .settings(name := "pekko-projection-cassandra-test") |
| .settings(publish / skip := true) |
| .settings(Test / parallelExecution := false) |
| .dependsOn(core) |
| .dependsOn(cassandra) |
| .dependsOn(coreTest % "test->test") |
| .dependsOn(testkit % Test) |
| |
| // 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) |
| .dependsOn(testkit % "test") |
| |
| lazy val kafkaTest = |
| Project(id = "kafka-test", base = file("kafka-test")) |
| .disablePlugins(MimaPlugin) |
| .settings(Dependencies.kafkaTest) |
| .settings( |
| name := "pekko-projection-kafka-test", |
| publish / skip := true) |
| .dependsOn(kafka % "test->test") |
| .dependsOn(slick % "compile;test->test") |
| .dependsOn(testkit % "test") |
| |
| // provides source providers for durable state changes |
| lazy val `durable-state` = |
| Project(id = "durable-state", base = file("durable-state")) |
| .enablePlugins(ReproducibleBuildsPlugin) |
| .settings(Dependencies.state) |
| .settings(AutomaticModuleName.settings("pekko.projection.durable-state")) |
| .settings(name := "pekko-projection-durable-state") |
| .dependsOn(core) |
| .dependsOn(testkit % Test) |
| |
| // provides event producer/consumer over gRPC |
| lazy val grpc = |
| Project(id = "grpc", base = file("grpc")) |
| .enablePlugins(ReproducibleBuildsPlugin, PekkoGrpcPlugin) |
| .disablePlugins(MimaPlugin) // new in 2.0.0 |
| .settings(Dependencies.grpc) |
| .settings(AutomaticModuleName.settings("pekko.projection.grpc")) |
| .settings( |
| name := "pekko-projection-grpc", |
| pekkoGrpcCodeGeneratorSettings += "server_power_apis") |
| .dependsOn(core) |
| .dependsOn(eventsourced) |
| .dependsOn(testkit % Test) |
| |
| // provides offset storage backed by a R2DBC table |
| lazy val r2dbc = |
| Project(id = "r2dbc", base = file("r2dbc")) |
| .enablePlugins(ReproducibleBuildsPlugin) |
| .settings(Dependencies.r2dbc) |
| .settings(AutomaticModuleName.settings("pekko.projection.r2dbc")) |
| .settings( |
| name := "pekko-projection-r2dbc") |
| .dependsOn(core) |
| .dependsOn(grpc) |
| |
| lazy val grpcTest = |
| Project(id = "grpc-test", base = file("grpc-test")) |
| .enablePlugins(PekkoGrpcPlugin) |
| .disablePlugins(MimaPlugin) |
| .settings(Dependencies.grpcTest) |
| .settings( |
| name := "pekko-projection-grpc-test", |
| publish / skip := true, |
| // following is needed by Agrona lib |
| // https://github.com/aeron-io/agrona/wiki/Change-Log#200-2024-12-17 |
| Test / fork := true, |
| Test / javaOptions += "--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED") |
| .dependsOn(grpc % "compile;test->compile") |
| .dependsOn(r2dbc % Test) |
| .dependsOn(testkit % Test) |
| |
| lazy val grpcIntTest = |
| Project(id = "grpc-int-test", base = file("grpc-int-test")) |
| .disablePlugins(MimaPlugin) |
| .settings(Dependencies.grpcIntTest) |
| .settings( |
| name := "pekko-projection-grpc-int-test", |
| publish / skip := true, |
| // following is needed by Agrona lib |
| // https://github.com/aeron-io/agrona/wiki/Change-Log#200-2024-12-17 |
| Test / fork := true, |
| Test / javaOptions += "--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED") |
| .dependsOn(grpcTest % "test->test;test->compile") |
| .dependsOn(eventsourced % Test) |
| .dependsOn(r2dbc % Test) |
| .dependsOn(testkit % Test) |
| |
| lazy val r2dbcIntTest = |
| Project(id = "r2dbc-int-test", base = file("r2dbc-int-test")) |
| .disablePlugins(MimaPlugin) |
| .settings(Dependencies.r2dbcIntTest) |
| .settings( |
| name := "pekko-projection-r2dbc-int-test", |
| publish / skip := true, |
| Test / parallelExecution := false, |
| // there are some compile warnings in the test code (Scala 2.13) |
| scalacOptions ++= { |
| if (scalaVersion.value.startsWith("2.")) |
| Seq( |
| "-Wconf:msg=Implicit resolves to enclosing:s", |
| "-Wconf:msg=outer reference in this type test:s", |
| "-Wconf:cat=lint:s") |
| else Seq.empty |
| }) |
| .dependsOn(core) |
| .dependsOn(coreTest % "test->test") |
| .dependsOn(r2dbc % "test->test;test->compile") |
| .dependsOn(eventsourced % Test) |
| .dependsOn(`durable-state` % Test) |
| .dependsOn(testkit % Test) |
| |
| lazy val userProjects: Seq[ProjectReference] = List[ProjectReference]( |
| core, jdbc, slick, cassandra, eventsourced, kafka, `durable-state`, r2dbc, grpc, testkit) |
| |
| lazy val examples = project |
| .enablePlugins(ReproducibleBuildsPlugin) |
| .disablePlugins(MimaPlugin) |
| .settings(Dependencies.examples) |
| .dependsOn(slick % "test->test") |
| .dependsOn(jdbc % "test->test") |
| .dependsOn(cassandraTest % "test->test") |
| .dependsOn(eventsourced) |
| .dependsOn(`durable-state`) |
| .dependsOn(kafka % "test->test") |
| .dependsOn(testkit % Test) |
| .settings(publish / skip := true, scalacOptions += "-feature", javacOptions += "-parameters") |
| |
| lazy val integrationExamples = Project("integration-examples", file("integration-examples")) |
| .enablePlugins(ReproducibleBuildsPlugin) |
| .disablePlugins(MimaPlugin) |
| .settings(Dependencies.examples) |
| .dependsOn(slick % "test->test") |
| .dependsOn(jdbc % "test->test") |
| .dependsOn(cassandraTest % "test->test") |
| .dependsOn(eventsourced) |
| .dependsOn(`durable-state`) |
| .dependsOn(kafka % "test->test") |
| .dependsOn(examples % "test->test") |
| .dependsOn(testkit % Test) |
| .settings(publish / skip := true, |
| scalacOptions += "-feature", |
| javacOptions += "-parameters", |
| Test / parallelExecution := false) |
| |
| 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, |
| Global / excludeLintKeys += previewPath, |
| 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.r2dbc.version" -> Dependencies.Versions.pekkoPersistenceR2dbc, |
| // 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", |
| "extref.pekko-grpc.base_url" -> |
| s"https://pekko.apache.org/docs/pekko-grpc/${Dependencies.PekkoGrpcVersionInDocs}/%s", |
| "scaladoc.org.apache.pekko.grpc.base_url" -> |
| s"https://pekko.apache.org/api/pekko-grpc/${Dependencies.PekkoGrpcVersionInDocs}", |
| "javadoc.org.apache.pekko.grpc.base_url" -> |
| s"https://pekko.apache.org/api/pekko-grpc/${Dependencies.PekkoGrpcVersionInDocs}", |
| "javadoc.org.apache.pekko.grpc.link_style" -> "direct", |
| "extref.pekko-persistence-r2dbc.base_url" -> |
| s"https://pekko.apache.org/docs/pekko-persistence-r2dbc/${Dependencies.PekkoPersistenceR2dbcVersionInDocs}/%s", |
| "scaladoc.org.apache.pekko.persistence.r2dbc.base_url" -> |
| s"https://pekko.apache.org/api/pekko-persistence-r2dbc/${Dependencies.PekkoPersistenceR2dbcVersionInDocs}", |
| "javadoc.org.apache.pekko.persistence.r2dbc.base_url" -> |
| s"https://pekko.apache.org/api/pekko-persistence-r2dbc/${Dependencies.PekkoPersistenceR2dbcVersionInDocs}", |
| "javadoc.org.apache.pekko.persistence.r2dbc.link_style" -> "direct", |
| // Java |
| "javadoc.base_url" -> "https://docs.oracle.com/en/java/javase/17/docs/api/java.base/", |
| "javadoc.link_style" -> "direct", |
| // 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, cassandraTest, grpcTest, examples, integrationExamples, docs) |
| .settings( |
| publish / skip := true, |
| name := "pekko-projection-root") |
| .enablePlugins(ScalaUnidocPlugin) |
| .disablePlugins(SitePlugin, MimaPlugin) |
| |
| // check format and headers |
| addCommandAlias("checkCodeStyle", "scalafmtCheckAll; scalafmtSbtCheck; javafmtCheckAll; +headerCheckAll") |
| addCommandAlias("applyCodeStyle", "+headerCreateAll; scalafmtAll; scalafmtSbt; javafmtAll") |