Merge "Let LLNDK implementation libraries depend on LLNDK headers" into main

This commit is contained in:
Hsin-Yi Chen
2024-04-08 02:06:13 +00:00
committed by Gerrit Code Review
2 changed files with 29 additions and 0 deletions

View File

@@ -136,6 +136,12 @@ type Deps struct {
ExcludeLibsForApex []string
// List of libs that need to be excluded for non-APEX variant
ExcludeLibsForNonApex []string
// LLNDK headers for the ABI checker to check LLNDK implementation library.
// An LLNDK implementation is the core variant. LLNDK header libs are reexported by the vendor variant.
// The core variant cannot depend on the vendor variant because of the order of CreateVariations.
// Instead, the LLNDK implementation depends on the LLNDK header libs.
LlndkHeaderLibs []string
}
// PathDeps is a struct containing file paths to dependencies of a module.
@@ -191,6 +197,10 @@ type PathDeps struct {
// Paths to direct srcs and transitive include dirs from direct aidl_library deps
AidlLibraryInfos []aidl_library.AidlLibraryInfo
// LLNDK headers for the ABI checker to check LLNDK implementation library.
LlndkIncludeDirs android.Paths
LlndkSystemIncludeDirs android.Paths
}
// LocalOrGlobalFlags contains flags that need to have values set globally by the build system or locally by the module
@@ -789,6 +799,7 @@ var (
JniFuzzLibTag = dependencyTag{name: "jni_fuzz_lib_tag"}
FdoProfileTag = dependencyTag{name: "fdo_profile"}
aidlLibraryTag = dependencyTag{name: "aidl_library"}
llndkHeaderLibTag = dependencyTag{name: "llndk_header_lib"}
)
func IsSharedDepTag(depTag blueprint.DependencyTag) bool {
@@ -2278,6 +2289,7 @@ func (c *Module) deps(ctx DepsContext) Deps {
deps.LateSharedLibs = android.LastUniqueStrings(deps.LateSharedLibs)
deps.HeaderLibs = android.LastUniqueStrings(deps.HeaderLibs)
deps.RuntimeLibs = android.LastUniqueStrings(deps.RuntimeLibs)
deps.LlndkHeaderLibs = android.LastUniqueStrings(deps.LlndkHeaderLibs)
for _, lib := range deps.ReexportSharedLibHeaders {
if !inList(lib, deps.SharedLibs) {
@@ -2548,6 +2560,15 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
), stubImplementation, c.BaseModuleName())
}
// If this module is an LLNDK implementation library, let it depend on LlndkHeaderLibs.
if c.ImageVariation().Variation == android.CoreVariation && c.Device() &&
c.Target().NativeBridge == android.NativeBridgeDisabled {
actx.AddVariationDependencies(
[]blueprint.Variation{{Mutator: "image", Variation: VendorVariation}},
llndkHeaderLibTag,
deps.LlndkHeaderLibs...)
}
for _, lib := range deps.WholeStaticLibs {
depTag := libraryDependencyTag{Kind: staticLibraryDependency, wholeStatic: true, reexportFlags: true}
@@ -3104,6 +3125,12 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
return
}
if depTag == llndkHeaderLibTag {
depExporterInfo, _ := android.OtherModuleProvider(ctx, dep, FlagExporterInfoProvider)
depPaths.LlndkIncludeDirs = append(depPaths.LlndkIncludeDirs, depExporterInfo.IncludeDirs...)
depPaths.LlndkSystemIncludeDirs = append(depPaths.LlndkSystemIncludeDirs, depExporterInfo.SystemIncludeDirs...)
}
linkFile := ccDep.OutputFile()
if libDepTag, ok := depTag.(libraryDependencyTag); ok {