summaryrefslogtreecommitdiff
path: root/android/override_module.go
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2021-04-28 10:41:21 +0100
committer Paul Duffin <paulduffin@google.com> 2021-04-28 14:02:04 +0100
commitf7c99f598321d139d7926a2bb34b16ec35e78a81 (patch)
tree5dab54ecab1950cf85c4dbc03c859f6d1323cc17 /android/override_module.go
parent8d817b70e6889f2445be4c9ef507640e4104575c (diff)
Add GetEmbeddedPrebuilt and IsModulePrebuilt
Dedups the many repetitions of the code to obtain a *Prebuilt from a module. Bug: 177892522 Test: m nothing Change-Id: I1ededbe9ee79e89ea6dd8882dfee4be0bf0b51b7
Diffstat (limited to 'android/override_module.go')
-rw-r--r--android/override_module.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/android/override_module.go b/android/override_module.go
index 97acc5c36..0a7e29491 100644
--- a/android/override_module.go
+++ b/android/override_module.go
@@ -244,11 +244,11 @@ func overrideModuleDepsMutator(ctx BottomUpMutatorContext) {
// See if there's a prebuilt module that overrides this override module with prefer flag,
// in which case we call HideFromMake on the corresponding variant later.
ctx.VisitDirectDepsWithTag(PrebuiltDepTag, func(dep Module) {
- prebuilt, ok := dep.(PrebuiltInterface)
- if !ok {
+ prebuilt := GetEmbeddedPrebuilt(dep)
+ if prebuilt == nil {
panic("PrebuiltDepTag leads to a non-prebuilt module " + dep.Name())
}
- if prebuilt.Prebuilt().UsePrebuilt() {
+ if prebuilt.UsePrebuilt() {
module.setOverriddenByPrebuilt(true)
return
}