Skip to content

buffa-build: don't watch generated files in OUT_DIR - #852

Open
mfridman wants to merge 1 commit into
anthropics:mainfrom
mfridman:mf/buffa-build-out-dir-rerun
Open

mfridman wants to merge 1 commit into
anthropics:mainfrom
mfridman:mf/buffa-build-out-dir-rerun

Conversation

@mfridman

Copy link
Copy Markdown

Fixes #851.

Config::compile() emitted rerun-if-changed for protos in the build script's own OUT_DIR. The script writes those on every run, so cargo always saw them as changed and reran it. That's why buffa-test recompiled on every cargo test.

Now compile() skips files that are really in OUT_DIR, after resolving symlinks and .., so a symlink back to real sources is still watched. The same loop happened with .descriptor_set(path) when the script writes the descriptor set into OUT_DIR, so that's covered too.

One behavior change: a script that generates files in OUT_DIR but doesn't watch the sources they came from used to rerun on every build by accident. Now it needs its own rerun-if-changed, like buffa-test already does with protos/ and like descriptor_set_bytes already requires.

To try it:

cargo test -p buffa-test --no-run              # first build
cargo test -p buffa-test --no-run              # no changes
touch buffa-test/protos/basic.proto
cargo test -p buffa-test --no-run              # a real edit

Before, the second build recompiles buffa-test:

   Compiling buffa-test v0.9.2 (/.../buffa/buffa-test)
    Finished `test` profile [unoptimized + debuginfo] target(s) in 28.11s

After, it's a no-op:

    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.11s

And the build after the touch still recompiles buffa-test (29.12s), so edits to real sources still run codegen.

@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@mfridman

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Nov 27, 2026

This branch has not been deployed

No deployments
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.

buffa-build: generated protos in OUT_DIR cause a rebuild every time

1 participant