Add "apex_vndk" module type
"apex_vndk" is a variant of "apex" module.
apex_vndk {
name: "com.android.vndk",
..
}
This rule is used to produce a VNDK APEX per vndk version.
It supports automatic inclusion of vndk libs.
If "vndk_version" property is set, the prebuilt vndk libs of
the version will be included in the apex bundle.
apex_vndk {
name: "com.android.vndk.v29"
vndk_version: "29",
...
}
Otherwise, platform's vndk version is used.
This will replace /system/{lib}/vndk-{ver} and vndk-sp-{ver}.
Bug: 134357236
Bug: 139772411
Test: m com.android.vndk
Change-Id: Ib5c86e625839389670d13c683a7427198ef6852f
diff --git a/cc/cc.go b/cc/cc.go
index 2ff3434..cd832cb 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -478,6 +478,19 @@
return ""
}
+// IsVndkOnSystem returns true if a module is supposed to be a vndk library provided by system to vendor
+func (c *Module) IsVndkOnSystem() bool {
+ if linker, ok := c.linker.(libraryInterface); ok {
+ return linker.shared() && c.isVndk() && c.useVndk() && !c.isVndkExt()
+ }
+
+ return false
+}
+
+func (c *Module) VndkVersion() string {
+ return c.vndkVersion()
+}
+
func (c *Module) Init() android.Module {
c.AddProperties(&c.Properties, &c.VendorProperties)
if c.compiler != nil {
diff --git a/cc/prebuilt.go b/cc/prebuilt.go
index dc6c43a..3455691 100644
--- a/cc/prebuilt.go
+++ b/cc/prebuilt.go
@@ -19,8 +19,8 @@
)
func init() {
- android.RegisterModuleType("cc_prebuilt_library_shared", prebuiltSharedLibraryFactory)
- android.RegisterModuleType("cc_prebuilt_library_static", prebuiltStaticLibraryFactory)
+ android.RegisterModuleType("cc_prebuilt_library_shared", PrebuiltSharedLibraryFactory)
+ android.RegisterModuleType("cc_prebuilt_library_static", PrebuiltStaticLibraryFactory)
android.RegisterModuleType("cc_prebuilt_binary", prebuiltBinaryFactory)
}
@@ -131,7 +131,7 @@
// cc_prebuilt_library_shared installs a precompiled shared library that are
// listed in the srcs property in the device's directory.
-func prebuiltSharedLibraryFactory() android.Module {
+func PrebuiltSharedLibraryFactory() android.Module {
module, _ := NewPrebuiltSharedLibrary(android.HostAndDeviceSupported)
return module.Init()
}
@@ -158,7 +158,7 @@
// cc_prebuilt_library_static installs a precompiled static library that are
// listed in the srcs property in the device's directory.
-func prebuiltStaticLibraryFactory() android.Module {
+func PrebuiltStaticLibraryFactory() android.Module {
module, _ := NewPrebuiltStaticLibrary(android.HostAndDeviceSupported)
return module.Init()
}
diff --git a/cc/prebuilt_test.go b/cc/prebuilt_test.go
index 98d78e8..edcd26e 100644
--- a/cc/prebuilt_test.go
+++ b/cc/prebuilt_test.go
@@ -72,8 +72,8 @@
ctx := CreateTestContext(bp, fs, android.Android)
- ctx.RegisterModuleType("cc_prebuilt_library_shared", android.ModuleFactoryAdaptor(prebuiltSharedLibraryFactory))
- ctx.RegisterModuleType("cc_prebuilt_library_static", android.ModuleFactoryAdaptor(prebuiltStaticLibraryFactory))
+ ctx.RegisterModuleType("cc_prebuilt_library_shared", android.ModuleFactoryAdaptor(PrebuiltSharedLibraryFactory))
+ ctx.RegisterModuleType("cc_prebuilt_library_static", android.ModuleFactoryAdaptor(PrebuiltStaticLibraryFactory))
ctx.RegisterModuleType("cc_prebuilt_binary", android.ModuleFactoryAdaptor(prebuiltBinaryFactory))
ctx.PreArchMutators(android.RegisterPrebuiltsPreArchMutators)
diff --git a/cc/testing.go b/cc/testing.go
index 5a3993c..a0b1634 100644
--- a/cc/testing.go
+++ b/cc/testing.go
@@ -253,7 +253,7 @@
ctx.RegisterModuleType("vendor_public_library", android.ModuleFactoryAdaptor(vendorPublicLibraryFactory))
ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(ObjectFactory))
ctx.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(android.FileGroupFactory))
- ctx.RegisterModuleType("vndk_prebuilt_shared", android.ModuleFactoryAdaptor(vndkPrebuiltSharedFactory))
+ ctx.RegisterModuleType("vndk_prebuilt_shared", android.ModuleFactoryAdaptor(VndkPrebuiltSharedFactory))
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
ctx.BottomUp("image", ImageMutator).Parallel()
ctx.BottomUp("link", LinkageMutator).Parallel()
diff --git a/cc/vndk_prebuilt.go b/cc/vndk_prebuilt.go
index c8ff87f..1dfe8ea 100644
--- a/cc/vndk_prebuilt.go
+++ b/cc/vndk_prebuilt.go
@@ -202,11 +202,11 @@
// },
// },
// }
-func vndkPrebuiltSharedFactory() android.Module {
+func VndkPrebuiltSharedFactory() android.Module {
module := vndkPrebuiltSharedLibrary()
return module.Init()
}
func init() {
- android.RegisterModuleType("vndk_prebuilt_shared", vndkPrebuiltSharedFactory)
+ android.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory)
}