aboutsummaryrefslogtreecommitdiff
path: root/build.sbt
diff options
context:
space:
mode:
authorJim Lawson2017-09-14 09:41:56 -0700
committerGitHub2017-09-14 09:41:56 -0700
commitc5627f355767d4c4f5232fee81a61b7e8510672f (patch)
tree25a5c00745cd4743dc566f9a63774a30c5861825 /build.sbt
parente2ad4650c73a33fa84f1b8d4aa84438feaefb153 (diff)
Update sbt to 0.13.16; add Scala 2.12 support. (#639)
* Update sbt to 0.13.16; add Scala 2.12 support. To clean, test, and build Scala 2.11 and Scala 2.12 versions: % sbt +clean +test +publishLocal * Update Travis to test in 2.11.11 and 2.12.3 * Try different way of providing Travis Scala version * Attempt to get verilator built before tests.
Diffstat (limited to 'build.sbt')
-rw-r--r--build.sbt59
1 files changed, 44 insertions, 15 deletions
diff --git a/build.sbt b/build.sbt
index 1bb393fc..637e2390 100644
--- a/build.sbt
+++ b/build.sbt
@@ -2,13 +2,11 @@
// sbt-site - sbt-ghpages
-site.settings
+enablePlugins(SiteScaladocPlugin)
-site.includeScaladoc()
+enablePlugins(GhpagesPlugin)
-ghpages.settings
-
-git.remoteRepo := "git@github.com:ucb-bar/firrtl.git"
+git.remoteRepo := "git@github.com:freechipsproject/firrtl.git"
// Firrtl code
@@ -20,19 +18,49 @@ version := "1.1-SNAPSHOT"
scalaVersion := "2.11.11"
-javacOptions ++= Seq("-source", "1.7", "-target", "1.7")
+crossScalaVersions := Seq("2.11.11", "2.12.3")
+
+def scalacOptionsVersion(scalaVersion: String): Seq[String] = {
+ Seq() ++ {
+ // If we're building with Scala > 2.11, enable the compile option
+ // switch to support our anonymous Bundle definitions:
+ // https://github.com/scala/bug/issues/10047
+ CrossVersion.partialVersion(scalaVersion) match {
+ case Some((2, scalaMajor: Int)) if scalaMajor < 12 => Seq()
+ case _ => Seq("-Xsource:2.11")
+ }
+ }
+}
+
+scalacOptions := scalacOptionsVersion(scalaVersion.value)
+
+def javacOptionsVersion(scalaVersion: String): Seq[String] = {
+ Seq() ++ {
+ // Scala 2.12 requires Java 8, but we continue to generate
+ // Java 7 compatible code until we need Java 8 features
+ // for compatibility with old clients.
+ CrossVersion.partialVersion(scalaVersion) match {
+ case Some((2, scalaMajor: Int)) if scalaMajor < 12 =>
+ Seq("-source", "1.7", "-target", "1.7")
+ case _ =>
+ Seq("-source", "1.8", "-target", "1.8")
+ }
+ }
+}
+
+javacOptions ++= javacOptionsVersion(scalaVersion.value)
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value
-libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.5.0"
+libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.7.2"
-libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.1.7"
+libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.3"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.13.4" % "test"
-libraryDependencies += "com.github.scopt" %% "scopt" % "3.5.0"
+libraryDependencies += "com.github.scopt" %% "scopt" % "3.6.0"
libraryDependencies += "net.jcazevedo" %% "moultingyaml" % "0.4.0"
@@ -54,14 +82,15 @@ antlr4GenListener in Antlr4 := false // default = true
antlr4PackageName in Antlr4 := Option("firrtl.antlr")
+antlr4Version in Antlr4 := "4.7"
+
// ScalaDoc
-import UnidocKeys._
+enablePlugins(ScalaUnidocPlugin)
+
+doc in Compile := (doc in ScalaUnidoc).value
-lazy val customUnidocSettings = unidocSettings ++ Seq (
- doc in Compile := (doc in ScalaUnidoc).value,
- target in unidoc in ScalaUnidoc := crossTarget.value / "api"
-)
+//target in unidoc in ScalaUnidoc := crossTarget.value / "api"
autoAPIMappings := true
@@ -71,4 +100,4 @@ scalacOptions in Compile in doc ++= Seq(
"-doc-version", version.value,
"-doc-title", name.value,
"-doc-root-content", baseDirectory.value+"/root-doc.txt"
-)
+) ++ scalacOptionsVersion(scalaVersion.value)