Skip to content

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

Closed
azad-uber-2 wants to merge 3 commits into
uber-common:uber/android/8.1.1from
azad-uber-2:azad/mnemonic-cache-salt-8.1.1
Closed

azad-uber-2 wants to merge 3 commits into
uber-common:uber/android/8.1.1from
azad-uber-2:azad/mnemonic-cache-salt-8.1.1

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.

Depends on #32 and #33

Test plan

  • Built Bazel binary, java_tools, and android_tools successfully from this branch
  • carbonBundleRelease build in progress

🤖 Generated with Claude Code

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

azad-uber-2 and others added 3 commits May 31, 2026 22:25
Remove two extra closing braces that cause a syntax error during
the java_tools bootstrap build (unexpected token: void).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The desugar_jdk_libs.jar target no longer exists in the Bazel 8 tree,
causing the android_tools bootstrap build to fail.

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 all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ azad-uber-2
❌ oliviernotteghem
You have signed the CLA already but the status is still pending? Let us recheck it.

@azad-uber-2

Copy link
Copy Markdown
Author

Superseded by standalone PR.

@azad-uber-2
azad-uber-2 deleted the azad/mnemonic-cache-salt-8.1.1 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