aboutsummaryrefslogtreecommitdiff
path: root/project/VersionUtil.scala
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-06-08 10:50:38 +0200
committerFelix Mulder <felix.mulder@gmail.com>2016-06-09 11:38:40 +0200
commita00a972c7425232432364bf991e118d248578f0d (patch)
tree6a59f3ec71facdbea462773c6b2e5d1a65b6c9ac /project/VersionUtil.scala
parentfbf44ebaf4ae80cbc10613b759beb1f0167b19c6 (diff)
downloaddotty-a00a972c7425232432364bf991e118d248578f0d.tar.gz
dotty-a00a972c7425232432364bf991e118d248578f0d.tar.bz2
dotty-a00a972c7425232432364bf991e118d248578f0d.zip
Add date and hash to publishing version
Diffstat (limited to 'project/VersionUtil.scala')
-rw-r--r--project/VersionUtil.scala18
1 files changed, 18 insertions, 0 deletions
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")
+}