Add non_apex.exclude_shared_libs to cc

This can be used to add apex-specific shared_libs to a CC module. It
would be nice if we could have apex.shared_libs. But it would make code
much harder to follow because we need to record the shared_libs list as
"exclude list" for non-apex anyway.

Bug: 312510312
Test: m libhardware libhardware.vendor libhardware.vendor.com.google.cf.ir
  # check DTNEEDED for libapexsupport
  # only apex-variant should have the dependency
Change-Id: I56a3dc280127d8ba44337707444ea226a49ccf0f
This commit is contained in:
Jooyung Han
2023-11-28 22:31:35 +09:00
parent a4291d572a
commit 9ffbe83028
2 changed files with 19 additions and 0 deletions

View File

@@ -214,6 +214,11 @@ type BaseLinkerProperties struct {
// variant of the C/C++ module.
Exclude_static_libs []string
}
Non_apex struct {
// list of shared libs that should not be used to build the non-apex
// variant of the C/C++ module.
Exclude_shared_libs []string
}
} `android:"arch_variant"`
// make android::build:GetBuildNumber() available containing the build ID.
@@ -300,6 +305,10 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
// variants.
deps.ExcludeLibsForApex = append(deps.ExcludeLibsForApex, linker.Properties.Target.Apex.Exclude_shared_libs...)
deps.ExcludeLibsForApex = append(deps.ExcludeLibsForApex, linker.Properties.Target.Apex.Exclude_static_libs...)
// Record the libraries that need to be excluded when building for non-APEX variants
// for the same reason above. This is used for marking deps and marked deps are
// ignored for non-apex variants.
deps.ExcludeLibsForNonApex = append(deps.ExcludeLibsForNonApex, linker.Properties.Target.Non_apex.Exclude_shared_libs...)
if Bool(linker.Properties.Use_version_lib) {
deps.WholeStaticLibs = append(deps.WholeStaticLibs, "libbuildversion")