Convert NewProvider/NewMutatorProvider to generic providers API

Convert all of the callers to NewProvider and NewMutatorProvider
to use a generic type parameter instead of an example object.

Bug: 316410648
Test: builds
Change-Id: Ic9cdafc87336e26730d3fd596df05de0e7267542
This commit is contained in:
Colin Cross
2023-12-12 16:39:03 -08:00
parent 3c0a83d19f
commit bc7d76cca2
27 changed files with 44 additions and 42 deletions

View File

@@ -89,7 +89,7 @@ type ApexInfo struct {
TestApexes []string
}
var ApexInfoProvider = blueprint.NewMutatorProvider(ApexInfo{}, "apex")
var ApexInfoProvider = blueprint.NewMutatorProvider[ApexInfo]("apex")
func (i ApexInfo) AddJSONData(d *map[string]interface{}) {
(*d)["Apex"] = map[string]interface{}{
@@ -145,7 +145,7 @@ type ApexTestForInfo struct {
ApexContents []*ApexContents
}
var ApexTestForInfoProvider = blueprint.NewMutatorProvider(ApexTestForInfo{}, "apex_test_for")
var ApexTestForInfoProvider = blueprint.NewMutatorProvider[ApexTestForInfo]("apex_test_for")
// DepIsInSameApex defines an interface that should be used to determine whether a given dependency
// should be considered as part of the same APEX as the current module or not. Note: this was

View File

@@ -124,7 +124,7 @@ func (a *allApexContributions) SetPrebuiltSelectionInfoProvider(ctx BaseModuleCo
// A provider containing metadata about whether source or prebuilt should be used
// This provider will be used in prebuilt_select mutator to redirect deps
var PrebuiltSelectionInfoProvider = blueprint.NewMutatorProvider(PrebuiltSelectionInfoMap{}, "prebuilt_select")
var PrebuiltSelectionInfoProvider = blueprint.NewMutatorProvider[PrebuiltSelectionInfoMap]("prebuilt_select")
// Map of baseModuleName to the selected source or prebuilt
type PrebuiltSelectionInfoMap map[string]PrebuiltSelectionInfo

View File

@@ -98,7 +98,7 @@ func (i DeapexerInfo) PrebuiltExportPath(apexRelativePath string) WritablePath {
// Provider that can be used from within the `GenerateAndroidBuildActions` of a module that depends
// on a `deapexer` module to retrieve its `DeapexerInfo`.
var DeapexerProvider = blueprint.NewProvider(DeapexerInfo{})
var DeapexerProvider = blueprint.NewProvider[DeapexerInfo]()
// NewDeapexerInfo creates and initializes a DeapexerInfo that is suitable
// for use with a prebuilt_apex module.

View File

@@ -200,7 +200,7 @@ func isContainerFromFileExtensions(installPaths InstallPaths, builtPaths Paths)
}
// LicenseMetadataProvider is used to propagate license metadata paths between modules.
var LicenseMetadataProvider = blueprint.NewProvider(&LicenseMetadataInfo{})
var LicenseMetadataProvider = blueprint.NewProvider[*LicenseMetadataInfo]()
// LicenseMetadataInfo stores the license metadata path for a module.
type LicenseMetadataInfo struct {

View File

@@ -322,7 +322,7 @@ type LicenseInfo struct {
Licenses []string
}
var LicenseInfoProvider = blueprint.NewProvider(LicenseInfo{})
var LicenseInfoProvider = blueprint.NewProvider[LicenseInfo]()
func init() {
RegisterMakeVarsProvider(pctx, licensesMakeVarsProvider)

View File

@@ -860,11 +860,11 @@ type ExportedComponentsInfo struct {
Components []string
}
var ExportedComponentsInfoProvider = blueprint.NewProvider(ExportedComponentsInfo{})
var ExportedComponentsInfoProvider = blueprint.NewProvider[ExportedComponentsInfo]()
// AdditionalSdkInfo contains additional properties to add to the generated SDK info file.
type AdditionalSdkInfo struct {
Properties map[string]interface{}
}
var AdditionalSdkInfoProvider = blueprint.NewProvider(AdditionalSdkInfo{})
var AdditionalSdkInfoProvider = blueprint.NewProvider[AdditionalSdkInfo]()