xref: /XiangShan/build.sc (revision 06a36b4fc9846f4cabc63aa8b4f243ab13e4d01b)
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.1"
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    )
38    def testFrameworks = Seq("org.scalatest.tools.Framework")
39  }
40}
41
42trait HasMacroParadise extends ScalaModule {
43  // Enable macro paradise for @chiselName et al
44  val macroPlugins = Agg(ivy"org.scalamacros:::paradise:2.1.0")
45  def scalacPluginIvyDeps = macroPlugins
46  def compileIvyDeps = macroPlugins
47}
48
49object chiselModule extends CrossSbtModule with HasChisel3 with HasChiselTests with HasXsource211 with HasMacroParadise {
50  def zincWorker = CustomZincWorkerModule
51  def crossScalaVersion = "2.11.12"
52}
53
54