summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yu Liu <yudiliu@google.com> 2025-02-26 20:13:04 +0000
committer Yu Liu <yudiliu@google.com> 2025-02-26 20:13:04 +0000
commite472c1dce304ca1e156e3270d104c552cc46ca2a (patch)
treefd441c471f4885370cbc3c7a705664dc59984159
parent119d38cb12b965ca54c9a761dd71466e9f8f78e2 (diff)
Make EqualModules a free function.
Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: I7e00f09a15f2857f58bea70bcedc4798630a40bc
-rw-r--r--android/apex.go2
-rw-r--r--android/base_module_context.go6
-rw-r--r--android/container.go2
-rw-r--r--android/module.go7
-rw-r--r--android/prebuilt.go2
-rw-r--r--apex/apex.go4
-rw-r--r--cc/cc.go2
-rw-r--r--dexpreopt/config.go4
-rw-r--r--java/app.go2
9 files changed, 14 insertions, 17 deletions
diff --git a/android/apex.go b/android/apex.go
index 4e92f44f6..39de6de33 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -196,7 +196,7 @@ func IsDepInSameApex(ctx BaseModuleContext, module, dep Module) bool {
return false
}
- if !ctx.EqualModules(ctx.Module(), module) {
+ if !EqualModules(ctx.Module(), module) {
if moduleInfo, ok := OtherModuleProvider(ctx, module, DepInSameApexInfoProvider); ok {
if !moduleInfo.Checker.OutgoingDepIsInSameApex(depTag) {
return false
diff --git a/android/base_module_context.go b/android/base_module_context.go
index 5e05f547a..d2404fd3e 100644
--- a/android/base_module_context.go
+++ b/android/base_module_context.go
@@ -34,8 +34,6 @@ type BaseModuleContext interface {
blueprintBaseModuleContext() blueprint.BaseModuleContext
- EqualModules(m1, m2 Module) bool
-
// OtherModuleName returns the name of another Module. See BaseModuleContext.ModuleName for more information.
// It is intended for use inside the visit functions of Visit* and WalkDeps.
OtherModuleName(m blueprint.Module) string
@@ -271,8 +269,8 @@ func getWrappedModule(module blueprint.Module) blueprint.Module {
return module
}
-func (b *baseModuleContext) EqualModules(m1, m2 Module) bool {
- return b.bp.EqualModules(getWrappedModule(m1), getWrappedModule(m2))
+func EqualModules(m1, m2 Module) bool {
+ return blueprint.EqualModules(getWrappedModule(m1), getWrappedModule(m2))
}
func (b *baseModuleContext) OtherModuleName(m blueprint.Module) string {
diff --git a/android/container.go b/android/container.go
index 5dc97d38e..a5aab79bb 100644
--- a/android/container.go
+++ b/android/container.go
@@ -449,7 +449,7 @@ func generateContainerInfo(ctx ModuleContext) ContainersInfo {
}
func getContainerModuleInfo(ctx ModuleContext, module Module) (ContainersInfo, bool) {
- if ctx.EqualModules(ctx.Module(), module) {
+ if EqualModules(ctx.Module(), module) {
return ctx.getContainersInfo(), true
}
diff --git a/android/module.go b/android/module.go
index d19648124..85909b602 100644
--- a/android/module.go
+++ b/android/module.go
@@ -1665,7 +1665,7 @@ func (m *ModuleBase) generateModuleTarget(ctx *moduleContext) {
var checkbuildTarget Path
var uncheckedModule bool
var skipAndroidMkProcessing bool
- if ctx.EqualModules(m.module, module) {
+ if EqualModules(m.module, module) {
allInstalledFiles = append(allInstalledFiles, ctx.installFiles...)
checkbuildTarget = ctx.checkbuildTarget
uncheckedModule = ctx.uncheckedModule
@@ -2931,7 +2931,6 @@ type OutputFilesProviderModuleContext interface {
OtherModuleProviderContext
Module() Module
GetOutputFiles() OutputFilesInfo
- EqualModules(m1, m2 Module) bool
}
// TODO(b/397766191): Change the signature to take ModuleProxy
@@ -2943,7 +2942,7 @@ func outputFilesForModule(ctx PathContext, module Module, tag string) (Paths, er
}
if octx, ok := ctx.(OutputFilesProviderModuleContext); ok {
- if octx.EqualModules(octx.Module(), module) {
+ if EqualModules(octx.Module(), module) {
// It is the current module, we can access the srcs through interface
if sourceFileProducer, ok := module.(SourceFileProducer); ok {
return sourceFileProducer.Srcs(), nil
@@ -2971,7 +2970,7 @@ func outputFilesForModuleFromProvider(ctx PathContext, module Module, tag string
fromProperty := false
if mctx, isMctx := ctx.(OutputFilesProviderModuleContext); isMctx {
- if !mctx.EqualModules(mctx.Module(), module) {
+ if !EqualModules(mctx.Module(), module) {
outputFiles, _ = OtherModuleProvider(mctx, module, OutputFilesProvider)
} else {
outputFiles = mctx.GetOutputFiles()
diff --git a/android/prebuilt.go b/android/prebuilt.go
index 72735991d..4a94c0bcb 100644
--- a/android/prebuilt.go
+++ b/android/prebuilt.go
@@ -412,7 +412,7 @@ func PrebuiltGetPreferred(ctx BaseModuleContext, module Module) Module {
if prebuiltMod != nil {
return false
}
- if ctx.EqualModules(parent, ctx.Module()) {
+ if EqualModules(parent, ctx.Module()) {
// First level: Only recurse if the module is found as a direct dependency.
sourceModDepFound = child == module
return sourceModDepFound
diff --git a/apex/apex.go b/apex/apex.go
index 4dd3d4cc0..0e4416b4f 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1849,7 +1849,7 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext,
return false
}
depName := ctx.OtherModuleName(child)
- if ctx.EqualModules(parent, ctx.Module()) {
+ if android.EqualModules(parent, ctx.Module()) {
switch depTag {
case sharedLibTag, jniLibTag:
isJniLib := depTag == jniLibTag
@@ -2891,7 +2891,7 @@ func (a *apexBundle) verifyNativeImplementationLibs(ctx android.ModuleContext) {
tag := ctx.OtherModuleDependencyTag(child)
- if ctx.EqualModules(parent, ctx.Module()) {
+ if android.EqualModules(parent, ctx.Module()) {
if !checkApexTag(tag) {
return false
}
diff --git a/cc/cc.go b/cc/cc.go
index 7122bcee6..9e373ad8e 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -3705,7 +3705,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
func ShouldUseStubForApex(ctx android.ModuleContext, parent android.Module, dep android.ModuleProxy) bool {
inVendorOrProduct := false
bootstrap := false
- if ctx.EqualModules(ctx.Module(), parent) {
+ if android.EqualModules(ctx.Module(), parent) {
if linkable, ok := parent.(LinkableInterface); !ok {
ctx.ModuleErrorf("Not a Linkable module: %q", ctx.ModuleName())
} else {
diff --git a/dexpreopt/config.go b/dexpreopt/config.go
index c5cafb1cf..655ee9b7b 100644
--- a/dexpreopt/config.go
+++ b/dexpreopt/config.go
@@ -510,7 +510,7 @@ func dex2oatPathFromDep(ctx android.ModuleContext) android.Path {
var dex2oatModule android.ModuleProxy
ctx.WalkDepsProxy(func(child, parent android.ModuleProxy) bool {
prebuiltInfo, isPrebuilt := android.OtherModuleProvider(ctx, child, android.PrebuiltModuleInfoProvider)
- if ctx.EqualModules(parent, ctx.Module()) && ctx.OtherModuleDependencyTag(child) == Dex2oatDepTag {
+ if android.EqualModules(parent, ctx.Module()) && ctx.OtherModuleDependencyTag(child) == Dex2oatDepTag {
// Found the source module, or prebuilt module that has replaced the source.
dex2oatModule = child
if isPrebuilt {
@@ -519,7 +519,7 @@ func dex2oatPathFromDep(ctx android.ModuleContext) android.Path {
return true // Recurse to check if the source has a prebuilt dependency.
}
}
- if ctx.EqualModules(parent, dex2oatModule) && ctx.OtherModuleDependencyTag(child) == android.PrebuiltDepTag {
+ if android.EqualModules(parent, dex2oatModule) && ctx.OtherModuleDependencyTag(child) == android.PrebuiltDepTag {
if isPrebuilt && prebuiltInfo.UsePrebuilt {
dex2oatModule = child // Found a prebuilt that should be used.
}
diff --git a/java/app.go b/java/app.go
index 827b23526..c2aa8a474 100644
--- a/java/app.go
+++ b/java/app.go
@@ -1175,7 +1175,7 @@ func collectAppDeps(ctx android.ModuleContext, app appDepsInterface,
apkInApex := ctx.Module().(android.ApexModule).NotInPlatform()
childLinkable, _ := android.OtherModuleProvider(ctx, child, cc.LinkableInfoProvider)
parentIsLinkable := false
- if ctx.EqualModules(ctx.Module(), parent) {
+ if android.EqualModules(ctx.Module(), parent) {
parentLinkable, _ := ctx.Module().(cc.LinkableInterface)
parentIsLinkable = parentLinkable != nil
} else {