From ed431446aa2f00d7c9a733cd4386f4986b57a28b Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Wed, 9 Oct 2024 10:33:05 +0100 Subject: [PATCH] use sbt-pekko-build addPekkoModuleDependency (#241) * use sbt-pekko-build addPekkoModuleDependency * more changes * remove snapshot resolvers * remove pekkoVersion --- build.sbt | 21 +++++++++++++++------ project/Dependencies.scala | 21 ++++++--------------- project/ParadoxSettings.scala | 4 +--- project/Versions.scala | 1 - 4 files changed, 22 insertions(+), 25 deletions(-) diff --git a/build.sbt b/build.sbt index 318c0c2b..e442b1a4 100644 --- a/build.sbt +++ b/build.sbt @@ -8,6 +8,7 @@ */ import net.bzzt.reproduciblebuilds.ReproducibleBuildsPlugin.reproducibleBuildsCheckResolver +import com.github.pjfanning.pekkobuild._ import com.typesafe.tools.mima.core.{ Problem, ProblemFilters } import ProjectSettings.commonSettings @@ -15,7 +16,6 @@ sourceDistName := "apache-pekko-connectors-kafka" sourceDistIncubating := false ThisBuild / reproducibleBuildsCheckResolver := Resolver.ApacheMavenStagingRepo -ThisBuild / resolvers += Resolver.ApacheMavenSnapshotsRepo addCommandAlias("verifyCodeStyle", "scalafmtCheckAll; scalafmtSbtCheck; +headerCheckAll; javafmtCheckAll") addCommandAlias("applyCodeStyle", "+headerCreateAll; scalafmtAll; scalafmtSbt; javafmtAll") @@ -42,6 +42,8 @@ lazy val core = project .disablePlugins(SitePlugin) .settings(commonSettings) .settings(VersionGenerator.settings) + .addPekkoModuleDependency("pekko-stream", "", PekkoCoreDependency.default) + .addPekkoModuleDependency("pekko-discovery", "provided", PekkoCoreDependency.default) .settings( name := "pekko-connectors-kafka", AutomaticModuleName.settings("org.apache.pekko.kafka"), @@ -55,11 +57,12 @@ lazy val testkit = project .enablePlugins(ReproducibleBuildsPlugin) .disablePlugins(SitePlugin) .settings(commonSettings) + .addPekkoModuleDependency("pekko-stream-testkit", "", PekkoCoreDependency.default) .settings( name := "pekko-connectors-kafka-testkit", AutomaticModuleName.settings("org.apache.pekko.kafka.testkit"), JupiterKeys.junitJupiterVersion := "5.11.2", - libraryDependencies ++= Dependencies.testKitDependencies.value, + libraryDependencies ++= Dependencies.testKitDependencies, libraryDependencies ++= Seq( "org.junit.jupiter" % "junit-jupiter-api" % JupiterKeys.junitJupiterVersion.value % Provided), mimaPreviousArtifacts := Set( @@ -72,11 +75,11 @@ lazy val `cluster-sharding` = project .enablePlugins(ReproducibleBuildsPlugin) .disablePlugins(SitePlugin) .settings(commonSettings) + .addPekkoModuleDependency("pekko-cluster-sharding-typed", "", PekkoCoreDependency.default) .settings( name := "pekko-connectors-kafka-cluster-sharding", AutomaticModuleName.settings("org.apache.pekko.kafka.cluster.sharding"), AddMetaInfLicenseFiles.clusterShardingSettings, - libraryDependencies ++= Dependencies.clusterShardingDependencies, mimaPreviousArtifacts := Set( organization.value %% name.value % mimaCompareVersion)) @@ -88,10 +91,12 @@ lazy val tests = project .settings(commonSettings) .settings(Defaults.itSettings) .settings(headerSettings(IntegrationTest)) + .addPekkoModuleDependency("pekko-discovery", "test", PekkoCoreDependency.default) + .addPekkoModuleDependency("pekko-slf4j", "test", PekkoCoreDependency.default) .settings( name := "pekko-connectors-kafka-tests", resolvers ++= ResolverSettings.testSpecificResolvers, - libraryDependencies ++= Dependencies.testDependencies.value, + libraryDependencies ++= Dependencies.testDependencies, publish / skip := true, Test / fork := true, Test / parallelExecution := false, @@ -101,10 +106,12 @@ lazy val `java-tests` = project .dependsOn(core, testkit, `cluster-sharding`, tests % "compile->compile;test->test") .disablePlugins(MimaPlugin, SitePlugin) .settings(commonSettings) + .addPekkoModuleDependency("pekko-discovery", "test", PekkoCoreDependency.default) + .addPekkoModuleDependency("pekko-slf4j", "test", PekkoCoreDependency.default) .settings( name := "pekko-connectors-kafka-java-tests", resolvers ++= ResolverSettings.testSpecificResolvers, - libraryDependencies ++= Dependencies.testDependencies.value, + libraryDependencies ++= Dependencies.testDependencies, libraryDependencies ++= Seq( "org.junit.vintage" % "junit-vintage-engine" % JupiterKeys.junitVintageVersion.value % Test, "net.aichler" % "jupiter-interface" % JupiterKeys.jupiterVersion.value % Test), @@ -147,8 +154,10 @@ lazy val benchmarks = project .settings(commonSettings) .settings(Defaults.itSettings) .settings(headerSettings(IntegrationTest)) + .addPekkoModuleDependency("pekko-slf4j", "it", PekkoCoreDependency.default) + .addPekkoModuleDependency("pekko-stream-testkit", "it", PekkoCoreDependency.default) .settings( name := "pekko-connectors-kafka-benchmarks", publish / skip := true, IntegrationTest / parallelExecution := false, - libraryDependencies ++= Dependencies.benchmarkDependencies.value) + libraryDependencies ++= Dependencies.benchmarkDependencies) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 13009861..ce366c76 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -11,25 +11,18 @@ import Versions._ import sbt._ object Dependencies { - lazy val benchmarkDependencies = Def.setting(Seq( + lazy val benchmarkDependencies = Seq( "com.typesafe.scala-logging" %% "scala-logging" % "3.9.5", "io.dropwizard.metrics" % "metrics-core" % "4.2.28", "ch.qos.logback" % "logback-classic" % logbackVersion, "org.slf4j" % "log4j-over-slf4j" % slf4jVersion, "org.testcontainers" % "kafka" % testcontainersVersion % IntegrationTest, - "org.apache.pekko" %% "pekko-slf4j" % pekkoVersion % IntegrationTest, - "org.apache.pekko" %% "pekko-stream-testkit" % pekkoVersion % IntegrationTest, - "org.scalatest" %% "scalatest" % scalaTestVersion % IntegrationTest)) - - lazy val clusterShardingDependencies = Seq("org.apache.pekko" %% "pekko-cluster-sharding-typed" % pekkoVersion) + "org.scalatest" %% "scalatest" % scalaTestVersion % IntegrationTest) lazy val coreDependencies = Seq( - "org.apache.pekko" %% "pekko-stream" % pekkoVersion, - "org.apache.pekko" %% "pekko-discovery" % pekkoVersion % Provided, "org.apache.kafka" % "kafka-clients" % kafkaVersion) - lazy val testDependencies = Def.setting(Seq( - "org.apache.pekko" %% "pekko-discovery" % pekkoVersion, + lazy val testDependencies = Seq( "com.google.protobuf" % "protobuf-java" % "3.25.5", // use the same version as in scalapb ("io.confluent" % "kafka-avro-serializer" % confluentAvroSerializerVersion % Test).excludeAll( confluentLibsExclusionRules: _*), @@ -42,18 +35,16 @@ object Dependencies { // See http://hamcrest.org/JavaHamcrest/distributables#upgrading-from-hamcrest-1x "org.hamcrest" % "hamcrest-library" % "3.0" % Test, "org.hamcrest" % "hamcrest" % "3.0" % Test, - "org.apache.pekko" %% "pekko-slf4j" % pekkoVersion % Test, "ch.qos.logback" % "logback-classic" % logbackVersion % Test, "org.slf4j" % "log4j-over-slf4j" % slf4jVersion % Test, // Schema registry uses Glassfish which uses java.util.logging "org.slf4j" % "jul-to-slf4j" % slf4jVersion % Test, "org.mockito" % "mockito-core" % "4.11.0" % Test, - "com.thesamet.scalapb" %% "scalapb-runtime" % scalaPBVersion % Test)) + "com.thesamet.scalapb" %% "scalapb-runtime" % scalaPBVersion % Test) - lazy val testKitDependencies = Def.setting(Seq( - "org.apache.pekko" %% "pekko-stream-testkit" % pekkoVersion, + lazy val testKitDependencies = Seq( "org.testcontainers" % "kafka" % testcontainersVersion % Provided, "org.scalatest" %% "scalatest" % scalaTestVersion % Provided, - "junit" % "junit" % "4.13.2" % Provided)) + "junit" % "junit" % "4.13.2" % Provided) } diff --git a/project/ParadoxSettings.scala b/project/ParadoxSettings.scala index 11593918..08ed511b 100644 --- a/project/ParadoxSettings.scala +++ b/project/ParadoxSettings.scala @@ -24,8 +24,6 @@ import sbtlicensereport.SbtLicenseReport.autoImportImpl.dumpLicenseReportAggrega object ParadoxSettings { val themeSettings = Seq( - // allow access to snapshots for pekko-sbt-paradox - resolvers += "Apache Nexus Snapshots".at("https://repository.apache.org/content/repositories/snapshots/"), pekkoParadoxGithub := Some("https://github.com/apache/pekko-connectors-kafka")) val propertiesSettings = Seq( @@ -36,7 +34,7 @@ object ParadoxSettings { "image.base_url" -> "images/", "confluent.version" -> confluentAvroSerializerVersion, "scalatest.version" -> scalaTestVersion, - "pekko.version" -> pekkoVersion, + "pekko.version" -> PekkoCoreDependency.version, "extref.pekko.base_url" -> s"$pekkoDocs/pekko/$pekkoVersionForDocs/%s", "scaladoc.org.apache.pekko.base_url" -> s"$pekkoAPI/pekko/$pekkoVersionForDocs/", "javadoc.org.apache.pekko.base_url" -> s"$pekkoAPI/pekko/$pekkoVersionForDocs/", diff --git a/project/Versions.scala b/project/Versions.scala index 8f82cf15..3fbd6846 100644 --- a/project/Versions.scala +++ b/project/Versions.scala @@ -23,7 +23,6 @@ object Versions { val pekkoVersionForDocs = "current" val pekkoConnectorsKafkaVersionForDocs = "current" val pekkoManagementVersionForDocs = "current" - val pekkoVersion = PekkoCoreDependency.version val kafkaVersion = "3.8.0" val KafkaVersionForDocs = "37"