Skip to content

Commit 30ce1c1

Browse files
aristov.konstantin@sgaz.localSethTisue
authored andcommitted
Using a comparison that supports semver
1 parent f079e4b commit 30ce1c1

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ git.baseVersion := "1.0"
1515

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

2222
scriptedLaunchOpts += s"-Dproject.version=${version.value}"

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)