summaryrefslogtreecommitdiff
path: root/java/base.go
diff options
context:
space:
mode:
author Yu Liu <yudiliu@google.com> 2025-01-14 01:03:08 +0000
committer Yu Liu <yudiliu@google.com> 2025-01-15 20:54:26 +0000
commitc41eae5e45123a48fd3ec9a3723fdf7adbb6f148 (patch)
tree48472e3499925ef195176d14c2fb2732b4fef261 /java/base.go
parent39f5fb3db37a307081cd96d334feb6a7fcc7a7d7 (diff)
Convert collectDirectDepsProviders, collectTransitiveSrcFiles and
r8Flags to use ModuleProxy. Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: Ib3d45c317e1f2669808d0c785454fb8d8fb9cd3b
Diffstat (limited to 'java/base.go')
-rw-r--r--java/base.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/java/base.go b/java/base.go
index 9e448c64b..8e013b954 100644
--- a/java/base.go
+++ b/java/base.go
@@ -2275,7 +2275,7 @@ func (j *Module) JacocoReportClassesFile() android.Path {
func (j *Module) collectTransitiveSrcFiles(ctx android.ModuleContext, mine android.Paths) {
var fromDeps []depset.DepSet[android.Path]
- ctx.VisitDirectDeps(func(module android.Module) {
+ ctx.VisitDirectDepsProxy(func(module android.ModuleProxy) {
tag := ctx.OtherModuleDependencyTag(module)
if tag == staticLibTag {
if depInfo, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok {
@@ -2550,7 +2550,7 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
JavaInfo: dep,
})
}
- } else if dep, ok := android.OtherModuleProvider(ctx, module, android.SourceFilesInfoKey); ok {
+ } else if dep, ok := android.OtherModuleProvider(ctx, module, android.SourceFilesInfoProvider); ok {
switch tag {
case sdkLibTag, libTag:
checkProducesJars(ctx, dep, module)
@@ -2740,7 +2740,7 @@ func collectDirectDepsProviders(ctx android.ModuleContext) (result *JarJarProvid
module := ctx.Module()
moduleName := module.Name()
- ctx.VisitDirectDeps(func(m android.Module) {
+ ctx.VisitDirectDepsProxy(func(m android.ModuleProxy) {
tag := ctx.OtherModuleDependencyTag(m)
// This logic mirrors that in (*Module).collectDeps above. There are several places
// where we explicitly return RenameUseExclude, even though it is the default, to
@@ -2779,10 +2779,8 @@ func collectDirectDepsProviders(ctx android.ModuleContext) (result *JarJarProvid
//fmt.Printf("collectDirectDepsProviders: %v -> %v StubsLinkType unknown\n", module, m)
// Fall through to the heuristic logic.
}
- switch reflect.TypeOf(m).String() {
- case "*java.GeneratedJavaLibraryModule":
+ if _, ok := android.OtherModuleProvider(ctx, m, android.CodegenInfoProvider); ok {
// Probably a java_aconfig_library module.
- // TODO: make this check better.
return RenameUseInclude
}
switch tag {
@@ -2805,7 +2803,7 @@ func collectDirectDepsProviders(ctx android.ModuleContext) (result *JarJarProvid
default:
return RenameUseExclude
}
- } else if _, ok := m.(android.SourceFileProducer); ok {
+ } else if _, ok := android.OtherModuleProvider(ctx, m, android.SourceFilesInfoProvider); ok {
switch tag {
case sdkLibTag, libTag, staticLibTag:
return RenameUseInclude