-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Fix NPE when setting --java_classpath=bazel
#16636
Fix NPE when setting --java_classpath=bazel
#16636
Conversation
// Register JavaCompileActionContext for java_classpath=bazel to work | ||
actionContextRegistryBuilder.register( | ||
JavaCompileActionContext.class, new JavaCompileActionContext()); | ||
|
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.
A better location to do this registration is BazelStrategyModule
overriding registeringActionContext
. The module allows for better extensibility, that is potential use of a different compilation context.
Please move it there.
@@ -79,6 +79,19 @@ java_library( | |||
], | |||
) | |||
|
|||
java_library( |
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.
It's a bad practice to have a source file part of two rules. Please remove JavaCompileActgionContext.java
from the other rule where it's still used and fix dependencies if needed.
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.
Does the bazel classpath work after this fix?
Could you also add a regression test for this NPE?
This makes --experimental_java_classpath=bazel work. This CL is similar to bazelbuild#16636 but applies the code review feedback. (Though, I put the context registration in BazelRulesModule rather than BazelStrategyModule as JavaCompileActionContext isn't really an strategy.) Fixes bazelbuild#16635.
This makes --experimental_java_classpath=bazel work. This CL is similar to bazelbuild#16636 but applies the code review feedback. (Though, I put the context registration in BazelRulesModule rather than BazelStrategyModule as JavaCompileActionContext isn't really a strategy.) Fixes bazelbuild#16635.
This makes --experimental_java_classpath=bazel work. This CL is similar to bazelbuild#16636 but applies the code review feedback. (Though, I put the context registration in BazelRulesModule rather than BazelStrategyModule as JavaCompileActionContext isn't really a strategy.) Fixes bazelbuild#16635.
The same thing done #16921 |
This makes --experimental_java_classpath=bazel work. This CL is similar to #16636 but applies the code review feedback. (Though, I put the context registration in BazelRulesModule rather than BazelStrategyModule as JavaCompileActionContext isn't really a strategy.) Fixes #16635. Closes #16921. PiperOrigin-RevId: 494950719 Change-Id: Ia32e2d0e67ddacaf18ba52591f7b67b3c6c7b792
Sorry could not follow up on review comments, thanks @comius @benjaminp! |
This makes --experimental_java_classpath=bazel work. This CL is similar to #16636 but applies the code review feedback. (Though, I put the context registration in BazelRulesModule rather than BazelStrategyModule as JavaCompileActionContext isn't really a strategy.) Fixes #16635. Closes #16921. PiperOrigin-RevId: 494950719 Change-Id: Ia32e2d0e67ddacaf18ba52591f7b67b3c6c7b792 Co-authored-by: Benjamin Peterson <[email protected]>
Fixes #16635