Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
farewell Scala 2.11
Browse files Browse the repository at this point in the history
sequencer committed Jan 14, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 29ab6d7 commit ef0e5b0
Showing 3 changed files with 14 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
scala: [2.12.12, 2.11.12]
scala: [2.12.12]
container:
image: ucbbar/chisel3-tools
options: --user github --entrypoint /bin/bash
45 changes: 8 additions & 37 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -2,32 +2,6 @@

enablePlugins(SiteScaladocPlugin)

def scalacOptionsVersion(scalaVersion: String): Seq[String] = {
Seq() ++ {
// If we're building with Scala > 2.11, enable the compile option
// switch to support our anonymous Bundle definitions:
// https://github.com/scala/bug/issues/10047
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, scalaMajor: Long)) if scalaMajor < 12 => Seq()
case _ => Seq("-Xsource:2.11")
}
}
}

def javacOptionsVersion(scalaVersion: String): Seq[String] = {
Seq() ++ {
// Scala 2.12 requires Java 8. We continue to generate
// Java 7 compatible code for Scala 2.11
// for compatibility with old clients.
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, scalaMajor: Long)) if scalaMajor < 12 =>
Seq("-source", "1.7", "-target", "1.7")
case _ =>
Seq("-source", "1.8", "-target", "1.8")
}
}
}

val defaultVersions = Map(
"firrtl" -> "edu.berkeley.cs" %% "firrtl" % "1.5-SNAPSHOT",
"treadle" -> "edu.berkeley.cs" %% "treadle" % "1.5-SNAPSHOT"
@@ -42,8 +16,13 @@ lazy val commonSettings = Seq (
version := "3.5-SNAPSHOT",
autoAPIMappings := true,
scalaVersion := "2.12.12",
crossScalaVersions := Seq("2.12.12", "2.11.12"),
scalacOptions := Seq("-deprecation", "-feature") ++ scalacOptionsVersion(scalaVersion.value),
crossScalaVersions := Seq("2.12.12"),
scalacOptions := Seq("-deprecation", "-feature",
// We're building with Scala > 2.11, enable the compile option
// switch to support our anonymous Bundle definitions:
// https://github.com/scala/bug/issues/10047
"-Xsource:2.11"
),
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full),
)
@@ -83,16 +62,11 @@ lazy val publishSettings = Seq (
lazy val chiselSettings = Seq (
name := "chisel3",

// sbt 1.2.6 fails with `Symbol 'term org.junit' is missing from the classpath`
// when compiling tests under 2.11.12
// An explicit dependency on junit seems to alleviate this.
libraryDependencies ++= Seq(
"junit" % "junit" % "4.13.1" % "test",
"org.scalatest" %% "scalatest" % "3.1.2" % "test",
"org.scalatestplus" %% "scalacheck-1-14" % "3.1.1.1" % "test",
"com.github.scopt" %% "scopt" % "3.7.1"
),
javacOptions ++= javacOptionsVersion(scalaVersion.value)
) ++ (
// Tests from other projects may still run concurrently
// if we're not running with -DminimalResources.
@@ -110,7 +84,6 @@ autoCompilerPlugins := true
// Plugin must be fully cross-versioned (published for Scala minor version)
// The plugin only works in Scala 2.12+
lazy val pluginScalaVersions = Seq(
"2.11.12", // Only to support chisel3 cross building for 2.11, plugin does nothing in 2.11
// scalamacros paradise version used is not published for 2.12.0 and 2.12.1
"2.12.2",
"2.12.3",
@@ -144,9 +117,7 @@ lazy val plugin = (project in file("plugin")).
).
settings(
mimaPreviousArtifacts := {
// Not published for 2.11, do not try to check binary compatibility with a 2.11 artifact
if (scalaVersion.value.startsWith("2.11")) Set()
else Set()
Set()
}
)

28 changes: 5 additions & 23 deletions build.sc
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import coursier.maven.MavenRepository
import $ivy.`com.lihaoyi::mill-contrib-buildinfo:$MILL_VERSION`
import mill.contrib.buildinfo.BuildInfo

object chisel3 extends mill.Cross[chisel3CrossModule]("2.11.12", "2.12.12")
object chisel3 extends mill.Cross[chisel3CrossModule]("2.12.12")

// The following stanza is searched for and used when preparing releases.
// Please retain it.
@@ -56,25 +56,12 @@ trait CommonModule extends CrossSbtModule with PublishModule {
MavenRepository("https://oss.sonatype.org/content/repositories/releases")
)

private def scalacCrossOptions = majorVersion match {
case i if i < 12 => Seq()
case _ => Seq("-Xsource:2.11")
}

private def javacCrossOptions = majorVersion match {
case i if i < 12 => Seq("-source", "1.7", "-target", "1.7")
case _ => Seq("-source", "1.8", "-target", "1.8")
}

override def scalacOptions = T {
super.scalacOptions() ++ Agg(
"-deprecation",
"-feature"
) ++ scalacCrossOptions
}

override def javacOptions = T {
super.javacOptions() ++ javacCrossOptions
"-feature",
"-Xsource:2.11"
)
}

private val macroParadise = ivy"org.scalamacros:::paradise:2.1.1"
@@ -118,16 +105,11 @@ class chisel3CrossModule(val crossScalaVersion: String) extends CommonModule wit
object test extends Tests {
override def scalacPluginClasspath = m.scalacPluginClasspath

private def ivyCrossDeps = majorVersion match {
case i if i < 12 => Agg(ivy"junit:junit:4.13.1")
case _ => Agg()
}

override def ivyDeps = m.ivyDeps() ++ Agg(
ivy"org.scalatest::scalatest:3.1.2",
ivy"org.scalatestplus::scalacheck-1-14:3.1.1.1",
ivy"com.github.scopt::scopt:3.7.1"
) ++ ivyCrossDeps ++ m.treadleIvyDeps
) ++ m.treadleIvyDeps

override def moduleDeps = super.moduleDeps ++ treadleModule

0 comments on commit ef0e5b0

Please sign in to comment.