Skip to content

Commit

Permalink
use addPekkoModuleDependency (#383)
Browse files Browse the repository at this point in the history
* use addPekkoModuleDependency

* some issues
  • Loading branch information
pjfanning authored Oct 9, 2024
1 parent 1080524 commit 295fa4b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 31 deletions.
24 changes: 18 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
* This file is part of the Apache Pekko project, derived from Akka.
*/

import com.github.pjfanning.pekkobuild._
import net.bzzt.reproduciblebuilds.ReproducibleBuildsPlugin.reproducibleBuildsCheckResolver
import org.apache.pekko.grpc.Dependencies
import org.apache.pekko.grpc.{ Dependencies, NoPublish, PekkoCoreDependency, PekkoHttpDependency }
import org.apache.pekko.grpc.Dependencies.Versions.{ scala212, scala213 }
import org.apache.pekko.grpc.ProjectExtensions._
import org.apache.pekko.grpc.NoPublish
import org.apache.pekko.grpc.build.ReflectiveCodeGen
import com.typesafe.tools.mima.core._
import sbt.Keys.scalaVersion
Expand All @@ -27,7 +27,6 @@ commands := commands.value.filterNot { command =>
}
}

ThisBuild / resolvers += Resolver.ApacheMavenSnapshotsRepo
ThisBuild / reproducibleBuildsCheckResolver := Resolver.ApacheMavenStagingRepo

// So that gRPC is properly styled
Expand Down Expand Up @@ -86,11 +85,18 @@ lazy val codegen = Project(id = "codegen", base = file("codegen"))
}
})
.settings(addArtifact(Compile / assembly / artifact, assembly))
.settings(addArtifact(Artifact(pekkoGrpcCodegenId, "bat", "bat", "bat"), mkBatAssemblyTask))
.settings(addArtifact(sbt.Artifact(pekkoGrpcCodegenId, "bat", "bat", "bat"), mkBatAssemblyTask))

val mimaCompareVersion = "1.0.2"

lazy val runtime = Project(id = "runtime", base = file("runtime"))
.addPekkoModuleDependency("pekko-stream", "", PekkoCoreDependency.default)
.addPekkoModuleDependency("pekko-http-core", "", PekkoHttpDependency.default)
.addPekkoModuleDependency("pekko-http", "", PekkoHttpDependency.default)
.addPekkoModuleDependency("pekko-discovery", "", PekkoCoreDependency.default)
.addPekkoModuleDependency("pekko-http-cors", "", PekkoHttpDependency.default)
.addPekkoModuleDependency("pekko-testkit", "test", PekkoCoreDependency.default)
.addPekkoModuleDependency("pekko-stream-testkit", "test", PekkoCoreDependency.default)
.settings(Dependencies.runtime)
.settings(VersionGenerator.settings)
.settings(MetaInfLicenseNoticeCopy.runtimeSettings)
Expand Down Expand Up @@ -133,7 +139,7 @@ lazy val scalapbProtocPlugin = Project(id = "scalapb-protoc-plugin", base = file
crossScalaVersions := Dependencies.Versions.CrossScalaForLib,
scalaVersion := Dependencies.Versions.CrossScalaForLib.head)
.settings(addArtifact(Compile / assembly / artifact, assembly))
.settings(addArtifact(Artifact(pekkoGrpcProtocPluginId, "bat", "bat", "bat"), mkBatAssemblyTask))
.settings(addArtifact(sbt.Artifact(pekkoGrpcProtocPluginId, "bat", "bat", "bat"), mkBatAssemblyTask))
.enablePlugins(ReproducibleBuildsPlugin)

