aboutsummaryrefslogblamecommitdiff
path: root/project/VersionWithSHA.scala
blob: 4479b88f1e705cc50cf579eb663eb763bc71f220 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                                                                                                                         
import sbt.Process

object VersionWithSHA {

  private lazy val VersionWithShaRegex = """(?:\d+\.)?(?:\d+\.)?(?:\d+)-[0-9a-f]{5,40}"""

  /** Don't use this. You should use version.value instead. */
  def kamonVersionWithSHA(version: String) = version.takeWhile(_ != '-') + "-" + Process("git rev-parse HEAD").lines.head

  /** Don't use this. You should use isSnapshot.value instead. */
  def kamonIsSnapshot(version: String) = (version matches VersionWithShaRegex) || (version endsWith "-SNAPSHOT")

}