summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
author Yu Liu <yudiliu@google.com> 2025-02-26 23:39:20 +0000
committer Yu Liu <yudiliu@google.com> 2025-02-26 23:59:24 +0000
commit71f1ea3f81feae294a3031799cd638c38610850e (patch)
tree8789f5835a3464960509903acbf698b5780371e6 /java
parente472c1dce304ca1e156e3270d104c552cc46ca2a (diff)
Convert tidyPhonySingleton, jdepsGeneratorSingleton and
genNoticeBuildRules to use ModuleProxy. Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: I7507a580e3533b01f552778a7815bcc43d301e23
Diffstat (limited to 'java')
-rw-r--r--java/java.go9
-rw-r--r--java/jdeps.go21
2 files changed, 11 insertions, 19 deletions
diff --git a/java/java.go b/java/java.go
index 38361bfa7..c1e4f8ca0 100644
--- a/java/java.go
+++ b/java/java.go
@@ -3363,21 +3363,12 @@ func (j *Import) UseProfileGuidedDexpreopt() bool {
// Add compile time check for interface implementation
var _ android.IDEInfo = (*Import)(nil)
-var _ android.IDECustomizedModuleName = (*Import)(nil)
// Collect information for opening IDE project files in java/jdeps.go.
-
func (j *Import) IDEInfo(ctx android.BaseModuleContext, dpInfo *android.IdeInfo) {
dpInfo.Jars = append(dpInfo.Jars, j.combinedImplementationFile.String())
}
-func (j *Import) IDECustomizedModuleName() string {
- // TODO(b/113562217): Extract the base module name from the Import name, often the Import name
- // has a prefix "prebuilt_". Remove the prefix explicitly if needed until we find a better
- // solution to get the Import name.
- return android.RemoveOptionalPrebuiltPrefix(j.Name())
-}
-
var _ android.PrebuiltInterface = (*Import)(nil)
func (j *Import) IsInstallable() bool {
diff --git a/java/jdeps.go b/java/jdeps.go
index 07f8c4378..4711dc1a4 100644
--- a/java/jdeps.go
+++ b/java/jdeps.go
@@ -45,13 +45,13 @@ func (j *jdepsGeneratorSingleton) GenerateBuildActions(ctx android.SingletonCont
// (b/204397180) Generate module_bp_java_deps.json by default.
moduleInfos := make(map[string]android.IdeInfo)
- ctx.VisitAllModules(func(module android.Module) {
- if !module.Enabled(ctx) {
+ ctx.VisitAllModuleProxies(func(module android.ModuleProxy) {
+ if !android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoKey).Enabled {
return
}
// Prevent including both prebuilts and matching source modules when one replaces the other.
- if !android.IsModulePreferred(module) {
+ if !android.IsModulePreferredProxy(ctx, module) {
return
}
@@ -60,9 +60,11 @@ func (j *jdepsGeneratorSingleton) GenerateBuildActions(ctx android.SingletonCont
return
}
name := ideInfoProvider.BaseModuleName
- ideModuleNameProvider, ok := module.(android.IDECustomizedModuleName)
- if ok {
- name = ideModuleNameProvider.IDECustomizedModuleName()
+ if info, ok := android.OtherModuleProvider(ctx, module, JavaLibraryInfoProvider); ok && info.Prebuilt {
+ // TODO(b/113562217): Extract the base module name from the Import name, often the Import name
+ // has a prefix "prebuilt_". Remove the prefix explicitly if needed until we find a better
+ // solution to get the Import name.
+ name = android.RemoveOptionalPrebuiltPrefix(module.Name())
}
dpInfo := moduleInfos[name]
@@ -70,13 +72,12 @@ func (j *jdepsGeneratorSingleton) GenerateBuildActions(ctx android.SingletonCont
dpInfo.Paths = []string{ctx.ModuleDir(module)}
moduleInfos[name] = dpInfo
- mkProvider, ok := module.(android.AndroidMkDataProvider)
+ mkProvider, ok := android.OtherModuleProvider(ctx, module, android.AndroidMkDataInfoProvider)
if !ok {
return
}
- data := mkProvider.AndroidMk()
- if data.Class != "" {
- dpInfo.Classes = append(dpInfo.Classes, data.Class)
+ if mkProvider.Class != "" {
+ dpInfo.Classes = append(dpInfo.Classes, mkProvider.Class)
}
if dep, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok {