From e3ae3dd6f99a6f9758f1f8540e274285771e5e60 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Fri, 25 Nov 2022 12:11:40 +0000 Subject: [PATCH] Dedup checks for module being in versioned sdk snapshot Previously, various places duplicated the logic to check whether a module was part of a versioned snapshot. This change replaces that code with a call to the existing IsModuleInVersionedSdk(Module) func. This makes the code consistent in preparation for a change that will remove all calls to IsModuleInVersionedSdk(Module). It is separated out from that change as it is easier to see that the replaced code is equivalent to the IsModuleInVersionedSdk(Module) func when it is not mixed in with other changes. It also makes the following change easier to review. Bug: 260237150 Test: m nothing Change-Id: I44d665bf02d2fc97632a03b5a3d2225ea3c2827d --- cc/cc.go | 2 +- cc/fuzz.go | 2 +- java/androidmk.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cc/cc.go b/cc/cc.go index e07edeb14..c4f87257e 100644 --- a/cc/cc.go +++ b/cc/cc.go @@ -3520,7 +3520,7 @@ func (c *Module) IsInstallableToApex() bool { if lib := c.library; lib != nil { // Stub libs and prebuilt libs in a versioned SDK are not // installable to APEX even though they are shared libs. - return lib.shared() && !lib.buildStubs() && c.ContainingSdk().Unversioned() + return lib.shared() && !lib.buildStubs() && !android.IsModuleInVersionedSdk(c) } else if _, ok := c.linker.(testPerSrc); ok { return true } diff --git a/cc/fuzz.go b/cc/fuzz.go index 3da76512e..d714bf2aa 100644 --- a/cc/fuzz.go +++ b/cc/fuzz.go @@ -211,7 +211,7 @@ func IsValidSharedDependency(dependency android.Module) bool { // Discard versioned members of SDK snapshots, because they will conflict with // unversioned ones. - if sdkMember, ok := dependency.(android.SdkAware); ok && !sdkMember.ContainingSdk().Unversioned() { + if android.IsModuleInVersionedSdk(dependency) { return false } diff --git a/java/androidmk.go b/java/androidmk.go index 42b4ef1b2..e37a90e0f 100644 --- a/java/androidmk.go +++ b/java/androidmk.go @@ -200,7 +200,7 @@ func (prebuilt *Import) AndroidMkEntries() []android.AndroidMkEntries { dexpreoptEntries := prebuilt.dexpreopter.AndroidMkEntriesForApex() return append(dexpreoptEntries, android.AndroidMkEntries{Disabled: true}) } - if !prebuilt.ContainingSdk().Unversioned() { + if android.IsModuleInVersionedSdk(prebuilt) { return []android.AndroidMkEntries{android.AndroidMkEntries{ Disabled: true, }}