diff --git a/build.sbt b/build.sbt index 537cb10c..3e844930 100644 --- a/build.sbt +++ b/build.sbt @@ -7,14 +7,14 @@ * This file is part of the Apache Pekko project, which was derived from Akka. */ +import com.github.pjfanning.pekkobuild._ import net.bzzt.reproduciblebuilds.ReproducibleBuildsPlugin.reproducibleBuildsCheckResolver -import org.apache.pekko.projections.Dependencies +import org.apache.pekko.projections._ ThisBuild / versionScheme := Some(VersionScheme.SemVerSpec) sourceDistName := "apache-pekko-projection" sourceDistIncubating := false -ThisBuild / resolvers += Resolver.ApacheMavenSnapshotsRepo ThisBuild / reproducibleBuildsCheckResolver := Resolver.ApacheMavenStagingRepo lazy val core = @@ -23,6 +23,13 @@ lazy val core = .enablePlugins(ReproducibleBuildsPlugin) .settings(headerSettings(IntegrationTest)) .settings(Defaults.itSettings) + .addPekkoModuleDependency("pekko-stream", "", PekkoCoreDependency.default) + .addPekkoModuleDependency("pekko-actor-typed", "", PekkoCoreDependency.default) + .addPekkoModuleDependency("pekko-protobuf-v3", "", PekkoCoreDependency.default) + // pekko-persistence-query is only needed for OffsetSerialization and to provide a typed EventEnvelope that + // references the Offset type from pekko-persistence. + .addPekkoModuleDependency("pekko-persistence-query", "", PekkoCoreDependency.default) + .addPekkoModuleDependency("pekko-actor-testkit-typed", "test,it", PekkoCoreDependency.default) .settings(Dependencies.core) .settings(AutomaticModuleName.settings("pekko.projection.core")) .settings(name := "pekko-projection-core") @@ -34,6 +41,8 @@ lazy val coreTest = .settings(headerSettings(IntegrationTest)) .disablePlugins(MimaPlugin) .settings(Defaults.itSettings) + .addPekkoModuleDependency("pekko-actor-testkit-typed", "test,it", PekkoCoreDependency.default) + .addPekkoModuleDependency("pekko-stream-testkit", "test,it", PekkoCoreDependency.default) .settings(Dependencies.coreTest) .settings( name := "pekko-projection-core-test") @@ -47,6 +56,8 @@ lazy val testkit = .enablePlugins(ReproducibleBuildsPlugin) .settings(headerSettings(IntegrationTest)) .settings(Defaults.itSettings) + .addPekkoModuleDependency("pekko-actor-testkit-typed", "", PekkoCoreDependency.default) + .addPekkoModuleDependency("pekko-stream-testkit", "", PekkoCoreDependency.default) .settings(Dependencies.testKit) .settings(AutomaticModuleName.settings("pekko.projection.testkit")) .settings(name := "pekko-projection-testkit") @@ -59,6 +70,8 @@ lazy val jdbc = .enablePlugins(ReproducibleBuildsPlugin) .settings(headerSettings(IntegrationTest)) .settings(Defaults.itSettings) + .addPekkoModuleDependency("pekko-persistence-query", "", PekkoCoreDependency.default) + .addPekkoModuleDependency("pekko-actor-testkit-typed", "test,it", PekkoCoreDependency.default) .settings(Dependencies.jdbc) .settings(AutomaticModuleName.settings("pekko.projection.jdbc")) .settings(name := "pekko-projection-jdbc") @@ -73,6 +86,8 @@ lazy val slick = .enablePlugins(ReproducibleBuildsPlugin) .settings(headerSettings(IntegrationTest)) .settings(Defaults.itSettings) + .addPekkoModuleDependency("pekko-persistence-query", "", PekkoCoreDependency.default) + .addPekkoModuleDependency("pekko-actor-testkit-typed", "test,it", PekkoCoreDependency.default) .settings( // Transitive dependency `scala-reflect` to avoid `NoClassDefFoundError`. // See: https://github.com/slick/slick/issues/2933 @@ -97,6 +112,9 @@ lazy val cassandra = .enablePlugins(ReproducibleBuildsPlugin) .settings(headerSettings(IntegrationTest)) .settings(Defaults.itSettings) + .addPekkoModuleDependency("pekko-connectors-cassandra", "", PekkoConnectorsDependency.default) + .addPekkoModuleDependency("pekko-persistence-query", "", PekkoCoreDependency.default) + .addPekkoModuleDependency("pekko-actor-testkit-typed", "test", PekkoCoreDependency.default) .settings(Dependencies.cassandra) .settings(AutomaticModuleName.settings("pekko.projection.cassandra")) .settings(name := "pekko-projection-cassandra") @@ -111,7 +129,7 @@ lazy val cassandra = lazy val eventsourced = Project(id = "eventsourced", base = file("eventsourced")) .enablePlugins(ReproducibleBuildsPlugin) - .settings(Dependencies.eventsourced) + .addPekkoModuleDependency("pekko-persistence-query", "", PekkoCoreDependency.default) .settings(AutomaticModuleName.settings("pekko.projection.eventsourced")) .settings(name := "pekko-projection-eventsourced") .dependsOn(core) @@ -121,6 +139,7 @@ lazy val eventsourced = lazy val kafka = Project(id = "kafka", base = file("kafka")) .enablePlugins(ReproducibleBuildsPlugin) + .addPekkoModuleDependency("pekko-connectors-kafka", "", PekkoConnectorsKafkaDependency.default) .settings(Dependencies.kafka) .settings(AutomaticModuleName.settings("pekko.projection.kafka")) .settings(name := "pekko-projection-kafka") @@ -133,6 +152,9 @@ lazy val kafkaTest = .disablePlugins(MimaPlugin) .settings(headerSettings(IntegrationTest)) .settings(Defaults.itSettings) + .addPekkoModuleDependency("pekko-actor-testkit-typed", "test,it", PekkoCoreDependency.default) + .addPekkoModuleDependency("pekko-stream-testkit", "test,it", PekkoCoreDependency.default) + .addPekkoModuleDependency("pekko-connectors-kafka-testkit", "test,it", PekkoConnectorsKafkaDependency.default) .settings(Dependencies.kafkaTest) .settings( name := "pekko-projection-kafka-test", @@ -146,6 +168,9 @@ lazy val `durable-state` = Project(id = "durable-state", base = file("durable-state")) .configs(IntegrationTest) .enablePlugins(ReproducibleBuildsPlugin) + .addPekkoModuleDependency("pekko-persistence-query", "", PekkoCoreDependency.default) + .addPekkoModuleDependency("pekko-persistence-testkit", "test", PekkoCoreDependency.default) + .addPekkoModuleDependency("pekko-stream-testkit", "test", PekkoCoreDependency.default) .settings(Dependencies.state) .settings(AutomaticModuleName.settings("pekko.projection.durable-state")) .settings(name := "pekko-projection-durable-state") @@ -161,6 +186,12 @@ lazy val examples = project .enablePlugins(ReproducibleBuildsPlugin) .disablePlugins(MimaPlugin) .settings(Defaults.itSettings) + .addPekkoModuleDependency("pekko-persistence-typed", "", PekkoCoreDependency.default) + .addPekkoModuleDependency("pekko-cluster-sharding-typed", "", PekkoCoreDependency.default) + .addPekkoModuleDependency("pekko-persistence-cassandra", "", PekkoPersistenceCassandraDependency.default) + .addPekkoModuleDependency("pekko-persistence-jdbc", "", PekkoPersistenceJdbcDependency.default) + .addPekkoModuleDependency("pekko-serialization-jackson", "", PekkoCoreDependency.default) + .addPekkoModuleDependency("pekko-actor-testkit-typed", "test", PekkoCoreDependency.default) .settings(Dependencies.examples) .dependsOn(slick % "test->test") .dependsOn(jdbc % "test->test") @@ -188,7 +219,7 @@ lazy val docs = project "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.version" -> PekkoCoreDependency.version, // 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}/", diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 3883b3d1..6bf1ac36 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -24,11 +24,6 @@ object Dependencies { val ConnectorsKafkaVersionInDocs = PekkoConnectorsKafkaDependency.default.link object Versions { - val pekko = PekkoCoreDependency.version - val pekkoPersistenceJdbc = "1.1.0" - val pekkoPersistenceCassandra = "1.1.0-M1" - val connectors = PekkoConnectorsDependency.version - val connectorsKafka = PekkoConnectorsKafkaDependency.version val slick = "3.5.1" val scalaTest = "3.2.19" val testContainers = "1.20.2" @@ -39,21 +34,8 @@ object Dependencies { } object Compile { - val pekkoActorTyped = "org.apache.pekko" %% "pekko-actor-typed" % Versions.pekko - val pekkoStream = "org.apache.pekko" %% "pekko-stream" % Versions.pekko - val pekkoProtobufV3 = "org.apache.pekko" %% "pekko-protobuf-v3" % Versions.pekko - val pekkoPersistenceQuery = "org.apache.pekko" %% "pekko-persistence-query" % Versions.pekko - - // TestKit in compile scope for ProjectionTestKit - val pekkoTypedTestkit = "org.apache.pekko" %% "pekko-actor-testkit-typed" % Versions.pekko - val pekkoStreamTestkit = "org.apache.pekko" %% "pekko-stream-testkit" % Versions.pekko - val slick = "com.typesafe.slick" %% "slick" % Versions.slick - val connectorsCassandra = "org.apache.pekko" %% "pekko-connectors-cassandra" % Versions.connectors - - val connectorsKafka = "org.apache.pekko" %% "pekko-connectors-kafka" % Versions.connectorsKafka - // must be provided on classpath when using Apache Kafka 2.6.0+ val jackson = "com.fasterxml.jackson.core" % "jackson-databind" % Versions.jackson @@ -64,10 +46,6 @@ object Dependencies { object Test { private val allTestConfig = "test,it" - val pekkoTypedTestkit = Compile.pekkoTypedTestkit % allTestConfig - val pekkoStreamTestkit = Compile.pekkoStreamTestkit % allTestConfig - val persistenceTestkit = "org.apache.pekko" %% "pekko-persistence-testkit" % Versions.pekko % "test" - val scalatest = "org.scalatest" %% "scalatest" % Versions.scalaTest % allTestConfig val scalatestJUnit = "org.scalatestplus" %% "junit-4-13" % (Versions.scalaTest + ".0") % allTestConfig val junit = "junit" % "junit" % Versions.junit % allTestConfig @@ -91,40 +69,21 @@ object Dependencies { val oracleDbContainer = "org.testcontainers" % "oracle-xe" % Versions.testContainers % allTestConfig - - val connectorsKafkaTestkit = - "org.apache.pekko" %% "pekko-connectors-kafka-testkit" % Versions.connectorsKafka % allTestConfig } object Examples { val hibernate = "org.hibernate" % "hibernate-core" % "5.6.15.Final" - - val pekkoPersistenceTyped = "org.apache.pekko" %% "pekko-persistence-typed" % Versions.pekko - val pekkoClusterShardingTyped = "org.apache.pekko" %% "pekko-cluster-sharding-typed" % Versions.pekko - val pekkoPersistenceCassandra = - "org.apache.pekko" %% "pekko-persistence-cassandra" % Versions.pekkoPersistenceCassandra - val pekkoPersistenceJdbc = "org.apache.pekko" %% "pekko-persistence-jdbc" % Versions.pekkoPersistenceJdbc - val pekkoSerializationJackson = "org.apache.pekko" %% "pekko-serialization-jackson" % Versions.pekko } private val deps = libraryDependencies val core = deps ++= Seq( - Compile.pekkoStream, - Compile.pekkoActorTyped, - Compile.pekkoProtobufV3, - // pekko-persistence-query is only needed for OffsetSerialization and to provide a typed EventEnvelope that - // references the Offset type from pekko-persistence. - Compile.pekkoPersistenceQuery, - Test.pekkoTypedTestkit, Test.logback, Test.scalatest) val coreTest = deps ++= Seq( - Test.pekkoTypedTestkit, - Test.pekkoStreamTestkit, Test.scalatest, Test.scalatestJUnit, Test.junit, @@ -132,23 +91,16 @@ object Dependencies { val testKit = deps ++= Seq( - Compile.pekkoTypedTestkit, - Compile.pekkoStreamTestkit, Test.scalatest, Test.scalatestJUnit, Test.junit, Test.logback) - val eventsourced = - deps ++= Seq(Compile.pekkoPersistenceQuery) - val state = - deps ++= Seq(Compile.pekkoPersistenceQuery, Test.persistenceTestkit, Test.pekkoStreamTestkit, Test.scalatest) + deps ++= Seq(Test.scalatest) val jdbc = deps ++= Seq( - Compile.pekkoPersistenceQuery, - Test.pekkoTypedTestkit, Test.h2Driver, Test.postgresDriver, Test.postgresContainer, @@ -163,8 +115,6 @@ object Dependencies { val slick = deps ++= Seq( Compile.slick, - Compile.pekkoPersistenceQuery, - Test.pekkoTypedTestkit, Test.h2Driver, Test.postgresDriver, Test.postgresContainer, @@ -178,36 +128,24 @@ object Dependencies { val cassandra = deps ++= Seq( - Compile.connectorsCassandra, - Compile.pekkoPersistenceQuery, - Test.pekkoTypedTestkit, Test.logback, Test.cassandraContainer, Test.scalatestJUnit) val kafka = deps ++= Seq( - Compile.connectorsKafka, Compile.jackson) val kafkaTest = deps ++= Seq( Test.scalatest, - Test.pekkoTypedTestkit, - Test.pekkoStreamTestkit, - Test.connectorsKafkaTestkit, Test.logback, Test.scalatestJUnit) val examples = deps ++= Seq( - Examples.pekkoPersistenceTyped, - Examples.pekkoClusterShardingTyped, - Examples.pekkoPersistenceCassandra, - Examples.pekkoPersistenceJdbc, Examples.hibernate, Test.h2Driver, - Test.pekkoTypedTestkit, Test.logback, Test.cassandraContainer) } diff --git a/project/PekkoPersistenceCassandraDependency.scala b/project/PekkoPersistenceCassandraDependency.scala new file mode 100644 index 00000000..a74262cd --- /dev/null +++ b/project/PekkoPersistenceCassandraDependency.scala @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.pekko.projections + +import com.github.pjfanning.pekkobuild.PekkoDependency + +object PekkoPersistenceCassandraDependency extends PekkoDependency { + override val checkProject: String = "pekko-persistence-cassandra" + override val module: Option[String] = Some("persistence.cassandra") + override val currentVersion: String = "1.1.0-M1" +} diff --git a/project/PekkoPersistenceJdbcDependency.scala b/project/PekkoPersistenceJdbcDependency.scala new file mode 100644 index 00000000..0b133e67 --- /dev/null +++ b/project/PekkoPersistenceJdbcDependency.scala @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.pekko.projections + +import com.github.pjfanning.pekkobuild.PekkoDependency + +object PekkoPersistenceJdbcDependency extends PekkoDependency { + override val checkProject: String = "pekko-persistence-jdbc" + override val module: Option[String] = Some("persistence.jdbc") + override val currentVersion: String = "1.1.0" +}