-
Notifications
You must be signed in to change notification settings - Fork 269
Expand file tree
/
Copy pathbuild.sbt
More file actions
148 lines (130 loc) · 5.9 KB
/
Copy pathbuild.sbt
File metadata and controls
148 lines (130 loc) · 5.9 KB
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
import Tests._
val chiselVersion = "3.6.1"
// keep chisel/firrtl specific class files, rename other conflicts
val chiselFirrtlMergeStrategy = CustomMergeStrategy.rename { dep =>
import sbtassembly.Assembly.{Project, Library}
val nm = dep match {
case p: Project => p.name
case l: Library => l.moduleCoord.name
}
if (Seq("firrtl", "chisel3").contains(nm.split("_")(0))) { // split by _ to avoid checking on major/minor version
dep.target
} else {
"renamed/" + dep.target
}
}
// This is set by CI and should otherwise be unmodified
val apiDirectory = settingKey[String]("The site directory into which the published scaladoc should placed.")
apiDirectory := "latest"
lazy val commonSettings = Seq(
organization := "edu.berkeley.cs",
version := "1.0",
scalaVersion := "2.13.10",
scalacOptions ++= Seq("-deprecation","-unchecked","-Ywarn-unused","-Ymacro-annotations"),
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.2" % "test",
libraryDependencies += "org.json4s" %% "json4s-native" % "3.6.10",
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
libraryDependencies += "edu.berkeley.cs" %% "chisel3" % chiselVersion,
libraryDependencies += "com.lihaoyi" %% "sourcecode" % "0.3.1",
addCompilerPlugin("edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full),
// Scalafix
semanticdbEnabled := true,
semanticdbVersion := scalafixSemanticdb.revision,
// ScalaDoc
autoAPIMappings := true,
exportJars := true,
resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots"),
Resolver.sonatypeRepo("releases"),
Resolver.mavenLocal),
assembly / test := {},
assembly / assemblyMergeStrategy := {
case PathList("chisel3", "stage", xs @ _*) => chiselFirrtlMergeStrategy
case PathList("firrtl", "stage", xs @ _*) => chiselFirrtlMergeStrategy
// should be safe in JDK11: https://stackoverflow.com/questions/54834125/sbt-assembly-deduplicate-module-info-class
case x if x.endsWith("module-info.class") => MergeStrategy.discard
case x =>
val oldStrategy = (assembly / assemblyMergeStrategy).value
oldStrategy(x)
}
)
lazy val chiselSettings = Seq(
libraryDependencies ++= Seq(
"edu.berkeley.cs" %% "chisel3" % "3.6.1",
"org.apache.commons" % "commons-lang3" % "3.12.0",
"org.apache.commons" % "commons-text" % "1.9"
),
addCompilerPlugin("edu.berkeley.cs" % "chisel3-plugin" % "3.6.1" cross CrossVersion.full)
)
// Fork each scala test for now, to work around persistent mutable state
// in Rocket-Chip based generators
def isolateAllTests(tests: Seq[TestDefinition]) = tests map { test =>
val options = ForkOptions()
new Group(test.name, Seq(test), SubProcess(options))
} toSeq
lazy val cde = (project in file("cde"))
.settings(commonSettings)
.settings(chiselSettings)
.settings(Compile / scalaSource := baseDirectory.value / "cde/src/chipsalliance/rocketchip")
lazy val hardfloat = (project in file("berkeley-hardfloat/hardfloat"))
.settings(commonSettings)
.settings(chiselSettings)
lazy val rocketMacros = (project in file("rocket-chip/macros"))
.settings(commonSettings)
.settings(chiselSettings)
lazy val diplomacy = (project in file("diplomacy/diplomacy"))
.dependsOn(cde)
.settings(commonSettings)
.settings(chiselSettings)
.settings(Compile / scalaSource := baseDirectory.value / "src" / "diplomacy")
lazy val rocketchip = (project in file("rocket-chip"))
.dependsOn(hardfloat, rocketMacros, diplomacy, cde)
.settings(commonSettings)
.settings(chiselSettings)
.settings(
libraryDependencies ++= Seq(
"com.lihaoyi" %% "mainargs" % "0.5.0",
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.json4s" %% "json4s-jackson" % "4.0.5",
"org.scalatest" %% "scalatest" % "3.2.0" % "test",
"org.scala-graph" %% "graph-core" % "1.13.5",
"com.lihaoyi" %% "sourcecode" % "0.3.1"
)
)
// Doesn't depend on FireSim stuff at all
lazy val targetutils = (project in file("midas/targetutils"))
.settings(commonSettings)
// Doesn't depend on FireSim stuff at all
lazy val firesimLib = (project in file("firesim-lib"))
.dependsOn(targetutils)
.settings(commonSettings)
// We cannot forward reference firesim from midas (this creates a circular
// dependency on the project definitions), so declare a reference to it
// first and use that to append to our RuntimeClasspath
lazy val firesimRef = ProjectRef(file("."), "firesim")
lazy val midas = (project in file("midas"))
.dependsOn(rocketchip, targetutils, firesimLib)
.settings(libraryDependencies ++= Seq(
"org.scalatestplus" %% "scalacheck-1-14" % "3.1.3.0" % "test"))
.settings(commonSettings)
// Contains example targets, like the MIDAS examples, and FASED tests
lazy val firesim = (project in file("."))
.enablePlugins(ScalaUnidocPlugin, GhpagesPlugin, SiteScaladocPlugin)
.settings(commonSettings,
git.remoteRepo := "git@github.com:firesim/firesim.git",
// Publish scala doc only for the library projects -- classes under this
// project are all integration test-related
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(targetutils, midas, firesimLib),
ScalaUnidoc / siteSubdirName := apiDirectory.value + "/api",
// Only delete the files in the docs branch that are in the directory were
// trying to publish to. This prevents main-versions from blowing away
// tagged versions and vice versa
ghpagesCleanSite / includeFilter := new sbt.io.PrefixFilter(apiDirectory.value),
ghpagesCleanSite / excludeFilter := NothingFilter,
// Clobber the existing doc task to instead have it use the unified one
Compile / doc := (ScalaUnidoc / doc).value,
// Registers the unidoc-generated html with sbt-site
addMappingsToSiteDir(ScalaUnidoc / packageDoc / mappings, ScalaUnidoc / siteSubdirName),
concurrentRestrictions += Tags.limit(Tags.Test, 1)
)
.dependsOn(rocketchip, midas, firesimLib % "test->test;compile->compile")