aboutsummaryrefslogblamecommitdiff
path: root/project/VersionUtil.scala
blob: 338cf2d95e2f639e1da302e6c54b2edb48c3180d (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                                                               
import scala.sys.process.Process

object VersionUtil {
  def executeScript(scriptName: String) = {
    val cmd =
      if (System.getProperty("os.name").toLowerCase.contains("windows"))
        s"cmd.exe /c scripts\\build\\$scriptName.bat -p"
      else s"scripts/build/$scriptName"
    Process(cmd).lines.head.trim
  }

  /** Seven letters of the SHA hash is considered enough to uniquely identify a
   *  commit, albeit extremely large projects - such as the Linux kernel - need
   *  more letters to stay unique
   */
  def gitHash = executeScript("get-scala-commit-sha").substring(0, 7)
  def commitDate = executeScript("get-scala-commit-date")
}