-
Notifications
You must be signed in to change notification settings - Fork 13
/
version.sbt
39 lines (33 loc) · 1.07 KB
/
version.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
ThisBuild / dynverVTagPrefix := false
ThisBuild / version := {
val Stable = """([0-9]+)\.([0-9]+)\.([0-9]+)""".r
(ThisBuild / dynverGitDescribeOutput).value match {
case Some(descr) => {
if ((ThisBuild / isSnapshot).value) {
(ThisBuild / previousStableVersion).value match {
case Some(previousVer) => {
val current = (for {
Seq(maj, min, patch) <- Stable.unapplySeq(previousVer)
nextPatch <- scala.util.Try(patch.toInt).map(_ + 1).toOption
} yield {
val suffix = descr.commitSuffix.sha
s"${maj}.${min}.${nextPatch}-${suffix}-SNAPSHOT"
}).getOrElse {
println(
s"Fails to determine qualified snapshot version: $previousVer"
)
previousVer
}
current
}
case _ =>
sys.error("Fails to determine previous stable version")
}
} else {
descr.ref.value
}
}
case _ =>
sys.error("Fails to resolve Git information")
}
}