Skip to content

Commit 81114af

Browse files
Using a comparison that supports semver
1 parent b1df0b1 commit 81114af

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ git.baseVersion := "1.0"
1515

1616
libraryDependencies ++= Seq(
1717
"org.eclipse.jgit" % "org.eclipse.jgit" % "5.13.1.202206130422-r",
18-
"com.michaelpollmeier" % "versionsort" % "1.0.11",
18+
"com.github.zafarkhaja" % "java-semver" % "0.10.2",
1919
"org.scalameta" %% "munit" % "0.7.29" % Test
2020
)
2121

src/main/scala/com/github/sbt/git/GitPlugin.scala

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package com.github.sbt.git
22

3-
import sbt._
4-
import Keys._
3+
import sbt.*
4+
import Keys.*
5+
import com.github.zafarkhaja.semver.Version
6+
57
import sys.process.Process
68

79
/** This plugin has all the basic 'git' functionality for other plugins. */
@@ -299,7 +301,12 @@ object SbtGit {
299301
} yield version
300302

301303
// NOTE - Selecting the last tag or the first tag should be an option.
302-
val highestVersion = versions.sortWith { versionsort.VersionHelper.compare(_, _) > 0 }.headOption
304+
val highestVersion =
305+
versions
306+
.map(Version.parse)
307+
.sortWith(_.compareTo(_) > 0)
308+
.headOption
309+
303310
highestVersion.map(_ + suffix)
304311
}
305312

0 commit comments

Comments
 (0)