build: parallelize R8 across apps, keep per-task determinism
- Commit
b1d3ed70c4343e763caf7d6ecc23c91a329e1dd2- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-18 17:28 UTC (17 days ago)
- Parents
7e7a794
Supersede the threadPoolSize=32 bump: R8 9.5 races its worker threads while recording argument-type-strengthened signatures, so multi-threaded R8 output depends on thread timing and breaks F-Droid byte-for-byte reproducibility (the settings.gradle.kts deterministicR8 profile pins each R8 task to one thread in its own process for exactly this reason). The actual serializer was android.r8.maxWorkers, referenced in comments but never set, leaving AGP's small default. Set it to 48: dozens of deterministic single-thread R8 processes (3g heap cap each) run concurrently across apps.
Diff
gradle.properties
diff --git a/gradle.properties b/gradle.propertiesindex a1ea7d0ada..af1c14c7ad 100644--- a/gradle.properties+++ b/gradle.properties@@ -27,11 +27,15 @@ kotlin.code.style=official # Performance & Optimization org.gradle.configuration-cache=true android.enableR8.fullMode=true-# R8 threads per task (each runs in its own process, see settings.gradle.kts).-# Raised to 32 for parallel local release builds (owner decision, 2026-11-18);-# multi-threaded R8 output can depend on thread timing, so F-Droid byte-for-byte-# reproducibility should be re-verified before relying on it for a release.-android.r8.threadPoolSize=32+# One thread per R8 task (each runs in its own process, see settings.gradle.kts):+# multi-threaded R8 output depends on thread timing, which broke F-Droid's+# byte-for-byte reproducibility. Release builds parallelize across apps instead+# (android.r8.maxWorkers below).+android.r8.threadPoolSize=1+# Concurrent per-app R8 processes. Each is a single deterministic thread with a+# 3g heap cap (settings.gradle.kts deterministicR8 profile), so 48 workers use+# at most ~144g and ~48 cores while every APK stays byte-identical anywhere.+android.r8.maxWorkers=48 # Preview Support (Remove once SDK 37 is stable) android.suppressUnsupportedCompileSdk=37.0