2018-11-09 13:41:11 +08:00
|
|
|
import Tests._
|
|
|
|
|
2023-03-21 10:06:26 +08:00
|
|
|
val chiselVersion = "3.5.6"
|
2021-02-13 03:51:26 +08:00
|
|
|
|
2023-05-30 13:29:41 +08:00
|
|
|
// keep chisel/firrtl specific class files, rename other conflicts
|
|
|
|
val chiselFirrtlMergeStrategy = CustomMergeStrategy.rename { dep =>
|
2023-03-04 09:17:16 +08:00
|
|
|
import sbtassembly.Assembly.{Project, Library}
|
2023-05-30 13:29:41 +08:00
|
|
|
val nm = dep match {
|
|
|
|
case p: Project => p.name
|
|
|
|
case l: Library => l.moduleCoord.name
|
2023-03-04 09:17:16 +08:00
|
|
|
}
|
2023-05-30 13:29:41 +08:00
|
|
|
if (Seq("firrtl", "chisel3").contains(nm.split("_")(0))) { // split by _ to avoid checking on major/minor version
|
|
|
|
dep.target
|
2023-03-04 09:17:16 +08:00
|
|
|
} else {
|
2023-05-30 13:29:41 +08:00
|
|
|
"renamed/" + dep.target
|
2023-03-04 09:17:16 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-25 16:15:12 +08:00
|
|
|
// 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"
|
|
|
|
|
2018-05-14 03:40:34 +08:00
|
|
|
lazy val commonSettings = Seq(
|
|
|
|
organization := "berkeley",
|
|
|
|
version := "1.0",
|
2023-01-04 17:42:16 +08:00
|
|
|
scalaVersion := "2.13.10",
|
2023-05-30 13:29:41 +08:00
|
|
|
scalacOptions ++= Seq("-deprecation","-unchecked","-Ywarn-unused","-Ymacro-annotations"),
|
2020-11-29 08:01:12 +08:00
|
|
|
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.2" % "test",
|
|
|
|
libraryDependencies += "org.json4s" %% "json4s-native" % "3.6.10",
|
2018-05-14 03:40:34 +08:00
|
|
|
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
|
2021-12-02 05:28:36 +08:00
|
|
|
libraryDependencies += "edu.berkeley.cs" %% "chisel3" % chiselVersion,
|
|
|
|
addCompilerPlugin("edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full),
|
2023-01-26 02:34:10 +08:00
|
|
|
// Scalafix
|
|
|
|
semanticdbEnabled := true,
|
|
|
|
semanticdbVersion := scalafixSemanticdb.revision,
|
2020-05-20 16:08:37 +08:00
|
|
|
// ScalaDoc
|
|
|
|
autoAPIMappings := true,
|
2019-09-24 11:52:14 +08:00
|
|
|
exportJars := true,
|
2019-06-29 03:15:02 +08:00
|
|
|
resolvers ++= Seq(
|
|
|
|
Resolver.sonatypeRepo("snapshots"),
|
|
|
|
Resolver.sonatypeRepo("releases"),
|
2023-03-04 09:17:16 +08:00
|
|
|
Resolver.mavenLocal),
|
|
|
|
assembly / test := {},
|
|
|
|
assembly / assemblyMergeStrategy := {
|
|
|
|
case PathList("chisel3", "stage", xs @ _*) => chiselFirrtlMergeStrategy
|
|
|
|
case PathList("firrtl", "stage", xs @ _*) => chiselFirrtlMergeStrategy
|
2023-05-30 13:29:41 +08:00
|
|
|
// 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
|
2023-03-04 09:17:16 +08:00
|
|
|
case x =>
|
|
|
|
val oldStrategy = (assembly / assemblyMergeStrategy).value
|
|
|
|
oldStrategy(x)
|
|
|
|
}
|
2018-05-14 03:40:34 +08:00
|
|
|
)
|
|
|
|
|
2018-11-09 13:41:11 +08:00
|
|
|
// Fork each scala test for now, to work around persistent mutable state
|
2019-05-28 06:49:44 +08:00
|
|
|
// in Rocket-Chip based generators
|
2018-11-09 13:41:11 +08:00
|
|
|
def isolateAllTests(tests: Seq[TestDefinition]) = tests map { test =>
|
|
|
|
val options = ForkOptions()
|
|
|
|
new Group(test.name, Seq(test), SubProcess(options))
|
|
|
|
} toSeq
|
|
|
|
|
2019-05-28 06:49:44 +08:00
|
|
|
lazy val firesimAsLibrary = sys.env.get("FIRESIM_STANDALONE") == None
|
2018-05-14 03:40:34 +08:00
|
|
|
|
2019-06-29 01:56:11 +08:00
|
|
|
lazy val chipyardDir = if(firesimAsLibrary) {
|
2019-05-28 06:49:44 +08:00
|
|
|
file("../../../")
|
|
|
|
} else {
|
2019-11-06 05:15:34 +08:00
|
|
|
file("../target-design/chipyard")
|
2019-05-28 06:49:44 +08:00
|
|
|
}
|
2018-11-28 04:40:59 +08:00
|
|
|
|
2020-02-07 12:04:48 +08:00
|
|
|
lazy val chipyard = ProjectRef(chipyardDir, "chipyard")
|
2019-06-29 01:56:11 +08:00
|
|
|
lazy val rocketchip = ProjectRef(chipyardDir, "rocketchip")
|
|
|
|
lazy val icenet = ProjectRef(chipyardDir, "icenet")
|
|
|
|
lazy val testchipip = ProjectRef(chipyardDir, "testchipip")
|
|
|
|
lazy val sifive_blocks = ProjectRef(chipyardDir, "sifive_blocks")
|
|
|
|
lazy val firechip = ProjectRef(chipyardDir, "firechip")
|
2018-11-28 04:40:59 +08:00
|
|
|
|
2019-05-28 06:49:44 +08:00
|
|
|
lazy val targetutils = (project in file("midas/targetutils"))
|
2018-11-28 04:40:59 +08:00
|
|
|
.settings(commonSettings)
|
|
|
|
|
2019-09-24 11:52:14 +08:00
|
|
|
// 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"))
|
2021-12-02 05:28:36 +08:00
|
|
|
.dependsOn(rocketchip)
|
2021-12-02 07:56:58 +08:00
|
|
|
.settings(libraryDependencies ++= Seq(
|
|
|
|
"org.scalatestplus" %% "scalacheck-1-14" % "3.1.3.0" % "test"))
|
2021-12-02 05:28:36 +08:00
|
|
|
.settings(commonSettings)
|
|
|
|
|
2019-05-28 06:49:44 +08:00
|
|
|
|
|
|
|
lazy val firesimLib = (project in file("firesim-lib"))
|
2021-02-13 03:51:26 +08:00
|
|
|
.dependsOn(midas, icenet, testchipip, sifive_blocks)
|
2021-12-02 05:28:36 +08:00
|
|
|
.settings(commonSettings)
|
2018-05-14 03:40:34 +08:00
|
|
|
|
2019-05-28 06:49:44 +08:00
|
|
|
// Contains example targets, like the MIDAS examples, and FASED tests
|
2018-11-28 04:40:59 +08:00
|
|
|
lazy val firesim = (project in file("."))
|
2020-05-20 16:08:37 +08:00
|
|
|
.enablePlugins(ScalaUnidocPlugin, GhpagesPlugin, SiteScaladocPlugin)
|
|
|
|
.settings(commonSettings,
|
|
|
|
git.remoteRepo := "git@github.com:firesim/firesim.git",
|
2020-05-25 16:15:12 +08:00
|
|
|
// Publish scala doc only for the library projects -- classes under this
|
|
|
|
// project are all integration test-related
|
2022-02-03 12:39:10 +08:00
|
|
|
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(targetutils, midas, firesimLib),
|
2022-01-21 12:28:20 +08:00
|
|
|
ScalaUnidoc / siteSubdirName := apiDirectory.value + "/api",
|
2020-05-25 16:15:12 +08:00
|
|
|
// Only delete the files in the docs branch that are in the directory were
|
2022-02-16 03:07:30 +08:00
|
|
|
// trying to publish to. This prevents main-versions from blowing away
|
2020-05-25 16:15:12 +08:00
|
|
|
// tagged versions and vice versa
|
2022-01-21 12:28:20 +08:00
|
|
|
ghpagesCleanSite / includeFilter := new sbt.io.PrefixFilter(apiDirectory.value),
|
|
|
|
ghpagesCleanSite / excludeFilter := NothingFilter,
|
2020-05-25 16:15:12 +08:00
|
|
|
|
2020-05-20 16:08:37 +08:00
|
|
|
// Clobber the existing doc task to instead have it use the unified one
|
2022-02-03 12:39:10 +08:00
|
|
|
Compile / doc := (ScalaUnidoc / doc).value,
|
2020-05-20 16:08:37 +08:00
|
|
|
// Registers the unidoc-generated html with sbt-site
|
2022-02-03 12:39:10 +08:00
|
|
|
addMappingsToSiteDir(ScalaUnidoc / packageDoc / mappings, ScalaUnidoc / siteSubdirName),
|
2020-05-26 14:25:33 +08:00
|
|
|
concurrentRestrictions += Tags.limit(Tags.Test, 1)
|
2020-05-20 16:08:37 +08:00
|
|
|
)
|
2021-12-02 05:28:36 +08:00
|
|
|
.dependsOn(rocketchip, midas, firesimLib % "test->test;compile->compile", chipyard)
|