Skip to content

Commit

Permalink
Make mima check optional
Browse files Browse the repository at this point in the history
Also: use scala 3 syntax in sbt files.
  • Loading branch information
erikvanoosten committed Apr 13, 2024
1 parent 14cb6a8 commit 33caba3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
15 changes: 13 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import sbt.Def
import MimaSettings.mimaSettings

/**
* As of zio-kafka version 2.8.0 releases are binary compatible. This is checked with Mima.
*
* Keep this value set to the oldest minor release (with patch version set to "0") that is still binary compatible.
*
* Set this value to `None` when master is _not_ binary compatible with te last minor release, the next release shall
* increase the minor version.
*/
lazy val binCompatVersionToCompare = None // Some("2.8.0")

lazy val kafkaVersion = "3.7.0"
lazy val embeddedKafkaVersion = "3.7.0" // Should be the same as kafkaVersion, except for the patch part

Expand Down Expand Up @@ -106,7 +116,7 @@ lazy val zioKafka =
.enablePlugins(BuildInfoPlugin)
.settings(stdSettings("zio-kafka"))
.settings(buildInfoSettings("zio.kafka"))
.settings(mimaSettings(failOnProblem = true))
.settings(mimaSettings(binCompatVersionToCompare, failOnProblem = true))
.settings(enableZIO(enableStreaming = true))
.settings(
libraryDependencies ++= Seq(
Expand All @@ -129,7 +139,7 @@ lazy val zioKafkaTestkit =
.dependsOn(zioKafka)
.enablePlugins(BuildInfoPlugin)
.settings(stdSettings("zio-kafka-testkit"))
.settings(mimaSettings(failOnProblem = false))
.settings(mimaSettings(binCompatVersionToCompare, failOnProblem = false))
.settings(
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % zioVersion.value,
Expand Down Expand Up @@ -212,6 +222,7 @@ lazy val docs = project
.enablePlugins(WebsitePlugin)
.dependsOn(zioKafka, zioKafkaTestkit)

// Extend 'lint' with mimaCheck
lazy val lint = {
val defaultLint = zio.sbt.Commands.ComposableCommand.lint
defaultLint.copy(commandStrings = defaultLint.commandStrings :+ "mimaCheck").toCommand
Expand Down
24 changes: 15 additions & 9 deletions project/MimaSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@ import sbt.*
import sbt.Keys.{ name, organization }

object MimaSettings {
lazy val bincompatVersionToCompare = "2.4.2"

def mimaSettings(failOnProblem: Boolean) =
Seq(
mimaPreviousArtifacts := Set(organization.value %% name.value % bincompatVersionToCompare),
mimaBinaryIssueFilters ++= Seq(
exclude[Problem]("zio.kafka.consumer.internal.*")
),
mimaFailOnProblem := failOnProblem
)
def mimaSettings(binCompatVersionToCompare: Option[String], failOnProblem: Boolean): Seq[Def.Setting[?]] =
binCompatVersionToCompare match {
case None =>
Seq.empty
case Some(binCompatVersion) =>
Seq(
mimaPreviousArtifacts := Set(organization.value %% name.value % binCompatVersion),
mimaBinaryIssueFilters ++= Seq(
exclude[Problem]("zio.kafka.consumer.internal.*")
),
mimaFailOnProblem := failOnProblem
)

}

}

0 comments on commit 33caba3

Please sign in to comment.