From 856980ebdad8068e063a54cb996097912f0f4cbb Mon Sep 17 00:00:00 2001 From: Tomasz Godzik Date: Thu, 29 Aug 2024 10:09:21 +0200 Subject: [PATCH] chore: Remove old release options We now compile for JDK 17 +. Unfortunately, we cannot set proper target for 2.12 or 2.11, so we need to make sure release workflow is not changed without a reason. --- .github/workflows/release.yml | 1 + build.sbt | 30 +++++++++--------------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 366588c90d1..cef3cc6fc02 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,6 +15,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: 'temurin' + # Do not change the version of Java, it is the minimal version Metals works with java-version: 17 cache: 'sbt' - name: Publish diff --git a/build.sbt b/build.sbt index d9c7d5843d5..26517df85be 100644 --- a/build.sbt +++ b/build.sbt @@ -172,37 +172,25 @@ def lintingOptions(scalaVersion: String) = { val sharedJavacOptions = List( Compile / javacOptions ++= { - if (sys.props("java.version").startsWith("1.8")) + if (sys.props("java.version").startsWith("17")) Nil else - Seq("--release", "8") + Seq("--release", "17") } ) val sharedScalacOptions = List( scalacOptions ++= { CrossVersion.partialVersion(scalaVersion.value) match { - case partialVersion - // Scala 2.12.16 and lower break within the tests if target is set to 11 - if isScala211(partialVersion) || - scalaVersion.value == "2.12.16" || - isScala212(partialVersion) && V.deprecatedScala2Versions - .contains(scalaVersion.value) => - List( - "-target:jvm-1.8", - "-Yrangepos", - "-Xexperimental", - ) // TODO after release drop 2.11.12 - /* Scala 2.12 has a bug on older version that break with `-release, but target - * is enough and we will confirm the compilation on latest Scala 2.12 - */ - case partialVersion - if isScala212(partialVersion) && V.scala212 != scalaVersion.value => - List("-target:11", "-Yrangepos", "-Xexperimental") + // Scala 2.12 and 2.11 cannot output for JDKs > 8 + case partialVersion if isScala211(partialVersion) => + List("-target:jvm-1.8", "-Yrangepos", "-Xexperimental") + case partialVersion if isScala212(partialVersion) => + List("-Yrangepos", "-Xexperimental") case partialVersion if isScala3(partialVersion) => - List("-Xtarget:11", "-language:implicitConversions", "-Xsemanticdb") + List("-Xtarget:17", "-language:implicitConversions", "-Xsemanticdb") case _ => - List("-target:11", "-Yrangepos") + List("-target:17", "-Yrangepos") } } )