-
Notifications
You must be signed in to change notification settings - Fork 33
/
build.sc
94 lines (63 loc) · 2.53 KB
/
build.sc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import mill._
import scalalib._
import scalafmt._
import $file.common
import $file.`rocket-chip`.common
import $file.`rocket-chip`.cde.common
import $file.`rocket-chip`.hardfloat.common
val defaultVersions = Map(
"chisel3" -> "3.6.0",
"chisel3-plugin" -> "3.6.0",
"chiseltest" -> "0.6.2",
"scala" -> "2.13.10",
)
def getVersion(dep: String, org: String = "edu.berkeley.cs", cross: Boolean = false) = {
val version = sys.env.getOrElse(dep + "Version", defaultVersions(dep))
if (cross)
ivy"$org:::$dep:$version"
else
ivy"$org::$dep:$version"
}
trait HasChisel extends ScalaModule {
def chiselModule: Option[ScalaModule] = None
def chiselPluginJar: T[Option[PathRef]] = None
def chiselIvy: Option[Dep] = Some(getVersion("chisel3"))
def chiselPluginIvy: Option[Dep] = Some(getVersion("chisel3-plugin", cross=true))
override def scalaVersion = defaultVersions("scala")
override def scalacOptions = super.scalacOptions() ++
Agg("-language:reflectiveCalls", "-Ymacro-annotations", "-Ytasty-reader")
override def ivyDeps = super.ivyDeps() ++ Agg(chiselIvy.get)
override def scalacPluginIvyDeps = super.scalacPluginIvyDeps() ++ Agg(chiselPluginIvy.get)
}
object rocketchip extends `rocket-chip`.common.RocketChipModule with HasChisel {
val rcPath = os.pwd / "rocket-chip"
override def millSourcePath = rcPath
def mainargsIvy = ivy"com.lihaoyi::mainargs:0.5.0"
def json4sJacksonIvy = ivy"org.json4s::json4s-jackson:4.0.5"
object macros extends `rocket-chip`.common.MacrosModule with HasChisel {
def scalaReflectIvy = ivy"org.scala-lang:scala-reflect:${scalaVersion}"
}
object cde extends `rocket-chip`.cde.common.CDEModule with HasChisel {
override def millSourcePath = rcPath / "cde" / "cde"
}
object hardfloat extends `rocket-chip`.hardfloat.common.HardfloatModule with HasChisel {
override def millSourcePath = rcPath / "hardfloat" / "hardfloat"
}
def macrosModule = macros
def hardfloatModule = hardfloat
def cdeModule = cde
}
object utility extends SbtModule with HasChisel {
override def millSourcePath = os.pwd / "Utility"
override def moduleDeps = super.moduleDeps ++ Seq(rocketchip)
}
object HuanCun extends SbtModule with HasChisel with millbuild.common.HuanCunModule {
override def millSourcePath = millOuterCtx.millSourcePath
def rocketModule: ScalaModule = rocketchip
def utilityModule: ScalaModule = utility
object test extends SbtModuleTests with TestModule.ScalaTest {
override def ivyDeps = super.ivyDeps() ++ Agg(
getVersion("chiseltest"),
)
}
}