This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Gazelle

Repository BUILD file generation

    //tools/gazelle:gazelle runs the repository’s Gazelle language plugins. Repository-wide directives remain in root BUILD.bazel, where Gazelle discovers them for all packages. Root //:gazelle and //:gazelle_bin remain compatibility entry points.

    //tools/gazelle:workspace_test checks BUILD file freshness across the root workspace in diff mode. Normal CI’s root test wildcard includes it. Packages with hand-maintained targets use scoped Gazelle directives to preserve explicit runtime, platform, or generated-source wiring.

    The transitive-visibility extension is registered last so it also covers packages created by other languages. Each tree selects a package group with tools/transitive_visibility/transitive_visibility.toml. To regenerate only these package declarations, run:

    bazel run //:gazelle -- -lang=enforce_transitive_visibility
    

    The plugin documentation describes inheritance and standalone use. Nested modules are separate Gazelle workspaces; root path mappings do not cross those boundaries.

    //tools/gazelle:gazelle_python_manifest.update refreshes root gazelle_python.yaml; //tools/gazelle:gazelle_python_manifest.test validates its integrity against tools/py/uv.lock. The manifest stays at the repository root for default ancestor discovery. It can live elsewhere if the root BUILD file sets gazelle:python_manifest_file_name to its relative path.