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
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 8368db1..da059eb 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -3870,6 +3870,7 @@
}
`+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)
})
diff --git a/apex/vndk.go b/apex/vndk.go
index 095e89d..8893240 100644
--- a/apex/vndk.go
+++ b/apex/vndk.go
@@ -103,7 +103,7 @@
}
} 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)...)
}
}
diff --git a/apex/vndk_test.go b/apex/vndk_test.go
index 21526c3..4327a61 100644
--- a/apex/vndk_test.go
+++ b/apex/vndk_test.go
@@ -51,6 +51,7 @@
`+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
diff --git a/cc/cc_test.go b/cc/cc_test.go
index d95ed3f..7ce0f37 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -654,6 +654,7 @@
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")
diff --git a/cc/vndk.go b/cc/vndk.go
index 7a2286e..95a5a4f 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -39,25 +39,34 @@
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 (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