summaryrefslogtreecommitdiff
path: root/android/override_module.go
diff options
context:
space:
mode:
Diffstat (limited to 'android/override_module.go')
-rw-r--r--android/override_module.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/android/override_module.go b/android/override_module.go
index 3994084a8..f8342d52d 100644
--- a/android/override_module.go
+++ b/android/override_module.go
@@ -313,3 +313,15 @@ func replaceDepsOnOverridingModuleMutator(ctx BottomUpMutatorContext) {
}
}
}
+
+// ModuleNameWithPossibleOverride returns the name of the OverrideModule that overrides the current
+// variant of this OverridableModule, or ctx.ModuleName() if this module is not an OverridableModule
+// or if this variant is not overridden.
+func ModuleNameWithPossibleOverride(ctx ModuleContext) string {
+ if overridable, ok := ctx.Module().(OverridableModule); ok {
+ if o := overridable.GetOverriddenBy(); o != "" {
+ return o
+ }
+ }
+ return ctx.ModuleName()
+}