mobile-install cache sharing

Aperta
#598 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 6 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
30/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
android, java
Ambito
build-system

Direzione di ricerca

Start by reading @rules_android//mobile_install:mi.bzl and mobile_install/utils.bzl around MIASPECT and dex(), then compare their dex actions with dex_desugar_aspect. The issue asks whether reuse of per-jar .dex.zip outputs is viable and seeks maintainer guidance on the mobile-install roadmap; a first step is to check those entry points and the project’s current direction. Done would require a maintainer decision and likely design work, so this is not a self-contained first contribution.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Context

We are evaluating bazel mobile-install (the Starlark MIASPECT in @rules_android//mobile_install:mi.bzl) for the inner dev loop of a large android_binary app.

  • Bazel 8.8.1, rules_android 0.6.0 (our local patches do not touch mobile_install/ or dexing)
  • Debug build, no ProGuard/R8
  • About 158k actions in the normal build graph

What we see

Dex outputs are not shared between build and mobile-install

bazel aquery "deps(//app:bin)" --output=summary, with and without --aspects=@rules_android//mobile_install:mi.bzl%MIASPECT:

Mnemonic build mobile-install delta
DesugarDexSharding 0 7,284 +7,284
ExtractJarResources 0 3,018 +3,018
SignShellApp / MakeSplitApk / CompileAndroidManifest 0 36 each +108
DexMerge 0 33 +33
Total 158,011 168,466 +10,455

The normal build already dexes each jar with Desugar (9.7k) and DexBuilder (39k) through dex_desugar_aspect. The MI aspect (mobile_install/utils.bzl dex()) runs the same desugar and dexbuilder tools, but in one android_kit dex action per jar that writes N shard zips. The command line and outputs are different, so no action key overlaps with the normal build, local or remote. Resource processing is shared (MI adds no compile/link resource actions).

Results:

  • A developer who uses both bazel build and bazel mobile-install dexes the app twice.
  • A cold mobile-install on top of a fully built (and remote-cached) normal build ran about 6,700 local actions and took about 26 minutes on a laptop.
  • The MI outputs add about 3.5 GB under bazel-bin/<app>_mi.
  • Remote caching helps only partly. To warm the cache, CI must run mobile-install as well as build, which adds about 10.5k actions per run.

Questions

  1. Roadmap: What is the plan for mobile-install in rules_android? Is the MIASPECT path the long-term supported approach, or is there a plan to move to another approach (for example, build the normal APK and deploy deltas with the Studio deployer)?
  2. By design? Is the separate dexing path in the MI aspect (android_kit dex with per-jar shards) intentionally independent of dex_desugar_aspect? If yes, what is the reason (shard layout, incremental granularity, other)?
  3. Reuse normal dexing: Would you accept a change that makes the MI aspect consume the per-jar .dex.zip outputs of dex_desugar_aspect, and bucket whole jars into the DexMerge shards? This removes the DesugarDexSharding actions and lets MI share the cache with build. Are there known problems with this, such as shard balance or desugaring differences?
Lingua principale
Java
Stelle
205
Fork
113
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bazelbuild/rules_android

Tutte le issue di bazelbuild/rules_android

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.