Skip to content

Commit

Permalink
add firtoolVersion to mill build system.
Browse files Browse the repository at this point in the history
  • Loading branch information
sequencer committed Apr 12, 2023
1 parent 34feb24 commit 19ac3b7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
14 changes: 14 additions & 0 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,20 @@ class Core(val crossScalaVersion: String)
def osLibModuleIvy = v.osLib

def upickleModuleIvy = v.upickle

def firtoolVersion = T {
import scala.sys.process._
val Version = """^CIRCT firtool-(\S+)$""".r
try {
val lines = Process(Seq("firtool", "--version")).lineStream
lines.collectFirst {
case Version(v) => v
case _ => "unknown"
}.get
} catch {
case e: java.io.IOException => sys.error(s"Failed to determine firtool version. Make sure firtool is found on the PATH.")
}
}
}

object plugin extends mill.Cross[Plugin](v.pluginScalaCrossVersions: _*)
Expand Down
3 changes: 3 additions & 0 deletions common.sc
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ trait CoreModule

def upickleModuleIvy: Dep

def firtoolVersion: T[String]

override def moduleDeps = super.moduleDeps ++ Seq(macrosModule, firrtlModule)

override def ivyDeps = super.ivyDeps() ++ Agg(
Expand All @@ -118,6 +120,7 @@ trait CoreModule
Map(
"buildInfoPackage" -> artifactName(),
"version" -> buildVersion(),
"firtoolVersion" -> firtoolVersion(),
"scalaVersion" -> scalaVersion()
)
}
Expand Down

0 comments on commit 19ac3b7

Please sign in to comment.