Skip to content

Conversation

@keynmol
Copy link
Contributor

@keynmol keynmol commented Apr 10, 2024

Summary:

  • Update dependencies for scip-java itself so it can be built on JDK 21 itself
  • Add JDK 21 to build matrix
  • Introduce a concept of 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 support
  • Restore support for Gradle2 and Gradle3 that were quietly lost when a switch to Kotlin init script happened
  • Correctly detect external JDK version in build tool tests - previously we'd always detect JDK 11 because that's what the tests were running due to javaHome override

Test plan

  • Existing tests that actually run
  • New entry in build matrix for JDK 21

keynmol added 3 commits April 10, 2024 16:19
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]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add JDK 21 to the build matrix - that's what triggered the rest of the changes.

Comment on lines 15 to 28
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"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Various dependency upgrades

Comment on lines +408 to +417
lazy val minimized21 = project
.in(file("tests/minimized/.j21"))
.settings(
javaOnlySettings,
minimizedSettings,
javaToolchainVersion := "21",
javacOptions ++= javacModuleOptions
)
.dependsOn(agent, javacPlugin)
.disablePlugins(JavaFormatterPlugin)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure our test java sources are compiled under java 21 as well

Comment on lines +195 to +200
private val PrintJavaVersion = """
public class PrintJavaVersion {
public static void main(String[] args) {
System.out.print(System.getProperty("java.version"));
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@keynmol keynmol changed the title WIP Update dependencies and improve build tool testing infrastructure Apr 18, 2024
@keynmol keynmol changed the title Update dependencies and improve build tool testing infrastructure Update dependencies and improve build tool testing infrastructure, add JDK 21 Apr 18, 2024
@keynmol keynmol marked this pull request as ready for review April 18, 2024 09:41
@keynmol keynmol requested a review from olafurpg April 18, 2024 10:53
Copy link
Contributor

@olafurpg olafurpg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏻

@keynmol keynmol merged commit 0fd665e into main Apr 18, 2024
@keynmol keynmol deleted the java-21 branch April 18, 2024 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants