-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sc
89 lines (63 loc) · 2.56 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
import mill._
import scalalib._
import scalafmt._
import os.Path
import publish._
import $file.common
import $file.`external`.`rocket-chip`.common
import $file.`external`.`rocket-chip`.common
import $file.`external`.`rocket-chip`.cde.common
import $file.`external`.`rocket-chip`.hardfloat.build
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 `external`.`rocket-chip`.common.RocketChipModule with HasChisel {
val rcPath = os.pwd / "external" / "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 `external`.`rocket-chip`.common.MacrosModule with HasChisel {
def scalaReflectIvy = ivy"org.scala-lang:scala-reflect:${scalaVersion}"
}
object cde extends `external`.`rocket-chip`.cde.common.CDEModule with HasChisel {
override def millSourcePath = rcPath / "cde" / "cde"
}
object hardfloat extends `external`.`rocket-chip`.hardfloat.common.HardfloatModule with HasChisel {
override def millSourcePath = rcPath / "hardfloat" / "hardfloat"
}
def macrosModule = macros
def hardfloatModule = hardfloat
def cdeModule = cde
}
object OpenNCB extends SbtModule with HasChisel with millbuild.common.OpenNCBModule {
override def millSourcePath = millOuterCtx.millSourcePath
def rocketModule: ScalaModule = rocketchip
override def scalacOptions = super.scalacOptions() ++
Agg("-deprecation")
object test extends SbtModuleTests with TestModule.ScalaTest {
override def ivyDeps = super.ivyDeps() ++ Agg(
getVersion("chiseltest"),
)
}
}