-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.mill.scala
76 lines (67 loc) · 2.41 KB
/
build.mill.scala
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
/**
* build.sc
*
* This is the build configuration file for the Chisel project.
* It defines the project structure and its dependencies.
*/
// Import Mill build tool dependencies
import mill._
import mill.define.Sources
import mill.modules.Util
import mill.scalalib.scalafmt.ScalafmtModule
import mill.scalalib.TestModule.ScalaTest
import mill.scalalib._
// Import BSP (Build Server Protocol) support
import mill.bsp._
/**
* Main build definition for the Chisel project.
* This object defines the project structure and its dependencies.
*/
object ChiselProject extends ScalaModule with ScalafmtModule { m =>
// Flag to switch between Chisel 3.x and Chisel 6.x
val useChisel3 = false
// Configure Scala version based on Chisel version
override def scalaVersion = if (useChisel3) "2.13.10" else "2.13.15"
// Scala compiler options
override def scalacOptions = Seq(
"-language:reflectiveCalls", // Enable reflective calls
"-deprecation", // Emit warning for deprecated features
"-feature", // Emit warning for usages of features that should be imported explicitly
"-Xcheckinit" // Add runtime checks for uninitialized values
)
// Define Chisel dependencies based on version
override def ivyDeps = Agg(
if (useChisel3)
ivy"edu.berkeley.cs::chisel3:3.6.0"
else
ivy"org.chipsalliance::chisel:6.6.0"
)
// Add Chisel compiler plugin
override def scalacPluginIvyDeps = Agg(
if (useChisel3)
ivy"edu.berkeley.cs:::chisel3-plugin:3.6.0"
else
ivy"org.chipsalliance:::chisel-plugin:6.6.0"
)
/**
* Test configuration object that includes ScalaTest support
*/
object test extends ScalaTests with TestModule.ScalaTest with ScalafmtModule {
// Add test dependencies
override def ivyDeps = super.ivyDeps() ++ Agg(
ivy"org.scalatest::scalatest::3.2.19",
if (useChisel3)
ivy"edu.berkeley.cs::chiseltest:0.6.0"
else
ivy"edu.berkeley.cs::chiseltest:6.0.0"
)
}
// Configure additional Maven repositories for dependency resolution
def repositoriesTask = Task.Anon {
Seq(
coursier.MavenRepository("https://repo.scala-sbt.org/scalasbt/maven-releases"),
coursier.MavenRepository("https://oss.sonatype.org/content/repositories/releases"),
coursier.MavenRepository("https://oss.sonatype.org/content/repositories/snapshots")
) ++ super.repositoriesTask()
}
}