From f22120fb1da7f75a571966124bb0da6a57fd4f07 Mon Sep 17 00:00:00 2001 From: Yu Liu Date: Thu, 13 Mar 2025 18:36:35 +0000 Subject: Change CommonModuleInfoProvider to a pointer. Bug: 358427516 Test: Manually verified genereated ninja and mk files, unit tests. Change-Id: I53a6dd718232735decbeb93febfd269dd9449e86 --- android/provider.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'android/provider.go') 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 { -- cgit v1.2.3-59-g8ed1b