Store remote registry file hashes in the lockfile
MODULE.bazel, bazel_registry.json and source.json files obtained from remote registries are stored in the repository cache and their hashes are collected in the lockfile. This speeds up incremental module resolutions, such as after adding a new bazel_dep.
Yanked versions are not stored in the lockfile. Their handling will be part of a follow-up PR.
Implements part of https://docs.google.com/document/d/1TjA7-M5njkI1F38IC0pm305S9EOmxcUwaCIvaSmansg/edit Work towards #20369
Currently stacked on #21906, but otherwise ready for review.
This is no longer stacked and ready for review again.
This is stacked on #22058, please only consider the last commit.
No longer stacked.
@fmeum You sent me a private message last week I think related to this change but now I can't find it, I believe due to default chat retention. Please try re-sending or asking on a more durable medium (like here).
@justinhorvitz It's related to a follow-up PR I haven't sent out yet, but it does make sense to ask it here:
While continuing my work to get rid of Bzlmod events retained by Skyframe, I noticed that certain Bazel commands don't cause Skyframe to invalidate its "done" nodes. For example, in the afterCommand of a bazel shutdown invocation, I still see "done" Skyframe nodes that depend on invalidated values (say changed flag values injected as precomputed values).
Is there a way to reliably detect such commands so that I can skip all work for them?
@justinhorvitz It's related to a follow-up PR I haven't sent out yet, but it does make sense to ask it here:
While continuing my work to get rid of Bzlmod events retained by Skyframe, I noticed that certain Bazel commands don't cause Skyframe to invalidate its "done" nodes. For example, in the afterCommand of a bazel shutdown invocation, I still see "done" Skyframe nodes that depend on invalidated values (say changed flag values injected as precomputed values). Is there a way to reliably detect such commands so that I can skip all work for them?
I don't know of a perfect way short of listening for MemoizingEvaluator#evaluate calls. But perhaps an acceptable proxy is to check Command#mustRunInWorkspace - I think that should return false for a bunch of commands that you don't care about.
@fmeum can you please add the Javadoc comment for KnownFileHashesMode from src/main/java/com/google/devtools/build/lib/bazel/bzlmod/IndexRegistry.java? Thanks!
@fmeum can you please add the Javadoc comment for
KnownFileHashesModefromsrc/main/java/com/google/devtools/build/lib/bazel/bzlmod/IndexRegistry.java? Thanks!
Done!
quick update -- running into some internal test failures during import; will probably submit today or tomorrow
For future reference:
- Anything contained in a SkyValue needs to implement
equals()andhashCode()(Checksumdid not) - Our internal serialization framework doesn't support
records (yet?), so we have to useAutoValuefor now.
No need to make any changes -- this is just informational
@bazel-io fork 7.2.0
The changes in this PR have been included in Bazel 7.2.0 RC1. Please test out the release candidate and report any issues as soon as possible. If you're using Bazelisk, you can point to the latest RC by setting USE_BAZEL_VERSION=7.2.0rc1. Thanks!