From 8e1b19668bda442065ee7ec90ce541c6ca3c29bc Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Fri, 9 Jul 2021 08:00:11 +0100 Subject: Using mill-vcs-version --- build.sc | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/build.sc b/build.sc index 938f412..fef43df 100644 --- a/build.sc +++ b/build.sc @@ -2,6 +2,8 @@ import mill._ import mill.scalalib._ import scalafmt._ +import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version_mill0.9:0.1.1` +import de.tobiasroeser.mill.vcs.version.VcsVersion import $ivy.`com.lihaoyi::mill-contrib-buildinfo:$MILL_VERSION` import mill.contrib.buildinfo.BuildInfo @@ -33,28 +35,11 @@ object server extends ScalaModule with ScalafmtModule with BuildInfo { super.compile() } - def gitHead = T.input { os.proc('git, "rev-parse", "HEAD").call().out.trim } - - def getVersion = T.input { - val tag = try Option( - os.proc('git, 'describe, "--exact-match", "--tags", "--always", gitHead()).call().out.trim - ) - catch { case e => None } - - tag match { - case Some(t) => t - case None => - val latestTaggedVersion = os.proc('git, 'describe, "--abbrev=0", "--always", "--tags").call().out.trim - val latestCommit = gitHead().take(6) - s"$latestTaggedVersion-$latestCommit" - } - } - val name = "spacebeans" def buildInfoMembers: T[Map[String, String]] = T { Map( "name" -> name, - "version" -> getVersion().drop(1) // version tags start with v + "version" -> VcsVersion.vcsState().format() ) } def buildInfoPackageName = Some("net.usebox.gemini.server") -- cgit v1.2.3