Let LLNDK implementation libraries depend on LLNDK headers
The ABI checker dumps the ABI from the source code of LLNDK
implementation libraries. It needs to filter the ABI by the LLNDK
headers.
This commit adds dependencies from LLNDK implementation libraries to
their export_llndk_headers. The LLNDK header directories are added to
PathDeps. A followup change will pass the directories to the ABI
checker.
Bug: 314010764
Test: make
Change-Id: Ibc2d5eac3d70d9e038e0fd255cd1ebc1044fabbe
diff --git a/cc/cc.go b/cc/cc.go
index fb5d096..742d08c 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -137,6 +137,12 @@
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.
@@ -192,6 +198,10 @@
// 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
@@ -809,6 +819,7 @@
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 {
@@ -2316,6 +2327,7 @@
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) {
@@ -2627,6 +2639,15 @@
), 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}
@@ -3187,6 +3208,12 @@
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 {