xref: /XiangShan/build.sbt (revision 945710d1cbecc29a498e58cfbe1dd56f7c51e71e)
1// See README.md for license details.
2
3def scalacOptionsVersion(scalaVersion: String): Seq[String] = {
4  Seq() ++ {
5    // If we're building with Scala > 2.11, enable the compile option
6    //  switch to support our anonymous Bundle definitions:
7    //  https://github.com/scala/bug/issues/10047
8    CrossVersion.partialVersion(scalaVersion) match {
9      case Some((2, scalaMajor: Long)) if scalaMajor < 12 => Seq()
10      case _ => Seq("-Xsource:2.11")
11    }
12  }
13}
14
15def javacOptionsVersion(scalaVersion: String): Seq[String] = {
16  Seq() ++ {
17    // Scala 2.12 requires Java 8. We continue to generate
18    //  Java 7 compatible code for Scala 2.11
19    //  for compatibility with old clients.
20    CrossVersion.partialVersion(scalaVersion) match {
21      case Some((2, scalaMajor: Long)) if scalaMajor < 12 =>
22        Seq("-source", "1.7", "-target", "1.7")
23      case _ =>
24        Seq("-source", "1.8", "-target", "1.8")
25    }
26  }
27}
28
29name := "noop"
30
31version := "3.1.1"
32
33scalaVersion := "2.11.12"
34
35crossScalaVersions := Seq("2.11.12", "2.12.4")
36
37resolvers ++= Seq(
38  Resolver.sonatypeRepo("snapshots"),
39  Resolver.sonatypeRepo("releases")
40)
41
42// Provide a managed dependency on X if -DXVersion="" is supplied on the command line.
43val defaultVersions = Map(
44  "chisel3" -> "3.1.+",
45  "chisel-iotesters" -> "[1.2.5,1.3-SNAPSHOT["
46  )
47
48libraryDependencies ++= Seq("chisel3","chisel-iotesters").map {
49  dep: String => "edu.berkeley.cs" %% dep % sys.props.getOrElse(dep + "Version", defaultVersions(dep)) }
50
51scalacOptions ++= scalacOptionsVersion(scalaVersion.value)
52
53javacOptions ++= javacOptionsVersion(scalaVersion.value)
54