diff --git a/.github/scripts/ci.sh b/.github/scripts/ci.sh index 1294d16..c783da9 100755 --- a/.github/scripts/ci.sh +++ b/.github/scripts/ci.sh @@ -10,6 +10,8 @@ TEST_VERSION="0.1.0-test" echo "Running tests" sbt +test +export COURSIER_INTERFACE_JAVA8_HOME="$(cs java-home --jvm 8)" + IS_UNIX="false" case "$(uname -s)" in Linux*) IS_UNIX="true";; diff --git a/build.sbt b/build.sbt index f696a74..35df634 100644 --- a/build.sbt +++ b/build.sbt @@ -19,6 +19,8 @@ inThisBuild(List( lazy val finalPackageBin = taskKey[File]("") +lazy val isJava9OrMore = sys.props.get("java.version").exists(!_.startsWith("1.")) + lazy val interface = project .enablePlugins(SbtProguard) .settings( @@ -121,7 +123,6 @@ lazy val interface = project "-keep class coursierapi.** {\n public protected *;\n}" ) - val isJava9OrMore = sys.props.get("java.version").exists(!_.startsWith("1.")) val maybeJava9Options = if (isJava9OrMore) { val javaHome = sys.props.getOrElse("java.home", ???) diff --git a/project/Settings.scala b/project/Settings.scala index 5294b63..25dfe3a 100644 --- a/project/Settings.scala +++ b/project/Settings.scala @@ -9,15 +9,29 @@ object Settings { def scala212 = "2.12.20" + private lazy val java8Home = Option(System.getenv("COURSIER_INTERFACE_JAVA8_HOME")) + .map(java.nio.file.Paths.get(_)) + .getOrElse { + sys.error("COURSIER_INTERFACE_JAVA8_HOME not set") + } + private lazy val rtJar = { + val path = java8Home.resolve("jre/lib/rt.jar") + assert(java.nio.file.Files.exists(path)) + path + } lazy val shared = Seq( scalaVersion := scala213, crossScalaVersions := Seq(scala213, scala212), - scalacOptions += "-target:jvm-1.8", + scalacOptions ++= Seq("--release", "8"), javacOptions ++= Seq( - "-source", "1.8", - "-target", "1.8" + "-source", "8", + "-target", "8", + "-bootclasspath", rtJar.toString ), - Compile / doc / javacOptions := Seq("-source", "1.8") + Compile / doc / javacOptions := Seq( + "-source", "8", + "-bootclasspath", rtJar.toString + ) ) private val filterOut = Set("0.0.1")