Introduce runtime_libs to cc_binary and cc_library
This commit adds `runtime_libs` to cc_binary and cc_library.
Similar to the `required` property, if a module specifies the
`runtime_libs` properties and it is installed, then the modules
specified in `runtime_libs` will be installed as well.
Differnt from the `required` property, if a module is using VNDK and the
module names specified in `runtime_libs` are resolved to the modules
with both core and vendor variants, then '.vendor' will be appended to
those module names.
For example, if `libb` is vendor_available and `libd` is a vendor lib,
then LOCAL_REQUIRED_MODULES will contain `libb.vendor` (instead of
`libb`).
Bug: 72343507
Test: lunch aosp_arm64_ab-userdebug && make # this runs the unit tests
Test: Create a vendor module with runtime_libs property to a
vendor_available shared library and check the generated Android.mk.
Change-Id: I9e245d80004dab597a5d3db5acd8a09117118db7
diff --git a/cc/linker.go b/cc/linker.go
index cde7a6d..71da09e 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -88,15 +88,24 @@
// between static libraries, but it is generally better to order them correctly instead.
Group_static_libs *bool `android:"arch_variant"`
+ // list of modules that should be installed with this module. This is similar to 'required'
+ // but '.vendor' suffix will be appended to the module names if the shared libraries have
+ // vendor variants and this module uses VNDK.
+ Runtime_libs []string `android:"arch_variant"`
+
Target struct {
Vendor struct {
- // list of shared libs that should not be used to build
- // the vendor variant of the C/C++ module.
+ // list of shared libs that should not be used to build the vendor variant
+ // of the C/C++ module.
Exclude_shared_libs []string
- // list of static libs that should not be used to build
- // the vendor variant of the C/C++ module.
+ // list of static libs that should not be used to build the vendor variant
+ // of the C/C++ module.
Exclude_static_libs []string
+
+ // list of runtime libs that should not be installed along with the vendor
+ // variant of the C/C++ module.
+ Exclude_runtime_libs []string
}
}
@@ -137,6 +146,7 @@
deps.HeaderLibs = append(deps.HeaderLibs, linker.Properties.Header_libs...)
deps.StaticLibs = append(deps.StaticLibs, linker.Properties.Static_libs...)
deps.SharedLibs = append(deps.SharedLibs, linker.Properties.Shared_libs...)
+ deps.RuntimeLibs = append(deps.RuntimeLibs, linker.Properties.Runtime_libs...)
deps.ReexportHeaderLibHeaders = append(deps.ReexportHeaderLibHeaders, linker.Properties.Export_header_lib_headers...)
deps.ReexportStaticLibHeaders = append(deps.ReexportStaticLibHeaders, linker.Properties.Export_static_lib_headers...)
@@ -153,6 +163,7 @@
deps.StaticLibs = removeListFromList(deps.StaticLibs, linker.Properties.Target.Vendor.Exclude_static_libs)
deps.ReexportStaticLibHeaders = removeListFromList(deps.ReexportStaticLibHeaders, linker.Properties.Target.Vendor.Exclude_static_libs)
deps.WholeStaticLibs = removeListFromList(deps.WholeStaticLibs, linker.Properties.Target.Vendor.Exclude_static_libs)
+ deps.RuntimeLibs = removeListFromList(deps.RuntimeLibs, linker.Properties.Target.Vendor.Exclude_runtime_libs)
}
if ctx.ModuleName() != "libcompiler_rt-extras" {