8000 Migrate SBT to mill by sequencer · Pull Request #3357 · chipsalliance/chisel · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Migrate SBT to mill #3357

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
53 changes: 19 additions & 34 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,15 @@ jobs:
uses: ./.github/workflows/install-espresso
with:
version: ${{ matrix.espresso }}
- name: Setup Scala
uses: actions/setup-java@v3
- uses: jodersky/setup-mill@master
with:
distribution: 'adopt'
java-version: ${{ matrix.jvm }}
cache: 'sbt'
mill-version: 0.11.0
- name: Install CIRCT
uses: ./.github/workflows/install-circt
with:
version: ${{ matrix.circt }}
- name: Test
run: sbt ++${{ matrix.scala }} test
run: mill __[${{ matrix.scala }}].test
- name: Binary compatibility
# TODO either make this also check the plugin or decide that we don't
# support binary compatibility for the plugin
Expand All @@ -69,16 +66,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Scala
uses: actions/setup-java@v3
- name: Install Mill
uses: jodersky/setup-mill@master
with:
distribution: 'adopt'
java-version: '11'
cache: 'sbt'
- name: Install CIRCT
uses: ./.github/workflows/install-circt
mill-version: 0.11.0
- name: Check Formatting
run: sbt fmtCheck
run: mill __[${{ matrix.scala }}].checkFormat

integration:
name: Integration Tests
Expand All @@ -90,12 +83,10 @@ jobs:
uses: ./.github/workflows/setup-oss-cad-suite
- name: Install Espresso
uses: ./.github/workflows/install-espresso
- name: Setup Scala
uses: actions/setup-java@v3
- name: Install Mill
uses: jodersky/setup-mill@master
with:
distribution: 'adopt'
java-version: '11'
cache: 'sbt'
mill-version: 0.11.0
- name: Install CIRCT
uses: ./.github/workflows/install-circt
- name: Integration Tests
Expand All @@ -112,12 +103,10 @@ jobs:
uses: actions/checkout@v3
- name: Install Tabby OSS Cad Suite
uses: ./.github/workflows/setup-oss-cad-suite
- name: Setup Scala
uses: actions/setup-java@v3
- name: Install Mill
uses: jodersky/setup-mill@master
with:
distribution: 'adopt'
java-version: '11'
cache: 'sbt'
mill-version: 0.11.0
- name: Check Formatting
run: sbt ++${{ matrix.scala }} standardLibrary/scalafmtCheckAll
- name: Unit Tests
Expand All @@ -130,12 +119,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Scala
uses: actions/setup-java@v3
- name: Install Mill
uses: jodersky/setup-mill@master
with:
distribution: 'adopt'
java-version: '11'
cache: 'sbt'
mill-version: 0.11.0
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down Expand Up @@ -225,12 +212,10 @@ jobs:
fetch-depth: 0
- name: Install CIRCT
uses: ./.github/workflows/install-circt
- name: Setup Scala
uses: actions/setup-java@v3
- name: Install Mill
uses: jodersky/setup-mill@master
with:
distribution: 'adopt'
java-version: '8'
cache: 'sbt'
mill-version: 0.11.0
- name: Setup GPG (for Publish)
uses: olafurpg/setup-gpg@v3
- name: Publish
Expand Down
42 changes: 13 additions & 29 deletions build.sc
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import $ivy.`com.github.lolgab::mill-mima::0.0.23`
import $ivy.`io.chris-kipp::mill-ci-release::0.1.9`

import mill._
import mill.scalalib._
import mill.scalalib.TestModule._
import mill.scalalib.publish._
import mill.scalalib.scalafmt._
import coursier.maven.MavenRepository
import mill.scalalib.api.ZincWorkerUtil.matchingVersions
import com.github.lolgab.mill.mima._
import io.kipp.mill.ci.release.{CiReleaseModule, SonatypeHost}
import $file.common

object v {
Expand Down Expand Up @@ -134,33 +139,7 @@ trait Core
}
}

def buildVersion = T("build-from-source")

private def generateBuildInfo = T {
val outputFile = T.dest / "chisel3" / "BuildInfo.scala"
val firtoolVersionString = firtoolVersion().map("Some(" + _ + ")").getOrElse("None")
val contents =
s"""
|package chisel3
|case object BuildInfo {
| val buildInfoPackage: String = "${artifactName()}"
| val version: String = "${buildVersion()}"
| val scalaVersion: String = "${scalaVersion()}"
| val firtoolVersion: scala.Option[String] = $firtoolVersionString
| override val toString: String = {
| "buildInfoPackage: %s, version: %s, scalaVersion: %s, firtoolVersion %s".format(
| buildInfoPackage, version, scalaVersion, firtoolVersion
| )
| }
|}
|""".stripMargin
os.write(outputFile, contents, createFolders = true)
PathRef(T.dest)
}

override def generatedSources = T {
super.generatedSources() :+ generateBuildInfo()
}
def buildVersion = T(os.proc("git", "describe", "--tags", "--dirty").call().out.lines.head.stripPrefix("v"))
}

object plugin extends Cross[Plugin](v.pluginScalaCrossVersions)
Expand Down Expand Up @@ -233,7 +212,10 @@ trait Stdlib
def pluginModule = plugin(crossScalaVersion)
}

trait ChiselPublishModule extends PublishModule {
trait ChiselPublishModule
extends PublishModule
with CiReleaseModule
with Mima {
def pomSettings = PomSettings(
description = artifactName(),
organization = "org.chipsalliance",
Expand All @@ -242,5 +224,7 @@ trait ChiselPublishModule extends PublishModule {
versionControl = VersionControl.github("chipsalliance", "chisel"),
developers = Seq()
)
def publishVersion = "5.0-SNAPSHOT"
def mimaPreviousVersions = os.read.lines(os.pwd / "project" / "previous-versions.txt")

override def sonatypeHost = Some(SonatypeHost.s01)
}
32 changes: 29 additions & 3 deletions common.sc
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import mill._
import mill.scalalib._

// 12 or 13
private def majorScalaVersion(scalaVersion: String) = scalaVersion.split('.')(1).toInt

trait HasMacroAnnotations
extends ScalaModule {

Expand Down Expand Up @@ -97,6 +94,35 @@ trait CoreModule

def upickleModuleIvy: Dep

def firtoolVersion: T[Option[String]]

def buildVersion: T[String]

def generateBuildInfo = T {
val outputFile = T.dest / "BuildInfo.scala"
val firtoolVersionString = firtoolVersion().map("Some(" + _ + ")").getOrElse("None")
val contents =
s"""package chisel3
|case object BuildInfo {
| val buildInfoPackage: String = "chisel3"
| val version: String = "${buildVersion()}"
| val scalaVersion: String = "${scalaVersion()}"
| val firtoolVersion: scala.Option[String] = $firtoolVersionString
| override val toString: String = {
| "buildInfoPackage: %s, version: %s, scalaVersion: %s, firtoolVersion %s".format(
| buildInfoPackage, version, scalaVersion, firtoolVersion
| )
| }
|}
|""".stripMargin
os.write(outputFile, contents)
PathRef(T.dest)
}

override def generatedSources = T {
super.generatedSources() :+ generateBuildInfo()
}

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

override def ivyDeps = super.ivyDeps() ++ Agg(
Expand Down
0