diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-06-08 10:50:38 +0200 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-06-09 11:38:40 +0200 |
commit | a00a972c7425232432364bf991e118d248578f0d (patch) | |
tree | 6a59f3ec71facdbea462773c6b2e5d1a65b6c9ac /project | |
parent | fbf44ebaf4ae80cbc10613b759beb1f0167b19c6 (diff) | |
download | dotty-a00a972c7425232432364bf991e118d248578f0d.tar.gz dotty-a00a972c7425232432364bf991e118d248578f0d.tar.bz2 dotty-a00a972c7425232432364bf991e118d248578f0d.zip |
Add date and hash to publishing version
Diffstat (limited to 'project')
-rw-r--r-- | project/Build.scala | 6 | ||||
-rw-r--r-- | project/VersionUtil.scala | 18 |
2 files changed, 22 insertions, 2 deletions
diff --git a/project/Build.scala b/project/Build.scala index c07fab230..85a7bb861 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -25,7 +25,8 @@ object DottyBuild extends Build { override def settings: Seq[Setting[_]] = { super.settings ++ Seq( scalaVersion in Global := "2.11.5", - version in Global := "0.1-SNAPSHOT", + version in Global := + "0.1-SNAPSHOT-" + VersionUtil.commitDate + "-" + VersionUtil.gitHash, organization in Global := "ch.epfl.lamp", organizationName in Global := "LAMP/EPFL", organizationHomepage in Global := Some(url("http://lamp.epfl.ch")), @@ -208,7 +209,8 @@ object DottyBuild extends Build { "org.scala-sbt" % "api" % sbtVersion.value % "test", "org.specs2" %% "specs2" % "2.3.11" % "test" ), - version := "0.1.1-SNAPSHOT", + version := + "0.1.1-SNAPSHOT-" + VersionUtil.commitDate + "-" + VersionUtil.gitHash, // The sources should be published with crossPaths := false, the binaries // are unused so it doesn't matter. crossPaths := false, diff --git a/project/VersionUtil.scala b/project/VersionUtil.scala new file mode 100644 index 000000000..338cf2d95 --- /dev/null +++ b/project/VersionUtil.scala @@ -0,0 +1,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") +} |