-
Notifications
You must be signed in to change notification settings - Fork 41.3k
Implement possibility to set custom java home for Gradle tasks #20179
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
Implement possibility to set custom java home for Gradle tasks #20179
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much, @dreis2211.
I don't think we need to generate the javadoc with JDK 14 (we don't really need to generate it with anything other than JDK 8). If we ignore Javadoc
tasks here, the changes would then be focused on Test
tasks alone. That would mean we could give the property a more descriptive name. Something like testTaskJavaHome
, perhaps.
Don't we want to compile with JDK14 as well? |
Oops. I'd completely overlooked that part of the PR. I'm not sure that we do. The binaries that we ship will be built with Java 8 so our CI will be closer to what users will be running if we compile with Java 8 and test with JDK 14. This applies to our JDK 11 and 13 builds too, I just hadn't thought about it before. |
Anything I can do to help? I'm a bit confused what you want me to do now ;-) |
I have trouble to actually see where the JDK 11+ builds do compile with JDK 8. Or do you mean that they do exactly the same as proposed here? And you simply wonder if that's the right approach? Anyhow, I do see some value in compiling with the newer JDK versions as that will show deprecation warnings etc. E.g. compiling with JDK 11 shows warnings about using For the javadocs, this overlaps with #17259 if you ask me. Again, I see some value in generating them with the respective versions as that will show eventual changes in behaviour better. Similar to what @snicoll mentioned there already. In summary, being aware of changes on the JDK level - let it be on compiler, javadoc or test side - is imho beneficial. But I'm also fine with removing the javadoc & compile part if you really want me to. |
Sorry for the confusion, @dreis2211.
Yes, that's what I meant. I was trying to acknowledge that the problem I described with what's proposed here also already exists in our JDK 11 and 13 builds.
There's definitely some value. However, if we're going to pick one approach over the other, I think that testing Java 8-compiled code against later JDKs is of greater value as that's what our users will be doing. Feeling this way is also influenced by the fact that there's often nothing we can do about the deprecation warnings while we continue to support Java 8, although that's not the case with the example above. A downside of compiling with JDK 8 and testing with a later JDK is that it complicates our CI set up. We currently have everything in place to produce Docker images with a single JDK in a well-known location. Adopting the approach I've described above would require our JDK 11, 13, and 14 images to have two JDKs in place. That's unavoidable for JDK 14 with Gradle's current capabilities no matter which approach we take so maybe it's not so bad. |
Exactly. It feels like we're discussing the bigger picture (which I enjoy) while this PR seems needed anyway for the time being and is only a tiny piece of the complete JDK 14 CI process... |
@dres2211 Thanks again for your work on this one. We discussed it and the broader topic today and concluded that we'd like two properties:
We'll use This PR pretty much covers 1, other than renaming |
Sure...will do so in a couple of minutes. |
Pushed |
Thanks for the updates, @dreis2211. I've polished this a bit (wilkinsona@563083b) and in doing so, I think I've noticed that |
And almost immediately after writing the above, I realised that we need to call
|
@wilkinsona As I saw test failures I didn't question that the custom Java home was (or wasn't) used. Good catch! Sorry that I didn't catch it. :/ |
Thanks once again, @dreis2211. The proposed changes are now on the master branch. |
Hi,
as discussed in #20147 this PR should give us a first insight into what might be broken with JDK 14.
The new functionality can be used like this:
I specifically implemented a check for emptiness of the new property in preparation for an eventual CI. By that we could simply set it for JDK 14 builds and leave it empty for the others. That should keep the build-project.sh relatively simple.
Let me know what you think.
Cheers,
Christoph