🐞 bug report
Affected Rule
gazelle
Is this a regression?
No, I believe it's a new feature introduced by #2994 and it seems to be not working as expected in the specific situation of this report.
Description
When using gazelle to generate py_proto_library, it doesn't work as expected when the proto file is in a subfolder of a python root that differs from the repo root (specified with the directive # gazelle:python_root).
Gazelle generates the target with an imports attribute, which is not supported and thus the target fails to build.
🔬 Minimal Reproduction
https://github.com/regb/issue-reports/tree/main/rules_python/py_proto_imports
🔥 Exception or Error
Gazelle runs smoothly but generates the invalid targets, then running build generate this error:
$ bazel build ...
ERROR: /home/regb/vcs/issue-reports/rules_python/py_proto_imports/src/mypackage/BUILD.bazel:10:17: //src/mypackage:example_py_pb2: no such attribute 'imports' in 'py_proto_library' rule
ERROR: package contains errors: src/mypackage
ERROR: package contains errors: src/mypackage: //src/mypackage:example_py_pb2: no such attribute 'imports' in 'py_proto_library' rule
WARNING: Target pattern parsing failed.
ERROR: Skipping '...': Error evaluating '...': error loading package 'src/mypackage': Package 'src/mypackage' contains errors
ERROR: Error evaluating '...': error loading package 'src/mypackage': Package 'src/mypackage' contains errors
INFO: Elapsed time: 0.136s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
🌍 Your Environment
Operating System:
Output of bazel version:
Rules_python version:
1.7.0 (also tested 1.6.3)
🐞 bug report
Affected Rule
gazelleIs this a regression?
No, I believe it's a new feature introduced by #2994 and it seems to be not working as expected in the specific situation of this report.
Description
When using gazelle to generate
py_proto_library, it doesn't work as expected when the proto file is in a subfolder of a python root that differs from the repo root (specified with the directive# gazelle:python_root).Gazelle generates the target with an
importsattribute, which is not supported and thus the target fails to build.🔬 Minimal Reproduction
https://github.com/regb/issue-reports/tree/main/rules_python/py_proto_imports
🔥 Exception or Error
Gazelle runs smoothly but generates the invalid targets, then running build generate this error:
🌍 Your Environment
Operating System:
Output of
bazel version:Rules_python version: