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
diff --git a/cc/cc.go b/cc/cc.go
index 89f32f1..afc96ba 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -432,6 +432,7 @@
mustUseVendorVariant() bool
nativeCoverage() bool
directlyInAnyApex() bool
+ isPreventInstall() bool
}
type ModuleContext interface {
@@ -1325,6 +1326,10 @@
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 959d670..73ff754 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -1345,7 +1345,7 @@
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())