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

Commit

Permalink
modernize build.sbt
Browse files Browse the repository at this point in the history
With lots of inspiration from the firrtl build.sbt.
  • Loading branch information
ekiwi committed Sep 20, 2023
1 parent 51fac62 commit 9983296
Showing 1 changed file with 69 additions and 81 deletions.
150 changes: 69 additions & 81 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,90 +1,78 @@
// SPDX-License-Identifier: Apache-2.0

organization := "edu.berkeley.cs"
name := "chiseltest"

// we keep in sync with chisel version names
version := "6.0-SNAPSHOT"

scalaVersion := "2.13.10"

crossScalaVersions := Seq("2.13.10")

resolvers ++= Resolver.sonatypeOssRepos("snapshots")
resolvers ++= Resolver.sonatypeOssRepos("releases")

testFrameworks += new TestFramework("utest.runner.Framework")

publishMavenStyle := true

Test / publishArtifact := false
pomIncludeRepository := { x => false }

// scm is set by sbt-ci-release
pomExtra := (
<url>http://chisel.eecs.berkeley.edu/</url>
<licenses>
<license>
<name>apache_v2</name>
<url>https://opensource.org/licenses/Apache-2.0</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>ducky64</id>
<name>Richard Lin</name>
</developer>
</developers>
lazy val commonSettings = Seq(
organization := "edu.berkeley.cs",
scalaVersion := "2.13.10",
crossScalaVersions := Seq("2.13.10"),
)

publishTo := {
val v = version.value
val nexus = "https://oss.sonatype.org/"
if (v.trim.endsWith("SNAPSHOT")) {
Some("snapshots".at(nexus + "content/repositories/snapshots"))
} else {
Some("releases".at(nexus + "service/local/staging/deploy/maven2"))
}
}
val chiselVersion = "6.0.0-M3"
val firrtlVersion = "6.0-SNAPSHOT"

// Provide a managed dependency on X if -DXVersion="" is supplied on the command line.
val defaultVersions = Map(
"chisel3" -> "6.0.0-M3",
"firrtl" -> "6.0-SNAPSHOT"
lazy val chiseltestSettings = Seq(
name := "chiseltest",
// we keep in sync with chisel version names
version := "6.0-SNAPSHOT",
scalacOptions := Seq(
"-deprecation",
"-feature",
"-language:reflectiveCalls",
// do not warn about firrtl imports, once the firrtl repo is removed, we will need to import the code
"-Wconf:cat=deprecation&msg=Importing from firrtl is deprecated:s",
// do not warn about firrtl deprecations
"-Wconf:cat=deprecation&msg=will not be supported as part of the migration to the MLIR-based FIRRTL Compiler:s"
),
// Always target Java8 for maximum compatibility
javacOptions ++= Seq("-source", "1.8", "-target", "1.8"),
libraryDependencies ++= Seq(
"org.chipsalliance" %% "chisel" % chiselVersion,
"edu.berkeley.cs" %% "firrtl2" % firrtlVersion,
"org.scalatest" %% "scalatest" % "3.2.17",
"com.lihaoyi" %% "utest" % "0.8.1",
"net.java.dev.jna" % "jna" % "5.13.0",
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"com.lihaoyi" %% "os-lib" % "0.8.1",
compilerPlugin(("org.chipsalliance" % "chisel-plugin" % chiselVersion).cross(CrossVersion.full))
),
resolvers ++= Resolver.sonatypeOssRepos("snapshots"),
resolvers ++= Resolver.sonatypeOssRepos("releases"),
testFrameworks += new TestFramework("utest.runner.Framework"),
)

scalacOptions ++= Seq(
"-language:reflectiveCalls",
"-deprecation",
"-feature",
"-Xcheckinit",
// do not warn about firrtl imports, once the firrtl repo is removed, we will need to import the code
"-Wconf:cat=deprecation&msg=Importing from firrtl is deprecated:s",
// do not warn about firrtl deprecations
"-Wconf:cat=deprecation&msg=will not be supported as part of the migration to the MLIR-based FIRRTL Compiler:s"
) ++ {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n >= 13 => Seq("-Ymacro-annotations")
case _ => Nil
}
}
lazy val publishSettings = Seq(
publishMavenStyle := true,
Test / publishArtifact := false,
pomIncludeRepository := { x => false },
// scm is set by sbt-ci-release
pomExtra := (
<url>http://chisel.eecs.berkeley.edu/</url>
<licenses>
<license>
<name>apache_v2</name>
<url>https://opensource.org/licenses/Apache-2.0</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>ducky64</id>
<name>Richard Lin</name>
</developer>
</developers>
),
publishTo := {
val v = version.value
val nexus = "https://oss.sonatype.org/"
if (v.trim.endsWith("SNAPSHOT")) {
Some("snapshots".at(nexus + "content/repositories/snapshots"))
} else {
Some("releases".at(nexus + "service/local/staging/deploy/maven2"))
}
},
)

libraryDependencies ++= Seq(
"org.chipsalliance" %% "chisel" % defaultVersions("chisel3"),
"edu.berkeley.cs" %% "firrtl2" % defaultVersions("firrtl"),
"org.scalatest" %% "scalatest" % "3.2.17",
"com.lihaoyi" %% "utest" % "0.8.1",
"net.java.dev.jna" % "jna" % "5.13.0",
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"com.lihaoyi" %% "os-lib" % "0.8.1",
compilerPlugin(("org.chipsalliance" % "chisel-plugin" % defaultVersions("chisel3")).cross(CrossVersion.full))
) ++ {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n >= 13 => Nil
case _ =>
Seq(
compilerPlugin(("org.scalamacros" % "paradise" % "2.1.1").cross(CrossVersion.full))
)
}
}
lazy val chiseltest = (project in file("."))
.settings(commonSettings)
.settings(chiseltestSettings)
.settings(publishSettings)

0 comments on commit 9983296

Please sign in to comment.