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
This commit is contained in:
MarkDacek
2022-04-21 18:33:17 +00:00
committed by Mark Dacek
parent e91f9d439e
commit ff851b83b6
8 changed files with 204 additions and 38 deletions

View File

@@ -170,6 +170,10 @@ type config struct {
ninjaFileDepsSet sync.Map
OncePer
mixedBuildsLock sync.Mutex
mixedBuildEnabledModules map[string]struct{}
mixedBuildDisabledModules map[string]struct{}
}
type deviceConfig struct {
@@ -375,7 +379,9 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string
// 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 @@ func NewConfig(moduleListFile string, runGoTests bool, outDir, soongOutDir strin
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) RBEWrapper() string {
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{}{}
}
}