Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use versionfile for mill #3990

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 30 additions & 71 deletions build.sc
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import $ivy.`com.lihaoyi::mill-contrib-versionfile:`
import $ivy.`com.lihaoyi::mill-contrib-jmh:`

import mill._
import mill.scalalib._
import mill.scalalib.publish._
import mill.scalalib.scalafmt._
import mill.define.Cross
import mill.scalalib.api.ZincWorkerUtil.matchingVersions
import $ivy.`com.lihaoyi::mill-contrib-jmh:`
import mill.contrib.versionfile.VersionFileModule
import mill.contrib.jmh.JmhModule

import $file.common
import $file.tests

object v {
object v extends VersionFileModule {
val pluginScalaCrossVersions = Seq(
"2.13.11",
"2.13.12"
Expand All @@ -34,15 +38,13 @@ object v {
def scalaCompiler(scalaVersion: String) = ivy"org.scala-lang:scala-compiler:$scalaVersion"

def scalaLibrary(scalaVersion: String) = ivy"org.scala-lang:scala-library:$scalaVersion"

override def versionFile: T[PathRef] = T.source(super.millSourcePath / os.up / "version" / "chisel")
}

object firrtl extends Cross[Firrtl](v.scalaCrossVersions)

trait Firrtl
extends common.FirrtlModule
with ChiselPublishModule
with CrossSbtModule
with ScalafmtModule {
trait Firrtl extends common.FirrtlModule with ChiselPublishModule with CrossSbtModule with ScalafmtModule {
def millSourcePath = super.millSourcePath / os.up / "firrtl"

def osLibModuleIvy = v.osLib
Expand All @@ -58,20 +60,13 @@ trait Firrtl

object svsim extends Cross[Svsim](v.scalaCrossVersions)

trait Svsim
extends common.SvsimModule
with ChiselPublishModule
with CrossSbtModule
with ScalafmtModule {
trait Svsim extends common.SvsimModule with ChiselPublishModule with CrossSbtModule with ScalafmtModule {
def millSourcePath = super.millSourcePath / os.up / "svsim"
}

object firrtlut extends Cross[FirrtlUnitTest](v.scalaCrossVersions)

trait FirrtlUnitTest
extends tests.FirrtlUnitTestModule
with CrossModuleBase
with ScalafmtModule {
trait FirrtlUnitTest extends tests.FirrtlUnitTestModule with CrossModuleBase with ScalafmtModule {
override def millSourcePath = firrtl(crossScalaVersion).millSourcePath

def firrtlModule = firrtl(crossScalaVersion)
Expand All @@ -88,23 +83,15 @@ trait FirrtlUnitTest

object macros extends Cross[Macros](v.scalaCrossVersions)

trait Macros
extends common.MacrosModule
with ChiselPublishModule
with CrossSbtModule
with ScalafmtModule {
trait Macros extends common.MacrosModule with ChiselPublishModule with CrossSbtModule with ScalafmtModule {
def millSourcePath = super.millSourcePath / os.up / "macros"

def scalaReflectIvy = v.scalaReflect(crossScalaVersion)
}

object core extends Cross[Core](v.scalaCrossVersions)

trait Core
extends common.CoreModule
with ChiselPublishModule
with CrossSbtModule
with ScalafmtModule {
trait Core extends common.CoreModule with ChiselPublishModule with CrossSbtModule with ScalafmtModule {
def millSourcePath = super.millSourcePath / os.up / "core"

def firrtlModule = firrtl(crossScalaVersion)
Expand Down Expand Up @@ -154,11 +141,7 @@ trait Core

object plugin extends Cross[Plugin](v.pluginScalaCrossVersions)

trait Plugin
extends common.PluginModule
with ChiselPublishModule
with CrossSbtModule
with ScalafmtModule {
trait Plugin extends common.PluginModule with ChiselPublishModule with CrossSbtModule with ScalafmtModule {
def millSourcePath = super.millSourcePath / os.up / "plugin"

def scalaLibraryIvy = v.scalaLibrary(crossScalaVersion)
Expand All @@ -170,11 +153,7 @@ trait Plugin

object chisel extends Cross[Chisel](v.scalaCrossVersions)

trait Chisel
extends common.ChiselModule
with ChiselPublishModule
with CrossSbtModule
with ScalafmtModule {
trait Chisel extends common.ChiselModule with ChiselPublishModule with CrossSbtModule with ScalafmtModule {
override def millSourcePath = super.millSourcePath / os.up

def svsimModule = svsim(crossScalaVersion)
Expand All @@ -188,10 +167,7 @@ trait Chisel

object chiselut extends Cross[ChiselUnitTest](v.scalaCrossVersions)

trait ChiselUnitTest
extends tests.ChiselUnitTestModule
with CrossModuleBase
with ScalafmtModule {
trait ChiselUnitTest extends tests.ChiselUnitTestModule with CrossModuleBase with ScalafmtModule {
override def millSourcePath = chisel(crossScalaVersion).millSourcePath

def chiselModule = chisel(crossScalaVersion)
Expand All @@ -210,11 +186,7 @@ trait ChiselUnitTest

object stdlib extends Cross[Stdlib](v.scalaCrossVersions)

trait Stdlib
extends common.StdLibModule
with ChiselPublishModule
with CrossSbtModule
with ScalafmtModule {
trait Stdlib extends common.StdLibModule with ChiselPublishModule with CrossSbtModule with ScalafmtModule {
def millSourcePath = super.millSourcePath / os.up / "stdlib"

def chiselModule = chisel(crossScalaVersion)
Expand All @@ -232,14 +204,12 @@ trait ChiselPublishModule extends PublishModule {
developers = Seq()
)

def publishVersion = "5.0-SNAPSHOT"
def publishVersion = T(v.releaseVersion().asRelease.toString())
}

object circtpanamabinding extends CIRCTPanamaBinding

trait CIRCTPanamaBinding
extends common.CIRCTPanamaBindingModule
with ChiselPublishModule {
trait CIRCTPanamaBinding extends common.CIRCTPanamaBindingModule with ChiselPublishModule {

def header = T(PathRef(millSourcePath / "jextract-headers.h"))

Expand All @@ -252,28 +222,20 @@ trait CIRCTPanamaBinding

object panamalib extends Cross[PanamaLib](v.scalaCrossVersions)

trait PanamaLib
extends common.PanamaLibModule
with CrossModuleBase
with ChiselPublishModule
with ScalafmtModule {
trait PanamaLib extends common.PanamaLibModule with CrossModuleBase with ChiselPublishModule with ScalafmtModule {
def circtPanamaBindingModule = circtpanamabinding
}

object panamaom extends Cross[PanamaOM](v.scalaCrossVersions)

trait PanamaOM
extends common.PanamaOMModule
with CrossModuleBase
with ChiselPublishModule
with ScalafmtModule {
trait PanamaOM extends common.PanamaOMModule with CrossModuleBase with ChiselPublishModule with ScalafmtModule {
def panamaLibModule = panamalib(crossScalaVersion)
}

object panamaconverter extends Cross[PanamaConverter](v.scalaCrossVersions)

trait PanamaConverter
extends common.PanamaConverterModule
extends common.PanamaConverterModule
with CrossModuleBase
with ChiselPublishModule
with ScalafmtModule {
Expand All @@ -286,27 +248,24 @@ trait PanamaConverter

object litutility extends Cross[LitUtility](v.scalaCrossVersions)

trait LitUtility
extends tests.LitUtilityModule
with CrossModuleBase
with ScalafmtModule {
trait LitUtility extends tests.LitUtilityModule with CrossModuleBase with ScalafmtModule {
def millSourcePath = super.millSourcePath / os.up / "lit" / "utility"
def panamaConverterModule = panamaconverter(crossScalaVersion)
def panamaOMModule = panamaom(crossScalaVersion)
}

object lit extends Cross[Lit](v.scalaCrossVersions)

trait Lit
extends tests.LitModule
with Cross.Module[String] {
trait Lit extends tests.LitModule with Cross.Module[String] {
def scalaVersion: T[String] = crossValue
def runClasspath: T[Seq[os.Path]] = T(litutility(crossValue).runClasspath().map(_.path))
def pluginJars: T[Seq[os.Path]] = T(Seq(litutility(crossValue).panamaConverterModule.pluginModule.jar().path))
def javaLibraryPath: T[Seq[os.Path]] = T(litutility(crossValue).panamaConverterModule.circtPanamaBindingModule.libraryPaths().map(_.path))
def javaHome: T[os.Path] = T(os.Path(sys.props("java.home")))
def pluginJars: T[Seq[os.Path]] = T(Seq(litutility(crossValue).panamaConverterModule.pluginModule.jar().path))
def javaLibraryPath: T[Seq[os.Path]] = T(
litutility(crossValue).panamaConverterModule.circtPanamaBindingModule.libraryPaths().map(_.path)
)
def javaHome: T[os.Path] = T(os.Path(sys.props("java.home")))
def chiselLitDir: T[os.Path] = T(millSourcePath)
def litConfigIn: T[PathRef] = T.source(millSourcePath / "tests" / "lit.site.cfg.py.in")
def litConfigIn: T[PathRef] = T.source(millSourcePath / "tests" / "lit.site.cfg.py.in")
}

object benchmark extends ScalaModule with JmhModule {
Expand Down
1 change: 1 addition & 0 deletions version/chisel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.0.0-SNAPSHOT
Loading