build.sc (cf7d6b7a1a781c73aeb87de112de2e7fe5ea3b7c) build.sc (844fba5b86d00c2ec233eddeffc3d637862575fd)
1/***************************************************************************************
2* Copyright (c) 2024 Beijing Institute of Open Source Chip (BOSC)
3* Copyright (c) 2020-2024 Institute of Computing Technology, Chinese Academy of Sciences
4* Copyright (c) 2020-2021 Peng Cheng Laboratory
5*
6* XiangShan is licensed under Mulan PSL v2.
7* You can use this software according to the terms and conditions of the Mulan PSL v2.
8* You may obtain a copy of Mulan PSL v2 at:

--- 14 unchanged lines hidden (view full) ---

23import $file.`rocket-chip`.hardfloat.build
24import $file.huancun.common
25import $file.coupledL2.common
26import $file.openLLC.common
27
28/* for publishVersion */
29import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
30import de.tobiasroeser.mill.vcs.version.VcsVersion
1/***************************************************************************************
2* Copyright (c) 2024 Beijing Institute of Open Source Chip (BOSC)
3* Copyright (c) 2020-2024 Institute of Computing Technology, Chinese Academy of Sciences
4* Copyright (c) 2020-2021 Peng Cheng Laboratory
5*
6* XiangShan is licensed under Mulan PSL v2.
7* You can use this software according to the terms and conditions of the Mulan PSL v2.
8* You may obtain a copy of Mulan PSL v2 at:

--- 14 unchanged lines hidden (view full) ---

23import $file.`rocket-chip`.hardfloat.build
24import $file.huancun.common
25import $file.coupledL2.common
26import $file.openLLC.common
27
28/* for publishVersion */
29import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
30import de.tobiasroeser.mill.vcs.version.VcsVersion
31import java.io.{BufferedReader, InputStreamReader}
31import java.time.LocalDateTime
32import java.time.format.DateTimeFormatter
33import java.util.Locale
34import scala.util.matching.Regex
35
36val defaultScalaVersion = "2.13.14"
37
38def defaultVersions = Map(

--- 233 unchanged lines hidden (view full) ---

272 },
273 /* add "username, buildhost, buildtime" for non-release version */
274 untaggedSuffix = " (%s@%s) # %s".format(
275 System.getProperty("user.name"),
276 java.net.InetAddress.getLocalHost().getHostName(),
277 LocalDateTime.now().format(DateTimeFormatter.ofPattern("MMM dd hh:mm:ss yyyy").withLocale(new Locale("en")))),
278 )
279
32import java.time.LocalDateTime
33import java.time.format.DateTimeFormatter
34import java.util.Locale
35import scala.util.matching.Regex
36
37val defaultScalaVersion = "2.13.14"
38
39def defaultVersions = Map(

--- 233 unchanged lines hidden (view full) ---

273 },
274 /* add "username, buildhost, buildtime" for non-release version */
275 untaggedSuffix = " (%s@%s) # %s".format(
276 System.getProperty("user.name"),
277 java.net.InetAddress.getLocalHost().getHostName(),
278 LocalDateTime.now().format(DateTimeFormatter.ofPattern("MMM dd hh:mm:ss yyyy").withLocale(new Locale("en")))),
279 )
280
281 def gitStatus: T[String] = {
282 val gitRevParseBuilder = new ProcessBuilder("git", "rev-parse", "HEAD")
283 val gitRevParseProcess = gitRevParseBuilder.start()
284 val shaReader = new BufferedReader(new InputStreamReader(gitRevParseProcess.getInputStream))
285 val sha = shaReader.readLine()
286
287 val gitStatusBuilder = new ProcessBuilder("git", "status", "-uno", "--porcelain")
288 val gitStatusProcess = gitStatusBuilder.start()
289 val gitStatusReader = new BufferedReader(new InputStreamReader(gitStatusProcess.getInputStream))
290 val status = gitStatusReader.readLine()
291 val gitDirty = if (status == null) 0 else 1
292
293 val str =
294 s"""|SHA=$sha
295 |dirty=$gitDirty
296 |""".stripMargin
297 str
298 }
299
280 override def resources = T.sources {
281 os.write(T.dest / "publishVersion", publishVersion())
300 override def resources = T.sources {
301 os.write(T.dest / "publishVersion", publishVersion())
302 os.write(T.dest / "gitStatus", gitStatus())
282 super.resources() ++ Seq(PathRef(T.dest))
283 }
284
285 object test extends SbtModuleTests with TestModule.ScalaTest {
286 override def forkArgs = Seq("-Xmx40G", "-Xss256m")
287
288 override def ivyDeps = super.ivyDeps() ++ Agg(
289 defaultVersions("chiseltest")
290 )
291
292 override def scalacOptions = super.scalacOptions() ++ Agg("-deprecation", "-feature")
293
294 val resourcesPATH = os.pwd.toString() + "/src/main/resources"
295 val envPATH = sys.env("PATH") + ":" + resourcesPATH
296
297 override def forkEnv = Map("PATH" -> envPATH)
298 }
299}
303 super.resources() ++ Seq(PathRef(T.dest))
304 }
305
306 object test extends SbtModuleTests with TestModule.ScalaTest {
307 override def forkArgs = Seq("-Xmx40G", "-Xss256m")
308
309 override def ivyDeps = super.ivyDeps() ++ Agg(
310 defaultVersions("chiseltest")
311 )
312
313 override def scalacOptions = super.scalacOptions() ++ Agg("-deprecation", "-feature")
314
315 val resourcesPATH = os.pwd.toString() + "/src/main/resources"
316 val envPATH = sys.env("PATH") + ":" + resourcesPATH
317
318 override def forkEnv = Map("PATH" -> envPATH)
319 }
320}