Merge "Add non_apex.exclude_shared_libs to cc" into main am: 2648a99386

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2849278

Change-Id: I88115bd157f5c8eb5135f2c53a394998d9e92799
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jooyung Han
2023-11-29 02:14:34 +00:00
committed by Automerger Merge Worker
2 changed files with 19 additions and 0 deletions

View File

@@ -141,6 +141,8 @@ type Deps struct {
// List of libs that need to be excluded for APEX variant // List of libs that need to be excluded for APEX variant
ExcludeLibsForApex []string ExcludeLibsForApex []string
// List of libs that need to be excluded for non-APEX variant
ExcludeLibsForNonApex []string
} }
// PathDeps is a struct containing file paths to dependencies of a module. // PathDeps is a struct containing file paths to dependencies of a module.
@@ -728,6 +730,8 @@ type libraryDependencyTag struct {
// Whether or not this dependency has to be followed for the apex variants // Whether or not this dependency has to be followed for the apex variants
excludeInApex bool excludeInApex bool
// Whether or not this dependency has to be followed for the non-apex variants
excludeInNonApex bool
// If true, don't automatically export symbols from the static library into a shared library. // If true, don't automatically export symbols from the static library into a shared library.
unexportedSymbols bool unexportedSymbols bool
@@ -2819,6 +2823,9 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
if inList(lib, deps.ExcludeLibsForApex) { if inList(lib, deps.ExcludeLibsForApex) {
depTag.excludeInApex = true depTag.excludeInApex = true
} }
if inList(lib, deps.ExcludeLibsForNonApex) {
depTag.excludeInNonApex = true
}
name, version := StubsLibNameAndVersion(lib) name, version := StubsLibNameAndVersion(lib)
if apiLibraryName, ok := apiImportInfo.SharedLibs[name]; ok && !ctx.OtherModuleExists(name) { if apiLibraryName, ok := apiImportInfo.SharedLibs[name]; ok && !ctx.OtherModuleExists(name) {
@@ -3335,6 +3342,9 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
if !apexInfo.IsForPlatform() && libDepTag.excludeInApex { if !apexInfo.IsForPlatform() && libDepTag.excludeInApex {
return return
} }
if apexInfo.IsForPlatform() && libDepTag.excludeInNonApex {
return
}
depExporterInfo := ctx.OtherModuleProvider(dep, FlagExporterInfoProvider).(FlagExporterInfo) depExporterInfo := ctx.OtherModuleProvider(dep, FlagExporterInfoProvider).(FlagExporterInfo)

View File

@@ -214,6 +214,11 @@ type BaseLinkerProperties struct {
// variant of the C/C++ module. // variant of the C/C++ module.
Exclude_static_libs []string 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"` } `android:"arch_variant"`
// make android::build:GetBuildNumber() available containing the build ID. // make android::build:GetBuildNumber() available containing the build ID.
@@ -300,6 +305,10 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
// variants. // variants.
deps.ExcludeLibsForApex = append(deps.ExcludeLibsForApex, linker.Properties.Target.Apex.Exclude_shared_libs...) deps.ExcludeLibsForApex = append(deps.ExcludeLibsForApex, linker.Properties.Target.Apex.Exclude_shared_libs...)
deps.ExcludeLibsForApex = append(deps.ExcludeLibsForApex, linker.Properties.Target.Apex.Exclude_static_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) { if Bool(linker.Properties.Use_version_lib) {
deps.WholeStaticLibs = append(deps.WholeStaticLibs, "libbuildversion") deps.WholeStaticLibs = append(deps.WholeStaticLibs, "libbuildversion")