Skip to content

[Android] Add --mnemonic_cache_salt flag for Bazel 8.1.1 - #37

Merged
azad-uber-2 merged 1 commit into
uber-common:uber/android/8.1.1from
azad-uber-2:azad/mnemonic-cache-salt-8.1.1-v2
Jun 1, 2026
Merged

azad-uber-2 merged 1 commit into
uber-common:uber/android/8.1.1from
azad-uber-2:azad/mnemonic-cache-salt-8.1.1-v2

Conversation

@azad-uber-2

Copy link
Copy Markdown

Summary

Cherry-pick of fae19c5 from uber/android/7.6.1 to uber/android/8.1.1 with adaptations for the Bazel 8 codebase:

  • DigestUtils.xor(): Backported from 7.6.1 — the method was removed in upstream Bazel 8 (replaced by combineUnordered) but is needed by the mnemonic cache salt feature.
  • RemoteExecutionService.buildSalt(): The method is static in 8.1.1 (was non-static in 7.6.1), so mnemonicCacheSalts is passed as a parameter instead of accessed as an instance field.

Test plan

  • Built Bazel binary, java_tools, and android_tools successfully from this branch
  • Built carbonBundleRelease in the Android monorepo using this binary (with the other two fixes applied separately)

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

…validation

Add a new `--mnemonic_cache_salt=<Mnemonic>=<value>` flag that allows
selectively busting the local and remote action cache for specific action
types (e.g. `--mnemonic_cache_salt=Javac=V2`).

The salt is included in the action properties digest (local cache) and in
the CacheSalt proto (remote cache), so changing or removing it forces a
cache miss only for the targeted mnemonic. Salts for unrelated mnemonics
have no effect on other actions.

Changes:
- ExecutionOptions: add `--mnemonic_cache_salt` flag + `getMnemonicCacheSalts()` helper
- ActionCache.Entry: include optional mnemonic salt in `digestActionProperties()`
- ActionCacheChecker: thread `mnemonicCacheSalts` through `getTokenIfNeedToExecute()` and `updateActionCache()`; add backward-compat overloads
- SkyframeActionExecutor / SkyframeExecutor: accept and store `mnemonicCacheSalts` at configure time
- SkyframeBuilder / ExecutionTool: read the flag and pass it down through the builder pipeline
- RemoteExecutionService: include mnemonic salt in `CacheSalt` proto for remote cache
- RemoteActionContextProvider: wire `mnemonicCacheSalts` into `RemoteExecutionService` via setter
- cache_salt.proto: add `mnemonic_salt` field (field 4)
- Tests: fix pre-existing 8-param `updateActionCache` call; add 7 new tests covering salt hit/miss semantics

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@azad-uber-2
azad-uber-2 merged commit de68057 into uber-common:uber/android/8.1.1 Jun 1, 2026
3 of 4 checks passed
@azad-uber-2
azad-uber-2 deleted the azad/mnemonic-cache-salt-8.1.1-v2 branch June 1, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants