Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into 1.5-release
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkoenig committed Dec 18, 2021
2 parents 5a6ca9b + c00a4eb commit c47764e
Show file tree
Hide file tree
Showing 106 changed files with 7,636 additions and 2,290 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
scala: [2.13.6, 2.12.14]
container:
image: ucbbar/chisel3-tools
options: --user github --entrypoint /bin/bash
env:
CONTAINER_HOME: /home/github
scala: [2.13.7, 2.12.15]

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Tabby OSS Cad Suite (from YosysHQ)
uses: YosysHQ/setup-oss-cad-suite@v1
with:
osscadsuite-version: '2021-11-09'
- name: Setup Scala
uses: olafurpg/setup-scala@v10
with:
Expand All @@ -51,7 +50,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
scala: [2.13.6, 2.12.14]
scala: [2.13.7, 2.12.15]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -71,15 +70,14 @@ jobs:
strategy:
matrix:
design: [RocketCore, FPU, ICache, Ops, AddNot]
container:
image: ucbbar/chisel3-tools
options: --user github --entrypoint /bin/bash
env:
CONTAINER_HOME: /home/github

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Tabby OSS Cad Suite (from YosysHQ)
uses: YosysHQ/setup-oss-cad-suite@v1
with:
osscadsuite-version: '2021-11-09'
- name: Setup Scala
uses: olafurpg/setup-scala@v10
with:
Expand All @@ -92,7 +90,10 @@ jobs:
# By having this "if" here, this job returns success so that all_tests_passed will succeed too
if: github.event_name == 'pull_request' &&
! contains(github.event.pull_request.labels.*.name, 'Skip Formal CI')
run: ./.run_formal_checks.sh ${{ matrix.design }}
run: |
echo ${{ github.event_name }}
echo ${{ github.event.pull_request.labels }}
./.run_formal_checks.sh ${{ matrix.design }}
# Sentinel job to simplify how we specify which checks need to pass in branch
# protection and in Mergify
Expand Down
86 changes: 45 additions & 41 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ enablePlugins(SiteScaladocPlugin)

lazy val commonSettings = Seq(
organization := "edu.berkeley.cs",
scalaVersion := "2.12.14",
crossScalaVersions := Seq("2.13.6", "2.12.14")
scalaVersion := "2.12.15",
crossScalaVersions := Seq("2.13.7", "2.12.15")
)

