Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read previousVersions for bincompat checking from a file #3202

Merged
merged 2 commits into from
Apr 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ ThisBuild / firtoolVersion := {
}
}

// Previous versions are read from project/previous-versions.txt
// If this file is empty or does not exist, no binary compatibility checking will be done
// Add waivers to the directory defined by key `mimaFiltersDirectory` in files named: <since version>.backwards.excludes
// eg. unipublish/src/main/mima-filters/5.0.0.backwards.excludes
val previousVersions = settingKey[Set[String]]("Previous versions for binary compatibility checking")
ThisBuild / previousVersions := {
val file = new java.io.File("project", "previous-versions.txt")
if (file.isFile) {
scala.io.Source.fromFile(file).getLines.toSet
} else {
Set()
}
}

val emitVersion = taskKey[Unit]("Write the version to version.txt")
emitVersion := {
IO.write(new java.io.File("version.txt"), version.value)
Expand Down Expand Up @@ -169,10 +183,6 @@ lazy val firrtlSettings = Seq(
}
)

lazy val mimaSettings = Seq(
mimaPreviousArtifacts := Set()
)

lazy val assemblySettings = Seq(
assembly / assemblyJarName := "firrtl.jar",
assembly / test := {},
Expand Down Expand Up @@ -223,7 +233,6 @@ lazy val firrtl = (project in file("firrtl"))
buildInfoUsePackageAsPath := true,
buildInfoKeys := Seq[BuildInfoKey](buildInfoPackage, version, scalaVersion, sbtVersion)
)
.settings(mimaSettings)
.settings(warningSuppression: _*)
.settings(fatalWarningsSettings: _*)

Expand Down Expand Up @@ -297,8 +306,8 @@ lazy val plugin = (project in file("plugin"))
)
.settings(fatalWarningsSettings: _*)
.settings(
mimaPreviousArtifacts := {
Set()
mimaPreviousArtifacts := previousVersions.value.map { version =>
(organization.value % name.value % version).cross(CrossVersion.full)
}
)

Expand All @@ -320,7 +329,6 @@ lazy val macros = (project in file("macros"))
// Published as part of unipublish
publish / skip := true
)
.settings(mimaPreviousArtifacts := Set())

lazy val core = (project in file("core"))
.settings(commonSettings: _*)
Expand All @@ -334,7 +342,6 @@ lazy val core = (project in file("core"))
// Published as part of unipublish
publish / skip := true
)
.settings(mimaPreviousArtifacts := Set())
.settings(warningSuppression: _*)
.settings(fatalWarningsSettings: _*)
.settings(
Expand Down Expand Up @@ -409,7 +416,9 @@ lazy val unipublish =
.settings(warningSuppression: _*)
.settings(fatalWarningsSettings: _*)
.settings(
mimaPreviousArtifacts := Set(),
mimaPreviousArtifacts := previousVersions.value.map { version =>
organization.value %% name.value % version
},
// This is a pseudo-project with no class files, use the package jar instead
mimaCurrentClassfiles := (Compile / packageBin).value,
// Forward doc command to unidoc
Expand Down