-
Notifications
You must be signed in to change notification settings - Fork 4k
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
prelude is stricter at head #11940
Comments
@alandonovan Need to discuss backpatching a rollback to the release branch vs. hiding change behind a flag. |
For context: The motivation behind this change is to make prelude evaluation more consistent with regular bzl loading. Before this change, the (parsed) prelude contents were syntactically prepended to every BUILD file, sort of like a C-style #include directive. This meant that the prelude's AST was shared by all BUILD files, and therefore couldn't be statically processed in the usual way by the Starlark interpreter (specifically, to record variable scoping information for faster runtime evaluation). It also made BUILD file evaluation even more complex, compared to treating the prelude as just another (virtual) load dependency. We need to assess the use cases and how difficult they are to migrate. So if you're broken, please chime in. I also opened #11946 to discuss possibly eliminating the prelude file altogether. |
Thanks for making this ticket! We use the prelude for two things:
with that macro defined roughly as:
This doesn't work if the prelude is handled as a regular bzl file, as the macros can't be called during load() ("The native module can be accessed only from a BUILD thread. Wrap the function in a macro and call it from a BUILD file"). So this would break with this change. Is there another way of supporting this kind of target creation? |
Ah ha. Thanks Kevin. That is an interesting use case. We cope with that at Google by doing it metadata hooks at the source code repository level. Essentially, we set up the SCM so that we do the format test at PR pre-merge time, through non-bazel mechanisms. One obvious trade-off is that we have to maintain a more complex SCM than git, but we don't have to run (literally) millions of style checks in addition to the behavioral tests that our continuous testing pipeline is looking at. |
No longer a release blocker for 3.5. I moved the baseline to before this change. |
@kevingessner Would it be acceptable for you to update the BUILD files and make them explicit? py_formatting_test() With a presubmit check, you can enforce that the call is present. The load statement isn't required if you put the load in the prelude file. I uderstand it's not ideal for you, but supporting your use-case causes some problems. Right now, this bug is blocking the next Bazel release. Anyone has an opinion on what's the way forward? We could design a solution to support your use-case, but that would take time (and we need releases in the meantime). cc @alandonovan |
@laurentlb I thought the change was reverted, so releases could continue? We can do something like that, but I definitely liked having it automatic. I'd love to see a feature like that for the future. |
It was not reverted. Bazel 3.5 used a baseline just before the change, but the change is still at head and is blocking 3.6. |
Ah, I didn't realize. I was hoping this would be reverted and put behind a flag. I guess if you want to put this breaking change in 3.6, go ahead. I'll work around it when we upgrade. |
I see you added release blocker again. |
I'm filing this bug to assess the impact of the change.
From the draft release notes:
My comment:
According to @kevingessner:
The text was updated successfully, but these errors were encountered: