Remove milestone from MIMA checks

And ensure the ones to come aren't added either
This commit is contained in:
Alexandre Archambault 2018-03-18 22:41:49 +01:00
parent db2a871391
commit e1800e74a9
2 changed files with 24 additions and 18 deletions

View File

@ -10,7 +10,6 @@ object Mima {
// Important: the line with the "binary compatibility versions" comment below is matched during releases
def binaryCompatibilityVersions = Set(
"1.1.0-M1",
"" // binary compatibility versions
)

View File

@ -244,6 +244,8 @@ object Release {
val mimaVersionsPattern = s"(?m)^(\\s+)${Pattern.quote("\"\" // binary compatibility versions")}$$".r
val milestonePattern = ("[^-]+" + Pattern.quote("-M") + "[0-9]+(-[0-9]+)*").r
val updateMimaVersions = ReleaseStep { state =>
val vcs = state.vcs
@ -253,28 +255,33 @@ object Release {
sys.error(s"${ReleaseKeys.versions.label} key not set")
}
val baseDir = Project.extract(state).get(baseDirectory.in(ThisBuild))
val mimaScalaFile = baseDir / "project" / "Mima.scala"
if (milestonePattern.unapplySeq(releaseVer).isEmpty) {
val content = Source.fromFile(mimaScalaFile)(Codec.UTF8).mkString
val baseDir = Project.extract(state).get(baseDirectory.in(ThisBuild))
val mimaScalaFile = baseDir / "project" / "Mima.scala"
mimaVersionsPattern.findAllIn(content).toVector match {
case Seq() => sys.error(s"Found no matches in $mimaScalaFile")
case Seq(_) =>
case _ => sys.error(s"Found too many matches in $mimaScalaFile")
}
val content = Source.fromFile(mimaScalaFile)(Codec.UTF8).mkString
val newContent = mimaVersionsPattern.replaceAllIn(
content,
m => {
val indent = m.group(1)
indent + "\"" + releaseVer + "\",\n" +
indent + "\"\" // binary compatibility versions"
mimaVersionsPattern.findAllIn(content).toVector match {
case Seq() => sys.error(s"Found no matches in $mimaScalaFile")
case Seq(_) =>
case _ => sys.error(s"Found too many matches in $mimaScalaFile")
}
)
Files.write(mimaScalaFile.toPath, newContent.getBytes(StandardCharsets.UTF_8))
vcs.add(mimaScalaFile.getAbsolutePath).!!(log)
val newContent = mimaVersionsPattern.replaceAllIn(
content,
m => {
val indent = m.group(1)
indent + "\"" + releaseVer + "\",\n" +
indent + "\"\" // binary compatibility versions"
}
)
Files.write(mimaScalaFile.toPath, newContent.getBytes(StandardCharsets.UTF_8))
vcs.add(mimaScalaFile.getAbsolutePath).!!(log)
} else
state.log.info(s"$releaseVer is a milestone release, not adding it to the MIMA checks")
state
}