From 5a37718c956b1bfbda5e236c0fe50f08661a81de Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 14 Dec 2023 14:46:23 -0800 Subject: Convert ModuleProvder to generic providers API Convert all of the callers of ModuleProvider/ModuleHasProvider to use the type-safe android.SingletonModuleProvider API. Bug: 316410648 Test: builds Change-Id: I6f11638546b64749e451cebbf33140248dc1d193 --- android/singleton.go | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'android/singleton.go') diff --git a/android/singleton.go b/android/singleton.go index 8936cac65..47cfb2818 100644 --- a/android/singleton.go +++ b/android/singleton.go @@ -35,16 +35,6 @@ type SingletonContext interface { // Allows generating build actions for `referer` based on the metadata for `name` deferred until the singleton context. ModuleVariantsFromName(referer Module, name string) []Module - // ModuleProvider returns the value, if any, for the provider for a module. If the value for the - // provider was not set it returns the zero value of the type of the provider, which means the - // return value can always be type-asserted to the type of the provider. The return value should - // always be considered read-only. It panics if called before the appropriate mutator or - // GenerateBuildActions pass for the provider on the module. - ModuleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) any - - // ModuleHasProvider returns true if the provider for the given module has been set. - ModuleHasProvider(module blueprint.Module, provider blueprint.AnyProviderKey) bool - moduleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool) ModuleErrorf(module blueprint.Module, format string, args ...interface{}) @@ -291,17 +281,6 @@ func (s *singletonContextAdaptor) ModuleVariantsFromName(referer Module, name st return result } -func (s *singletonContextAdaptor) ModuleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) any { - value, _ := s.SingletonContext.ModuleProvider(module, provider) - return value -} - -// ModuleHasProvider returns true if the provider for the given module has been set. -func (s *singletonContextAdaptor) ModuleHasProvider(module blueprint.Module, provider blueprint.AnyProviderKey) bool { - _, ok := s.SingletonContext.ModuleProvider(module, provider) - return ok -} - func (s *singletonContextAdaptor) moduleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool) { return s.SingletonContext.ModuleProvider(module, provider) } -- cgit v1.2.3-59-g8ed1b