Last active
September 14, 2015 10:06
-
-
Save petekneller/5b117039d2292e7c8977 to your computer and use it in GitHub Desktop.
SBT BuildInfo example 1 - output in /target
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
object BuildInfo { | |
lazy val settings = sourceGenerators in Test <+= (streams, sourceManaged in Test, baseDirectory) map emitBuildInfo | |
def emitBuildInfo(logger: TaskStreams, outputDir: File, baseDir: File): Seq[File] = { | |
val outputFile = outputDir / "BuildInfo.scala" | |
logger.log.info(s"Generating build info file at: ${outputFile}") | |
IO.write(outputFile, | |
s""" | |
|package buildInfo | |
| | |
|object BuildInfo { | |
| val baseDir = "${baseDir.absolutePath}" | |
|} | |
""".stripMargin) | |
Seq(outputFile) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment