2018-11-09 13:41:11 +08:00
|
|
|
import Tests._
|
|
|
|
|
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",
|
2019-12-11 06:48:11 +08:00
|
|
|
scalaVersion := "2.12.10",
|
2018-05-14 03:40:34 +08:00
|
|
|
traceLevel := 15,
|
2018-09-23 07:34:05 +08:00
|
|
|
scalacOptions ++= Seq("-deprecation","-unchecked","-Xsource:2.11"),
|
2020-05-13 02:48:45 +08:00
|
|
|
libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.0" % "test",
|
2020-04-01 15:33:23 +08:00
|
|
|
// Remove after bump to FIRRTL 1.3
|
2020-05-13 02:48:45 +08:00
|
|
|
libraryDependencies += "org.scalatestplus" %% "scalacheck-1-14" % "3.1.0.1" % "test",
|
2019-05-28 06:49:44 +08:00
|
|
|
libraryDependencies += "org.json4s" %% "json4s-native" % "3.6.1",
|
2018-05-14 03:40:34 +08:00
|
|
|
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
|
2019-06-29 03:15:02 +08:00
|
|
|
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full),
|
2020-05-20 16:08:37 +08:00
|
|
|
// ScalaDoc
|
|
|
|
autoAPIMappings := true,
|
|
|
|
apiMappings += (
|
|
|
|
(chipyardRoot / unmanagedBase).value / "firrtl.jar" -> url("https://www.chisel-lang.org/api/firrtl/latest/")
|
|
|
|
),
|
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"),
|
|
|
|
Resolver.mavenLocal)
|
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
|
|
|
|
|
|
|
|
testGrouping in Test := isolateAllTests( (definedTests in Test).value )
|
|
|
|
|
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-05-14 10:58:46 +08:00
|
|
|
lazy val chipyardRoot = ProjectRef(chipyardDir, "chipyardRoot")
|
2020-02-07 12:04:48 +08:00
|
|
|
lazy val chipyard = ProjectRef(chipyardDir, "chipyard")
|
2019-06-29 01:56:11 +08:00
|
|
|
lazy val chisel = ProjectRef(chipyardDir, "chisel")
|
|
|
|
lazy val rocketchip = ProjectRef(chipyardDir, "rocketchip")
|
|
|
|
lazy val barstools = ProjectRef(chipyardDir, "barstoolsMacros")
|
|
|
|
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-05-28 06:49:44 +08:00
|
|
|
.dependsOn(chisel)
|
2018-11-28 04:40:59 +08:00
|
|
|
|
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"))
|
|
|
|
.dependsOn(barstools, rocketchip)
|
|
|
|
.settings(commonSettings,
|
2020-05-14 10:58:46 +08:00
|
|
|
Test / unmanagedBase := (chipyardRoot / baseDirectory).value / "test_lib",
|
2019-09-24 11:52:14 +08:00
|
|
|
Runtime / fullClasspathAsJars ++= ((firesimRef / Runtime / fullClasspath).value ++
|
|
|
|
(firechip / Runtime / fullClasspath).value)
|
|
|
|
)
|
2019-05-28 06:49:44 +08:00
|
|
|
|
|
|
|
lazy val firesimLib = (project in file("firesim-lib"))
|
2020-02-24 14:50:38 +08:00
|
|
|
.settings(commonSettings).dependsOn(midas, icenet, testchipip, sifive_blocks)
|
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
|
2020-05-20 16:08:37 +08:00
|
|
|
unidocProjectFilter in (ScalaUnidoc, unidoc) := inProjects(targetutils, midas, firesimLib),
|
2020-05-25 16:15:12 +08:00
|
|
|
siteSubdirName in ScalaUnidoc := apiDirectory.value + "/api",
|
|
|
|
// Only delete the files in the docs branch that are in the directory were
|
|
|
|
// trying to publish to. This prevents dev-versions from blowing away
|
|
|
|
// tagged versions and vice versa
|
|
|
|
includeFilter in ghpagesCleanSite := new sbt.io.PrefixFilter(apiDirectory.value),
|
|
|
|
excludeFilter in ghpagesCleanSite := NothingFilter,
|
|
|
|
|
2020-05-20 16:08:37 +08:00
|
|
|
// Clobber the existing doc task to instead have it use the unified one
|
|
|
|
Compile / doc := (doc in ScalaUnidoc).value,
|
|
|
|
// Registers the unidoc-generated html with sbt-site
|
|
|
|
addMappingsToSiteDir(mappings in (ScalaUnidoc, packageDoc), siteSubdirName in ScalaUnidoc)
|
|
|
|
)
|
|
|
|
.dependsOn(chisel, rocketchip, midas, firesimLib % "test->test;compile->compile", chipyard)
|