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
This commit is contained in:
Dan Willemsen 2021-09-21 17:50:30 -07:00
parent b13daf2ba7
commit 66213a64b2
2 changed files with 9 additions and 2 deletions

View file

@ -22,6 +22,7 @@ blueprint_go_binary {
"blueprint", "blueprint",
"blueprint-bootstrap", "blueprint-bootstrap",
"golang-protobuf-proto", "golang-protobuf-proto",
"golang-protobuf-android",
"soong", "soong",
"soong-android", "soong-android",
"soong-bp2build", "soong-bp2build",

View file

@ -23,14 +23,14 @@ import (
"strings" "strings"
"time" "time"
"android/soong/android"
"android/soong/bp2build" "android/soong/bp2build"
"android/soong/shared" "android/soong/shared"
"github.com/google/blueprint/bootstrap" "github.com/google/blueprint/bootstrap"
"github.com/google/blueprint/deptools" "github.com/google/blueprint/deptools"
"github.com/google/blueprint/pathtools" "github.com/google/blueprint/pathtools"
androidProtobuf "google.golang.org/protobuf/android"
"android/soong/android"
) )
var ( var (
@ -85,6 +85,12 @@ func init() {
// Flags that probably shouldn't be flags of soong_build but we haven't found // Flags that probably shouldn't be flags of soong_build but we haven't found
// the time to remove them yet // the time to remove them yet
flag.BoolVar(&runGoTests, "t", false, "build and run go tests during bootstrap") 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 { func newNameResolver(config android.Config) *android.NameResolver {