Don't copy uninstallable variants of NDK libraries to sysroot

After the next patch libraryDecorator.install will be called for
uninstallable variants of modules, manually filter them out when
copying to the NDK sysroot.

Bug: 124313442
Test: m checkbuild
Change-Id: I28b538d4ae271dc5e27c386d7cfa538ac0ed841b
This commit is contained in:
Colin Cross 2020-12-16 11:06:50 -08:00
parent f1c48afc31
commit 95b07f2b59
2 changed files with 6 additions and 1 deletions

View File

@ -432,6 +432,7 @@ type ModuleContextIntf interface {
mustUseVendorVariant() bool mustUseVendorVariant() bool
nativeCoverage() bool nativeCoverage() bool
directlyInAnyApex() bool directlyInAnyApex() bool
isPreventInstall() bool
} }
type ModuleContext interface { type ModuleContext interface {
@ -1325,6 +1326,10 @@ func (ctx *moduleContextImpl) directlyInAnyApex() bool {
return ctx.mod.DirectlyInAnyApex() return ctx.mod.DirectlyInAnyApex()
} }
func (ctx *moduleContextImpl) isPreventInstall() bool {
return ctx.mod.Properties.PreventInstall
}
func newBaseModule(hod android.HostOrDeviceSupported, multilib android.Multilib) *Module { func newBaseModule(hod android.HostOrDeviceSupported, multilib android.Multilib) *Module {
return &Module{ return &Module{
hod: hod, hod: hod,

View File

@ -1345,7 +1345,7 @@ func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
if Bool(library.Properties.Static_ndk_lib) && library.static() && if Bool(library.Properties.Static_ndk_lib) && library.static() &&
!ctx.useVndk() && !ctx.inRamdisk() && !ctx.inVendorRamdisk() && !ctx.inRecovery() && ctx.Device() && !ctx.useVndk() && !ctx.inRamdisk() && !ctx.inVendorRamdisk() && !ctx.inRecovery() && ctx.Device() &&
library.baseLinker.sanitize.isUnsanitizedVariant() && library.baseLinker.sanitize.isUnsanitizedVariant() &&
!library.buildStubs() && ctx.sdkVersion() == "" { ctx.isForPlatform() && !ctx.isPreventInstall() {
installPath := getNdkSysrootBase(ctx).Join( installPath := getNdkSysrootBase(ctx).Join(
ctx, "usr/lib", config.NDKTriple(ctx.toolchain()), file.Base()) ctx, "usr/lib", config.NDKTriple(ctx.toolchain()), file.Base())