Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provision min runtime version jdk for compilation #105152

Merged
merged 4 commits into from
Feb 6, 2024

Conversation

rjernst
Copy link
Member

@rjernst rjernst commented Feb 5, 2024

This commit adjusts compile tasks to explicitly provision a Java toolchain for the Java minimum runtime version. By doing so the Java used by Gradle may be upgraded without the possibility of causing spurious warnings from javac which could fail the build, such as when new warnings are added in later JDK versions.

This commit adjusts compile tasks to explicitly provision a Java
toolchain for the Java minimum runtime version. By doing so the Java
used by Gradle may be upgraded without the possibility of causing
spurious warnings from javac which could fail the build, such as when
new warnings are added in later JDK versions.
@rjernst rjernst added >enhancement :Delivery/Build Build or test infrastructure labels Feb 5, 2024
@rjernst rjernst requested a review from a team as a code owner February 5, 2024 18:43
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-delivery (Team:Delivery)

@elasticsearchmachine elasticsearchmachine added Team:Delivery Meta label for Delivery team v8.13.0 labels Feb 5, 2024
@@ -112,6 +123,10 @@ public static void configureCompile(Project project) {
java.setSourceCompatibility(BuildParams.getMinimumRuntimeVersion());
java.setTargetCompatibility(BuildParams.getMinimumRuntimeVersion());
project.getTasks().withType(JavaCompile.class).configureEach(compileTask -> {
compileTask.getJavaCompiler().set(javaToolchains.compilerFor(spec -> {
spec.getLanguageVersion().set(JavaLanguageVersion.of(BuildParams.getMinimumRuntimeVersion().getMajorVersion()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we actually use minimumCompilerVersion? Although, I struggle to see why we have both, and when they would ever be different.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was mimicking the source and target compatibility above. It does seem odd that we have both.

Copy link
Contributor

@mark-vieira mark-vieira Feb 5, 2024

Choose a reason for hiding this comment

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

Yeah, on the 7.17 branch, the minimumCompilerVersion is 17 while minimumRuntimeVersion is 8. I believe the reason for this is because to keep the build logic consistent across these branches we require Java 17 to build 7.17 even though the production code targets Java 8. In reality it should be minimumGradleJavaVersion but we can follow up to clean this stuff up.

@rjernst rjernst merged commit e8c2f4f into elastic:main Feb 6, 2024
16 checks passed
@rjernst rjernst deleted the java/minimum_compiler branch February 6, 2024 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure >enhancement Team:Delivery Meta label for Delivery team v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants