xref: /XiangShan/build.sc (revision a42f2d46c5a9698f12a54d8e38debe85752c0564)
1import mill._, scalalib._
2import coursier.maven.MavenRepository
3
4object CustomZincWorkerModule extends ZincWorkerModule {
5  def repositories() = super.repositories ++ Seq(
6    MavenRepository("https://oss.sonatype.org/content/repositories/releases"),
7    MavenRepository("https://oss.sonatype.org/content/repositories/snapshots")
8  )
9}
10
11/**
12 * Scala 2.12 module that is source-compatible with 2.11.
13 * This is due to Chisel's use of structural types. See
14 * https://github.com/freechipsproject/chisel3/issues/606
15 */
16trait HasXsource211 extends ScalaModule {
17  override def scalacOptions = T {
18    super.scalacOptions() ++ Seq(
19      "-deprecation",
20      "-unchecked",
21      "-Xsource:2.11"
22    )
23  }
24}
25
26trait HasChisel3 extends ScalaModule {
27  override def ivyDeps = Agg(
28    ivy"edu.berkeley.cs::chisel3:3.3.2"
29 )
30}
31
32trait HasChiselTests extends CrossSbtModule  {
33  object test extends Tests {
34    override def ivyDeps = Agg(
35      ivy"org.scalatest::scalatest:3.0.4",
36      ivy"edu.berkeley.cs::chisel-iotesters:1.2+",
37      ivy"edu.berkeley.cs::chiseltest:0.2.1"
38    )
39    def testFrameworks = Seq("org.scalatest.tools.Framework")
40    def testOnly(args: String*) = T.command {
41      super.runMain("org.scalatest.tools.Runner", args: _*)
42    }
43  }
44}
45
46trait HasMacroParadise extends ScalaModule {
47  // Enable macro paradise for @chiselName et al
48  val macroPlugins = Agg(ivy"org.scalamacros:::paradise:2.1.0")
49  def scalacPluginIvyDeps = macroPlugins
50  def compileIvyDeps = macroPlugins
51}
52
53object chiselModule extends CrossSbtModule with HasChisel3 with HasChiselTests with HasXsource211 with HasMacroParadise {
54  def zincWorker = CustomZincWorkerModule
55  def crossScalaVersion = "2.11.12"
56  def forkArgs = Seq("-Xmx10G")
57}
58
59