Convert SetProvider to generic providers API
Convert all of the callers of SetProvider to use the type-safe
android.SetProvider API.
Bug: 316410648
Test: builds
Change-Id: If58f4b5355264ddab2045bc3591a4eac19cd58fc
diff --git a/cc/cc.go b/cc/cc.go
index 7a06128..fca5602 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -2131,9 +2131,9 @@
}
}
if c.testModule {
- ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{})
+ android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{})
}
- ctx.SetProvider(blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: deps.GeneratedSources.Strings()})
+ android.SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: deps.GeneratedSources.Strings()})
aconfig.CollectDependencyAconfigFiles(ctx, &c.mergedAconfigFiles)
@@ -2370,7 +2370,7 @@
if len(apiImportModule) > 0 && apiImportModule[0] != nil {
apiInfo := actx.OtherModuleProvider(apiImportModule[0], multitree.ApiImportsProvider).(multitree.ApiImportInfo)
apiImportInfo = apiInfo
- actx.SetProvider(multitree.ApiImportsProvider, apiInfo)
+ android.SetProvider(actx, multitree.ApiImportsProvider, apiInfo)
}
}
}
@@ -2394,7 +2394,7 @@
snapshot := actx.OtherModuleProvider(snapshotModule[0], SnapshotInfoProvider).(SnapshotInfo)
*snapshotInfo = &snapshot
// republish the snapshot for use in later mutators on this module
- actx.SetProvider(SnapshotInfoProvider, snapshot)
+ android.SetProvider(actx, SnapshotInfoProvider, snapshot)
}
}
if *snapshotInfo == nil {
diff --git a/cc/fdo_profile.go b/cc/fdo_profile.go
index 74d511a..0893da5 100644
--- a/cc/fdo_profile.go
+++ b/cc/fdo_profile.go
@@ -62,7 +62,7 @@
func (fp *fdoProfile) fdoProfileMutator(ctx android.BottomUpMutatorContext) {
if fp.properties.Profile != nil {
path := android.PathForModuleSrc(ctx, *fp.properties.Profile)
- ctx.SetProvider(FdoProfileProvider, FdoProfileInfo{
+ android.SetProvider(ctx, FdoProfileProvider, FdoProfileInfo{
Path: path,
})
}
diff --git a/cc/library.go b/cc/library.go
index 4d5a254..d9276d6 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -341,7 +341,7 @@
}
func (f *flagExporter) setProvider(ctx android.ModuleContext) {
- ctx.SetProvider(FlagExporterInfoProvider, FlagExporterInfo{
+ android.SetProvider(ctx, FlagExporterInfoProvider, FlagExporterInfo{
// Comes from Export_include_dirs property, and those of exported transitive deps
IncludeDirs: android.FirstUniquePaths(f.dirs),
// Comes from Export_system_include_dirs property, and those of exported transitive deps
@@ -1071,7 +1071,7 @@
ctx.CheckbuildFile(outputFile)
if library.static() {
- ctx.SetProvider(StaticLibraryInfoProvider, StaticLibraryInfo{
+ android.SetProvider(ctx, StaticLibraryInfoProvider, StaticLibraryInfo{
StaticLibrary: outputFile,
ReuseObjects: library.reuseObjects,
Objects: library.objects,
@@ -1085,7 +1085,7 @@
}
if library.header() {
- ctx.SetProvider(HeaderLibraryInfoProvider, HeaderLibraryInfo{})
+ android.SetProvider(ctx, HeaderLibraryInfoProvider, HeaderLibraryInfo{})
}
return outputFile
@@ -1239,7 +1239,7 @@
transitiveStaticLibrariesForOrdering = s.TransitiveStaticLibrariesForOrdering
}
- ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
+ android.SetProvider(ctx, SharedLibraryInfoProvider, SharedLibraryInfo{
TableOfContents: android.OptionalPathForPath(tocFile),
SharedLibrary: unstrippedOutputFile,
TransitiveStaticLibrariesForOrdering: transitiveStaticLibrariesForOrdering,
@@ -1264,7 +1264,7 @@
FlagExporterInfo: flagInfo,
})
}
- ctx.SetProvider(SharedLibraryStubsProvider, SharedLibraryStubsInfo{
+ android.SetProvider(ctx, SharedLibraryStubsProvider, SharedLibraryStubsInfo{
SharedStubLibraries: stubsInfo,
IsLLNDK: ctx.IsLlndk(),
})
diff --git a/cc/library_stub.go b/cc/library_stub.go
index 18d3f21..619e694 100644
--- a/cc/library_stub.go
+++ b/cc/library_stub.go
@@ -244,7 +244,7 @@
},
})
- ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
+ android.SetProvider(ctx, SharedLibraryInfoProvider, SharedLibraryInfo{
SharedLibrary: outputFile,
Target: ctx.Target(),
@@ -270,7 +270,7 @@
FlagExporterInfo: flagInfo,
})
}
- ctx.SetProvider(SharedLibraryStubsProvider, SharedLibraryStubsInfo{
+ android.SetProvider(ctx, SharedLibraryStubsProvider, SharedLibraryStubsInfo{
SharedStubLibraries: stubsInfo,
IsLLNDK: ctx.IsLlndk(),
diff --git a/cc/ndk_prebuilt.go b/cc/ndk_prebuilt.go
index 842bdf6..f503982 100644
--- a/cc/ndk_prebuilt.go
+++ b/cc/ndk_prebuilt.go
@@ -117,13 +117,13 @@
if ndk.static() {
depSet := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).Direct(lib).Build()
- ctx.SetProvider(StaticLibraryInfoProvider, StaticLibraryInfo{
+ android.SetProvider(ctx, StaticLibraryInfoProvider, StaticLibraryInfo{
StaticLibrary: lib,
TransitiveStaticLibrariesForOrdering: depSet,
})
} else {
- ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
+ android.SetProvider(ctx, SharedLibraryInfoProvider, SharedLibraryInfo{
SharedLibrary: lib,
Target: ctx.Target(),
})
diff --git a/cc/prebuilt.go b/cc/prebuilt.go
index f68fa24..e721c53 100644
--- a/cc/prebuilt.go
+++ b/cc/prebuilt.go
@@ -132,7 +132,7 @@
if p.static() {
depSet := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).Direct(in).Build()
- ctx.SetProvider(StaticLibraryInfoProvider, StaticLibraryInfo{
+ android.SetProvider(ctx, StaticLibraryInfoProvider, StaticLibraryInfo{
StaticLibrary: in,
TransitiveStaticLibrariesForOrdering: depSet,
@@ -190,7 +190,7 @@
},
})
- ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
+ android.SetProvider(ctx, SharedLibraryInfoProvider, SharedLibraryInfo{
SharedLibrary: outputFile,
Target: ctx.Target(),
@@ -213,7 +213,7 @@
}
if p.header() {
- ctx.SetProvider(HeaderLibraryInfoProvider, HeaderLibraryInfo{})
+ android.SetProvider(ctx, HeaderLibraryInfoProvider, HeaderLibraryInfo{})
// Need to return an output path so that the AndroidMk logic doesn't skip
// the prebuilt header. For compatibility, in case Android.mk files use a
diff --git a/cc/snapshot_prebuilt.go b/cc/snapshot_prebuilt.go
index a9c4c85..e769fe9 100644
--- a/cc/snapshot_prebuilt.go
+++ b/cc/snapshot_prebuilt.go
@@ -194,7 +194,7 @@
sharedLibs[k] = v
}
- ctx.SetProvider(SnapshotInfoProvider, SnapshotInfo{
+ android.SetProvider(ctx, SnapshotInfoProvider, SnapshotInfo{
HeaderLibs: headers,
Binaries: binaries,
Objects: objects,
@@ -494,7 +494,7 @@
p.tocFile = android.OptionalPathForPath(tocFile)
TransformSharedObjectToToc(ctx, in, tocFile)
- ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
+ android.SetProvider(ctx, SharedLibraryInfoProvider, SharedLibraryInfo{
SharedLibrary: in,
Target: ctx.Target(),
@@ -504,7 +504,7 @@
if p.static() {
depSet := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).Direct(in).Build()
- ctx.SetProvider(StaticLibraryInfoProvider, StaticLibraryInfo{
+ android.SetProvider(ctx, StaticLibraryInfoProvider, StaticLibraryInfo{
StaticLibrary: in,
TransitiveStaticLibrariesForOrdering: depSet,
diff --git a/cc/vndk_prebuilt.go b/cc/vndk_prebuilt.go
index 5e526db..3f3a025 100644
--- a/cc/vndk_prebuilt.go
+++ b/cc/vndk_prebuilt.go
@@ -171,7 +171,7 @@
p.androidMkSuffix = ""
}
- ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
+ android.SetProvider(ctx, SharedLibraryInfoProvider, SharedLibraryInfo{
SharedLibrary: in,
Target: ctx.Target(),