lazy val mavenPlugin = Project(id = "maven-plugin", base = file("maven-plugin"))
Expand Down Expand Up @@ -164,7 +170,7 @@ lazy val sbtPlugin = Project(id = "sbt-plugin", base = file("sbt-plugin"))
val p3 = (runtime / publishLocal).value
val p4 = (interopTests / publishLocal).value
},
scriptedSbt := "1.10.0",
scriptedSbt := "1.10.2",
scriptedBufferLog := false)
.settings(
crossScalaVersions := Dependencies.Versions.CrossScalaForPlugin,
Expand All @@ -173,6 +179,10 @@ lazy val sbtPlugin = Project(id = "sbt-plugin", base = file("sbt-plugin"))

lazy val interopTests = Project(id = "interop-tests", base = file("interop-tests"))
.disablePlugins(MimaPlugin)
.addPekkoModuleDependency("pekko-http", "", PekkoHttpDependency.default)
.addPekkoModuleDependency("pekko-slf4j", "", PekkoCoreDependency.default)
.addPekkoModuleDependency("pekko-testkit", "test", PekkoCoreDependency.default)
.addPekkoModuleDependency("pekko-stream-testkit", "test", PekkoCoreDependency.default)
.settings(Dependencies.interopTests)
.settings(
crossScalaVersions := Dependencies.Versions.CrossScalaForLib,
Expand Down Expand Up @@ -273,6 +283,8 @@ lazy val docs = Project(id = "docs", base = file("docs"))

lazy val pluginTesterScala = Project(id = "plugin-tester-scala", base = file("plugin-tester-scala"))
.disablePlugins(MimaPlugin)
.addPekkoModuleDependency("pekko-http-cors", "", PekkoHttpDependency.default)
.addPekkoModuleDependency("pekko-http", "", PekkoHttpDependency.default)
.settings(Dependencies.pluginTester)
.settings(
name := s"$pekkoPrefix-plugin-tester-scala",
Expand Down
26 changes: 1 addition & 25 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,6 @@ object Dependencies {
}

object Compile {
val pekkoStream = "org.apache.pekko" %% "pekko-stream" % Versions.pekko
val pekkoHttp = "org.apache.pekko" %% "pekko-http" % Versions.pekkoHttp
val pekkoHttpCore = "org.apache.pekko" %% "pekko-http-core" % Versions.pekkoHttp
val pekkoHttpCors = "org.apache.pekko" %% "pekko-http-cors" % Versions.pekkoHttp
val pekkoDiscovery = "org.apache.pekko" %% "pekko-discovery" % Versions.pekko
val pekkoSlf4j = "org.apache.pekko" %% "pekko-slf4j" % Versions.pekko

val scalapbCompilerPlugin = "com.thesamet.scalapb" %% "compilerplugin" % scalapb.compiler.Version.scalapbVersion
val scalapbRuntime = ("com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion)
.exclude("io.grpc", "grpc-netty")
Expand Down Expand Up @@ -79,9 +72,6 @@ object Dependencies {
final val Test = sbt.Test
val scalaTest = "org.scalatest" %% "scalatest" % Versions.scalaTest % Test
val scalaTestPlusJunit = "org.scalatestplus" %% "junit-4-13" % (Versions.scalaTest + ".0") % Test
val pekkoDiscoveryConfig = "org.apache.pekko" %% "pekko-discovery" % Versions.pekko % Test
val pekkoTestkit = "org.apache.pekko" %% "pekko-testkit" % Versions.pekko % Test
val pekkoStreamTestkit = "org.apache.pekko" %% "pekko-stream-testkit" % Versions.pekko % Test
}

object Runtime {
Expand Down Expand Up @@ -112,14 +102,6 @@ object Dependencies {
Compile.grpcCore,
Compile.grpcStub % Provided, // comes from the generators
Compile.grpcNettyShaded,
Compile.pekkoStream,
Compile.pekkoHttpCore,
Compile.pekkoHttp,
Compile.pekkoDiscovery,
Compile.pekkoHttpCors,
Compile.pekkoHttp % Provided,
Test.pekkoTestkit,
Test.pekkoStreamTestkit,
Test.scalaTest,
Test.scalaTestPlusJunit)

Expand All @@ -139,19 +121,13 @@ object Dependencies {
lazy val interopTests = l ++= Seq(
Compile.grpcInteropTesting,
Compile.grpcInteropTesting % "protobuf", // gets the proto files for interop tests
Compile.pekkoHttp,
Compile.pekkoSlf4j,
Runtime.logback,
Test.scalaTest.withConfigurations(Some("compile")),
Test.scalaTestPlusJunit.withConfigurations(Some("compile")),
Test.pekkoTestkit,
Test.pekkoStreamTestkit)
Test.scalaTestPlusJunit.withConfigurations(Some("compile")))

lazy val pluginTester = l ++= Seq(
// usually automatically added by `suggestedDependencies`, which doesn't work with ReflectiveCodeGen
Compile.grpcStub,
Compile.pekkoHttpCors,
Compile.pekkoHttp,
Test.scalaTest,
Test.scalaTestPlusJunit,
Protobuf.googleCommonProtos)
Expand Down

0 comments on commit 295fa4b

Please sign in to comment.