summaryrefslogtreecommitdiff
path: root/java/lint.go
diff options
context:
space:
mode:
author Yu Liu <yudiliu@google.com> 2025-02-21 20:46:25 +0000
committer Yu Liu <yudiliu@google.com> 2025-02-25 19:05:07 +0000
commit2a815b6d8ea8f29b54f780b1219c28b0c8c977aa (patch)
tree3637bda1bc41a893d7d0a502798d47c74434cb70 /java/lint.go
parenta88b86ff5d86306ec15bc1de7892d17b4154210e (diff)
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
Diffstat (limited to 'java/lint.go')
-rw-r--r--java/lint.go19
1 files changed, 10 insertions, 9 deletions
diff --git a/java/lint.go b/java/lint.go
index 66f7f8549..c31dfd005 100644
--- a/java/lint.go
+++ b/java/lint.go
@@ -595,12 +595,12 @@ func (l *lintSingleton) GenerateBuildActions(ctx android.SingletonContext) {
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 @@ func (l *lintSingleton) copyLintDependencies(ctx android.SingletonContext) {
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 @@ func (l *lintSingleton) generateLintReportZips(ctx android.SingletonContext) {
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