From 95b07f2b59049dd4a539780ed0c91b8809ce97a9 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 16 Dec 2020 11:06:50 -0800 Subject: [PATCH] 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 --- cc/cc.go | 5 +++++ cc/library.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cc/cc.go b/cc/cc.go index 89f32f163..afc96bacb 100644 --- a/cc/cc.go +++ b/cc/cc.go @@ -432,6 +432,7 @@ type ModuleContextIntf interface { mustUseVendorVariant() bool nativeCoverage() bool directlyInAnyApex() bool + isPreventInstall() bool } type ModuleContext interface { @@ -1325,6 +1326,10 @@ func (ctx *moduleContextImpl) directlyInAnyApex() bool { return ctx.mod.DirectlyInAnyApex() } +func (ctx *moduleContextImpl) isPreventInstall() bool { + return ctx.mod.Properties.PreventInstall +} + func newBaseModule(hod android.HostOrDeviceSupported, multilib android.Multilib) *Module { return &Module{ hod: hod, diff --git a/cc/library.go b/cc/library.go index 959d67086..73ff75425 100644 --- a/cc/library.go +++ b/cc/library.go @@ -1345,7 +1345,7 @@ func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) { if Bool(library.Properties.Static_ndk_lib) && library.static() && !ctx.useVndk() && !ctx.inRamdisk() && !ctx.inVendorRamdisk() && !ctx.inRecovery() && ctx.Device() && library.baseLinker.sanitize.isUnsanitizedVariant() && - !library.buildStubs() && ctx.sdkVersion() == "" { + ctx.isForPlatform() && !ctx.isPreventInstall() { installPath := getNdkSysrootBase(ctx).Join( ctx, "usr/lib", config.NDKTriple(ctx.toolchain()), file.Base())