-
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
--incompatible_default_to_explicit_init_py not respected when py_binary called from a rule with cfg="exec" #16388
Comments
Hello @mvukov , It will be helpful if you could provide the minimal steps to reproduce the above request like sample repo? Thanks! |
@kshyanashree I created a small example project showcasing the bug for Hopefully this helps reproducing and analyzing the problem. If you have any questions, feel free to reach out. |
Adding incompatible options is error-prone as it is easy to forget to add them to their corresponding `FragmentOption`'s `getHost` method. If this is not done, the flag will have no effect in the exec configuration, which has already caused very surprising, buggy behavior in numerous cases. This commit adds a test to verify that all non-deprecated incompatible flags: 1. are tagged with the `INCOMPATIBLE_CHANGE` metadata tag; 2. are preserved in the exec configuration. Fixes bazelbuild#12238 Fixes bazelbuild#16388
Adding incompatible options is error-prone as adding them to their corresponding `FragmentOption`'s `getHost` method is easily forgotten. In that case, the flag will have no effect in the exec configuration, which has already caused very surprising, buggy behavior in numerous cases. This commit adds a test to verify that all non-deprecated incompatible flags: 1. are tagged with the `INCOMPATIBLE_CHANGE` metadata tag; 2. are preserved in the exec configuration. Fixes bazelbuild#12238 Fixes bazelbuild#16388
@martis42 Thanks for providing a sample repo to easily reproduce the bug. |
Description of the bug:
In a .bazelrc I have defined
build: --incompatible_default_to_explicit_init_py
, needed for proper handling of automatically generated Python code for some Protobuf files. This auto-generated code is used in a py_binary. The binary works normally and the build option is respected. However, when I use the binary from a rule as e.g.then I get an import error related to the fact that the build option --incompatible_default_to_explicit_init_py isn't respected. A simple fix is to add
legacy_create_init = False,
to the py_binary definition.What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
No response
Which operating system are you running Bazel on?
Ubuntu 20.04
What is the output of
bazel info release
?release 5.2.0
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: