-
Notifications
You must be signed in to change notification settings - Fork 112
Replace legacy struct providers with modern ones #599
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
Conversation
Legacy struct providers have been deprecated by Bazel. Replacing them with modern providers, will make it possible to simplify and remove legacy handling from B. azel
| "language": "", | ||
| }) | ||
|
|
||
| ClosureExportsInfo = provider("ClosureExportsInfo", fields = {"exports": """ |
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.
Since we are introducing proper providers, would it be possible to get rid of this as well?
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.
For ClosureExportsInfo, it looks possible to remove it, by adding exports to ClosuresJsLibraryInfo and WebFilesInfo.
ClosureJsLegacyRunfilesInfo looks easier to remove, by using regular runfiles instead.
Both of those removals require some effort and should probably be done by code owners and not as a part of a large cleanup, where we're fixing about 80 other rulesets.
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.
Ok that's fair.
|
@mollyibot Could you do a quick/hacky prototype of required changes to build_defs/internal_do_not_use/j2cl_js_common.bzl to validate this. |
|
I did repro build for j2cl/ j2wasm, One minor thing : some deps may still in deprecated struct which means the in operator or index notation would not always work. |
We have internal fixes already for that file. They seem independent of rules_closure. |
To double check, you are referring to fixes in Bazel, right? That means if we submit the change we cannot use it from older versions? Edit: more particularly J2CL that is using |
No, not Bazel. The support for new style providers is in Bazel for ages, I believe even before Bazel 4. I was referring to fixes of |
|
Yes, I agree j2cl_js_common.bzl can be modified to handle special cases too. why not handle special dep cases in rules_closure as well if some the in operator or index notation usages exist in closure/compiler/closure_js_library.bzl and closure/private/defs.bzl? |
|
I send a pr for review @comius . The issue is how we handle the deps in rules_closure. not all deps are rule targets and in may not work to access providers . This is snippet shows the deps we passed in to to pass into |
|
@mollyibot What is the source of non-target deps here? |
|
one example srcs : |
|
But that's because we haven't migrated J2CL, right? i.e. j2cl is still producing the struct |
|
yes, my concern is will this happen for other callers that are not from j2cl, should rules_closure also handle those scenarios? |
|
But you mentioned that you needed to workaround a problem on J2CL side, I thought it was something else. Could you share me again the changes needed in J2CL?
We gonna need to be move forward at one point. Maybe we can temporary support both but one can just wait before upgrading since we don't have other important improvement. Anyway we can discuss if that becomes the only problem (your PR is small so it might be a good tradeoff) |
|
I had a messy workaround to change the some of the deps (of providers) that we passed in https://github.com/google/j2cl/blob/master/build_defs/internal_do_not_use/j2cl_java_library.bzl#L100-L104 to deps, and do checks for g3 extract providers for js info as before and opensource not extract providers, and for jvm extract java_info everywhere . This workaround has two versions for j2cl_common and j2cl_java_library for g3 and opensource, that is why I prefer to doing the cleaning in rules_closure. |
|
IIUC your concern is following steps:
And you are proposing:
And the final state in both approaches will be the same. Is that accurate or do you have other concerns? |
|
yes, apart from i do not plan to drop the legacy struct support, I plan to do 1 and 2 because i am afraid there would be other caller pass in provider(in a struct) rather than target. if we compare g3 version [js_checkable_provider] they support provider in their deps. I just uploaded a draft to demonstrate my idea to work around the issue https://github.com/google/j2cl/pull/227/files. i am afraid we need to have two versions(g3 and opensource) for these bzl files. |
|
There shouldn't be any struct passing scenario; we are under full control and that would be the point of the migration. That also shouldn't happen under js_checkable_provider either. I think something might be wrong in this picture if that's not the case. |
|
okay, I do not have issues with your plan then. |
|
Ok plan wise; Then we can submit this PR and do follow up changes to do further refactoring to get rid of the extra providers discussed in #599 (comment) Then prepare the J2CL PR that only supports the latest version of rules_closure. If there is any surprising impact; we can do more updates to rules_closure and finalize the next steps. Does it sound good? |
|
Yes, sounds good! Let me know if i can help with the release. |
## Motivation for features / changes Legacy struct providers have been deprecated by Bazel. Replacing them with modern providers, will make it possible to simplify and remove legacy handling from Bazel. Prerequiste: bazelbuild/rules_closure#599 is merged and released. Googlers, see cl/597800285.
## Motivation for features / changes Legacy struct providers have been deprecated by Bazel. Replacing them with modern providers, will make it possible to simplify and remove legacy handling from Bazel. Prerequiste: bazelbuild/rules_closure#599 is merged and released. Googlers, see cl/597800285.
Legacy struct providers have been deprecated by Bazel. Replacing them with modern providers, will make it possible to simplify and remove legacy handling from Bazel