Log information for Mixed Builds modules.
Test: Output matches expected. https://paste.googleplex.com/5913495636803584?raw
Performance evaluated: https://docs.google.com/spreadsheets/d/1X7eOVBKEZUwUWl5i8CDfBo9yUeZrDPXWi2JYO4BEZt4/edit?resourcekey=0-co8crIFW9dpiedhCMkhAgw#gid=0
Change-Id: I88780c7cc52a189a72216c5e2e499c96574b3731
diff --git a/android/config.go b/android/config.go
index ee058e8..d695217 100644
--- a/android/config.go
+++ b/android/config.go
@@ -170,6 +170,10 @@
ninjaFileDepsSet sync.Map
OncePer
+
+ mixedBuildsLock sync.Mutex
+ mixedBuildEnabledModules map[string]struct{}
+ mixedBuildDisabledModules map[string]struct{}
}
type deviceConfig struct {
@@ -375,7 +379,9 @@
// passed to PathForSource or PathForModuleSrc.
TestAllowNonExistentPaths: true,
- BazelContext: noopBazelContext{},
+ BazelContext: noopBazelContext{},
+ mixedBuildDisabledModules: make(map[string]struct{}),
+ mixedBuildEnabledModules: make(map[string]struct{}),
}
config.deviceConfig = &deviceConfig{
config: config,
@@ -466,8 +472,10 @@
runGoTests: runGoTests,
multilibConflicts: make(map[ArchType]bool),
- moduleListFile: moduleListFile,
- fs: pathtools.NewOsFs(absSrcDir),
+ moduleListFile: moduleListFile,
+ fs: pathtools.NewOsFs(absSrcDir),
+ mixedBuildDisabledModules: make(map[string]struct{}),
+ mixedBuildEnabledModules: make(map[string]struct{}),
}
config.deviceConfig = &deviceConfig{
@@ -2038,3 +2046,14 @@
func (c *config) UseHostMusl() bool {
return Bool(c.productVariables.HostMusl)
}
+
+func (c *config) LogMixedBuild(ctx ModuleContext, useBazel bool) {
+ moduleName := ctx.Module().Name()
+ c.mixedBuildsLock.Lock()
+ defer c.mixedBuildsLock.Unlock()
+ if useBazel {
+ c.mixedBuildEnabledModules[moduleName] = struct{}{}
+ } else {
+ c.mixedBuildDisabledModules[moduleName] = struct{}{}
+ }
+}