File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,19 @@ trait Plugin extends CrossSbtModule with ScalafmtModule with release.ChiselPubli
2121 // The plugin is compiled for every minor Scala version
2222 override def crossFullScalaVersion = true
2323
24+ // This is a bit of a hack, but for some reason, Scala compilation crashes with -release 8 for
25+ // Scala 2.13.0-2.13.2. While -release 8 is what we want, -target:jvm-1.8 at least ensures the
26+ // bytecode is Java 8 compatible, and then the higher Scala versions compiled with -release 8 will
27+ // enforce the other guarantees of -release 8 (that we don't accidentally use Java APIs introduced
28+ // in newer JDKs).
29+ def releaseArg(scalaVersion: String): Seq[String] = {
30+ val badSet = Set("2.13.0", "2.13.1", "2.13.2")
31+ if (badSet.contains(scalaVersion)) Seq("-target:jvm-1.8")
32+ else Seq("-release", "8")
33+ }
34+
2435 // Does not use common options because -Wconf wasn't supported in early 2.13, nor was "-release:"
25- override def scalacOptions = super.scalacOptions() ++ Seq("-release", "8" )
36+ override def scalacOptions = super.scalacOptions() ++ releaseArg(crossScalaVersion )
2637
2738 def scalaLibraryIvy = v.scalaLibrary(crossScalaVersion)
2839 def scalaReflectIvy = v.scalaReflect(crossScalaVersion)
You can’t perform that action at this time.
0 commit comments