Created
December 18, 2012 10:30
-
-
Save anonymous/4326949 to your computer and use it in GitHub Desktop.
Generate a file containing sbt version information during the build.
Using this, you can achieve a very simple version of ktoso/git-commit-id-maven-plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val genVersionFile = TaskKey[Unit]( | |
"gen-version-file", | |
"Generates a file in target containing the apps version" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val yapDeploySettings = Seq[Setting[_]]( | |
bump in yap <<= yapBump, | |
genVersionFile in yap <<= doGenVersionFile | |
) ++ Seq() | |
lazy val doGenVersionFile = { | |
(scalaVersion, baseDirectory, projectID) map { (sv, bd, pid) => | |
val buildSbt: File = bd / "build.sbt" | |
val targetProperties: File = bd / "target" / ("scala-"+sv) / "classes" / "build.version" | |
versionFrom(buildSbt) match { | |
case Some(version) => | |
replaceFileContent(targetProperties, version) | |
println("Generated version file in: " + targetProperties.getPath) | |
case _ => | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment