Skip to content

Commit

Permalink
simplify v update
Browse files Browse the repository at this point in the history
  • Loading branch information
ailrst committed Jul 10, 2024
1 parent 4d31993 commit c52e880
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -87,26 +87,19 @@ object basil extends RootModule with ScalaModule with antlr.AntlrModule with Sca
* available in PATH
*/
def updateVersion() = T.command {

val lastTaggedCommit = os.proc("git", "rev-list", "--tags", "--max-count=1").spawn().stdout.trim()
val head = os.proc("git", "rev-parse", "HEAD").spawn().stdout.trim()
val version = os.proc("git", "describe", "--tags", lastTaggedCommit).spawn().stdout.trim()
val shortHEAD = os.proc("git", "rev-parse", "--short", "HEAD").spawn().stdout.trim()
val buildVersion = os.proc("git", "describe", "--tags").spawn().stdout.trim()

val wd = os.pwd
val declaredVersion = os.read(wd / "VERSION")
val nowAtVersion = head != lastTaggedCommit

if (declaredVersion != version) {
println(s"Updating VERISON file $declaredVersion to $version")
if (nowAtVersion) {
println("WARNING: HEAD not at tagged commit " + version + " : " + lastTaggedCommit)
}
println(s"WARN: Updating VERSION file $declaredVersion to $version")
} else {
println("No new version")
}

val buildVersion = version + (if (nowAtVersion) ("+" + shortHEAD) else "")
writeVersionFiles(version, buildVersion)
}

Expand Down

0 comments on commit c52e880

Please sign in to comment.