diff options
author | Juan J. Martinez <jjm@usebox.net> | 2021-07-09 08:00:11 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2021-07-22 19:49:52 +0100 |
commit | 8e1b19668bda442065ee7ec90ce541c6ca3c29bc (patch) | |
tree | 4d9d69cfdd24d9ed692c083ef5800770c01cb9ae /build.sc | |
parent | 2e7b43a5ab80b0d143490e40dccd5938839c1c04 (diff) | |
download | spacebeans-8e1b19668bda442065ee7ec90ce541c6ca3c29bc.tar.gz spacebeans-8e1b19668bda442065ee7ec90ce541c6ca3c29bc.zip |
Using mill-vcs-version
Diffstat (limited to 'build.sc')
-rw-r--r-- | build.sc | 21 |
1 files changed, 3 insertions, 18 deletions
@@ -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") |