Skip to content

Commit

Permalink
chore: Remove old release options
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tgodzik committed Aug 29, 2024
1 parent 7964e55 commit 856980e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 9 additions & 21 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
)
Expand Down

0 comments on commit 856980e

Please sign in to comment.