-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sc
159 lines (131 loc) · 4.39 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import mill._
import mill.scalalib.publish._
import scalalib._
import scalafmt._
import coursier.maven.MavenRepository
import $ivy.`com.goyeau::mill-scalafix_mill0.11:0.3.1`
import com.goyeau.mill.scalafix.ScalafixModule
// learned from https://github.com/OpenXiangShan/fudian/blob/main/build.sc
val defaultVersions = Map(
"chisel" -> ("org.chipsalliance", "6.6.0", false),
"chisel-plugin" -> ("org.chipsalliance", "6.6.0", true),
"json4s-jackson" -> ("org.json4s", "4.0.6", false),
"chiseltest" -> ("edu.berkeley.cs", "0.6.0-RC3", false),
"scalatest" -> ("org.scalatest", "3.2.15", false),
"sourcecode" -> ("com.lihaoyi", "0.3.1", false),
"mainargs" -> ("com.lihaoyi", "0.5.0", false),
)
val commonScalaVersion = "2.13.15"
def getVersion(dep: String) = {
val (org, ver, cross) = defaultVersions(dep)
val version = sys.env.getOrElse(dep + "Version", ver)
if (cross)
ivy"$org:::$dep:$version"
else
ivy"$org::$dep:$version"
}
trait CommonModule extends ScalaModule {
def scalaVersion = commonScalaVersion
// for snapshot dependencies
override def repositoriesTask = T.task {
super.repositoriesTask() ++ Seq(
MavenRepository("https://oss.sonatype.org/content/repositories/snapshots")
)
}
// for scalafix rules
override def scalacOptions =
Seq("-Ywarn-unused", "-deprecation")
}
object hardfloat extends CommonModule with SbtModule {
override def millSourcePath =
os.pwd / "submodules" / "berkeley-hardfloat" / "hardfloat"
override def ivyDeps = super.ivyDeps() ++ Agg(
getVersion("chisel")
)
override def scalacPluginIvyDeps = super.scalacPluginIvyDeps() ++ Agg(
getVersion("chisel-plugin")
)
}
object apiConfigChipsalliance extends CommonModule {
override def millSourcePath =
os.pwd / "submodules" / "api-config-chipsalliance" / "cde"
}
object diplomacy extends CommonModule with ScalaModule {
override def millSourcePath =
os.pwd / "submodules" / "diplomacy" / "diplomacy"
override def ivyDeps = super.ivyDeps() ++ Agg(
getVersion("chisel"),
getVersion("sourcecode"),
)
override def moduleDeps =
super.moduleDeps ++ Seq(
apiConfigChipsalliance
)
override def scalacPluginIvyDeps = super.scalacPluginIvyDeps() ++ Agg(
getVersion("chisel-plugin")
)
}
object rocketChipMacros extends CommonModule {
override def millSourcePath = os.pwd / "submodules" / "rocket-chip" / "macros"
override def ivyDeps = super.ivyDeps() ++ Agg(
ivy"org.scala-lang:scala-reflect:$commonScalaVersion"
)
}
object rocketChip extends CommonModule with SbtModule {
override def millSourcePath = os.pwd / "submodules" / "rocket-chip"
override def ivyDeps = super.ivyDeps() ++ Agg(
getVersion("chisel"),
getVersion("mainargs"),
getVersion("json4s-jackson"),
ivy"org.scala-lang:scala-reflect:$commonScalaVersion"
)
override def scalacPluginIvyDeps = super.scalacPluginIvyDeps() ++ Agg(
getVersion("chisel-plugin")
)
override def moduleDeps =
super.moduleDeps ++ Seq(
hardfloat,
rocketChipMacros,
apiConfigChipsalliance,
diplomacy
)
override def scalacOptions = super.scalacOptions() ++
Seq("-deprecation", "-unchecked")
}
object boom extends CommonModule with SbtModule {
override def millSourcePath = os.pwd / "submodules" / "riscv-boom"
override def moduleDeps = super.moduleDeps ++ Seq(rocketChip)
override def scalacPluginIvyDeps = super.scalacPluginIvyDeps() ++ Agg(
getVersion("chisel-plugin")
)
}
object inclusiveCache extends CommonModule with ScalaModule {
override def millSourcePath =
os.pwd / "submodules" / "rocket-chip-inclusive-cache" / "design" / "craft" / "inclusivecache"
override def moduleDeps = super.moduleDeps ++ Seq(rocketChip)
override def scalacPluginIvyDeps = super.scalacPluginIvyDeps() ++ Agg(
getVersion("chisel-plugin")
)
}
object vcu128 extends CommonModule with ScalafmtModule {
override def millSourcePath = os.pwd
override def ivyDeps = super.ivyDeps() ++ Agg(
getVersion("chisel"),
getVersion("chiseltest")
)
override def scalacPluginIvyDeps = super.scalacPluginIvyDeps() ++ Agg(
getVersion("chisel-plugin")
)
override def moduleDeps =
super.moduleDeps ++ Seq(
apiConfigChipsalliance,
rocketChip,
boom,
inclusiveCache
)
object test extends ScalaTests with TestModule.ScalaTest {
override def ivyDeps = super.ivyDeps() ++ Agg(
getVersion("scalatest")
)
}
}