This is an automated email from the ASF dual-hosted git repository.

fanningpj pushed a commit to branch main
in repository 
https://gitbox.apache.org/repos/asf/incubator-pekko-persistence-dynamodb.git


The following commit(s) were added to refs/heads/main by this push:
     new f4db9c7  use sbt-pekko-build (#89)
f4db9c7 is described below

commit f4db9c71116629b288572c8c33237d1d4a6c3e8e
Author: PJ Fanning <[email protected]>
AuthorDate: Wed Jan 24 13:11:43 2024 +0100

    use sbt-pekko-build (#89)
    
    * use sbt-pekko-build
    
    * Update plugins.sbt
    
    * Update sbt-pekko-build to 0.3.1
    
    ---------
    
    Co-authored-by: Matthew de Detrich <[email protected]>
---
 build.sbt                         |  16 +++---
 project/PekkoCoreDependency.scala |  24 ++++++++
 project/PekkoDependency.scala     | 118 --------------------------------------
 project/plugins.sbt               |   2 +-
 4 files changed, 32 insertions(+), 128 deletions(-)

diff --git a/build.sbt b/build.sbt
index 61f7254..64ff168 100644
--- a/build.sbt
+++ b/build.sbt
@@ -7,7 +7,6 @@
  * This file is part of the Apache Pekko project, which was derived from Akka.
  */
 
-import PekkoDependency.pekkoVersion
 import 
net.bzzt.reproduciblebuilds.ReproducibleBuildsPlugin.reproducibleBuildsCheckResolver
 
 name := "pekko-persistence-dynamodb"
@@ -20,7 +19,6 @@ val amzVersion = "1.12.571"
 val testcontainersScalaVersion = "0.41.0"
 
 ThisBuild / resolvers += Resolver.ApacheMavenSnapshotsRepo
-ThisBuild / apacheSonatypeProjectProfile := "pekko"
 ThisBuild / versionScheme := Some(VersionScheme.SemVerSpec)
 sourceDistName := "apache-pekko-persistence-dynamodb"
 sourceDistIncubating := true
@@ -30,7 +28,7 @@ ThisBuild / reproducibleBuildsCheckResolver := 
Resolver.ApacheMavenStagingRepo
 inThisBuild(Def.settings(
   onLoad in Global := {
     sLog.value.info(
-      s"Building Pekko Persistence DynamoDB ${version.value} against Pekko 
${PekkoDependency.pekkoVersion} on Scala ${(ThisBuild / scalaVersion).value}")
+      s"Building Pekko Persistence DynamoDB ${version.value} against Pekko 
${PekkoCoreDependency.version} on Scala ${(ThisBuild / scalaVersion).value}")
     (onLoad in Global).value
   }))
 
@@ -53,12 +51,12 @@ libraryDependencies ++= Seq(
   "com.amazonaws" % "aws-java-sdk-core" % amzVersion,
   "com.amazonaws" % "aws-java-sdk-dynamodb" % amzVersion,
   "javax.xml.bind" % "jaxb-api" % "2.3.1", // see 
https://github.com/seek-oss/gradle-aws-plugin/issues/15
-  "org.apache.pekko" %% "pekko-persistence" % pekkoVersion,
-  "org.apache.pekko" %% "pekko-persistence-query" % pekkoVersion,
-  "org.apache.pekko" %% "pekko-stream" % pekkoVersion,
-  "org.apache.pekko" %% "pekko-persistence-tck" % pekkoVersion % Test,
-  "org.apache.pekko" %% "pekko-testkit" % pekkoVersion % Test,
-  "org.apache.pekko" %% "pekko-stream-testkit" % pekkoVersion % Test,
+  "org.apache.pekko" %% "pekko-persistence" % PekkoCoreDependency.version,
+  "org.apache.pekko" %% "pekko-persistence-query" % 
PekkoCoreDependency.version,
+  "org.apache.pekko" %% "pekko-stream" % PekkoCoreDependency.version,
+  "org.apache.pekko" %% "pekko-persistence-tck" % PekkoCoreDependency.version 
% Test,
+  "org.apache.pekko" %% "pekko-testkit" % PekkoCoreDependency.version % Test,
+  "org.apache.pekko" %% "pekko-stream-testkit" % PekkoCoreDependency.version % 
Test,
   "org.scalatest" %% "scalatest" % "3.2.17" % "test",
   "commons-io" % "commons-io" % "2.14.0" % Test,
   "org.hdrhistogram" % "HdrHistogram" % "2.1.8" % Test,
diff --git a/project/PekkoCoreDependency.scala 
b/project/PekkoCoreDependency.scala
new file mode 100644
index 0000000..b3244a5
--- /dev/null
+++ b/project/PekkoCoreDependency.scala
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+import com.github.pjfanning.pekkobuild.PekkoDependency
+
+object PekkoCoreDependency extends PekkoDependency {
+  override val checkProject: String = "pekko-cluster-sharding-typed"
+  override val module: Option[String] = None
+  override val currentVersion: String = "1.0.2"
+}
diff --git a/project/PekkoDependency.scala b/project/PekkoDependency.scala
deleted file mode 100644
index 540fdb6..0000000
--- a/project/PekkoDependency.scala
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * Copyright (C) 2017-2020 Lightbend Inc. <https://www.lightbend.com>
- */
-
-import sbt._
-import Keys._
-
-import scala.util.matching.Regex.Groups
-
-object PekkoDependency {
-
-  sealed trait Pekko {
-    def version: String
-    // The version to use in api/japi/docs links,
-    // so 'x.y', 'x.y.z', 'current' or 'snapshot'
-    def link: String
-  }
-  case class Artifact(version: String, isSnapshot: Boolean = false) extends 
Pekko {
-    override def link = VersionNumber(version) match { case 
VersionNumber(Seq(x, y, _*), _, _) => s"$x.$y" }
-  }
-  case class Sources(uri: String, link: String = "current") extends Pekko {
-    def version = link
-  }
-
-  def pekkoDependency(defaultVersion: String): Pekko = {
-    Option(System.getProperty("pekko.sources")) match {
-      case Some(pekkoSources) =>
-        Sources(pekkoSources)
-      case None =>
-        Option(System.getProperty("pekko.build.pekko.version")) match {
-          case Some("main")           => mainSnapshot
-          case Some("default") | None => Artifact(defaultVersion)
-          case Some(other)            => Artifact(other, true)
-        }
-    }
-  }
-
-  // Default version updated only when needed, 
https://pekko.apache.org/docs/pekko/current/project/downstream-upgrade-strategy.html
-  val minimumExpectedPekkoVersion = "1.0.1"
-  val default = pekkoDependency(defaultVersion = minimumExpectedPekkoVersion)
-  val docs = pekkoDependency(defaultVersion = minimumExpectedPekkoVersion)
-
-  lazy val mainSnapshot = Artifact(determineLatestSnapshot(), true)
-
-  val pekkoVersion: String = default match {
-    case Artifact(version, _) => version
-    case Sources(uri, _)      => uri
-  }
-
-  implicit class RichProject(project: Project) {
-
-    /** Adds either a source or a binary dependency, depending on whether the 
above settings are set */
-    def addPekkoModuleDependency(module: String,
-        config: String = "",
-        pekko: Pekko = default): Project =
-      pekko match {
-        case Sources(sources, _) =>
-          // as a little hacky side effect also disable aggregation of samples
-          System.setProperty("pekko.build.aggregateSamples", "false")
-
-          val moduleRef = ProjectRef(uri(sources), module)
-          val withConfig: ClasspathDependency =
-            if (config == "") moduleRef
-            else moduleRef % config
-
-          project.dependsOn(withConfig)
-        case Artifact(pekkoVersion, pekkoSnapshot) =>
-          project.settings(
-            libraryDependencies += {
-              if (config == "")
-                "org.apache.pekko" %% module % pekkoVersion
-              else
-                "org.apache.pekko" %% module % pekkoVersion % config
-            },
-            resolvers ++= (if (pekkoSnapshot)
-                             Seq(Resolver.ApacheMavenSnapshotsRepo)
-                           else Nil))
-      }
-  }
-
-  private def determineLatestSnapshot(prefix: String = ""): String = {
-    import sbt.librarymanagement.Http.http
-    import gigahorse.GigahorseSupport.url
-    import scala.concurrent.Await
-    import scala.concurrent.duration._
-
-    val snapshotVersionR = 
"""href=".*/((\d+)\.(\d+)\.(\d+)(-(M|RC)(\d+))?\+(\d+)-[0-9a-f]+-SNAPSHOT)/"""".r
-
-    // pekko-cluster-sharding-typed_2.13 seems to be the last nightly 
published by `pekko-publish-nightly` so if that's there then it's likely the 
rest also made it
-    val body = Await.result(http.run(url(
-        
s"${Resolver.ApacheMavenSnapshotsRepo.root}org/apache/pekko/pekko-cluster-sharding-typed_2.13/")),
-      10.seconds).bodyAsString
-
-    val allVersions =
-      snapshotVersionR.findAllMatchIn(body)
-        .map {
-          case Groups(full, ep, maj, min, _, _, tagNumber, offset) =>
-            (
-              ep.toInt,
-              maj.toInt,
-              min.toInt,
-              Option(tagNumber).map(_.toInt),
-              offset.toInt) -> full
-        }
-        .filter(_._2.startsWith(prefix))
-        .toVector.sortBy(_._1)
-    allVersions.last._2
-  }
-}
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 99f9560..1e19304 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -10,7 +10,7 @@
 addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0")
 addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
 addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
-addSbtPlugin("org.mdedetrich" % "sbt-apache-sonatype" % "0.1.10")
 addSbtPlugin("com.github.pjfanning" % "sbt-source-dist" % "0.1.11")
+addSbtPlugin("com.github.pjfanning" % "sbt-pekko-build" % "0.3.1")
 addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
 addSbtPlugin("net.bzzt" % "sbt-reproducible-builds" % "0.31")


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to