use sbt-pekko-build (#826)

* try sbt-pekko-build

* Use latest sbt-pekko-build 0.3.0

* remove temp resolver

---------

Co-authored-by: Matthew de Detrich <matthew.dedetrich@aiven.io>
This commit is contained in:
PJ Fanning 2024-01-15 10:44:49 +01:00 committed by GitHub
parent df302b8ee6
commit dc034749b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 110 deletions

View file

@ -26,6 +26,11 @@ commands := commands.value.filterNot { command =>
ThisBuild / reproducibleBuildsCheckResolver := Resolver.ApacheMavenStagingRepo
ThisBuild / pekkoCoreProject := true
// pekkoInlineEnabled must be set to false when this is backported to 1.0.x branch
ThisBuild / pekkoInlineEnabled := true
enablePlugins(
UnidocRoot,
UnidocWithPrValidation,

View file

@ -1,63 +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-2022 Lightbend Inc. <https://www.lightbend.com>
*/
import scala.collection.immutable
import sbt._
import sbt.Keys._
import com.typesafe.tools.mima.plugin.MimaPlugin
import com.typesafe.tools.mima.plugin.MimaPlugin.autoImport._
object MiMa extends AutoPlugin {
private val latestPatchOf10 = 0
override def requires = MimaPlugin
override def trigger = allRequirements
val checkMimaFilterDirectories =
taskKey[Unit]("Check that the mima directories are correct compared to latest version")
override val projectSettings = Seq(
mimaReportSignatureProblems := true,
mimaPreviousArtifacts := pekkoPreviousArtifacts(name.value, organization.value),
checkMimaFilterDirectories := checkFilterDirectories(baseDirectory.value))
def checkFilterDirectories(moduleRoot: File): Unit = {
val nextVersionFilterDir =
moduleRoot / "src" / "main" / "mima-filters" / s"1.0.${latestPatchOf10 + 1}.backwards.excludes"
if (nextVersionFilterDir.exists()) {
throw new IllegalArgumentException(s"Incorrect mima filter directory exists: '$nextVersionFilterDir' " +
s"should be with number from current release '${moduleRoot / "src" / "main" / "mima-filters" / s"1.0.$latestPatchOf10.backwards.excludes"}")
}
}
def pekkoPreviousArtifacts(
projectName: String,
organization: String): Set[sbt.ModuleID] = {
val versions: Seq[String] = {
val firstPatchOf10 = 0
val pekko10Previous = expandVersions(1, 0, 0 to latestPatchOf10)
pekko10Previous
}
// check against all binary compatible artifacts
versions.map { v =>
organization %% projectName % v
}.toSet
}
private def expandVersions(major: Int, minor: Int, patches: immutable.Seq[Int]): immutable.Seq[String] =
patches.map(patch => s"$major.$minor.$patch")
}

View file

@ -1,47 +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, derived from Akka.
*/
import sbt.Keys._
import sbt._
import sbt.plugins.JvmPlugin
object PekkoInlinePlugin extends AutoPlugin {
override def trigger: PluginTrigger = allRequirements
override def requires: Plugins = JvmPlugin
val enabled = !sys.props.contains("pekko.no.inline")
private val flagsFor212 = Seq(
"-opt-inline-from:org.apache.pekko.**",
"-opt-inline-from:<sources>",
"-opt:l:inline")
private val flagsFor213 = Seq(
"-opt-inline-from:org.apache.pekko.**",
"-opt-inline-from:<sources>",
"-opt:l:inline")
// Optimizer not yet available for Scala3, see https://docs.scala-lang.org/overviews/compiler-options/optimizer.html
private val flagsFor3 = Seq()
override lazy val projectSettings = Seq(
Compile / scalacOptions ++= {
if (enabled) {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n == 13 =>
flagsFor213
case Some((2, n)) if n == 12 =>
flagsFor212
case Some((3, _)) =>
flagsFor3
}
} else Seq.empty
})
}

View file

@ -27,6 +27,7 @@ addSbtPlugin("net.bzzt" % "sbt-reproducible-builds" % "0.31")
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1")
addSbtPlugin("com.github.pjfanning" % "sbt-source-dist" % "0.1.11")
addSbtPlugin("org.mdedetrich" % "sbt-apache-sonatype" % "0.1.10")
addSbtPlugin("com.github.pjfanning" % "sbt-pekko-build" % "0.3.0")
addSbtPlugin("com.github.reibitto" % "sbt-welcome" % "0.4.0")
addSbtPlugin("com.github.sbt" % "sbt-license-report" % "1.6.1")