lazy val isAtLeastScala213 = Def.setting {
Expand All @@ -23,25 +23,25 @@ lazy val firrtlSettings = Seq(
"-language:reflectiveCalls",
"-language:existentials",
"-language:implicitConversions",
"-Yrangepos", // required by SemanticDB compiler plugin
"-Yrangepos" // required by SemanticDB compiler plugin
),
// Always target Java8 for maximum compatibility
javacOptions ++= Seq("-source", "1.8", "-target", "1.8"),
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scalatest" %% "scalatest" % "3.2.9" % "test",
"org.scalatestplus" %% "scalacheck-1-14" % "3.1.3.0" % "test",
"org.scalatest" %% "scalatest" % "3.2.10" % "test",
"org.scalatestplus" %% "scalacheck-1-15" % "3.2.10.0" % "test",
"com.github.scopt" %% "scopt" % "3.7.1",
"net.jcazevedo" %% "moultingyaml" % "0.4.2",
"org.json4s" %% "json4s-native" % "3.6.11",
"org.apache.commons" % "commons-text" % "1.8",
"org.json4s" %% "json4s-native" % "3.6.12",
"org.apache.commons" % "commons-text" % "1.9",
"io.github.alexarchambault" %% "data-class" % "0.2.5",
"com.lihaoyi" %% "os-lib" % "0.7.8",
"com.lihaoyi" %% "os-lib" % "0.8.0"
),
// macros for the data-class library
libraryDependencies ++= {
if (isAtLeastScala213.value) Nil
else Seq(compilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full))
else Seq(compilerPlugin(("org.scalamacros" % "paradise" % "2.1.1").cross(CrossVersion.full)))
},
scalacOptions ++= {
if (isAtLeastScala213.value) Seq("-Ymacro-annotations")
Expand All @@ -51,7 +51,7 @@ lazy val firrtlSettings = Seq(
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, major)) if major <= 12 => Seq()
case _ => Seq("org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.3")
case _ => Seq("org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.4")
}
},
resolvers ++= Seq(
Expand All @@ -66,9 +66,7 @@ lazy val mimaSettings = Seq(

lazy val protobufSettings = Seq(
ProtobufConfig / sourceDirectory := baseDirectory.value / "src" / "main" / "proto",
ProtobufConfig / protobufRunProtoc := (args =>
com.github.os72.protocjar.Protoc.runProtoc("-v351" +: args.toArray)
)
ProtobufConfig / protobufRunProtoc := (args => com.github.os72.protocjar.Protoc.runProtoc("-v351" +: args.toArray))
)

lazy val assemblySettings = Seq(
Expand All @@ -77,7 +75,6 @@ lazy val assemblySettings = Seq(
assembly / assemblyOutputPath := file("./utils/bin/firrtl.jar")
)


lazy val testAssemblySettings = Seq(
Test / assembly / test := {}, // Ditto above
Test / assembly / assemblyMergeStrategy := {
Expand All @@ -92,9 +89,9 @@ lazy val testAssemblySettings = Seq(

lazy val antlrSettings = Seq(
Antlr4 / antlr4GenVisitor := true,
Antlr4 / antlr4GenListener := false,
Antlr4 / antlr4GenListener := true,
Antlr4 / antlr4PackageName := Option("firrtl.antlr"),
Antlr4 / antlr4Version := "4.9.2",
Antlr4 / antlr4Version := "4.9.3",
Antlr4 / javaSource := (Compile / sourceManaged).value
)

Expand Down Expand Up @@ -122,28 +119,35 @@ lazy val publishSettings = Seq(
val v = version.value
val nexus = "https://oss.sonatype.org/"
if (v.trim.endsWith("SNAPSHOT")) {
Some("snapshots" at nexus + "content/repositories/snapshots")
Some("snapshots".at(nexus + "content/repositories/snapshots"))
} else {
Some("releases" at nexus + "service/local/staging/deploy/maven2")
Some("releases".at(nexus + "service/local/staging/deploy/maven2"))
}
}
)


lazy val docSettings = Seq(
Compile / doc := (ScalaUnidoc / doc).value,
autoAPIMappings := true,
Compile / doc / scalacOptions ++= Seq(
// ANTLR-generated classes aren't really part of public API and cause
// errors in ScalaDoc generation
"-skip-packages",
"firrtl.antlr",
"-Xfatal-warnings",
"-feature",
"-diagrams",
"-diagrams-max-classes", "25",
"-doc-version", version.value,
"-doc-title", name.value,
"-doc-root-content", baseDirectory.value+"/root-doc.txt",
"-sourcepath", (ThisBuild / baseDirectory).value.toString,
"-doc-source-url",
{
"-diagrams-max-classes",
"25",
"-doc-version",
version.value,
"-doc-title",
name.value,
"-doc-root-content",
baseDirectory.value + "/root-doc.txt",
"-sourcepath",
(ThisBuild / baseDirectory).value.toString,
"-doc-source-url", {
val branch =
if (version.value.endsWith("-SNAPSHOT")) {
"master"
Expand Down Expand Up @@ -197,18 +201,18 @@ lazy val jqf = (project in file("jqf"))
libraryDependencies ++= Seq(
"edu.berkeley.cs.jqf" % "jqf-fuzz" % JQF_VERSION,
"edu.berkeley.cs.jqf" % "jqf-instrument" % JQF_VERSION,
"com.github.scopt" %% "scopt" % "3.7.1",
"com.github.scopt" %% "scopt" % "3.7.1"
)
)


lazy val jqfFuzz = sbt.inputKey[Unit]("input task that runs the firrtl.jqf.JQFFuzz main method")
lazy val jqfRepro = sbt.inputKey[Unit]("input task that runs the firrtl.jqf.JQFRepro main method")

lazy val testClassAndMethodParser = {
import sbt.complete.DefaultParsers._
val spaces = SpaceClass.+.string
val testClassName = token(Space) ~> token(charClass(c => isScalaIDChar(c) || (c == '.')).+.string, "<test class name>")
val testClassName =
token(Space) ~> token(charClass(c => isScalaIDChar(c) || (c == '.')).+.string, "<test class name>")
val testMethod = spaces ~> token(charClass(isScalaIDChar).+.string, "<test method name>")
val rest = spaces.? ~> token(any.*.string, "<other args>")
(testClassName ~ testMethod ~ rest).map {
Expand All @@ -226,28 +230,28 @@ lazy val fuzzer = (project in file("fuzzer"))
"edu.berkeley.cs.jqf" % "jqf-fuzz" % JQF_VERSION,
"org.scalacheck" %% "scalacheck" % "1.14.3" % Test
),

jqfFuzz := (Def.inputTaskDyn {
val (testClassName, testMethod, otherArgs) = testClassAndMethodParser.parsed
val outputDir = (Compile / target).value / "JQF" / testClassName / testMethod
val classpath = (Compile / fullClasspathAsJars).toTask.value.files.mkString(":")
(Compile / (jqf / runMain)).toTask(
s" firrtl.jqf.JQFFuzz " +
s"--testClassName $testClassName " +
s"--testMethod $testMethod " +
s"--classpath $classpath " +
s"--outputDirectory $outputDir " +
otherArgs)
s"--testClassName $testClassName " +
s"--testMethod $testMethod " +
s"--classpath $classpath " +
s"--outputDirectory $outputDir " +
otherArgs
)
}).evaluated,

jqfRepro := (Def.inputTaskDyn {
val (testClassName, testMethod, otherArgs) = testClassAndMethodParser.parsed
val classpath = (Compile / fullClasspathAsJars).toTask.value.files.mkString(":")
(Compile / (jqf / runMain)).toTask(
s" firrtl.jqf.JQFRepro " +
s"--testClassName $testClassName " +
s"--testMethod $testMethod " +
s"--classpath $classpath " +
otherArgs)
}).evaluated,
s"--testClassName $testClassName " +
s"--testMethod $testMethod " +
s"--classpath $classpath " +
otherArgs
)
}).evaluated
)
70 changes: 44 additions & 26 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ import mill.contrib.buildinfo.BuildInfo

import java.io.IOException

object firrtl extends mill.Cross[firrtlCrossModule]("2.12.14", "2.13.6")
object firrtl extends mill.Cross[firrtlCrossModule]("2.12.15", "2.13.7")

class firrtlCrossModule(val crossScalaVersion: String) extends CrossSbtModule with ScalafmtModule with PublishModule with BuildInfo {
class firrtlCrossModule(val crossScalaVersion: String)
extends CrossSbtModule
with ScalafmtModule
with PublishModule
with BuildInfo {
override def millSourcePath = super.millSourcePath / os.up

// 2.12.12 -> Array("2", "12", "12") -> "12" -> 12
Expand Down Expand Up @@ -43,27 +47,28 @@ class firrtlCrossModule(val crossScalaVersion: String) extends CrossSbtModule wi
ivy"${scalaOrganization()}:scala-reflect:${scalaVersion()}",
ivy"com.github.scopt::scopt:3.7.1",
ivy"net.jcazevedo::moultingyaml:0.4.2",
ivy"org.json4s::json4s-native:3.6.11",
ivy"org.apache.commons:commons-text:1.8",
ivy"org.json4s::json4s-native:3.6.12",
ivy"org.apache.commons:commons-text:1.9",
ivy"io.github.alexarchambault::data-class:0.2.5",
ivy"org.antlr:antlr4-runtime:$antlr4Version",
ivy"com.google.protobuf:protobuf-java:$protocVersion",
ivy"com.lihaoyi::os-lib:0.7.8",
ivy"com.lihaoyi::os-lib:0.8.0"
) ++ {
if (majorVersion == 13)
Agg(ivy"org.scala-lang.modules::scala-parallel-collections:1.0.3")
Agg(ivy"org.scala-lang.modules::scala-parallel-collections:1.0.4")
else
Agg()
}
}

override def scalacPluginIvyDeps = if (majorVersion == 12) Agg(ivy"org.scalamacros:::paradise:2.1.1") else super.scalacPluginIvyDeps
override def scalacPluginIvyDeps =
if (majorVersion == 12) Agg(ivy"org.scalamacros:::paradise:2.1.1") else super.scalacPluginIvyDeps

object test extends Tests {
override def ivyDeps = T {
Agg(
ivy"org.scalatest::scalatest:3.2.9",
ivy"org.scalatestplus::scalacheck-1-14:3.1.3.0"
ivy"org.scalatest::scalatest:3.2.10",
ivy"org.scalatestplus::scalacheck-1-15:3.2.10.0"
)
}

Expand All @@ -87,7 +92,7 @@ class firrtlCrossModule(val crossScalaVersion: String) extends CrossSbtModule wi
}

/* antlr4 */
def antlr4Version = "4.9.2"
def antlr4Version = "4.9.3"

def antlrSource = T.source {
millSourcePath / "src" / "main" / "antlr4" / "FIRRTL.g4"
Expand Down Expand Up @@ -124,20 +129,31 @@ class firrtlCrossModule(val crossScalaVersion: String) extends CrossSbtModule wi
def generatedAntlr4Source = T.sources {
antlr4Path().path match {
case f if f.last == "antlr4.jar" =>
os.proc("java",
"-jar", f.toString,
"-o", T.ctx.dest.toString,
"-lib", antlrSource().path.toString,
"-package", "firrtl.antlr",
"-no-listener", "-visitor",
os.proc(
"java",
"-jar",
f.toString,
"-o",
T.ctx.dest.toString,
"-lib",
antlrSource().path.toString,
"-package",
"firrtl.antlr",
"-listener",
"-visitor",
antlrSource().path.toString
).call()
case _ =>
os.proc(antlr4Path().path.toString,
"-o", T.ctx.dest.toString,
"-lib", antlrSource().path.toString,
"-package", "firrtl.antlr",
"-no-listener", "-visitor",
os.proc(
antlr4Path().path.toString,
"-o",
T.ctx.dest.toString,
"-lib",
antlrSource().path.toString,
"-package",
"firrtl.antlr",
"-listener",
"-visitor",
antlrSource().path.toString
).call()
}
Expand Down Expand Up @@ -214,10 +230,11 @@ class firrtlCrossModule(val crossScalaVersion: String) extends CrossSbtModule wi

val unpackPath = os.rel / "unpacked"

val bin = if (isWindows)
T.ctx.dest / unpackPath / "bin" / "protoc.exe"
else
T.ctx.dest / unpackPath / "bin" / "protoc"
val bin =
if (isWindows)
T.ctx.dest / unpackPath / "bin" / "protoc.exe"
else
T.ctx.dest / unpackPath / "bin" / "protoc"

if (!os.exists(bin)) {
Util.downloadUnpackZip(
Expand All @@ -234,7 +251,8 @@ class firrtlCrossModule(val crossScalaVersion: String) extends CrossSbtModule wi
def generatedProtoSources = T.sources {
os.proc(
protocPath().path.toString,
"-I", protobufSource().path / os.up,
"-I",
protobufSource().path / os.up,
s"--java_out=${T.ctx.dest.toString}",
protobufSource().path.toString()
).call()
Expand Down
Loading

0 comments on commit c47764e

Please sign in to comment.