Relocate llndk.libraries.txt into system

llndk.libraries.txt file is currently located within the VNDK APEX.
However, this file is still required even if VNDK APEX is deprecated.
This change removes llndk.libraries.txt from VNDK APEX, so it can be
installed within the system image.

Bug: 290160925
Test: aosp_cf build succeeded with llndk.libraries.txt in the system
image

Change-Id: I09a0a43babaa58ff16fc04ea71ab41ab68b54b70
This commit is contained in:
Kiyoung Kim 2023-08-11 10:14:43 +09:00
parent f768e6e27e
commit a2d6deedab
5 changed files with 26 additions and 10 deletions

View file

@ -3870,6 +3870,7 @@ func TestVndkApexCurrent(t *testing.T) {
}
`+vndkLibrariesTxtFiles("current"), android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.DeviceVndkVersion = proptools.StringPtr(tc.vndkVersion)
variables.KeepVndk = proptools.BoolPtr(true)
}))
ensureExactContents(t, ctx, "com.android.vndk.current", "android_common_image", tc.expectedFiles)
})

View file

@ -103,7 +103,7 @@ func apexVndkDepsMutator(mctx android.BottomUpMutatorContext) {
}
} else if a, ok := mctx.Module().(*apexBundle); ok && a.vndkApex {
vndkVersion := proptools.StringDefault(a.vndkProperties.Vndk_version, "current")
mctx.AddDependency(mctx.Module(), prebuiltTag, cc.VndkLibrariesTxtModules(vndkVersion)...)
mctx.AddDependency(mctx.Module(), prebuiltTag, cc.VndkLibrariesTxtModules(vndkVersion, mctx)...)
}
}

View file

@ -51,6 +51,7 @@ func TestVndkApexForVndkLite(t *testing.T) {
`+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

View file

@ -654,6 +654,7 @@ func TestVndkLibrariesTxtAndroidMk(t *testing.T) {
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
config.TestProductVariables.KeepVndk = BoolPtr(true)
ctx := testCcWithConfig(t, config)
module := ctx.ModuleForTests("llndk.libraries.txt", "android_common")

View file

@ -39,25 +39,34 @@ const (
vndkUsingCoreVariantLibrariesTxt = "vndkcorevariant.libraries.txt"
)
func VndkLibrariesTxtModules(vndkVersion string) []string {
func VndkLibrariesTxtModules(vndkVersion string, ctx android.BaseModuleContext) []string {
if vndkVersion == "current" {
return []string{
llndkLibrariesTxt,
result := []string{
vndkCoreLibrariesTxt,
vndkSpLibrariesTxt,
vndkPrivateLibrariesTxt,
vndkProductLibrariesTxt,
}
// TODO(b/290159430) This part will not be required once deprecation of VNDK
// is handled with 'ro.vndk.version' property
if !ctx.Config().IsVndkDeprecated() {
result = append(result, llndkLibrariesTxt)
}
return result
}
// Snapshot vndks have their own *.libraries.VER.txt files.
// Note that snapshots don't have "vndkcorevariant.libraries.VER.txt"
return []string{
insertVndkVersion(llndkLibrariesTxt, vndkVersion),
result := []string{
insertVndkVersion(vndkCoreLibrariesTxt, vndkVersion),
insertVndkVersion(vndkSpLibrariesTxt, vndkVersion),
insertVndkVersion(vndkPrivateLibrariesTxt, vndkVersion),
insertVndkVersion(vndkProductLibrariesTxt, vndkVersion),
insertVndkVersion(llndkLibrariesTxt, vndkVersion),
}
return result
}
type VndkProperties struct {
@ -519,11 +528,15 @@ func insertVndkVersion(filename string, vndkVersion string) string {
}
func (txt *vndkLibrariesTxt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
var filename string
if BoolDefault(txt.properties.Insert_vndk_version, true) {
filename := txt.Name()
shouldInsertVndkVersion := BoolDefault(txt.properties.Insert_vndk_version, true)
// llndk.libraries.txt file installed in the system image should not contain version info.
if ctx.Config().IsVndkDeprecated() && txt.Name() == llndkLibrariesTxt {
shouldInsertVndkVersion = false
}
if shouldInsertVndkVersion {
filename = insertVndkVersion(txt.Name(), ctx.DeviceConfig().PlatformVndkVersion())
} else {
filename = txt.Name()
}
txt.outputFile = android.PathForModuleOut(ctx, filename).OutputPath