From 08627b714f04794b8f8cc785452aa8dc58bc9c48 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Thu, 2 Feb 2023 20:46:02 +0100 Subject: [PATCH] scalacReleaseOption and javacReleaseOption --- build.sbt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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 "+"