aboutsummaryrefslogtreecommitdiff
path: root/build.sbt
diff options
context:
space:
mode:
authorJakob Odersky <jakob@odersky.com>2018-12-26 16:30:42 +0100
committerJakob Odersky <jakob@odersky.com>2018-12-26 16:38:32 +0100
commit433a83ff8e4849211ed1547d4246ef11afd059ac (patch)
treec94861b69f5e197512e2400b96f31bc2e60cec9e /build.sbt
downloadcodename-433a83ff8e4849211ed1547d4246ef11afd059ac.tar.gz
codename-433a83ff8e4849211ed1547d4246ef11afd059ac.tar.bz2
codename-433a83ff8e4849211ed1547d4246ef11afd059ac.zip
Initial commitv0.1.0
Diffstat (limited to 'build.sbt')
-rw-r--r--build.sbt24
1 files changed, 24 insertions, 0 deletions
diff --git a/build.sbt b/build.sbt
new file mode 100644
index 0000000..11b057a
--- /dev/null
+++ b/build.sbt
@@ -0,0 +1,24 @@
+enablePlugins(ScalaNativePlugin)
+
+scalaVersion := "2.11.12"
+
+version := {
+ import sys.process._
+ ("git describe --always --dirty=-SNAPSHOT --match v[0-9].*" !!).tail.trim
+}
+
+nativeMode := {
+ if (version.value.endsWith("SNAPSHOT")) "debug" else "release"
+}
+
+sourceGenerators in Compile += Def.task {
+ val file = (sourceManaged in Compile).value / "BuildInfo.scala"
+ IO.write(
+ file,
+ s"""|package codenames
+ |object BuildInfo {
+ | val version: String = "${version.value}"
+ |}""".stripMargin
+ )
+ Seq(file)
+}.taskValue