Feature request: store/load analysis cache on disk
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 75
Description
### Description of the feature request:
I'd like to be able to persist the analysis cache (e.g. after running `bazel aquery //...`) to disk and load it back into the Bazel server on next startup.
### Feature requests: what underlying problem are you trying to solve with this feature?
I have a lot of small git repos that have independent build systems (cmake, cabal, autotools, make, setup.py, ...), but are also part of a larger "stack" monorepo (except it's not mono, it's git submodules). This contains the WORKSPACE and third_party and various other bits.
I have a Docker image in the top level "stack" repo that downloads large third_party dependencies such as Android NDK/SDK, some .jar files, Qt, some external dependencies that aren't yet built with Bazel, and installs various other programs needed to run the build (mvn, make). Essentially it tries to do as much as possible of the build preparation right up to the point of building (which it doesn't do).
The idea here is that submodule repos can use this working snapshot (which is tested in its entirety on CI before the image is built) to run their own tests within the context of the large repo, so all their dependencies are there and at the most recent stable snapshot.
This is working pretty well, especially with remote caching, but now a large proportion of the time spent on submodule CI runs is in the analysis phase.
I'd like to be able to dump the analysis cache to disk and load it in the submodule CI builds. Of course the flags should be saved as well, so that if the submodule CI uses incompatible flags that require the analysis cache to be cleared, that will happen as normal. It'll be up to the submodule to ensure its flags are the same as in the Docker image.
### What operating system are you running Bazel on?
GNU/Linux Ubuntu 16.04 (l.gcr.io/google/bazel:3.0.0).
### What's the output of `bazel info release`?
release 3.0.0
### What's the output of `git remote get-url origin ; git rev-parse master ; git rev-parse HEAD` ?
```
github-iphy:iphydf/toktok-stack
017559a8ff5644dade5a3909417b2357133dd288
546bffa99618672417cb5106ff1147e974693755
```
### Have you found anything relevant by searching the web?
Nothing useful.
Contributor guide
Research direction
No files, tests, or entry points are named. Start by tracing how Bazel stores the analysis cache and restores server state across startup, then determine how command-line flags are recorded and compared. Done means an analysis cache can be dumped to disk, loaded on the next startup, and invalidated when incompatible flags are used.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100