From 66213a64b2dc1b5491dd127b35aa7b9c960ea6c7 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Tue, 21 Sep 2021 17:50:30 -0700 Subject: [PATCH] Disable protobuf deterministic randomness in soong_build Soong writes out text protos for the sbox manifests, and if those change every time soong changes, we trigger rebuilds of significant portions of the tree. This is very annoying when attempting to iterate on Soong, so disable this functionality at the soong_build level. Bug: 200727888 Change-Id: Icf21e1775a4c4200e983c1b8ac66ddd780d7c90c --- cmd/soong_build/Android.bp | 1 + cmd/soong_build/main.go | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cmd/soong_build/Android.bp b/cmd/soong_build/Android.bp index 703a8759a..e85163e20 100644 --- a/cmd/soong_build/Android.bp +++ b/cmd/soong_build/Android.bp @@ -22,6 +22,7 @@ blueprint_go_binary { "blueprint", "blueprint-bootstrap", "golang-protobuf-proto", + "golang-protobuf-android", "soong", "soong-android", "soong-bp2build", diff --git a/cmd/soong_build/main.go b/cmd/soong_build/main.go index 09a223473..c5e889664 100644 --- a/cmd/soong_build/main.go +++ b/cmd/soong_build/main.go @@ -23,14 +23,14 @@ import ( "strings" "time" + "android/soong/android" "android/soong/bp2build" "android/soong/shared" "github.com/google/blueprint/bootstrap" "github.com/google/blueprint/deptools" "github.com/google/blueprint/pathtools" - - "android/soong/android" + androidProtobuf "google.golang.org/protobuf/android" ) var ( @@ -85,6 +85,12 @@ func init() { // Flags that probably shouldn't be flags of soong_build but we haven't found // the time to remove them yet flag.BoolVar(&runGoTests, "t", false, "build and run go tests during bootstrap") + + // Disable deterministic randomization in the protobuf package, so incremental + // builds with unrelated Soong changes don't trigger large rebuilds (since we + // write out text protos in command lines, and command line changes trigger + // rebuilds). + androidProtobuf.DisableRand() } func newNameResolver(config android.Config) *android.NameResolver {