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
This commit is contained in:
Paul Duffin
2021-04-28 10:41:21 +01:00
parent 8d817b70e6
commit f7c99f5983
4 changed files with 44 additions and 28 deletions

View File

@@ -221,8 +221,7 @@ func isValidSharedDependency(dependency android.Module) bool {
// If the same library is present both as source and a prebuilt we must pick
// only one to avoid a conflict. Always prefer the source since the prebuilt
// probably won't be built with sanitizers enabled.
if prebuilt, ok := dependency.(android.PrebuiltInterface); ok &&
prebuilt.Prebuilt() != nil && prebuilt.Prebuilt().SourceExists() {
if prebuilt := android.GetEmbeddedPrebuilt(dependency); prebuilt != nil && prebuilt.SourceExists() {
return false
}