Only register .jdeps caching ActionContext when used#21290
Only register .jdeps caching ActionContext when used#21290fmeum wants to merge 2 commits intobazelbuild:masterfrom
.jdeps caching ActionContext when used#21290Conversation
By registering `JavaCompileActionContext` (renamed to `JdepsCachingActionContext` in this change to better reflect its only purpose) only when using `--java_classpath=bazel`, the `insertDependencies` field of `JavaHeaderCompileAction` becomes obsolete. Combined with the existing 3 bytes of padding, this makes room for a new 4-byte field that will be used in a rollforward of fd196bf.
.jdeps cache ActionContext when used.jdeps caching ActionContext when used
|
Additional context is provided in #19872 (comment). |
| BuildRequest buildRequest) { | ||
| registryBuilder.register(JavaCompileActionContext.class, new JavaCompileActionContext()); | ||
| JavaOptions javaOptions = env.getOptions().getOptions(JavaOptions.class); | ||
| if (javaOptions != null |
There was a problem hiding this comment.
The Blaze analogue of this setup would also have to gate adding the context behind this condition.
|
@bazel-io fork 7.1.0 |
|
@hvadehra Btw, does Google use all three modes of |
|
|
Thanks for sharing more numbers, I agree that this particular change is less important in this case. I will look into the more pressing problem first. Could you link to the lines you referred to as |
I'd meant to do that but forgot, sorry about that: https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/rules/java/JavaHeaderCompileAction.java#L373-L377 |
|
Thanks, now I fully understand your comment. This logic does make it difficult to replace the field, assuming it is needed at all. I will close this PR for now and think about how to prevent the large part of the regression. I will also look into submitting a PR to flip the default classpath mode for Bazel. |
By registering
JavaCompileActionContext(renamed toJdepsCachingActionContextin this change to better reflect its only purpose) only when using--java_classpath=bazel, theinsertDependenciesfield ofJavaHeaderCompileActionbecomes obsolete. Combined with the existing 3 bytes of padding, this makes room for a new 4-byte field that will be used in a rollforward of f5d76b1.Along the way, skip the unnecessary work of reading the
.jdepsinJavaHeaderCompilerAction#afterExecuteif neither using the.jdepscache nor path mapping.Work towards #21091