-
Notifications
You must be signed in to change notification settings - Fork 238
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
support multiplex worker for jetify #911
Conversation
8c1a0fa
to
e96ba32
Compare
e96ba32
to
72d2715
Compare
visibility = ["//visibility:public"], | ||
runtime_deps = [ | ||
":jetifier_jars", | ||
":jetifier_worker_wrapper" |
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.
Depending on WorkRequestHandler
as an implementation detail of the android_tools
probably isn't the best way to add worker support here.
There is an issue open already against Bazel to have this worker implementation exposed or distributed to some place like maven. bazelbuild/bazel#14556
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.
Is it acceptable to copy WorkRequestHandler to this repo for the time being?
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.
That's one option, although also not ideal. There is an implementation in the aswb plugin that's much simpler that we could pull into rules_jvm_external if we need to.
@SupSaiYaJin Are you using the jetify_include_list
attribute on maven_install
to limit the number of maven dependencies being Jetified to only those that need it? The screenshot in the description shows okio being Jetified which looks incorrect to me.
On a related note, AndroidX has been the default for 6+ years now. We should probably be figuring out how to remove Jetifier entirely from rules_jvm_external
instead of expanding support. People might even be unknowingly using it and experiencing slower builds as a result when it's in fact not needed. Alternatively we could switch the behavior to only run on the specific maven coords listed in jetify_include_list
by default.
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.
Agree on that, we do use jetify_include_list
to limit the libs. Besides even putting aside jetifier, this change could benefit all java_binary
actions if they are stateless, for example
rules_jvm_external/private/tools/java/com/github/bazelbuild/rules_jvm_external/jar/BUILD
Line 30 in e6c1ff2
java_binary( |
They could be disabled by default and enabled with --strategy
if it fits consuming project needs.
I also found BazelMultiplexWorker with a nicer API BazelMultiplexWorker.run(args, (compilerArgs, out) -> );
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.
Could you please add a test of some sort to demonstrate that this functionality is working?
http_archive( | ||
name = "android_tools", | ||
sha256 = "1afa4b7e13c82523c8b69e87f8d598c891ec7e2baa41d9e24e08becd723edb4d", | ||
url = "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.27.0.tar.gz", |
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.
This will also need to be added to the MODULE.bazel
@@ -0,0 +1,46 @@ | |||
package com.github.bazelbuild.rules_jvm_external; |
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.
This file should live under //private/tools/java
rather than in a new top-level directory.
Thank you for the PR. Making things more efficient is definitely a Good Thing! |
This PR and some other PRs and conversations recently have highlighted that we should really be keeping the focus of this ruleset tight. In #924 we deprecate In addition, it's not clear that people understand how limited the work it does is: it's only needed in a handful of cases. For example, the Square For these reasons, although I very much appreciate the PR and the work it represents, and I thank you for it, I shall be closing this PR. If you feel this needs further discussion, I'd be happy to chat on the |
This PR uses WorkRequestHandler in android_tools wrapping jetify-standalone to support multiplex worker which will significantly improves the performance of Jetifying especially during first-time compilation without cache.
not using worker:
![image](https://private-user-images.githubusercontent.com/10076965/242800945-395d2a82-0607-48c9-b62b-5d72549156c4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjExMTg0MTMsIm5iZiI6MTcyMTExODExMywicGF0aCI6Ii8xMDA3Njk2NS8yNDI4MDA5NDUtMzk1ZDJhODItMDYwNy00OGM5LWI2MmItNWQ3MjU0OTE1NmM0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmV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JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.uDBF2V2E_iVp9Xy4e7-fWX5QEGj06MMH9yU2_Jszm7k)
using worker: