Stop using VNDK from product partition
Product modules install required vndk modules in /product/lib[64].
But still the product modules can link to the llndk from system
partition using the list in /system/etc/llndk.libraries.txt.
To install /system/etc/llndk.libraries.txt file, use
llndk_libraries_txt singleton without versioned name.
Until VNDK is fully removed, the vndk apex must install the versioned
llndk.libraries.<ver>.txt file to the vndk apex.
Use llndk_libraries_txt_for_apex singleton for this purpose.
Test: lunch cf_x86_64_phone-next-userdebug; m
Test: atest GtsVndkDependencyTestCases
Bug: 299867815
Bug: 302255959
Change-Id: I058616081fe31597a9b76b772b69927807436896
diff --git a/apex/apex_test.go b/apex/apex_test.go
index e70d3af..2bed554 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -3882,13 +3882,24 @@
func vndkLibrariesTxtFiles(vers ...string) (result string) {
for _, v := range vers {
if v == "current" {
- for _, txt := range []string{"llndk", "vndkcore", "vndksp", "vndkprivate", "vndkproduct"} {
+ for _, txt := range []string{"vndkcore", "vndksp", "vndkprivate", "vndkproduct"} {
result += `
` + txt + `_libraries_txt {
name: "` + txt + `.libraries.txt",
+ insert_vndk_version: true,
}
`
}
+ result += `
+ llndk_libraries_txt {
+ name: "llndk.libraries.txt",
+ }
+ llndk_libraries_txt_for_apex {
+ name: "llndk.libraries.txt.apex",
+ stem: "llndk.libraries.txt",
+ insert_vndk_version: true,
+ }
+ `
} else {
for _, txt := range []string{"llndk", "vndkcore", "vndksp", "vndkprivate", "vndkproduct"} {
result += `
diff --git a/cc/library.go b/cc/library.go
index b7688f7..1807bbf 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -2195,7 +2195,7 @@
// do not install vndk libs
// vndk libs are packaged into VNDK APEX
- if ctx.isVndk() && !ctx.IsVndkExt() && !ctx.Config().IsVndkDeprecated() {
+ if ctx.isVndk() && !ctx.IsVndkExt() && !ctx.Config().IsVndkDeprecated() && !ctx.inProduct() {
return
}
} else if library.hasStubsVariants() && !ctx.Host() && ctx.directlyInAnyApex() {
diff --git a/cc/vndk.go b/cc/vndk.go
index 5ac5032..a849455 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -28,10 +28,12 @@
"android/soong/snapshot"
"github.com/google/blueprint"
+ "github.com/google/blueprint/proptools"
)
const (
llndkLibrariesTxt = "llndk.libraries.txt"
+ llndkLibrariesTxtForApex = "llndk.libraries.txt.apex"
vndkCoreLibrariesTxt = "vndkcore.libraries.txt"
vndkSpLibrariesTxt = "vndksp.libraries.txt"
vndkPrivateLibrariesTxt = "vndkprivate.libraries.txt"
@@ -40,6 +42,7 @@
)
func VndkLibrariesTxtModules(vndkVersion string, ctx android.BaseModuleContext) []string {
+ // Return the list of vndk txt files for the vndk apex of the vndkVersion.
if vndkVersion == "current" {
// We can assume all txt files are snapshotted if we find one of them.
currentVndkSnapshotted := ctx.OtherModuleExists(insertVndkVersion(llndkLibrariesTxt, ctx.DeviceConfig().PlatformVndkVersion()))
@@ -51,20 +54,13 @@
vndkVersion = ctx.DeviceConfig().PlatformVndkVersion()
} else {
// Use the txt files generated from the source
- result := []string{
+ return []string{
+ llndkLibrariesTxtForApex,
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
}
}
@@ -451,6 +447,7 @@
func RegisterVndkLibraryTxtTypes(ctx android.RegistrationContext) {
ctx.RegisterParallelSingletonModuleType("llndk_libraries_txt", llndkLibrariesTxtFactory)
+ ctx.RegisterParallelSingletonModuleType("llndk_libraries_txt_for_apex", llndkLibrariesTxtApexOnlyFactory)
ctx.RegisterParallelSingletonModuleType("vndksp_libraries_txt", vndkSPLibrariesTxtFactory)
ctx.RegisterParallelSingletonModuleType("vndkcore_libraries_txt", vndkCoreLibrariesTxtFactory)
ctx.RegisterParallelSingletonModuleType("vndkprivate_libraries_txt", vndkPrivateLibrariesTxtFactory)
@@ -474,22 +471,31 @@
type VndkLibrariesTxtProperties struct {
Insert_vndk_version *bool
+ Stem *string
}
var _ etc.PrebuiltEtcModule = &vndkLibrariesTxt{}
var _ android.OutputFileProducer = &vndkLibrariesTxt{}
// llndk_libraries_txt is a singleton module whose content is a list of LLNDK libraries
-// generated by Soong but can be referenced by other modules.
-// For example, apex_vndk can depend on these files as prebuilt.
+// generated by Soong.
// Make uses LLNDK_LIBRARIES to determine which libraries to install.
-// HWASAN is only part of the LL-NDK in builds in which libc depends on HWASAN.
+// HWASAN is only part of the LLNDK in builds in which libc depends on HWASAN.
// Therefore, by removing the library here, we cause it to only be installed if libc
// depends on it.
func llndkLibrariesTxtFactory() android.SingletonModule {
return newVndkLibrariesWithMakeVarFilter(llndkLibraries, "LLNDK_LIBRARIES", "libclang_rt.hwasan")
}
+// llndk_libraries_txt_for_apex is a singleton module that provide the same LLNDK libraries list
+// with the llndk_libraries_txt, but skips setting make variable LLNDK_LIBRARIES. So, it must not
+// be used without installing llndk_libraries_txt singleton.
+// We include llndk_libraries_txt by default to install the llndk.libraries.txt file to system/etc.
+// This singleton module is to install the llndk.libraries.<ver>.txt file to vndk apex.
+func llndkLibrariesTxtApexOnlyFactory() android.SingletonModule {
+ return newVndkLibrariesWithMakeVarFilter(llndkLibraries, "", "libclang_rt.hwasan")
+}
+
// vndksp_libraries_txt is a singleton module whose content is a list of VNDKSP libraries
// generated by Soong but can be referenced by other modules.
// For example, apex_vndk can depend on these files as prebuilt.
@@ -557,15 +563,10 @@
}
func (txt *vndkLibrariesTxt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- filename := txt.Name()
+ filename := proptools.StringDefault(txt.properties.Stem, 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())
+ if Bool(txt.properties.Insert_vndk_version) {
+ filename = insertVndkVersion(filename, ctx.DeviceConfig().PlatformVndkVersion())
}
txt.outputFile = android.PathForModuleOut(ctx, filename).OutputPath
@@ -592,6 +593,10 @@
}
func (txt *vndkLibrariesTxt) MakeVars(ctx android.MakeVarsContext) {
+ if txt.makeVarName == "" {
+ return
+ }
+
filter := func(modules []string, prefix string) []string {
if prefix == "" {
return modules