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

Using a comparison that supports semver #240

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ git.baseVersion := "1.0"

libraryDependencies ++= Seq(
"org.eclipse.jgit" % "org.eclipse.jgit" % "5.13.3.202401111512-r",
"com.michaelpollmeier" % "versionsort" % "1.0.11",
"com.github.zafarkhaja" % "java-semver" % "0.10.2",
"org.scalameta" %% "munit" % "1.0.2" % Test
)

Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.10.6
sbt.version=1.10.6
8 changes: 7 additions & 1 deletion src/main/scala/com/github/sbt/git/GitPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.github.sbt.git
import sbt.*
import Keys.*


/** This plugin has all the basic 'git' functionality for other plugins. */
object SbtGit {

Expand Down Expand Up @@ -317,7 +318,12 @@ object SbtGit {
} yield version

// NOTE - Selecting the last tag or the first tag should be an option.
val highestVersion = versions.sortWith { versionsort.VersionHelper.compare(_, _) > 0 }.headOption
val highestVersion =
versions
.map(Version.parse)
.sortWith(_.compareTo(_) > 0)
.headOption
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


highestVersion.map(_ + suffix)
}

Expand Down
2 changes: 1 addition & 1 deletion test-project/project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.1.0
sbt.version=1.10.1
Loading