You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
generate: python adds libraries for sources rules_dx binaries, tests or exports_files already own (part of #9237) #9333
On main (9a01083), bazel run //dx:generate_check proposes:
tools/docs/rule_names/BUILD.bazel: a new python_library(name = "rule_names", srcs = ["rule_names.py"]), although rule_names.py is already the main/srcs of the hand-written python_binaryrule_names_bin and python_testrule_names_test.
python/rules/BUILD.bazel: a new python_library(name = "grpc_protoc") for grpc_protoc.py, which the package only exports with exports_files.
python/tests/BUILD.bazel and python/tests/sdist_native/msvc/BUILD.bazel: testonly = True on existing python_test rules. Tests are already testonly, so this adds nothing.
Where
gazelle/python/lang.go:465-485foreignKinds/foreignSources: only rules_py/rules_python kinds count as owners.
gazelle/python/lang.go:341-376: makes a library plan for every unowned source.
gazelle/python/lang.go:385-387: FixtureTestonly sets testonly on every generated rule, test kinds included.
Fix
Treat a source as owned when it is in srcs or main of an existing rules_dx python_binary/python_test that the generator did not produce for that file, or when it is listed in exports_files. Do not plan a library for an owned source.
Skip testonly for testKind.
Add one test per fix in gazelle/python/lang_test.go.
Done when
bazel run //dx:generate_check shows no change to these four BUILD files.
Fixed on origin/main: #9336 (owned-source skip, no testonly on tests) and #9338 (applied the remaining generate diff for imports and python/rules). bazel run //dx:generate_check on current origin/main exits 0 with no change to the four BUILD files.
Activity
generate: python skips sources hand-written binaries, tests and expor…
generate: apply remaining root-module generate diff (closes #9237) (#…
TrapsterDK commentedon Nov 7, 2026
Fixed on origin/main: #9336 (owned-source skip, no testonly on tests) and #9338 (applied the remaining generate diff for imports and python/rules). bazel run //dx:generate_check on current origin/main exits 0 with no change to the four BUILD files.