Do not install vndk lib

VNDK libs are installed as part of VNDK APEX, so we don't need to
install them at all.

Bug: 170711679
Test: m
Change-Id: I62b881d6e65d6b007db1d26ab314c140c60e8a4e
This commit is contained in:
Jooyung Han 2020-10-20 18:54:21 +09:00
parent 81498621d3
commit 261e158c06
5 changed files with 27 additions and 40 deletions

View File

@ -482,12 +482,6 @@ func (c *vndkPrebuiltLibraryDecorator) AndroidMkEntries(ctx AndroidMkContext, en
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
c.libraryDecorator.androidMkWriteExportedFlags(entries)
path, file := filepath.Split(c.path.ToMakePath().String())
stem, suffix, ext := android.SplitFileExt(file)
entries.SetString("LOCAL_BUILT_MODULE_STEM", "$(LOCAL_MODULE)"+ext)
entries.SetString("LOCAL_MODULE_SUFFIX", suffix)
entries.SetString("LOCAL_MODULE_PATH", path)
entries.SetString("LOCAL_MODULE_STEM", stem)
if c.tocFile.Valid() {
entries.SetString("LOCAL_SOONG_TOC", c.tocFile.String())
}

View File

@ -111,6 +111,7 @@ func testCcError(t *testing.T, pattern string, bp string) {
}
func testCcErrorProductVndk(t *testing.T, pattern string, bp string) {
t.Helper()
config := TestConfig(buildDir, android.Android, nil, bp, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.ProductVndkVersion = StringPtr("current")
@ -388,10 +389,12 @@ func TestVndk(t *testing.T) {
ctx := testCcWithConfig(t, config)
checkVndkModule(t, ctx, "libvndk", "vndk-VER", false, "", vendorVariant)
checkVndkModule(t, ctx, "libvndk_private", "vndk-VER", false, "", vendorVariant)
checkVndkModule(t, ctx, "libvndk_sp", "vndk-sp-VER", true, "", vendorVariant)
checkVndkModule(t, ctx, "libvndk_sp_private", "vndk-sp-VER", true, "", vendorVariant)
// subdir == "" because VNDK libs are not supposed to be installed separately.
// They are installed as part of VNDK APEX instead.
checkVndkModule(t, ctx, "libvndk", "", false, "", vendorVariant)
checkVndkModule(t, ctx, "libvndk_private", "", false, "", vendorVariant)
checkVndkModule(t, ctx, "libvndk_sp", "", true, "", vendorVariant)
checkVndkModule(t, ctx, "libvndk_sp_private", "", true, "", vendorVariant)
// Check VNDK snapshot output.
@ -2452,8 +2455,8 @@ func TestEnforceProductVndkVersion(t *testing.T) {
ctx := testCcWithConfig(t, config)
checkVndkModule(t, ctx, "libvndk", "vndk-VER", false, "", productVariant)
checkVndkModule(t, ctx, "libvndk_sp", "vndk-sp-VER", true, "", productVariant)
checkVndkModule(t, ctx, "libvndk", "", false, "", productVariant)
checkVndkModule(t, ctx, "libvndk_sp", "", true, "", productVariant)
}
func TestEnforceProductVndkVersionErrors(t *testing.T) {

View File

@ -1246,19 +1246,23 @@ func (library *libraryDecorator) installSymlinkToRuntimeApex(ctx ModuleContext,
func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
if library.shared() {
if ctx.Device() && ctx.useVndk() {
// set subDir for VNDK extensions
if ctx.isVndkExt() {
if ctx.isVndkSp() {
library.baseInstaller.subDir = "vndk-sp"
} else if ctx.isVndk() {
} else {
library.baseInstaller.subDir = "vndk"
}
}
// In some cases we want to use core variant for VNDK-Core libs
if ctx.isVndk() && !ctx.isVndkSp() && !ctx.isVndkExt() {
mayUseCoreVariant := true
if ctx.mustUseVendorVariant() {
mayUseCoreVariant = false
}
if ctx.isVndkExt() {
mayUseCoreVariant = false
}
if ctx.Config().CFIEnabledForPath(ctx.ModuleDir()) && ctx.Arch().ArchType == android.Arm64 {
mayUseCoreVariant = false
}
@ -1269,15 +1273,12 @@ func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
library.useCoreVariant = true
}
}
library.baseInstaller.subDir = "vndk"
}
// Append a version to vndk or vndk-sp directories on the system partition.
// do not install vndk libs
// vndk libs are packaged into VNDK APEX
if ctx.isVndk() && !ctx.isVndkExt() {
vndkVersion := ctx.DeviceConfig().PlatformVndkVersion()
if vndkVersion != "current" && vndkVersion != "" {
library.baseInstaller.subDir += "-" + vndkVersion
}
return
}
} else if len(library.Properties.Stubs.Versions) > 0 && !ctx.Host() && ctx.directlyInAnyApex() {
// Bionic libraries (e.g. libc.so) is installed to the bootstrap subdirectory.

View File

@ -540,6 +540,9 @@ func isVndkSnapshotLibrary(config android.DeviceConfig, m *Module,
if m.Target().NativeBridge == android.NativeBridgeEnabled {
return nil, "", false
}
// !inVendor: There's product/vendor variants for VNDK libs. We only care about vendor variants.
// !installable: Snapshot only cares about "installable" modules.
// isSnapshotPrebuilt: Snapshotting a snapshot doesn't make sense.
if !m.inVendor() || !m.installable(apexInfo) || m.isSnapshotPrebuilt() {
return nil, "", false
}

View File

@ -201,21 +201,7 @@ func (p *vndkPrebuiltLibraryDecorator) isSnapshotPrebuilt() bool {
}
func (p *vndkPrebuiltLibraryDecorator) install(ctx ModuleContext, file android.Path) {
arches := ctx.DeviceConfig().Arches()
if len(arches) == 0 || arches[0].ArchType.String() != p.arch() {
return
}
if ctx.DeviceConfig().BinderBitness() != p.binderBit() {
return
}
if p.shared() {
if ctx.isVndkSp() {
p.baseInstaller.subDir = "vndk-sp-" + p.version()
} else if ctx.isVndk() {
p.baseInstaller.subDir = "vndk-" + p.version()
}
p.baseInstaller.install(ctx, file)
}
// do not install vndk libs
}
func vndkPrebuiltSharedLibrary() *Module {