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

#105 #136

Merged
merged 10 commits into from
Feb 10, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,26 @@ object TypelevelVersioningPlugin extends AutoPlugin {
None
}

// version here is the prefix used further to build a final version number
var version = latestInSeries.fold(tlBaseVersion.value)(_.toString)

V(version) match {
case None =>
sys.error(s"version must be semver format: $version")
case Some(value) =>
if (!(value.isSameSeries(baseV) || value >= baseV))
sys.error(
s"Your current version $version cannot be less than tlBaseVersion $baseV")
}
Comment on lines +88 to +95
Copy link
Member

Choose a reason for hiding this comment

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

I totally missed this: actually, we need to move this check outside of the current { }. Otherwise it's missing the current tags which are read here:

var version = getTaggedVersion(git.gitCurrentTags.value).map(_.toString).getOrElse {

// Looks for the distance to latest release in this series
latestInSeries.foreach { latestInSeries =>
Try(s"git describe --tags --match v$latestInSeries".!!.trim)
.collect { case Description(distance) => distance }
.foreach { distance => version += s"-$distance" }
}

git.gitHeadCommit.value.foreach { sha => version += s"-${sha.take(7)}" }
version

}

// Even if version was provided by a tag, we check for uncommited changes
Expand Down