Merge "Build VNDK with VNDK prebuilts without BOARD_VNDK_VERSION" into main
This commit is contained in:
@@ -3772,13 +3772,6 @@ func TestVndkApexCurrent(t *testing.T) {
|
|||||||
"lib64/libvndk.so",
|
"lib64/libvndk.so",
|
||||||
"lib64/libvndksp.so"),
|
"lib64/libvndksp.so"),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
vndkVersion: "",
|
|
||||||
expectedFiles: append(commonFiles,
|
|
||||||
// Legacy VNDK APEX contains only VNDK-SP files (of core variant)
|
|
||||||
"lib/libvndksp.so",
|
|
||||||
"lib64/libvndksp.so"),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
t.Run("VNDK.current with DeviceVndkVersion="+tc.vndkVersion, func(t *testing.T) {
|
t.Run("VNDK.current with DeviceVndkVersion="+tc.vndkVersion, func(t *testing.T) {
|
||||||
|
@@ -8,66 +8,6 @@ import (
|
|||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestVndkApexForVndkLite(t *testing.T) {
|
|
||||||
ctx := testApex(t, `
|
|
||||||
apex_vndk {
|
|
||||||
name: "com.android.vndk.current",
|
|
||||||
key: "com.android.vndk.current.key",
|
|
||||||
updatable: false,
|
|
||||||
}
|
|
||||||
|
|
||||||
apex_key {
|
|
||||||
name: "com.android.vndk.current.key",
|
|
||||||
public_key: "testkey.avbpubkey",
|
|
||||||
private_key: "testkey.pem",
|
|
||||||
}
|
|
||||||
|
|
||||||
cc_library {
|
|
||||||
name: "libvndk",
|
|
||||||
srcs: ["mylib.cpp"],
|
|
||||||
vendor_available: true,
|
|
||||||
product_available: true,
|
|
||||||
vndk: {
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
system_shared_libs: [],
|
|
||||||
stl: "none",
|
|
||||||
apex_available: [ "com.android.vndk.current" ],
|
|
||||||
}
|
|
||||||
|
|
||||||
cc_library {
|
|
||||||
name: "libvndksp",
|
|
||||||
srcs: ["mylib.cpp"],
|
|
||||||
vendor_available: true,
|
|
||||||
product_available: true,
|
|
||||||
vndk: {
|
|
||||||
enabled: true,
|
|
||||||
support_system_process: true,
|
|
||||||
},
|
|
||||||
system_shared_libs: [],
|
|
||||||
stl: "none",
|
|
||||||
apex_available: [ "com.android.vndk.current" ],
|
|
||||||
}
|
|
||||||
`+vndkLibrariesTxtFiles("current"),
|
|
||||||
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
|
||||||
variables.DeviceVndkVersion = proptools.StringPtr("")
|
|
||||||
variables.KeepVndk = proptools.BoolPtr(true)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
// VNDK-Lite contains only core variants of VNDK-Sp libraries
|
|
||||||
ensureExactContents(t, ctx, "com.android.vndk.current", "android_common", []string{
|
|
||||||
"lib/libvndksp.so",
|
|
||||||
"lib/libc++.so",
|
|
||||||
"lib64/libvndksp.so",
|
|
||||||
"lib64/libc++.so",
|
|
||||||
"etc/llndk.libraries.29.txt",
|
|
||||||
"etc/vndkcore.libraries.29.txt",
|
|
||||||
"etc/vndksp.libraries.29.txt",
|
|
||||||
"etc/vndkprivate.libraries.29.txt",
|
|
||||||
"etc/vndkproduct.libraries.29.txt",
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestVndkApexUsesVendorVariant(t *testing.T) {
|
func TestVndkApexUsesVendorVariant(t *testing.T) {
|
||||||
bp := `
|
bp := `
|
||||||
apex_vndk {
|
apex_vndk {
|
||||||
|
19
cc/vndk.go
19
cc/vndk.go
@@ -377,22 +377,17 @@ func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore prebuilt vndk modules that are newer than or equal to the platform vndk version
|
platformVndkVersion := mctx.DeviceConfig().PlatformVndkVersion()
|
||||||
platformVndkApiLevel := android.ApiLevelOrPanic(mctx, mctx.DeviceConfig().PlatformVndkVersion())
|
if platformVndkVersion != "" {
|
||||||
if platformVndkApiLevel.LessThanOrEqualTo(android.ApiLevelOrPanic(mctx, p.Version())) {
|
// ignore prebuilt vndk modules that are newer than or equal to the platform vndk version
|
||||||
return false
|
platformVndkApiLevel := android.ApiLevelOrPanic(mctx, platformVndkVersion)
|
||||||
|
if platformVndkApiLevel.LessThanOrEqualTo(android.ApiLevelOrPanic(mctx, p.Version())) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if lib, ok := m.linker.(libraryInterface); ok {
|
if lib, ok := m.linker.(libraryInterface); ok {
|
||||||
// VNDK APEX for VNDK-Lite devices will have VNDK-SP libraries from core variants
|
|
||||||
if mctx.DeviceConfig().VndkVersion() == "" {
|
|
||||||
// b/73296261: filter out libz.so because it is considered as LLNDK for VNDK-lite devices
|
|
||||||
if mctx.ModuleName() == "libz" {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return m.ImageVariation().Variation == android.CoreVariation && lib.shared() && m.IsVndkSp() && !m.IsVndkExt()
|
|
||||||
}
|
|
||||||
// VNDK APEX doesn't need stub variants
|
// VNDK APEX doesn't need stub variants
|
||||||
if lib.buildStubs() {
|
if lib.buildStubs() {
|
||||||
return false
|
return false
|
||||||
|
@@ -131,11 +131,14 @@ func (p *vndkPrebuiltLibraryDecorator) singleSourcePath(ctx ModuleContext) andro
|
|||||||
|
|
||||||
func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
|
func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
|
||||||
flags Flags, deps PathDeps, objs Objects) android.Path {
|
flags Flags, deps PathDeps, objs Objects) android.Path {
|
||||||
platformVndkApiLevel := android.ApiLevelOrPanic(ctx, ctx.DeviceConfig().PlatformVndkVersion())
|
platformVndkVersion := ctx.DeviceConfig().PlatformVndkVersion()
|
||||||
if platformVndkApiLevel.LessThanOrEqualTo(android.ApiLevelOrPanic(ctx, p.Version())) {
|
if platformVndkVersion != "" {
|
||||||
// This prebuilt VNDK module is not required for the current build
|
platformVndkApiLevel := android.ApiLevelOrPanic(ctx, platformVndkVersion)
|
||||||
ctx.Module().HideFromMake()
|
if platformVndkApiLevel.LessThanOrEqualTo(android.ApiLevelOrPanic(ctx, p.Version())) {
|
||||||
return nil
|
// This prebuilt VNDK module is not required for the current build
|
||||||
|
ctx.Module().HideFromMake()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !p.MatchesWithDevice(ctx.DeviceConfig()) {
|
if !p.MatchesWithDevice(ctx.DeviceConfig()) {
|
||||||
@@ -247,14 +250,6 @@ func vndkPrebuiltSharedLibrary() *Module {
|
|||||||
&prebuilt.properties,
|
&prebuilt.properties,
|
||||||
)
|
)
|
||||||
|
|
||||||
android.AddLoadHook(module, func(ctx android.LoadHookContext) {
|
|
||||||
// empty BOARD_VNDK_VERSION implies that the device won't support
|
|
||||||
// system only OTA. In this case, VNDK snapshots aren't needed.
|
|
||||||
if ctx.DeviceConfig().VndkVersion() == "" {
|
|
||||||
ctx.Module().Disable()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user