From a07ab91c35e6230adaf64ddf69a7887b832bcbc1 Mon Sep 17 00:00:00 2001 From: Tomasz Godzik Date: Fri, 10 Nov 2023 17:29:12 +0100 Subject: [PATCH] bugfix: Pin mdoc versions for different Scala versions and JDK ones --- .../main/scala/scala/meta/internal/metals/Embedded.scala | 9 +++++++++ project/V.scala | 2 +- project/plugins.sbt | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/metals/src/main/scala/scala/meta/internal/metals/Embedded.scala b/metals/src/main/scala/scala/meta/internal/metals/Embedded.scala index eb97d3ead0c..87a1fe8b5e1 100644 --- a/metals/src/main/scala/scala/meta/internal/metals/Embedded.scala +++ b/metals/src/main/scala/scala/meta/internal/metals/Embedded.scala @@ -5,6 +5,7 @@ import java.nio.file.Path import java.util.ServiceLoader import scala.collection.concurrent.TrieMap +import scala.util.Properties import scala.meta.internal.metals.MetalsEnrichments._ import scala.meta.internal.pc.ScalaPresentationCompiler @@ -170,6 +171,7 @@ final class Embedded( } object Embedded { + private val jdkVersion = JdkVersion.parse(Properties.javaVersion) lazy val repositories: List[Repository] = Repository.defaults().asScala.toList ++ @@ -270,6 +272,13 @@ object Embedded { if (scalaBinaryVersion == "2.11") "2.2.24" // from 2.2.24 mdoc is compiled with 3.1.x which is incompatible with 3.0.x else if (scalaVersion.exists(_.startsWith("3.0"))) "2.2.23" + // from 2.4.0 mdoc is released with Scala LTS 3.3.x + else if ( + scalaVersion.exists(_.startsWith("3.1")) || + scalaVersion.exists(_.startsWith("3.2")) + ) "2.3.8" + // from 2.5.0 mdoc is released with JDK 11 + else if (jdkVersion.exists(_.major < 11)) "2.4.0" else BuildInfo.mdocVersion, ) } diff --git a/project/V.scala b/project/V.scala index ff095c1c58c..1209b9ea9db 100644 --- a/project/V.scala +++ b/project/V.scala @@ -33,7 +33,7 @@ object V { val lsp4jV = "0.20.1" val mavenBloop = "2.0.0" val mill = "0.11.5" - val mdoc = "2.5.0" + val mdoc = "2.5.1" val munit = "1.0.0-M10" val pprint = "0.7.3" val sbtBloop = bloop diff --git a/project/plugins.sbt b/project/plugins.sbt index 4bf95c08925..68c89a97771 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.6") addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1") addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") -addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.5.0") +addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.5.1") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") addSbtPlugin("com.github.reibitto" % "sbt-welcome" % "0.4.0")