refactor(build): overhaul build scripts (#5010)

Mill introduces some breaking changes lately. This PR overhauls build
scripts to adapt to these changes. Now `build.sc` becomes `build.mill`.
Besides, since we don't support sbt anyway, and `build.sbt` has not been
maintained for a long time and will not be maintained in the future, we
had better remove it.

Mill version stays 0.12.15 instead of 1.0.4 because support for
`VcsVersion` plugin in broken in Mill 1.0.0 and above. APIs in 0.12.x is
different from that of 1.0.x, but we'll solve them later.

Since IDEA 2025.1, scala syntax highlighting is almost broken if the
project is built with `build.sc`. Now IDEA supports mill again with
`build.mill` through BSP. **Run `make bsp` instead of `make idea` to get
indexed!**

This PR also remove many unnecessary codes in the original build script.
This commit is contained in:
Muzi 2025-09-16 14:02:27 +08:00 committed by GitHub
parent fc1946064a
commit cabc245fe3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 239 additions and 445 deletions

View File

@ -452,9 +452,10 @@ jobs:
- name: init
run: make init
- name: mill
uses: jodersky/setup-mill@v0.3.0
with:
mill-version: 0.12.3
run: |
mkdir -p ~/.local/bin
sh -c "curl -L https://repo1.maven.org/maven2/com/lihaoyi/mill-dist/1.0.4/mill-dist-1.0.4-mill.sh -o ~/.local/bin/mill && chmod +x ~/.local/bin/mill"
export PATH=~/.local/bin:$PATH
- name: swapfile
run: |
sudo fallocate -l 10G /swapfile
@ -572,6 +573,6 @@ jobs:
java-version: '11'
- run: |
mkdir -p ~/.local/bin
sh -c "curl -L https://github.com/com-lihaoyi/mill/releases/download/0.11.7/0.11.7 > ~/.local/bin/mill && chmod +x ~/.local/bin/mill"
sh -c "curl -L https://repo1.maven.org/maven2/com/lihaoyi/mill-dist/1.0.4/mill-dist-1.0.4-mill.sh -o ~/.local/bin/mill && chmod +x ~/.local/bin/mill"
export PATH=~/.local/bin:$PATH
- run: make check-format

View File

@ -1 +1 @@
0.12.3
0.12.15

233
build.mill Normal file
View File

@ -0,0 +1,233 @@
// Copyright (c) 2024-2025 Beijing Institute of Open Source Chip (BOSC)
// Copyright (c) 2020-2025 Institute of Computing Technology, Chinese Academy of Sciences
// Copyright (c) 2020-2021 Peng Cheng Laboratory
//
// XiangShan is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
// https://license.coscl.org.cn/MulanPSL2
//
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
//
// See the Mulan PSL v2 for more details.
package build
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
import $ivy.`org.chipsalliance::chisel:6.6.0`
import $ivy.`org.chipsalliance::firtool-resolver:1.3.0`
import de.tobiasroeser.mill.vcs.version.VcsVersion
import java.io.BufferedReader
import java.io.InputStreamReader
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.util.Locale
import mill._
import mill.scalalib._
import mill.scalalib.scalafmt.ScalafmtModule
import os.Path
val defaultScalaVersion = "2.13.15"
val pwd = os.Path(sys.env("MILL_WORKSPACE_ROOT"))
trait ChiselModule extends SbtModule with ScalafmtModule {
def scalaVersion: T[String] = defaultScalaVersion
def scalacOptions = Seq("-language:reflectiveCalls", "-Ymacro-annotations", "-Ytasty-reader")
def ivyDeps: T[Agg[Dep]] = Agg(ivy"org.chipsalliance::chisel:6.6.0", ivy"edu.berkeley.cs::chiseltest:6.0.0")
def scalacPluginIvyDeps: T[Agg[Dep]] = Agg(ivy"org.chipsalliance:::chisel-plugin:6.6.0")
def resolveFirtoolDeps = T {
firtoolresolver.Resolve(chisel3.BuildInfo.firtoolVersion.get, true) match {
case Right(bin) => bin.path.getAbsolutePath
case Left(err) => err
}
}
}
object `rocket-chip` extends ChiselModule {
object macros extends ScalaModule {
def scalaVersion: T[String] = defaultScalaVersion
def ivyDeps: T[Agg[Dep]] = Agg(ivy"org.scala-lang:scala-reflect:$defaultScalaVersion")
}
object hardfloat extends ChiselModule {
def millSourcePath: Path = pwd / "rocket-chip" / "hardfloat" / "hardfloat"
}
object cde extends ScalaModule {
def scalaVersion: T[String] = defaultScalaVersion
def millSourcePath: Path = pwd / "rocket-chip" / "cde" / "cde"
}
def mainClass = Some("freechips.rocketchip.diplomacy.Main")
def moduleDeps = Seq(macros, hardfloat, cde)
def ivyDeps: T[Agg[Dep]] =
super.ivyDeps() ++ Agg(ivy"com.lihaoyi::mainargs:0.7.0", ivy"org.json4s::json4s-jackson:4.0.7")
}
object utility extends ChiselModule {
def moduleDeps = Seq(`rocket-chip`)
def ivyDeps: T[Agg[Dep]] = super.ivyDeps() ++ Agg(ivy"com.lihaoyi::sourcecode:0.4.2")
object test extends SbtTests with TestModule.ScalaTest {
def ivyDeps: T[Agg[Dep]] = super.ivyDeps() ++ Agg(ivy"org.scalatest::scalatest:3.2.7")
}
}
object yunsuan extends ChiselModule {}
object huancun extends ChiselModule {
def moduleDeps = Seq(`rocket-chip`, utility)
}
object coupledL2 extends ChiselModule {
def moduleDeps = Seq(`rocket-chip`, utility, huancun)
}
object openNCB extends ChiselModule {
def millSourcePath = pwd / "openLLC" / "openNCB"
def moduleDeps = Seq(`rocket-chip`)
}
object openLLC extends ChiselModule {
def moduleDeps = Seq(`rocket-chip`, utility, coupledL2, openNCB)
}
object difftest extends ChiselModule {
object test extends SbtTests with TestModule.ScalaTest {
override def sources: T[Seq[PathRef]] = Task.Sources {
super.sources() ++ Seq(PathRef(this.millSourcePath / "src" / "generator" / "chisel"))
}
}
}
object fudian extends ChiselModule {}
object ChiselAIA extends ChiselModule {
def moduleDeps = Seq(`rocket-chip`, utility)
}
object macros extends ScalaModule {
def scalaVersion: T[String] = defaultScalaVersion
def ivyDeps: T[Agg[Dep]] = Agg(ivy"org.scala-lang:scala-reflect:$defaultScalaVersion")
}
object xiangshan extends ChiselModule {
def millSourcePath = pwd
def moduleDeps = Seq(
`rocket-chip`,
difftest,
huancun,
coupledL2,
openLLC,
yunsuan,
fudian,
utility,
ChiselAIA,
macros
)
val resourcesPath: String = pwd.toString() + "/src/main/resources"
val envPath: String = sys.env("PATH") + ":" + resourcesPath
def forkEnv = Map("PATH" -> envPath)
def forkArgs = Seq(
s"-Xmx${sys.props.getOrElse("jvm-xmx", "40G")}",
s"-Xss${sys.props.getOrElse("jvm-xss", "256m")}"
)
def ivyDeps: T[Agg[Dep]] = super.ivyDeps() ++ Agg(
ivy"io.circe::circe-yaml:1.15.0",
ivy"io.circe::circe-generic-extras:0.14.4"
)
def scalacOptions: T[Seq[String]] = super.scalacOptions() ++ Agg("-deprecation", "-feature")
private def publishVersion: T[String] = VcsVersion.vcsState().format(
revHashDigits = 8,
dirtyHashDigits = 0,
commitCountPad = -1,
countSep = "",
tagModifier = (tag: String) =>
"[Rr]elease.*".r.findFirstMatchIn(tag) match {
case Some(_) => "KunminghuV3-Release-" + LocalDateTime.now().format(
DateTimeFormatter.ofPattern("MMM-dd-yyyy").withLocale(new Locale("en"))
)
case None => "KunminghuV3-dev"
},
/* add "username, build-host, build-time" for non-release version */
untaggedSuffix = " (%s@%s) # %s".format(
System.getProperty("user.name"),
java.net.InetAddress.getLocalHost.getHostName,
LocalDateTime.now().format(DateTimeFormatter.ofPattern("MMM dd hh:mm:ss yyyy").withLocale(new Locale("en")))
)
)
// gitStatus changes frequently and unpredictably. Use `Task.Input` here.
private def gitStatus: T[String] = Task.Input {
val gitRevParseBuilder = new ProcessBuilder("git", "rev-parse", "HEAD")
val gitRevParseProcess = gitRevParseBuilder.start()
val shaReader = new BufferedReader(new InputStreamReader(gitRevParseProcess.getInputStream))
val sha = shaReader.readLine()
val gitStatusBuilder = new ProcessBuilder("git", "status", "-uno", "--porcelain")
val gitStatusProcess = gitStatusBuilder.start()
val gitStatusReader = new BufferedReader(new InputStreamReader(gitStatusProcess.getInputStream))
val status = gitStatusReader.readLine()
val gitDirty = if (status == null) 0 else 1
val str =
s"""|SHA=$sha
|dirty=$gitDirty
|""".stripMargin
str
}
private def packDifftestResources(destDir: os.Path): Unit = {
// package difftest source as resources, only git tracked files were collected
val difftest_srcs = os.proc("git", "ls-files").call(cwd = pwd / "difftest").out
.text().split("\n").filter(_.nonEmpty).toSeq
.map(os.RelPath(_))
difftest_srcs.foreach(f => os.copy(pwd / "difftest" / f, destDir / "difftest-src" / f, createFolders = true))
// package ready-to-run binary as resources
val ready_to_run = Seq("riscv64-nemu-interpreter-dual-so", "riscv64-nemu-interpreter-so", "riscv64-spike-so")
ready_to_run.foreach(f => os.copy(pwd / "ready-to-run" / f, destDir / "ready-to-run" / f, createFolders = true))
}
override def resources: T[Seq[PathRef]] = Task.Sources {
os.write(T.dest / "publishVersion", publishVersion())
os.write(T.dest / "gitStatus", gitStatus())
os.write(T.dest / "gitModules", os.proc("git", "submodule", "status").call().out.text())
packDifftestResources(T.dest)
super.resources() ++ Seq(PathRef(T.dest))
}
object test extends SbtTests with TestModule.ScalaTest {
def moduleDeps: Seq[JavaModule] = super.moduleDeps ++ Seq(xiangshan, difftest.test)
def forkArgs: T[Seq[String]] = super.forkArgs
def scalacOptions: T[Seq[String]] = super.scalacOptions() ++ Seq("-deprecation", "-feature")
val resourcesPath: String = pwd.toString() + "/src/main/resources"
val envPath: String = sys.env("PATH") + ":" + resourcesPath
def forkEnv = Map("PATH" -> envPath)
}
}

View File

@ -1,53 +0,0 @@
val chiselVersion = "3.4.3"
scalaVersion := "2.12.10"
lazy val commonSettings = Seq(
scalacOptions ++= Seq("-deprecation","-unchecked","-Xsource:2.11"),
libraryDependencies ++= Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value),
libraryDependencies ++= Seq("org.json4s" %% "json4s-jackson" % "3.6.1"),
libraryDependencies ++= Seq("org.scalatest" %% "scalatest" % "3.2.0" % "test"),
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full),
resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots"),
Resolver.sonatypeRepo("releases"),
Resolver.mavenLocal
)
)
lazy val chiselSettings = Seq(
libraryDependencies ++= Seq("edu.berkeley.cs" %% "chisel3" % chiselVersion),
addCompilerPlugin("edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full)
)
lazy val `api-config-chipsalliance` = (project in file("api-config-chipsalliance/build-rules/sbt"))
.settings(commonSettings)
lazy val hardfloat = (project in file("berkeley-hardfloat"))
.settings(commonSettings, chiselSettings)
lazy val rocketMacros = (project in file("rocket-chip/macros"))
.settings(commonSettings)
lazy val `rocket-chip` = (Project("rocket-chip", file("rocket-chip/src")))
.settings(commonSettings, chiselSettings)
.settings(
scalaSource in Compile := baseDirectory.value / "main" / "scala",
resourceDirectory in Compile := baseDirectory.value / "main" / "resources"
)
.dependsOn(rocketMacros)
.dependsOn(`api-config-chipsalliance`)
.dependsOn(hardfloat)
lazy val `block-inclusive-cache` = (project in file("block-inclusivecache-sifive"))
.settings(commonSettings, chiselSettings)
.settings(
scalaSource in Compile := baseDirectory.value / "design" / "craft" / "inclusivecache",
)
.dependsOn(`rocket-chip`)
lazy val chiseltest = (project in file("chiseltest"))
.settings(commonSettings, chiselSettings)
lazy val xiangshan = (Project("XiangShan", base = file(".")))
.settings(commonSettings, chiselSettings)
.dependsOn(`rocket-chip`, `block-inclusive-cache`, chiseltest)

387
build.sc
View File

@ -1,387 +0,0 @@
/***************************************************************************************
* Copyright (c) 2024 Beijing Institute of Open Source Chip (BOSC)
* Copyright (c) 2020-2024 Institute of Computing Technology, Chinese Academy of Sciences
* Copyright (c) 2020-2021 Peng Cheng Laboratory
*
* XiangShan is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
*
* See the Mulan PSL v2 for more details.
***************************************************************************************/
import mill._
import scalalib._
import scalafmt._
import $packages._
import $file.`rocket-chip`.common
import $file.`rocket-chip`.cde.common
import $file.`rocket-chip`.hardfloat.common
import $file.huancun.common
import $file.coupledL2.common
import $file.openLLC.common
/* for publishVersion */
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
import de.tobiasroeser.mill.vcs.version.VcsVersion
import java.io.{BufferedReader, InputStreamReader}
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.util.Locale
import scala.util.matching.Regex
val defaultScalaVersion = "2.13.15"
val pwd = os.Path(sys.env("MILL_WORKSPACE_ROOT"))
def defaultVersions = Map(
"chisel" -> ivy"org.chipsalliance::chisel:6.6.0",
"chisel-plugin" -> ivy"org.chipsalliance:::chisel-plugin:6.6.0",
"chiseltest" -> ivy"edu.berkeley.cs::chiseltest:6.0.0"
)
/* resolve firtool dependency */
import $ivy.`org.chipsalliance::chisel:6.6.0`
import $ivy.`org.chipsalliance::firtool-resolver:1.3.0`
trait HasChisel extends SbtModule {
def chiselModule: Option[ScalaModule] = None
def chiselPluginJar: T[Option[PathRef]] = None
def chiselIvy: Option[Dep] = Some(defaultVersions("chisel"))
def chiselPluginIvy: Option[Dep] = Some(defaultVersions("chisel-plugin"))
override def scalaVersion = defaultScalaVersion
override def scalacOptions = super.scalacOptions() ++
Agg("-language:reflectiveCalls", "-Ymacro-annotations", "-Ytasty-reader")
override def ivyDeps = super.ivyDeps() ++ Agg(chiselIvy.get)
override def scalacPluginIvyDeps = super.scalacPluginIvyDeps() ++ Agg(chiselPluginIvy.get)
def resolveFirtoolDeps = T {
firtoolresolver.Resolve(chisel3.BuildInfo.firtoolVersion.get, true) match {
case Right(bin) => bin.path.getAbsolutePath
case Left(err) => err
}
}
}
object rocketchip
extends $file.`rocket-chip`.common.RocketChipModule
with HasChisel {
def scalaVersion: T[String] = T(defaultScalaVersion)
override def millSourcePath = pwd / "rocket-chip"
def macrosModule = macros
def hardfloatModule = hardfloat
def cdeModule = cde
def mainargsIvy = ivy"com.lihaoyi::mainargs:0.7.0"
def json4sJacksonIvy = ivy"org.json4s::json4s-jackson:4.0.7"
object macros extends Macros
trait Macros
extends $file.`rocket-chip`.common.MacrosModule
with SbtModule {
def scalaVersion: T[String] = T(defaultScalaVersion)
def scalaReflectIvy = ivy"org.scala-lang:scala-reflect:${defaultScalaVersion}"
}
object hardfloat
extends $file.`rocket-chip`.hardfloat.common.HardfloatModule with HasChisel {
def scalaVersion: T[String] = T(defaultScalaVersion)
override def millSourcePath = pwd / "rocket-chip" / "hardfloat" / "hardfloat"
}
object cde
extends $file.`rocket-chip`.cde.common.CDEModule with ScalaModule {
def scalaVersion: T[String] = T(defaultScalaVersion)
override def millSourcePath = pwd / "rocket-chip" / "cde" / "cde"
}
}
object utility extends HasChisel {
override def millSourcePath = pwd / "utility"
override def moduleDeps = super.moduleDeps ++ Seq(
rocketchip
)
override def ivyDeps = super.ivyDeps() ++ Agg(
ivy"com.lihaoyi::sourcecode:0.4.2",
)
object test extends SbtTests with TestModule.ScalaTest {
override def ivyDeps = Agg(ivy"org.scalatest::scalatest:3.2.7")
}
}
object yunsuan extends HasChisel {
override def millSourcePath = pwd / "yunsuan"
}
object huancun extends $file.huancun.common.HuanCunModule with HasChisel {
override def millSourcePath = pwd / "huancun"
def rocketModule: ScalaModule = rocketchip
def utilityModule: ScalaModule = utility
}
object coupledL2 extends $file.coupledL2.common.CoupledL2Module with HasChisel {
override def millSourcePath = pwd / "coupledL2"
def rocketModule: ScalaModule = rocketchip
def utilityModule: ScalaModule = utility
def huancunModule: ScalaModule = huancun
}
object openNCB extends SbtModule with HasChisel {
override def millSourcePath = pwd / "openLLC" / "openNCB"
override def moduleDeps = super.moduleDeps ++ Seq(
rocketchip
)
}
object openLLC extends $file.openLLC.common.OpenLLCModule with HasChisel {
override def millSourcePath = pwd / "openLLC"
def coupledL2Module: ScalaModule = coupledL2
def rocketModule: ScalaModule = rocketchip
def utilityModule: ScalaModule = utility
def openNCBModule: ScalaModule = openNCB
}
object difftest extends HasChisel {
override def millSourcePath = pwd / "difftest"
object test extends SbtTests with TestModule.ScalaTest {
override def sources = T.sources {
super.sources() ++ Seq(PathRef(this.millSourcePath / "src" / "generator" / "chisel"))
}
}
}
object fudian extends HasChisel {
override def millSourcePath = pwd / "fudian"
}
object chiselAIA extends HasChisel {
override def millSourcePath = pwd / "ChiselAIA"
override def moduleDeps = super.moduleDeps ++ Seq(
rocketchip,
utility
)
}
object macros extends ScalaModule {
override def millSourcePath = pwd / "macros"
override def scalaVersion: T[String] = T(defaultScalaVersion)
override def ivyDeps = super.ivyDeps() ++ Agg(ivy"org.scala-lang:scala-reflect:${defaultScalaVersion}")
def scalaReflectIvy = ivy"org.scala-lang:scala-reflect:${defaultScalaVersion}"
}
// extends this trait to use XiangShan in other projects
trait XiangShanModule extends ScalaModule {
def rocketModule: ScalaModule
def difftestModule: ScalaModule
def huancunModule: ScalaModule
def coupledL2Module: ScalaModule
def openLLCModule: ScalaModule
def fudianModule: ScalaModule
def utilityModule: ScalaModule
def yunsuanModule: ScalaModule
def chiselAIAModule: ScalaModule
def macrosModule: ScalaModule
override def moduleDeps = super.moduleDeps ++ Seq(
rocketModule,
difftestModule,
huancunModule,
coupledL2Module,
openLLCModule,
yunsuanModule,
fudianModule,
utilityModule,
chiselAIAModule,
macrosModule,
)
val resourcesPATH = pwd.toString() + "/src/main/resources"
val envPATH = sys.env("PATH") + ":" + resourcesPATH
override def forkEnv = Map("PATH" -> envPATH)
}
object xiangshan extends XiangShanModule with HasChisel with ScalafmtModule {
override def millSourcePath = pwd
def rocketModule = rocketchip
def difftestModule = difftest
def huancunModule = huancun
def coupledL2Module = coupledL2
def openLLCModule = openLLC
def fudianModule = fudian
def utilityModule = utility
def yunsuanModule = yunsuan
def chiselAIAModule = chiselAIA
def macrosModule = macros
// properties may be changed by user. Use `Task.Input` here.
def forkArgsTask = Task.Input {
Seq(s"-Xmx${sys.props.getOrElse("jvm-xmx", "40G")}", s"-Xss${sys.props.getOrElse("jvm-xss", "256m")}")
}
override def forkArgs = forkArgsTask()
override def ivyDeps = super.ivyDeps() ++ Agg(
defaultVersions("chiseltest"),
ivy"io.circe::circe-yaml:1.15.0",
ivy"io.circe::circe-generic-extras:0.14.4"
)
override def scalacOptions = super.scalacOptions() ++ Agg("-deprecation", "-feature")
def publishVersion: T[String] = VcsVersion.vcsState().format(
revHashDigits = 8,
dirtyHashDigits = 0,
commitCountPad = -1,
countSep = "",
tagModifier = (tag: String) => "[Rr]elease.*".r.findFirstMatchIn(tag) match {
case Some(_) => "KunminghuV3-Release-" + LocalDateTime.now().format(
DateTimeFormatter.ofPattern("MMM-dd-yyyy").withLocale(new Locale("en")))
case None => "KunminghuV3-dev"
},
/* add "username, buildhost, buildtime" for non-release version */
untaggedSuffix = " (%s@%s) # %s".format(
System.getProperty("user.name"),
java.net.InetAddress.getLocalHost().getHostName(),
LocalDateTime.now().format(DateTimeFormatter.ofPattern("MMM dd hh:mm:ss yyyy").withLocale(new Locale("en")))),
)
// gitStatus changes frequently and unpredictably. Use `Task.Input` here.
def gitStatus: T[String] = Task.Input {
val gitRevParseBuilder = new ProcessBuilder("git", "rev-parse", "HEAD")
val gitRevParseProcess = gitRevParseBuilder.start()
val shaReader = new BufferedReader(new InputStreamReader(gitRevParseProcess.getInputStream))
val sha = shaReader.readLine()
val gitStatusBuilder = new ProcessBuilder("git", "status", "-uno", "--porcelain")
val gitStatusProcess = gitStatusBuilder.start()
val gitStatusReader = new BufferedReader(new InputStreamReader(gitStatusProcess.getInputStream))
val status = gitStatusReader.readLine()
val gitDirty = if (status == null) 0 else 1
val str =
s"""|SHA=$sha
|dirty=$gitDirty
|""".stripMargin
str
}
def packDifftestResources(destDir: os.Path): Unit = {
// package difftest source as resources, only git tracked files were collected
val difftest_srcs = os.proc("git", "ls-files").call(cwd = pwd / "difftest").out
.text().split("\n").filter(_.nonEmpty).toSeq
.map(os.RelPath(_))
difftest_srcs.foreach { f =>
os.copy(pwd / "difftest" / f, destDir / "difftest-src" / f, createFolders = true)
}
// package ready-to-run binary as resources
val ready_to_run = Seq("riscv64-nemu-interpreter-dual-so",
"riscv64-nemu-interpreter-so",
"riscv64-spike-so")
ready_to_run.foreach { f =>
os.copy(pwd / "ready-to-run" / f, destDir / "ready-to-run" / f, createFolders = true)
}
}
override def resources = T.sources {
os.write(T.dest / "publishVersion", publishVersion())
os.write(T.dest / "gitStatus", gitStatus())
os.write(T.dest / "gitModules", os.proc("git", "submodule", "status").call().out.text())
packDifftestResources(T.dest)
super.resources() ++ Seq(PathRef(T.dest))
}
object test extends SbtTests with TestModule.ScalaTest {
override def moduleDeps = super.moduleDeps ++ Seq(
difftestModule.test
)
override def forkArgs = forkArgsTask()
override def scalacOptions = super.scalacOptions() ++ Agg("-deprecation", "-feature")
val resourcesPATH = pwd.toString() + "/src/main/resources"
val envPATH = sys.env("PATH") + ":" + resourcesPATH
override def forkEnv = Map("PATH" -> envPATH)
}
}