Conversation
We introduce the concept of Tool, which has restrictions on minimum/maximum JDK version it can run under. We also use external JDK version to conditionally ignore tests.
| # os: [windows-latest, ubuntu-latest] | ||
| os: [ubuntu-latest] | ||
| java: [8, 11, 17] | ||
| java: [8, 11, 17, 21] |
There was a problem hiding this comment.
Add JDK 21 to the build matrix - that's what triggered the rest of the changes.
| val coursier = "2.1.9" | ||
| val scalaXml = "2.1.0" | ||
| val bsp = "2.0.0-M13" | ||
| val moped = "0.1.11" | ||
| val moped = "0.1.11+2-c9893ac3-SNAPSHOT" | ||
| val gradle = "7.0" | ||
| val scala213 = "2.13.10" | ||
| val scala212 = "2.12.17" | ||
| val scala213 = "2.13.13" | ||
| val scala212 = "2.12.19" | ||
| val scala211 = "2.11.12" | ||
| val scala3 = "3.2.2" | ||
| val metals = "0.11.11" | ||
| val scalameta = "4.8.1" | ||
| val scala3 = "3.3.3" | ||
| val metals = "1.2.2" | ||
| val scalameta = "4.9.3" | ||
| val semanticdbKotlinc = "0.4.0" | ||
| val testcontainers = "0.39.3" | ||
| val requests = "0.6.5" | ||
| val requests = "0.8.0" |
There was a problem hiding this comment.
Various dependency upgrades
| lazy val minimized21 = project | ||
| .in(file("tests/minimized/.j21")) | ||
| .settings( | ||
| javaOnlySettings, | ||
| minimizedSettings, | ||
| javaToolchainVersion := "21", | ||
| javacOptions ++= javacModuleOptions | ||
| ) | ||
| .dependsOn(agent, javacPlugin) | ||
| .disablePlugins(JavaFormatterPlugin) |
There was a problem hiding this comment.
Make sure our test java sources are compiled under java 21 as well
scip-java/src/main/scala/com/sourcegraph/scip_java/buildtools/ScipBuildTool.scala
Show resolved
Hide resolved
| private val PrintJavaVersion = """ | ||
| public class PrintJavaVersion { | ||
| public static void main(String[] args) { | ||
| System.out.print(System.getProperty("java.version")); | ||
| } | ||
| } |
There was a problem hiding this comment.
This is a more reliable way of getting the version out of Java, because parsing java -version is more difficult due to variability in how that information is presented depending on version and vendor.
Logic and mechanism were lifted from sourcegraph/sbt-sourcegraph#78
|
|
||
| version | ||
| .map(parseJavaVersion) | ||
| .getOrElse(sys.error("Failed to detect external JDK version")) |
There was a problem hiding this comment.
It's fine to hard die here, because an external JVM has to be available for all the build tool tests (gradle, maven, sbt won't start without it)
| extraArguments: List[String] = Nil | ||
| extraArguments: List[String] = Nil, | ||
| gradleVersions: List[Tool.Gradle] = Nil, | ||
| tools: List[Tool] = Nil |
There was a problem hiding this comment.
This extra argument allows further specifying compilers/buildtools/etc. that are used as part of the test, which can affect the success under particular JDK.
E.g. if a Gradle build can run under JDK 21, but uses a Scala 2.12.12 compiler, it won't be able to complete because JDK 21 support requires at least Scala 2.12.18
Summary:
Tool- which adds the ability to add JDK version ranges, so that the tests are ignored automatically on JDK versions that the tools don't supportTest plan