diff --git a/android/module.go b/android/module.go index 9fbbb1e7b..f311165ef 100644 --- a/android/module.go +++ b/android/module.go @@ -848,10 +848,6 @@ type ModuleBase struct { // Merged Aconfig files for all transitive deps. aconfigFilePaths Paths - // 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 - // complianceMetadataInfo is for different module types to dump metadata. // See android.ModuleContext interface. complianceMetadataInfo *ComplianceMetadataInfo @@ -1999,7 +1995,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) SetProvider(ctx, InstallFilesProvider, installFiles) buildLicenseMetadata(ctx, ctx.licenseMetadataFile) - if m.moduleInfoJSON != nil { + if ctx.moduleInfoJSON != nil { var installed InstallPaths installed = append(installed, ctx.katiInstalls.InstallPaths()...) installed = append(installed, ctx.katiSymlinks.InstallPaths()...) @@ -2019,28 +2015,28 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) data = append(data, d.ToRelativeInstallPath()) } - if m.moduleInfoJSON.Uninstallable { + if ctx.moduleInfoJSON.Uninstallable { installedStrings = nil - if len(m.moduleInfoJSON.CompatibilitySuites) == 1 && m.moduleInfoJSON.CompatibilitySuites[0] == "null-suite" { - m.moduleInfoJSON.CompatibilitySuites = nil - m.moduleInfoJSON.TestConfig = nil - m.moduleInfoJSON.AutoTestConfig = nil + if len(ctx.moduleInfoJSON.CompatibilitySuites) == 1 && ctx.moduleInfoJSON.CompatibilitySuites[0] == "null-suite" { + ctx.moduleInfoJSON.CompatibilitySuites = nil + ctx.moduleInfoJSON.TestConfig = nil + ctx.moduleInfoJSON.AutoTestConfig = nil data = nil } } - m.moduleInfoJSON.core = CoreModuleInfoJSON{ - RegisterName: m.moduleInfoRegisterName(ctx, m.moduleInfoJSON.SubName), + ctx.moduleInfoJSON.core = CoreModuleInfoJSON{ + RegisterName: m.moduleInfoRegisterName(ctx, ctx.moduleInfoJSON.SubName), Path: []string{ctx.ModuleDir()}, Installed: installedStrings, - ModuleName: m.BaseModuleName() + m.moduleInfoJSON.SubName, + ModuleName: m.BaseModuleName() + ctx.moduleInfoJSON.SubName, SupportedVariants: []string{m.moduleInfoVariant(ctx)}, TargetDependencies: targetRequired, HostDependencies: hostRequired, Data: data, Required: m.RequiredModuleNames(ctx), } - SetProvider(ctx, ModuleInfoJSONProvider, m.moduleInfoJSON) + SetProvider(ctx, ModuleInfoJSONProvider, ctx.moduleInfoJSON) } m.buildParams = ctx.buildParams diff --git a/android/module_context.go b/android/module_context.go index 6b64b1deb..5322240e5 100644 --- a/android/module_context.go +++ b/android/module_context.go @@ -266,6 +266,10 @@ type moduleContext struct { buildParams []BuildParams ruleParams map[blueprint.Rule]blueprint.RuleParams variables map[string]string + + // 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 } var _ ModuleContext = &moduleContext{} @@ -729,11 +733,11 @@ func (m *moduleContext) LicenseMetadataFile() Path { } func (m *moduleContext) ModuleInfoJSON() *ModuleInfoJSON { - if moduleInfoJSON := m.module.base().moduleInfoJSON; moduleInfoJSON != nil { + if moduleInfoJSON := m.moduleInfoJSON; moduleInfoJSON != nil { return moduleInfoJSON } moduleInfoJSON := &ModuleInfoJSON{} - m.module.base().moduleInfoJSON = moduleInfoJSON + m.moduleInfoJSON = moduleInfoJSON return moduleInfoJSON }