Skip to content

Commit

Permalink
Don't add versions like '0.0.0' to previous artifacts (#9)
Browse files Browse the repository at this point in the history
This could happen with sbt-dynver generated versions like '0.0.0+3-70919203-SNAPSHOT'.
  • Loading branch information
alexarchambault authored Jun 3, 2020
1 parent dd262f1 commit 95bc504
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/scala/sbtcompatibility/version/Version.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ object Version {
val stripped = version.takeWhile(_ != '+')
if (tagPattern.findAllMatchIn(stripped).isEmpty)
Some(stripped)
// assume versions like '0.0.0' aren't published
.filter(_.exists(c => c.isDigit && c != '0'))
else
previousStableVersion(stripped)
} else
Expand Down
1 change: 1 addition & 0 deletions src/test/scala/sbtcompatibility/VersionsTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ object VersionsTests extends TestSuite {
* - check("1.1-RC2", "1.0")
* - checkEmpty("1.0-RC2")
* - checkEmpty("1.0-RC2+43")
* - checkEmpty("0.0.0+3-70919203-SNAPSHOT")
}

"compatible" - {
Expand Down

0 comments on commit 95bc504

Please sign in to comment.