diff options
Diffstat (limited to 'android')
-rw-r--r-- | android/aconfig_providers.go | 2 | ||||
-rw-r--r-- | android/all_teams.go | 2 | ||||
-rw-r--r-- | android/androidmk.go | 10 | ||||
-rw-r--r-- | android/base_module_context.go | 4 | ||||
-rw-r--r-- | android/compliance_metadata.go | 2 | ||||
-rw-r--r-- | android/container.go | 2 | ||||
-rw-r--r-- | android/gen_notice.go | 2 | ||||
-rw-r--r-- | android/license_metadata.go | 2 | ||||
-rw-r--r-- | android/logtags.go | 2 | ||||
-rw-r--r-- | android/makevars.go | 2 | ||||
-rw-r--r-- | android/module.go | 8 | ||||
-rw-r--r-- | android/package.go | 2 | ||||
-rw-r--r-- | android/paths.go | 2 | ||||
-rw-r--r-- | android/prebuilt.go | 4 | ||||
-rw-r--r-- | android/provider.go | 8 | ||||
-rw-r--r-- | android/testing.go | 6 |
16 files changed, 34 insertions, 26 deletions
diff --git a/android/aconfig_providers.go b/android/aconfig_providers.go index 9c71d927d..bb73f0bdd 100644 --- a/android/aconfig_providers.go +++ b/android/aconfig_providers.go @@ -248,7 +248,7 @@ func getContainer(m Module) string { // Please only access the module's internal data through providers. func getContainerUsingProviders(ctx OtherModuleProviderContext, m Module) string { container := "system" - commonInfo, _ := OtherModuleProvider(ctx, m, CommonModuleInfoProvider) + commonInfo := OtherModulePointerProviderOrDefault(ctx, m, CommonModuleInfoProvider) if commonInfo.Vendor || commonInfo.Proprietary || commonInfo.SocSpecific { container = "vendor" } else if commonInfo.ProductSpecific { diff --git a/android/all_teams.go b/android/all_teams.go index 5e76e53bf..18a050f5d 100644 --- a/android/all_teams.go +++ b/android/all_teams.go @@ -116,7 +116,7 @@ func (t *allTeamsSingleton) GenerateBuildActions(ctx SingletonContext) { testOnly: testModInfo.TestOnly, topLevelTestTarget: testModInfo.TopLevelTarget, kind: ctx.ModuleType(module), - teamName: OtherModuleProviderOrDefault(ctx, module, CommonModuleInfoProvider).Team, + teamName: OtherModulePointerProviderOrDefault(ctx, module, CommonModuleInfoProvider).Team, } t.teams_for_mods[module.Name()] = entry diff --git a/android/androidmk.go b/android/androidmk.go index 694f5d66b..784559312 100644 --- a/android/androidmk.go +++ b/android/androidmk.go @@ -888,14 +888,14 @@ func getSoongOnlyDataFromMods(ctx fillInEntriesContext, mods []Module) ([]distCo } } - commonInfo, _ := OtherModuleProvider(ctx, mod, CommonModuleInfoProvider) + commonInfo := OtherModulePointerProviderOrDefault(ctx, mod, CommonModuleInfoProvider) if commonInfo.SkipAndroidMkProcessing { continue } if info, ok := OtherModuleProvider(ctx, mod, AndroidMkInfoProvider); ok { // Deep copy the provider info since we need to modify the info later info := deepCopyAndroidMkProviderInfo(info) - info.PrimaryInfo.fillInEntries(ctx, mod, &commonInfo) + info.PrimaryInfo.fillInEntries(ctx, mod, commonInfo) if info.PrimaryInfo.disabled() { continue } @@ -1320,7 +1320,7 @@ var AndroidMkInfoProvider = blueprint.NewProvider[*AndroidMkProviderInfo]() // Please only access the module's internal data through providers. func translateAndroidMkEntriesInfoModule(ctx SingletonContext, w io.Writer, moduleInfoJSONs *[]*ModuleInfoJSON, mod Module, providerInfo *AndroidMkProviderInfo) error { - commonInfo, _ := OtherModuleProvider(ctx, mod, CommonModuleInfoProvider) + commonInfo := OtherModulePointerProviderOrDefault(ctx, mod, CommonModuleInfoProvider) if commonInfo.SkipAndroidMkProcessing { return nil } @@ -1331,11 +1331,11 @@ func translateAndroidMkEntriesInfoModule(ctx SingletonContext, w io.Writer, modu aconfigUpdateAndroidMkInfos(ctx, mod, &info) // Any new or special cases here need review to verify correct propagation of license information. - info.PrimaryInfo.fillInEntries(ctx, mod, &commonInfo) + info.PrimaryInfo.fillInEntries(ctx, mod, commonInfo) info.PrimaryInfo.write(w) if len(info.ExtraInfo) > 0 { for _, ei := range info.ExtraInfo { - ei.fillInEntries(ctx, mod, &commonInfo) + ei.fillInEntries(ctx, mod, commonInfo) ei.write(w) } } diff --git a/android/base_module_context.go b/android/base_module_context.go index eba367034..5cb9e71cf 100644 --- a/android/base_module_context.go +++ b/android/base_module_context.go @@ -410,7 +410,7 @@ func (b *baseModuleContext) validateAndroidModuleProxy( return &aModule } - if !OtherModuleProviderOrDefault(b, module, CommonModuleInfoProvider).Enabled { + if !OtherModulePointerProviderOrDefault(b, module, CommonModuleInfoProvider).Enabled { if t, ok := tag.(AllowDisabledModuleDependency); !ok || !t.AllowDisabledModuleDependencyProxy(b, aModule) { if b.Config().AllowMissingDependencies() { b.AddMissingDependencies([]string{b.OtherModuleName(aModule)}) @@ -440,7 +440,7 @@ func (b *baseModuleContext) getDirectDepsInternal(name string, tag blueprint.Dep func (b *baseModuleContext) getDirectDepsProxyInternal(name string, tag blueprint.DependencyTag) []ModuleProxy { var deps []ModuleProxy b.VisitDirectDepsProxy(func(module ModuleProxy) { - if OtherModuleProviderOrDefault(b, module, CommonModuleInfoProvider).BaseModuleName == name { + if OtherModulePointerProviderOrDefault(b, module, CommonModuleInfoProvider).BaseModuleName == name { returnedTag := b.OtherModuleDependencyTag(module) if tag == nil || returnedTag == tag { deps = append(deps, module) diff --git a/android/compliance_metadata.go b/android/compliance_metadata.go index c15a206ec..16a385300 100644 --- a/android/compliance_metadata.go +++ b/android/compliance_metadata.go @@ -304,7 +304,7 @@ func (c *complianceMetadataSingleton) GenerateBuildActions(ctx SingletonContext) rowId := -1 ctx.VisitAllModuleProxies(func(module ModuleProxy) { - commonInfo, _ := OtherModuleProvider(ctx, module, CommonModuleInfoProvider) + commonInfo := OtherModulePointerProviderOrDefault(ctx, module, CommonModuleInfoProvider) if !commonInfo.Enabled { return } diff --git a/android/container.go b/android/container.go index 5d223b86a..547fe816c 100644 --- a/android/container.go +++ b/android/container.go @@ -39,7 +39,7 @@ type StubsAvailableModule interface { // Returns true if the dependency module is a stubs module var depIsStubsModule exceptionHandleFunc = func(mctx ModuleContext, _ Module, dep ModuleProxy) bool { - return OtherModuleProviderOrDefault(mctx, dep, CommonModuleInfoProvider).IsStubsModule + return OtherModulePointerProviderOrDefault(mctx, dep, CommonModuleInfoProvider).IsStubsModule } // Returns true if the dependency module belongs to any of the apexes. diff --git a/android/gen_notice.go b/android/gen_notice.go index ae831185f..45f90f47c 100644 --- a/android/gen_notice.go +++ b/android/gen_notice.go @@ -60,7 +60,7 @@ func (s *genNoticeBuildRules) GenerateBuildActions(ctx SingletonContext) { for _, name := range gm.For { mods := ctx.ModuleVariantsFromName(m, name) for _, mod := range mods { - if !OtherModuleProviderOrDefault(ctx, mod, CommonModuleInfoProvider).Enabled { // don't depend on variants without build rules + if !OtherModulePointerProviderOrDefault(ctx, mod, CommonModuleInfoProvider).Enabled { // don't depend on variants without build rules continue } modules = append(modules, mod) diff --git a/android/license_metadata.go b/android/license_metadata.go index e79febb8f..0b880dd8a 100644 --- a/android/license_metadata.go +++ b/android/license_metadata.go @@ -65,7 +65,7 @@ func buildLicenseMetadata(ctx *moduleContext, licenseMetadataFile WritablePath) var allDepMetadataDepSets []depset.DepSet[Path] ctx.VisitDirectDepsProxy(func(dep ModuleProxy) { - if !OtherModuleProviderOrDefault(ctx, dep, CommonModuleInfoProvider).Enabled { + if !OtherModulePointerProviderOrDefault(ctx, dep, CommonModuleInfoProvider).Enabled { return } diff --git a/android/logtags.go b/android/logtags.go index ef7a61259..074f402e7 100644 --- a/android/logtags.go +++ b/android/logtags.go @@ -43,7 +43,7 @@ func MergedLogtagsPath(ctx PathContext) OutputPath { func (l *logtagsSingleton) GenerateBuildActions(ctx SingletonContext) { var allLogtags Paths ctx.VisitAllModuleProxies(func(module ModuleProxy) { - if !OtherModuleProviderOrDefault(ctx, module, CommonModuleInfoProvider).ExportedToMake { + if !OtherModulePointerProviderOrDefault(ctx, module, CommonModuleInfoProvider).ExportedToMake { return } if logtagsInfo, ok := OtherModuleProvider(ctx, module, LogtagsProviderKey); ok { diff --git a/android/makevars.go b/android/makevars.go index e1d947dff..7017e7db0 100644 --- a/android/makevars.go +++ b/android/makevars.go @@ -259,7 +259,7 @@ func (s *makeVarsSingleton) GenerateBuildActions(ctx SingletonContext) { singletonDists.lock.Unlock() ctx.VisitAllModuleProxies(func(m ModuleProxy) { - commonInfo, _ := OtherModuleProvider(ctx, m, CommonModuleInfoProvider) + commonInfo := OtherModulePointerProviderOrDefault(ctx, m, CommonModuleInfoProvider) if provider, ok := OtherModuleProvider(ctx, m, ModuleMakeVarsInfoProvider); ok && commonInfo.Enabled { mctx := &makeVarsContext{ diff --git a/android/module.go b/android/module.go index 334e5b722..0fba9aa63 100644 --- a/android/module.go +++ b/android/module.go @@ -1488,7 +1488,7 @@ func (m *ModuleBase) computeInstallDeps(ctx ModuleContext) ([]depset.DepSet[Inst // Installation is still handled by Make, so anything hidden from Make is not // installable. info := OtherModuleProviderOrDefault(ctx, dep, InstallFilesProvider) - commonInfo := OtherModuleProviderOrDefault(ctx, dep, CommonModuleInfoProvider) + commonInfo := OtherModulePointerProviderOrDefault(ctx, dep, CommonModuleInfoProvider) if !commonInfo.HideFromMake && !commonInfo.SkipInstall { installDeps = append(installDeps, info.TransitiveInstallFiles) } @@ -1505,7 +1505,7 @@ func (m *ModuleBase) computeInstallDeps(ctx ModuleContext) ([]depset.DepSet[Inst // should also install the output files of the given dependency and dependency tag. func isInstallDepNeeded(ctx ModuleContext, dep ModuleProxy) bool { // Don't add a dependency from the platform to a library provided by an apex. - if OtherModuleProviderOrDefault(ctx, dep, CommonModuleInfoProvider).UninstallableApexPlatformVariant { + if OtherModulePointerProviderOrDefault(ctx, dep, CommonModuleInfoProvider).UninstallableApexPlatformVariant { return false } // Only install modules if the dependency tag is an InstallDepNeeded tag. @@ -1928,7 +1928,7 @@ type ApiLevelOrPlatform struct { IsPlatform bool } -var CommonModuleInfoProvider = blueprint.NewProvider[CommonModuleInfo]() +var CommonModuleInfoProvider = blueprint.NewProvider[*CommonModuleInfo]() type PrebuiltModuleInfo struct { SourceExists bool @@ -2336,7 +2336,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) if mm, ok := m.module.(interface{ BaseModuleName() string }); ok { commonData.BaseModuleName = mm.BaseModuleName() } - SetProvider(ctx, CommonModuleInfoProvider, commonData) + SetProvider(ctx, CommonModuleInfoProvider, &commonData) if p, ok := m.module.(PrebuiltInterface); ok && p.Prebuilt() != nil { SetProvider(ctx, PrebuiltModuleInfoProvider, PrebuiltModuleInfo{ SourceExists: p.Prebuilt().SourceExists(), diff --git a/android/package.go b/android/package.go index 0f6a7678c..52bddf9d9 100644 --- a/android/package.go +++ b/android/package.go @@ -62,7 +62,7 @@ func (p *packageModule) DepsMutator(ctx BottomUpMutatorContext) { } func (p *packageModule) GenerateBuildActions(ctx blueprint.ModuleContext) { - ctx.SetProvider(CommonModuleInfoProvider, CommonModuleInfo{ + ctx.SetProvider(CommonModuleInfoProvider, &CommonModuleInfo{ Enabled: true, PrimaryLicensesProperty: p.primaryLicensesProperty, }) diff --git a/android/paths.go b/android/paths.go index f7fcd35ff..977473fbd 100644 --- a/android/paths.go +++ b/android/paths.go @@ -683,7 +683,7 @@ func getPathsFromModuleDep(ctx ModuleWithDepsPathContext, path, moduleName, tag if module == nil { return nil, missingDependencyError{[]string{moduleName}} } - if !OtherModuleProviderOrDefault(ctx, *module, CommonModuleInfoProvider).Enabled { + if !OtherModulePointerProviderOrDefault(ctx, *module, CommonModuleInfoProvider).Enabled { return nil, missingDependencyError{[]string{moduleName}} } diff --git a/android/prebuilt.go b/android/prebuilt.go index 0178f769c..1ff009bf5 100644 --- a/android/prebuilt.go +++ b/android/prebuilt.go @@ -358,7 +358,7 @@ func IsModulePreferred(module Module) bool { } func IsModulePreferredProxy(ctx OtherModuleProviderContext, module ModuleProxy) bool { - if OtherModuleProviderOrDefault(ctx, module, CommonModuleInfoProvider).ReplacedByPrebuilt { + if OtherModulePointerProviderOrDefault(ctx, module, CommonModuleInfoProvider).ReplacedByPrebuilt { // A source module that has been replaced by a prebuilt counterpart. return false } @@ -397,7 +397,7 @@ func GetEmbeddedPrebuilt(module Module) *Prebuilt { // the right module. This function is only safe to call after all TransitionMutators // have run, e.g. in GenerateAndroidBuildActions. func PrebuiltGetPreferred(ctx BaseModuleContext, module Module) Module { - if !OtherModuleProviderOrDefault(ctx, module, CommonModuleInfoProvider).ReplacedByPrebuilt { + if !OtherModulePointerProviderOrDefault(ctx, module, CommonModuleInfoProvider).ReplacedByPrebuilt { return module } if _, ok := OtherModuleProvider(ctx, module, PrebuiltModuleInfoProvider); ok { diff --git a/android/provider.go b/android/provider.go index d005daf55..aae93ef88 100644 --- a/android/provider.go +++ b/android/provider.go @@ -41,6 +41,14 @@ func OtherModuleProviderOrDefault[K any](ctx OtherModuleProviderContext, module return value } +func OtherModulePointerProviderOrDefault[K *T, T any](ctx OtherModuleProviderContext, module blueprint.Module, provider blueprint.ProviderKey[K]) K { + if value, ok := OtherModuleProvider(ctx, module, provider); ok { + return value + } + var val T + return &val +} + // ModuleProviderContext is a helper interface that is a subset of ModuleContext or BottomUpMutatorContext // for use in ModuleProvider. type ModuleProviderContext interface { diff --git a/android/testing.go b/android/testing.go index 08c8083a6..d2949ec8e 100644 --- a/android/testing.go +++ b/android/testing.go @@ -1197,11 +1197,11 @@ func AndroidMkInfoForTest(t *testing.T, ctx *TestContext, mod Module) *AndroidMk info := OtherModuleProviderOrDefault(ctx, mod, AndroidMkInfoProvider) aconfigUpdateAndroidMkInfos(ctx, mod, info) - commonInfo, _ := OtherModuleProvider(ctx, mod, CommonModuleInfoProvider) - info.PrimaryInfo.fillInEntries(ctx, mod, &commonInfo) + commonInfo := OtherModulePointerProviderOrDefault(ctx, mod, CommonModuleInfoProvider) + info.PrimaryInfo.fillInEntries(ctx, mod, commonInfo) if len(info.ExtraInfo) > 0 { for _, ei := range info.ExtraInfo { - ei.fillInEntries(ctx, mod, &commonInfo) + ei.fillInEntries(ctx, mod, commonInfo) } } |