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 (backport #3202) #3207

Merged
merged 2 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
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
34 changes: 29 additions & 5 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 @@ -193,8 +207,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 @@ -213,7 +227,11 @@ lazy val macros = (project in file("macros"))
.settings(name := "chisel3-macros")
.settings(commonSettings: _*)
.settings(publishSettings: _*)
.settings(mimaPreviousArtifacts := Set())
.settings(
mimaPreviousArtifacts := previousVersions.value.map { version =>
organization.value %% name.value % version
}
)

lazy val firrtlRef = ProjectRef(workspaceDirectory / "firrtl", "firrtl")

Expand All @@ -227,7 +245,11 @@ lazy val core = (project in file("core"))
buildInfoKeys := Seq[BuildInfoKey](buildInfoPackage, version, scalaVersion, sbtVersion, firtoolVersion)
)
.settings(publishSettings: _*)
.settings(mimaPreviousArtifacts := Set())
.settings(
mimaPreviousArtifacts := previousVersions.value.map { version =>
organization.value %% name.value % version
}
)
.settings(warningSuppression: _*)
.settings(fatalWarningsSettings: _*)
.settings(
Expand Down Expand Up @@ -263,7 +285,9 @@ lazy val chisel = (project in file("."))
.settings(warningSuppression: _*)
.settings(fatalWarningsSettings: _*)
.settings(
mimaPreviousArtifacts := Set(),
mimaPreviousArtifacts := previousVersions.value.map { version =>
organization.value %% name.value % version
},
Test / scalacOptions ++= Seq("-language:reflectiveCalls"),
// Forward doc command to unidoc
Compile / doc := (ScalaUnidoc / doc).value,
Expand Down
1 change: 1 addition & 0 deletions project/previous-versions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.6.0