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-http.git
The following commit(s) were added to refs/heads/main by this push:
new 38aa25e7c uptake sbt-pekko-build (#365)
38aa25e7c is described below
commit 38aa25e7c20232a4226c4ea5767813b99bca870a
Author: PJ Fanning <[email protected]>
AuthorDate: Wed Dec 13 13:29:14 2023 +0100
uptake sbt-pekko-build (#365)
---
.github/workflows/nightly.yml | 4 +-
build.sbt | 21 ++++---
project/MiMa.scala | 67 ---------------------
project/PekkoDependency.scala | 129 -----------------------------------------
project/VersionGenerator.scala | 3 +-
project/plugins.sbt | 1 +
6 files changed, 15 insertions(+), 210 deletions(-)
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index 3dd87ca9f..dca7e4030 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -42,10 +42,10 @@ jobs:
run: cp .jvmopts-ci .jvmopts
- name: Compile everything
- run: sbt -Dpekko.http.build.pekko.version=${{ matrix.PEKKO_VERSION }}
"++ ${{ matrix.SCALA_VERSION }}" Test/compile
+ run: sbt -Dpekko.build.pekko.version=${{ matrix.PEKKO_VERSION }} "++
${{ matrix.SCALA_VERSION }}" Test/compile
- name: Run all tests JDK ${{ matrix.JDK }}, Scala ${{
matrix.SCALA_VERSION }}, Pekko ${{ matrix.PEKKO_VERSION }}
- run: sbt -Dpekko.http.parallelExecution=false
-Dpekko.test.timefactor=2 -Dpekko.http.build.pekko.version=${{
matrix.PEKKO_VERSION }} "++ ${{ matrix.SCALA_VERSION }}" mimaReportBinaryIssues
test
+ run: sbt -Dpekko.http.parallelExecution=false
-Dpekko.test.timefactor=2 -Dpekko.build.pekko.version=${{ matrix.PEKKO_VERSION
}} "++ ${{ matrix.SCALA_VERSION }}" mimaReportBinaryIssues test
- name: Upload test results
uses: actions/upload-artifact@v3 # upload test results
diff --git a/build.sbt b/build.sbt
index f4abded98..161f33d8f 100644
--- a/build.sbt
+++ b/build.sbt
@@ -9,6 +9,7 @@
import ValidatePullRequest._
import
net.bzzt.reproduciblebuilds.ReproducibleBuildsPlugin.reproducibleBuildsCheckResolver
+import com.github.pjfanning.pekkobuild.PekkoDependency
import PekkoDependency._
import Dependencies.{ h2specExe, h2specName }
import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys.MultiJvm
@@ -147,9 +148,7 @@ lazy val httpCore = project("http-core")
.addPekkoModuleDependency(
"pekko-stream-testkit",
"test",
- pekko =
- if (System.getProperty("pekko.http.test-against-pekko-main", "false") ==
"true") PekkoDependency.snapshotMain
- else PekkoDependency.default)
+ PekkoDependency.default)
.settings(Dependencies.httpCore)
.settings(VersionGenerator.versionSettings)
.settings(scalaMacroSupport)
@@ -408,11 +407,11 @@ lazy val httpScalafixTests =
lazy val docs = project("docs")
.enablePlugins(ParadoxPlugin, PekkoParadoxPlugin, NoPublish)
.disablePlugins(MimaPlugin)
- .addPekkoModuleDependency("pekko-stream", "provided", PekkoDependency.docs)
- .addPekkoModuleDependency("pekko-actor-typed", "provided",
PekkoDependency.docs)
- .addPekkoModuleDependency("pekko-multi-node-testkit", "provided",
PekkoDependency.docs)
- .addPekkoModuleDependency("pekko-stream-testkit", "provided",
PekkoDependency.docs)
- .addPekkoModuleDependency("pekko-actor-testkit-typed", "provided",
PekkoDependency.docs)
+ .addPekkoModuleDependency("pekko-stream", "provided")
+ .addPekkoModuleDependency("pekko-actor-typed", "provided")
+ .addPekkoModuleDependency("pekko-multi-node-testkit", "provided")
+ .addPekkoModuleDependency("pekko-stream-testkit", "provided")
+ .addPekkoModuleDependency("pekko-actor-testkit-typed", "provided")
.dependsOn(
httpCore, http, httpXml, http2Tests, httpMarshallersJava,
httpMarshallersScala, httpCaching, httpCors,
httpTests % "compile;test->test", httpTestkit % "compile;test->test",
httpScalafixRules % ScalafixConfig)
@@ -442,15 +441,15 @@ lazy val docs = project("docs")
Compile / paradoxProperties ++= Map(
"project.name" -> "Apache Pekko HTTP",
"canonical.base_url" ->
"https://pekko.apache.org/docs/pekko-http/current",
- "pekko.version" -> PekkoDependency.docs.version,
+ "pekko.version" -> PekkoDependency.pekkoVersion,
"jackson.xml.version" -> Dependencies.jacksonXmlVersion,
"scalafix.version" -> _root_.scalafix.sbt.BuildInfo.scalafixVersion, //
grab from scalafix plugin directly
"extref.pekko-docs.base_url" ->
s"https://pekko.apache.org/docs/pekko/current/%s",
"javadoc.java.base_url" ->
"https://docs.oracle.com/en/java/javase/11/docs/api/java.base/",
"javadoc.java.link_style" -> "direct",
- "javadoc.org.apache.pekko.base_url" ->
s"https://pekko.apache.org/japi/pekko/${PekkoDependency.docs.link}",
+ "javadoc.org.apache.pekko.base_url" ->
s"https://pekko.apache.org/japi/pekko/${PekkoDependency.default.link}",
"javadoc.org.apache.pekko.link_style" -> "direct",
- "scaladoc.org.apache.pekko.base_url" ->
s"https://pekko.apache.org/api/pekko/${PekkoDependency.docs.link}",
+ "scaladoc.org.apache.pekko.base_url" ->
s"https://pekko.apache.org/api/pekko/${PekkoDependency.default.link}",
"scaladoc.org.apache.pekko.link_style" -> "direct",
"javadoc.org.apache.pekko.http.base_url" ->
s"https://pekko.apache.org/api/pekko-http/${projectInfoVersion.value}",
"scaladoc.org.apache.pekko.http.base_url" ->
s"https://pekko.apache.org/japi/pekko-http/${projectInfoVersion.value}",
diff --git a/project/MiMa.scala b/project/MiMa.scala
deleted file mode 100644
index be13a0f51..000000000
--- a/project/MiMa.scala
+++ /dev/null
@@ -1,67 +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) 2009-2020 Lightbend Inc. <https://www.lightbend.com>
- */
-
-import sbt._
-import sbt.Keys._
-import com.typesafe.tools.mima.core.ProblemFilter
-import com.typesafe.tools.mima.plugin.MimaPlugin
-import com.typesafe.tools.mima.plugin.MimaPlugin.autoImport._
-
-import scala.util.Try
-
-object MiMa extends AutoPlugin {
-
- override def requires = MimaPlugin
- override def trigger = allRequirements
-
- override val projectSettings = Seq(
- mimaPreviousArtifacts := {
- val versions = Set("1.0.0")
-
- versions.collect { case version =>
- organization.value %% name.value % version
- }
- },
- mimaBackwardIssueFilters := {
- val filters = mimaBackwardIssueFilters.value
- val allVersions = (mimaPreviousArtifacts.value.map(_.revision) ++
filters.keys).toSeq
-
- /**
- * Collect filters for all versions of a fork and add them as filters
for the latest version of the fork.
- * Otherwise, new versions in the fork that are listed above will
reintroduce issues that were already filtered
- * out before. We basically rebase this release line on top of the fork
from the view of Mima.
- */
- def forkFilter(fork: String): Option[(String, Seq[ProblemFilter])] = {
- val forkVersions = filters.keys.filter(_.startsWith(fork)).toSeq
- val collectedFilterOption = forkVersions.map(filters).reduceOption(_
++ _)
- collectedFilterOption.map(latestForkVersion(fork, allVersions) -> _)
- }
-
- Map.empty
- })
-
- def latestForkVersion(fork: String, allVersions: Seq[String]): String =
- allVersions
- .filter(_.startsWith(fork))
- .sorted(versionOrdering)
- .last
-
- // copied from
https://github.com/lightbend/migration-manager/blob/e54f3914741b7f528da5507e515cc84db60abdd5/core/src/main/scala/com/typesafe/tools/mima/core/ProblemReporting.scala#L14-L19
- private lazy val versionOrdering = Ordering[(Int, Int, Int)].on { version:
String =>
- val ModuleVersion = """(\d+)\.?(\d+)?\.?(.*)?""".r
- val ModuleVersion(epoch, major, minor) = version
- val toNumeric =
- (revision: String) => Try(revision.replace("x",
Short.MaxValue.toString).filter(_.isDigit).toInt).getOrElse(0)
- (toNumeric(epoch), toNumeric(major), toNumeric(minor))
- }
-}
diff --git a/project/PekkoDependency.scala b/project/PekkoDependency.scala
deleted file mode 100644
index 3539fc00b..000000000
--- a/project/PekkoDependency.scala
+++ /dev/null
@@ -1,129 +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) extends Pekko {
- override def link = VersionNumber(version) match { case
VersionNumber(Seq(x, y, _*), _, _) => s"$x.$y" }
- }
- object Artifact {
- def apply(version: String): Artifact = {
- val isSnap = version.endsWith("-SNAPSHOT")
- new Artifact(version, isSnap)
- }
- }
- 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.http.build.pekko.version")) match {
- case Some("main") => snapshotMain
- case Some("1.0.x") => snapshot10x
- 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.0"
- val default = pekkoDependency(defaultVersion = minimumExpectedPekkoVersion)
- def docs = default
-
- lazy val snapshot10x = Artifact(determineLatestSnapshot("1.0"), true)
- lazy val snapshotMain = 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
-
- // we use tagNumber set as Integer.MAX_VALUE when there is no tagNumber
- // this ensures that RC and Milistone versions are treated as older than
non-RC/non-milestone versions
- val allVersions =
- snapshotVersionR.findAllMatchIn(body)
- .map {
- case Groups(full, ep, maj, min, _, _, tagNumber, offset) =>
- (
- ep.toInt,
- maj.toInt,
- min.toInt,
- Option(tagNumber).map(_.toInt).getOrElse(Integer.MAX_VALUE),
- offset.toInt) -> full
- }
- .filter(_._2.startsWith(prefix))
- .toVector.sortBy(_._1)
-
- allVersions.last._2
- }
-}
diff --git a/project/VersionGenerator.scala b/project/VersionGenerator.scala
index caf0bb56a..8b717faa0 100644
--- a/project/VersionGenerator.scala
+++ b/project/VersionGenerator.scala
@@ -13,6 +13,7 @@
import sbt._
import sbt.Keys._
+import com.github.pjfanning.pekkobuild.PekkoDependency
/**
* Generate version.conf and pekko/Version.scala files based on the version
setting.
@@ -44,7 +45,7 @@ object VersionGenerator {
def generateVersion(dir: SettingKey[File], locate: File => File, template:
String) = Def.task[Seq[File]] {
val file = locate(dir.value)
- val content = template.stripMargin.format(version.value,
PekkoDependency.minimumExpectedPekkoVersion)
+ val content = template.stripMargin.format(version.value,
PekkoDependency.pekkoVersion)
if (!file.exists || IO.read(file) != content) IO.write(file, content)
Seq(file)
}
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 186290aaf..9a02339bb 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -39,6 +39,7 @@ addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.0")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
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.1.0")
addSbtPlugin("net.virtual-void" % "sbt-hackers-digest" % "0.1.2")
addSbtPlugin("com.lightbend.sbt" % "sbt-java-formatter" % "0.7.0")
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]