Merge "Remove containersInfo, complianceMetadataInfo and aconfigFilePaths from ModuleBase." into main

This commit is contained in:
Yu Liu
2024-08-29 17:07:05 +00:00
committed by Gerrit Code Review
4 changed files with 36 additions and 28 deletions

View File

@@ -136,7 +136,7 @@ func aconfigUpdateAndroidBuildActions(ctx ModuleContext) {
AconfigFiles: mergedAconfigFiles,
ModeInfos: mergedModeInfos,
})
ctx.Module().base().aconfigFilePaths = getAconfigFilePaths(ctx.Module().base(), mergedAconfigFiles)
ctx.setAconfigPaths(getAconfigFilePaths(ctx.Module().base(), mergedAconfigFiles))
}
}

View File

@@ -223,7 +223,6 @@ var containerBoundaryFunctionsTable = map[*container]containerBoundaryFunc{
// ----------------------------------------------------------------------------
type InstallableModule interface {
ContainersInfo() ContainersInfo
StaticDependencyTags() []blueprint.DependencyTag
DynamicDependencyTags() []blueprint.DependencyTag
}
@@ -417,7 +416,7 @@ func generateContainerInfo(ctx ModuleContext) ContainersInfo {
func getContainerModuleInfo(ctx ModuleContext, module Module) (ContainersInfo, bool) {
if ctx.Module() == module {
return module.ContainersInfo(), true
return ctx.getContainersInfo(), true
}
return OtherModuleProvider(ctx, module, ContainersInfoProvider)
@@ -432,7 +431,7 @@ func setContainerInfo(ctx ModuleContext) {
if _, ok := ctx.Module().(InstallableModule); ok {
containersInfo := generateContainerInfo(ctx)
ctx.Module().base().containersInfo = containersInfo
ctx.setContainersInfo(containersInfo)
SetProvider(ctx, ContainersInfoProvider, containersInfo)
}
}

View File

@@ -112,9 +112,6 @@ type Module interface {
VintfFragmentModuleNames(ctx ConfigAndErrorContext) []string
ConfigurableEvaluator(ctx ConfigAndErrorContext) proptools.ConfigurableEvaluator
// Get the information about the containers this module belongs to.
ContainersInfo() ContainersInfo
}
// Qualified id for a module
@@ -839,17 +836,6 @@ type ModuleBase struct {
buildParams []BuildParams
ruleParams map[blueprint.Rule]blueprint.RuleParams
variables map[string]string
// Merged Aconfig files for all transitive deps.
aconfigFilePaths Paths
// complianceMetadataInfo is for different module types to dump metadata.
// See android.ModuleContext interface.
complianceMetadataInfo *ComplianceMetadataInfo
// containersInfo stores the information about the containers and the information of the
// apexes the module belongs to.
containersInfo ContainersInfo
}
func (m *ModuleBase) AddJSONData(d *map[string]interface{}) {
@@ -2089,10 +2075,6 @@ func (m *ModuleBase) moduleInfoVariant(ctx ModuleContext) string {
return variant
}
func (m *ModuleBase) ContainersInfo() ContainersInfo {
return m.containersInfo
}
// Check the supplied dist structure to make sure that it is valid.
//
// property - the base property, e.g. dist or dists[1], which is combined with the

View File

@@ -226,6 +226,12 @@ type ModuleContext interface {
// which usually happens in GenerateAndroidBuildActions() of a module type.
// See android.ModuleBase.complianceMetadataInfo
ComplianceMetadataInfo() *ComplianceMetadataInfo
// Get the information about the containers this module belongs to.
getContainersInfo() ContainersInfo
setContainersInfo(info ContainersInfo)
setAconfigPaths(paths Paths)
}
type moduleContext struct {
@@ -270,6 +276,17 @@ type moduleContext struct {
// moduleInfoJSON can be filled out by GenerateAndroidBuildActions to write a JSON file that will
// be included in the final module-info.json produced by Make.
moduleInfoJSON *ModuleInfoJSON
// containersInfo stores the information about the containers and the information of the
// apexes the module belongs to.
containersInfo ContainersInfo
// Merged Aconfig files for all transitive deps.
aconfigFilePaths Paths
// complianceMetadataInfo is for different module types to dump metadata.
// See android.ModuleContext interface.
complianceMetadataInfo *ComplianceMetadataInfo
}
var _ ModuleContext = &moduleContext{}
@@ -517,7 +534,11 @@ func (m *moduleContext) PackageFile(installPath InstallPath, name string, srcPat
}
func (m *moduleContext) getAconfigPaths() *Paths {
return &m.module.base().aconfigFilePaths
return &m.aconfigFilePaths
}
func (m *moduleContext) setAconfigPaths(paths Paths) {
m.aconfigFilePaths = paths
}
func (m *moduleContext) packageFile(fullInstallPath InstallPath, srcPath Path, executable bool) PackagingSpec {
@@ -768,12 +789,10 @@ func (m *moduleContext) SetLicenseInstallMap(installMap []string) {
}
func (m *moduleContext) ComplianceMetadataInfo() *ComplianceMetadataInfo {
if complianceMetadataInfo := m.module.base().complianceMetadataInfo; complianceMetadataInfo != nil {
return complianceMetadataInfo
if m.complianceMetadataInfo == nil {
m.complianceMetadataInfo = NewComplianceMetadataInfo()
}
complianceMetadataInfo := NewComplianceMetadataInfo()
m.module.base().complianceMetadataInfo = complianceMetadataInfo
return complianceMetadataInfo
return m.complianceMetadataInfo
}
// Returns a list of paths expanded from globs and modules referenced using ":module" syntax. The property must
@@ -813,3 +832,11 @@ func (m *moduleContext) HostRequiredModuleNames() []string {
func (m *moduleContext) TargetRequiredModuleNames() []string {
return m.module.TargetRequiredModuleNames()
}
func (m *moduleContext) getContainersInfo() ContainersInfo {
return m.containersInfo
}
func (m *moduleContext) setContainersInfo(info ContainersInfo) {
m.containersInfo = info
}