Create vndkproduct.libraries.txt
Some VNDKs will be available to product modules by adding
'product_available' property. These VNDK libs will be listed in
vndkproduct.libraries.txt and tracked by the build system for the
changes. The product available VNDK list will be frozen by the
release process.
Bug: 174323911
Test: build
Change-Id: Ie1b085851413a8f2273925fefdc14fec3bfc7892
diff --git a/cc/vndk.go b/cc/vndk.go
index 6bc7131..2071a03 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -35,6 +35,7 @@
vndkCoreLibrariesTxt = "vndkcore.libraries.txt"
vndkSpLibrariesTxt = "vndksp.libraries.txt"
vndkPrivateLibrariesTxt = "vndkprivate.libraries.txt"
+ vndkProductLibrariesTxt = "vndkproduct.libraries.txt"
vndkUsingCoreVariantLibrariesTxt = "vndkcorevariant.libraries.txt"
)
@@ -45,6 +46,7 @@
vndkCoreLibrariesTxt,
vndkSpLibrariesTxt,
vndkPrivateLibrariesTxt,
+ vndkProductLibrariesTxt,
}
}
// Snapshot vndks have their own *.libraries.VER.txt files.
@@ -54,6 +56,7 @@
insertVndkVersion(vndkCoreLibrariesTxt, vndkVersion),
insertVndkVersion(vndkSpLibrariesTxt, vndkVersion),
insertVndkVersion(vndkPrivateLibrariesTxt, vndkVersion),
+ insertVndkVersion(vndkProductLibrariesTxt, vndkVersion),
}
}
@@ -229,10 +232,11 @@
}
var (
- vndkCoreLibrariesKey = android.NewOnceKey("vndkCoreLibrarires")
- vndkSpLibrariesKey = android.NewOnceKey("vndkSpLibrarires")
- llndkLibrariesKey = android.NewOnceKey("llndkLibrarires")
- vndkPrivateLibrariesKey = android.NewOnceKey("vndkPrivateLibrarires")
+ vndkCoreLibrariesKey = android.NewOnceKey("vndkCoreLibraries")
+ vndkSpLibrariesKey = android.NewOnceKey("vndkSpLibraries")
+ llndkLibrariesKey = android.NewOnceKey("llndkLibraries")
+ vndkPrivateLibrariesKey = android.NewOnceKey("vndkPrivateLibraries")
+ vndkProductLibrariesKey = android.NewOnceKey("vndkProductLibraries")
vndkUsingCoreVariantLibrariesKey = android.NewOnceKey("vndkUsingCoreVariantLibraries")
vndkMustUseVendorVariantListKey = android.NewOnceKey("vndkMustUseVendorVariantListKey")
vndkLibrariesLock sync.Mutex
@@ -262,6 +266,12 @@
}).(map[string]string)
}
+func vndkProductLibraries(config android.Config) map[string]string {
+ return config.Once(vndkProductLibrariesKey, func() interface{} {
+ return make(map[string]string)
+ }).(map[string]string)
+}
+
func vndkUsingCoreVariantLibraries(config android.Config) map[string]string {
return config.Once(vndkUsingCoreVariantLibrariesKey, func() interface{} {
return make(map[string]string)
@@ -299,6 +309,12 @@
}
func processVndkLibrary(mctx android.BottomUpMutatorContext, m *Module) {
+ if m.InProduct() {
+ // We may skip the steps for the product variants because they
+ // are already covered by the vendor variants.
+ return
+ }
+
name := m.BaseModuleName()
filename, err := getVndkFileName(m)
if err != nil {
@@ -318,12 +334,6 @@
vndkLibrariesLock.Lock()
defer vndkLibrariesLock.Unlock()
- if m.InProduct() {
- // We may skip the other steps for the product variants because they
- // are already covered by the vendor variants.
- return
- }
-
if inList(name, vndkMustUseVendorVariantList(mctx.Config())) {
m.Properties.MustUseVendorVariant = true
}
@@ -339,6 +349,9 @@
if m.IsVndkPrivate() {
vndkPrivateLibraries(mctx.Config())[name] = filename
}
+ if m.VendorProperties.Product_available != nil {
+ vndkProductLibraries(mctx.Config())[name] = filename
+ }
}
// Check for modules that mustn't be VNDK
@@ -453,6 +466,7 @@
// - vndkcore.libraries.txt
// - vndksp.libraries.txt
// - vndkprivate.libraries.txt
+// - vndkproduct.libraries.txt
// - vndkcorevariant.libraries.txt
// A module behaves like a prebuilt_etc but its content is generated by soong.
// By being a soong module, these files can be referenced by other soong modules.
@@ -486,6 +500,8 @@
list = android.SortedStringMapValues(vndkSpLibraries(ctx.Config()))
case vndkPrivateLibrariesTxt:
list = android.SortedStringMapValues(vndkPrivateLibraries(ctx.Config()))
+ case vndkProductLibrariesTxt:
+ list = android.SortedStringMapValues(vndkProductLibraries(ctx.Config()))
case vndkUsingCoreVariantLibrariesTxt:
list = android.SortedStringMapValues(vndkUsingCoreVariantLibraries(ctx.Config()))
default:
@@ -807,6 +823,7 @@
vndkcore := android.SortedStringMapValues(vndkCoreLibraries(ctx.Config()))
vndksp := android.SortedStringMapValues(vndkSpLibraries(ctx.Config()))
vndkprivate := android.SortedStringMapValues(vndkPrivateLibraries(ctx.Config()))
+ vndkproduct := android.SortedStringMapValues(vndkProductLibraries(ctx.Config()))
// Build list of vndk libs as merged & tagged & filter-out(libclang_rt):
// Since each target have different set of libclang_rt.* files,
@@ -824,6 +841,7 @@
merged = append(merged, addPrefix(vndksp, "VNDK-SP: ")...)
merged = append(merged, addPrefix(filterOutLibClangRt(vndkcore), "VNDK-core: ")...)
merged = append(merged, addPrefix(vndkprivate, "VNDK-private: ")...)
+ merged = append(merged, addPrefix(filterOutLibClangRt(vndkproduct), "VNDK-product: ")...)
c.vndkLibrariesFile = android.PathForOutput(ctx, "vndk", "vndk.libraries.txt")
android.WriteFileRule(ctx, c.vndkLibrariesFile, strings.Join(merged, "\n"))
}