-
Notifications
You must be signed in to change notification settings - Fork 135
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
Set the java launcher for Checkstyle tasks, too #2351
Conversation
The gradle-jdks plugin aims to download JDKs from a source and use them at runtime. In theory, this means that in order to develop using such a library, one only needs a JDK installed that can run Gradle (there are some limitations but this is the theory). Inside the Checkstyle task is a Java launcher property. When this is resolved, it will query the Java version service, which will query the configured JDKs. This means that the baseline-java-versions configured JDK is not used, and if the gradle-jdks approach is used, the Checkstyle task will fail. I _think_ that this change is enough to correctly override the Java launcher used. Fixes palantir/gradle-jdks#93
Generate changelog in
|
I verified that this fixed my problem locally. I wasn't sure how to write a test that isn't overengineered. Concretely my problem is that it's failing on CI, where my Java version is not installed by default. |
public void execute(Checkstyle checkstyle) { | ||
checkstyle.getJavaLauncher().set(javaToolchain.flatMap(BaselineJavaToolchain::javaLauncher)); | ||
} | ||
}); |
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.
Mind adding a test that this resolves?
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.
I'm not entirely sure what this means. What sort of test would you like me to write? I'm not really sure how to write the Checkstyle equivalent of the Java one.
...ine-java/src/main/groovy/com/palantir/baseline/plugins/javaversions/BaselineJavaVersion.java
Outdated
Show resolved
Hide resolved
Released 4.153.0 |
Just want to flag that this bumps the minimum Gradle version to 7.5. We likely have quite a few internal repos that are not yet on Gradle 7.5. |
Good flag, let's add a check rather than increasing the minimum supported gradle release: #2360 |
The gradle-jdks plugin aims to download JDKs from a source and use them
at runtime. In theory, this means that in order to develop using such a
library, one only needs a JDK installed that can run Gradle (there are
some limitations but this is the theory).
Inside the Checkstyle task is a Java launcher property. When this is
resolved, it will query the Java version service, which will query
the configured JDKs. This means that the baseline-java-versions
configured JDK is not used, and if the gradle-jdks approach is used, the
Checkstyle task will fail.
I think that this change is enough to correctly override the Java
launcher used.
Fixes palantir/gradle-jdks#93