镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

[bazel] Fetch generated sources for editors after bazelflare builds - #8409

Open
mikea wants to merge 1 commit into
mainfrom
maizatskyi/2026-11-12-generated-files
Open

mikea wants to merge 1 commit into
mainfrom
maizatskyi/2026-11-12-generated-files

Conversation

@mikea

@mikea mikea commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

A bazelflare build uses --remote_download_minimal, so the generated headers and Rust sources that clangd and rust-analyzer read from bazel-bin (Cap'n Proto and cxx bridge code, generated Rust Cap'n Proto crates, the _virtual_includes trees) stay remote and editors can't resolve them.

An aspect (build/generated_srcs.bzl) collects the generated headers and Rust sources of C++ and Rust targets and their dependencies into the generated_srcs output group. Generated C++ sources are left out; the Pyodide one alone is 75 MB.

--config=bazelflare-generated adds the aspect and its output group to a build, and downloads the files through --remote_download_regex, restricted to the target configuration and excluding node_modules; it also downloads files of the group that are missing locally. Adding common:bazelflare --config=bazelflare-generated to .local/bazelrc enables it on every bazelflare build. It doesn't change action keys or discard the analysis cache; build/check_ci_flags.sh passes with it.

just fetch-generated [targets] builds only the output group with that config, so it runs only the generating actions and downloads nothing else: about 1,450 files, 9 MB, for //src/.... It is a fallback for builds without the config; with the config enabled it isn't needed, and it fails, since Bazel rejects an aspect added twice.

A bazelflare build uses --remote_download_minimal, so the generated
headers and Rust sources that clangd and rust-analyzer read from
bazel-bin (Cap'n Proto and cxx bridge code, generated Rust Cap'n Proto
crates, the _virtual_includes trees) stay remote and editors can't
resolve them.

An aspect (build/generated_srcs.bzl) collects the generated headers and
Rust sources of C++ and Rust targets and their dependencies into the
generated_srcs output group. Generated C++ sources are left out; the
Pyodide one alone is 75 MB.

--config=bazelflare-generated adds the aspect and its output group to a
build, and downloads the files through --remote_download_regex,
restricted to the target configuration and excluding node_modules; it
also downloads files of the group that are missing locally. Adding
`common:bazelflare --config=bazelflare-generated` to .local/bazelrc
enables it on every bazelflare build. It doesn't change action keys or
discard the analysis cache; build/check_ci_flags.sh passes with it.

`just fetch-generated [targets]` builds only the output group with that
config, so it runs only the generating actions and downloads nothing
else: about 1,450 files, 9 MB, for //src/.... It is a fallback for
builds without the config; with the config enabled it isn't needed, and
it fails, since Bazel rejects an aspect added twice.
@mikea
mikea requested review from a team as code owners November 12, 2026 18:11
@mikea
mikea enabled auto-merge November 12, 2026 18:12
@mikea
mikea disabled auto-merge November 12, 2026 18:12
@mikea
mikea enabled auto-merge (rebase) November 12, 2026 18:13

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved — No issues found: the aspect, the .bazelrc config, the just recipe and the documentation agree with each other and with the pull request description.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

No security concerns in this build-tooling change.


📖 AGENTS.md: ✅ LGTM

No issues found.


📋 Code Quality: ✅ LGTM

The aspect handles unrelated rules, single-label attributes and missing attributes safely. The download regex and the extension list match each other, and the just recipe builds only the generated_srcs output group.


⚡ Performance: ✅ LGTM

No performance concerns. Excluding generated C++ sources keeps the download small.


📝 Documentation: ✅ LGTM

docs/development.md describes the new config and recipe accurately, including the failure when the aspect is added twice.


Reviewed commit: c10739d4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant