diff --git a/build.sbt b/build.sbt index 2db559c20c..5b7e3219ff 100644 --- a/build.sbt +++ b/build.sbt @@ -22,7 +22,8 @@ lazy val commonSettings = Seq( case Some((2, 11)) => Seq() case _ => sys.error("Unsupported scala version") } - }, + } ++ scalacReleaseOption, + javacOptions ++= javacReleaseOption, resolvers += Resolver.sonatypeRepo("public"), licenses := Seq("CC0" -> url("https://creativecommons.org/publicdomain/zero/1.0/legalcode")), homepage := Some(url("https://github.com/ScorexFoundation/sigmastate-interpreter")), @@ -55,6 +56,22 @@ lazy val commonSettings = Seq( ), ) +def scalacReleaseOption = { + if (System.getProperty("java.version").startsWith("1.")) + // java <9 "-release" is not supported + Seq() + else + Seq("-release", "8") // this is passed to javac as `javac -release 8` +} + +def javacReleaseOption = { + if (System.getProperty("java.version").startsWith("1.")) + // java <9 "--release" is not supported + Seq() + else + Seq("--release", "8") +} + // suffix version with "-SNAPSHOT" for builds without a git tag dynverSonatypeSnapshots in ThisBuild := true // use "-" instead of default "+"