protoc plugin that stamps a date into the output.
This is non-deterministic and means that the files produced will be different on each build,
so anything (transitively) depending on them will be a cache miss.
Non-determinism higher in the build graph causes more cascading cache misses and should be addressed first.
Remote Build Execution is sometimes sold as a solution, because it spreads the work over many machines, but if the work is unneeded this is the wrong solution because costs are excessive.
The best answer is simply “less execution”.
- Run two builds, collecting the
--execution_log_binary_file. Ideally these builds are on different machines but at the same VCS snapshot. - Run
bazel dump --action_cacheand see if thedigestKeymatches expectations. - The Aspect CLI has an
explaincommand. When run with the--cache-missesflag, it compares two “compact” execution logs, looking for non-determinism by analyzing:- Actions: Changed outputs, timing, or ordering
- Files: Unexpected file modifications
- Environment: Non-hermetic environment variables
- Arguments: Inconsistent build flags

