summaryrefslogtreecommitdiff
path: root/build.sbt
diff options
context:
space:
mode:
authorJim Lawson2016-09-19 15:27:52 -0700
committerJim Lawson2016-10-05 09:28:27 -0700
commitffe58abac5f60d785b684bb249aee0153bddea3f (patch)
treeb838758676d802e83c984fbc95bb430a39a7e1bf /build.sbt
parentc24fc9b93d440cd5604b5c83e5b79b80d9c7604c (diff)
Add sbt-buildinfo support.
Diffstat (limited to 'build.sbt')
-rw-r--r--build.sbt19
1 files changed, 19 insertions, 0 deletions
diff --git a/build.sbt b/build.sbt
index 02a0e9f5..fe22c95a 100644
--- a/build.sbt
+++ b/build.sbt
@@ -93,6 +93,25 @@ lazy val chiselFrontend = (project in file("chiselFrontend")).
dependsOn(coreMacros)
lazy val chisel = (project in file(".")).
+ enablePlugins(BuildInfoPlugin).
+ settings(
+ // We should really be using name.value, but currently, the package is "Chisel" (uppercase first letter)
+ buildInfoPackage := /* name.value */ "chisel3",
+ buildInfoOptions += BuildInfoOption.BuildTime,
+ buildInfoKeys := Seq[BuildInfoKey](buildInfoPackage, version, scalaVersion, sbtVersion),
+ // Move the managed source directory where git won't complain about it,
+ // and where we can easily package its files as part of the source jar artifact.
+ // We'd like to use versionToArray(), slice(), and mkString() to convert an explicit
+ // Scala version (like 2.10.6), into the leftmost two components (2.10),
+ // but this seems to run afoul of assumptions sbt makes about the inclusion
+ // of Scala-version-specfic code (we get
+ // BuildInfo is already defined as case class BuildInfo
+ // so use the full version spec.
+ //sourceManaged in Compile <<= (sourceDirectory in Compile, scalaVersion){ (s,v) => s / ("scala-" + versionToArray(v).slice(0,2).mkString(".") + "/src_managed") },
+ sourceManaged in Compile <<= (sourceDirectory in Compile, scalaVersion){ (s,v) => s / ("scala-" + v + "/src_managed") },
+ // Add the generated sources to the packagedSrc artifact since they are excluded by default.
+ mappings in (Compile, packageSrc) += { ((sourceManaged in Compile).value / "sbt-buildinfo" / "BuildInfo.scala") -> "BuildInfo.scala" }
+ ).
settings(commonSettings: _*).
settings(chiselSettings: _*).
dependsOn(coreMacros).