Skip to content

Ensure reproducible builds when building with Bazel#1640

Open
mgeisler wants to merge 1 commit into
bytecodealliance:mainfrom
mgeisler:bazel-reproducible
Open

Ensure reproducible builds when building with Bazel#1640
mgeisler wants to merge 1 commit into
bytecodealliance:mainfrom
mgeisler:bazel-reproducible

Conversation

@mgeisler

@mgeisler mgeisler commented Jul 1, 2026

Copy link
Copy Markdown

The build script would write a rustc --emit=metadata file into OUT_DIR purely to test whether a snippet compiles. Since the metadata is not stable, this file could vary from run to run.

When building with Bazel, which hashes the content of the files in OUT_DIR, the leftover file makes every build have a different cache key. This in turn defeats remote caching for the subtree of build graph below rustic.

This PR simply deletes the throwaway probe artifact before the build script exits so OUT_DIR is reproducible.

The build script would write a rustc `--emit=metadata` file into
`OUT_DIR` purely to test whether a snippet compiles. Since the
metadata is not stable, this file could vary from run to run.

When building with Bazel, which hashes the content of the files in
`OUT_DIR`, the leftover file makes every build have a different cache
key. This in turn defeats remote caching for the subtree of build
graph below `rustic`.

This PR simply deletes the throwaway probe artifact before the build
script exits so `OUT_DIR` is reproducible.
@mgeisler

mgeisler commented Jul 1, 2026

Copy link
Copy Markdown
Author

Hi there! I looked briefly at the build failures and I think they are unrelated?

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

Labels

None yet

1 participant