-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Simplify finding jps #45677
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
Merged
Merged
Simplify finding jps #45677
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
So
project.runtimeJavaHomemay or may not be Java home used to run the build. Sincejpsin this case is a build dependency, it seems to make sense to use the Java runtime that Gradle is using viaJvm.current(). Realistically, we should be able to setRUNTIME_JAVA_HOMEto a JRE, since it's just used for execution bits, not anything build related.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.
Yup. The way I’ve always thought of it is:
It’s not perfect (I think third-party audit runs in the Gradle JVM, although we want to move it out). I’d rather not break this mental model more though.
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.
Ah, giving this another think this makes sense. We should use the same version of
jpsthat's used to launch any ES processes, even though it's actually the build that's executingjpshere.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.
Precisely.
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.
ThirdPartyAuditTaskdoes have ajavaHomeproperty which we set toruntimeJavaHome.CheckForbiddenApisruns in the same jvm ( does not work ) and has a target compatibility specificto
runtimeJavaVersionThere 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 for the correction @atorok, I knew there was a
precommittask that runs in the Gradle JVM that we ideally would want running in the runtime Java home JVM, I couldn't remember which though.Uh oh!
There was an error while loading. Please reload this page.
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.
We actually are slowly migrating to the opposite @jasontedor. There's no reason for most precommit checks to run in the runtime JVM when
javac, checkstyle and most other build-time verification runs using the Gradle JVM. These are "build" operations, not runtime ones so realistically they should run the the Gradle JVM. Also, forking them has a significant build time penalty as we are creating and throwing away lots of JVMs for each of these tasks.This is a separate issue though and I think the usage of
runtimeJavaHomeis appropriate in this case. For others, we'll address them case-by-case but we are definitely misusing it in several places.