This plugin adds some keys containing SCM information. It may be useful in conjuction with sbt-buildinfo.
Currently only Git and Mercurial (via command-line commands) are supported
Add to your project/plugins.sbt
:
addSbtPlugin("fi.onesto.sbt" % "sbt-buildnumber" % "0.1.0")
With sbt-buildinfo you can use the
provided keys in buildInfoKeys
. For example:
buildInfoKeys := Seq[BuildInfoKey](organization, name, version, shortBuildNumber)
The available keys are:
scmType: Scm
- detected version control systemunstagedChanges: Boolean
– true if the current repository has unstaged changesuncommittedChanges: Boolean
– true if the current repository has uncommitted changesuntrackedFiles: Seq[File]
– list of files that are not in version controlbuildNumber: Option[String]
– current revision of the repositoryshortBuildNumber: Option[String]
– short version of the current revision of the repositorybranchName: Option[String]
– the current branch namedecoratedBuildNumber: Option[String]
– current revision with decorationsdecoratedShortBuildNumber: Option[String]
– current revision with decorations (short version)
The values default to false
, None
or an empty list if the project is not under version
control of if there is an error.
The decorated build numbers are the corresponding build number with markers similar
to __git_ps1
.
*
– project contains unstaged changes%
– project contains untracked files+
- project contains staged but uncommitted changes