Convert the following singletons to use ModuleProxy:
buildTargetSingleton
exportedJavaDeclarationsLibrarySingleton
javaFuzzPackager
kytheExtractAllSingleton
kytheExtractJavaSingleton
kytheExtractRustSingleton
lintSingleton
logtagsSingleton
makeVarsSingleton
ndkAbiDiffSingleton
ndkAbiDumpSingleton
phonySingleton
platformCompatConfigSingleton
sdkSingleton
Bug: 377723687
Test: Unit tests and compare the ninja and mk files generated.
Change-Id: I625ac8a209ca93755b2ba232202cfb44ecefde0a
diff --git a/java/lint.go b/java/lint.go
index 66f7f85..c31dfd0 100644
--- a/java/lint.go
+++ b/java/lint.go
@@ -595,12 +595,12 @@
l.copyLintDependencies(ctx)
}
-func findModuleOrErr(ctx android.SingletonContext, moduleName string) android.Module {
- var res android.Module
- ctx.VisitAllModules(func(m android.Module) {
+func findModuleOrErr(ctx android.SingletonContext, moduleName string) *android.ModuleProxy {
+ var res *android.ModuleProxy
+ ctx.VisitAllModuleProxies(func(m android.ModuleProxy) {
if ctx.ModuleName(m) == moduleName {
if res == nil {
- res = m
+ res = &m
} else {
ctx.Errorf("lint: multiple %s modules found: %s and %s", moduleName,
ctx.ModuleSubDir(m), ctx.ModuleSubDir(res))
@@ -635,13 +635,13 @@
ctx.Build(pctx, android.BuildParams{
Rule: android.CpIfChanged,
- Input: android.OutputFileForModule(ctx, sdkAnnotations, ""),
+ Input: android.OutputFileForModule(ctx, *sdkAnnotations, ""),
Output: copiedLintDatabaseFilesPath(ctx, files.annotationCopiedName),
})
ctx.Build(pctx, android.BuildParams{
Rule: android.CpIfChanged,
- Input: android.OutputFileForModule(ctx, apiVersionsDb, ".api_versions.xml"),
+ Input: android.OutputFileForModule(ctx, *apiVersionsDb, ".api_versions.xml"),
Output: copiedLintDatabaseFilesPath(ctx, files.apiVersionsCopiedName),
})
}
@@ -658,12 +658,13 @@
var outputs []*LintInfo
var dirs []string
- ctx.VisitAllModules(func(m android.Module) {
- if ctx.Config().KatiEnabled() && !m.ExportedToMake() {
+ ctx.VisitAllModuleProxies(func(m android.ModuleProxy) {
+ commonInfo, _ := android.OtherModuleProvider(ctx, m, android.CommonModuleInfoKey)
+ if ctx.Config().KatiEnabled() && !commonInfo.ExportedToMake {
return
}
- if apex, ok := m.(android.ApexModule); ok && apex.NotAvailableForPlatform() {
+ if commonInfo.IsApexModule && commonInfo.NotAvailableForPlatform {
apexInfo, _ := android.OtherModuleProvider(ctx, m, android.ApexInfoProvider)
if apexInfo.IsForPlatform() {
// There are stray platform variants of modules in apexes that are not available for