blob: fe3a2181b36ce613eb7bb767c483bc3880d66cd6 (
plain) (
tree)
|
|
package xyz.driver.sbt
import com.typesafe.sbt.GitPlugin
import com.typesafe.sbt.SbtGit.git
import sbt.Keys._
import sbt.plugins.JvmPlugin
import sbt.{AutoPlugin, _}
object Versioning extends AutoPlugin {
override def requires = JvmPlugin
override def trigger = allRequirements
// Get version from git unless a VERSION environment variable is set
lazy val versionSettings: Seq[Setting[_]] = sys.env.get("VERSION") match {
case None =>
GitPlugin.autoImport.versionWithGit ++ Seq(
git.useGitDescribe := true, // get version from git
git.baseVersion := "0.0.0" // this version is used for new projects without any commits
)
case Some(v) =>
Seq(
version := v
)
}
override def buildSettings = versionSettings ++ Seq(
organization := "xyz.driver"
)
}
|