Merge "Let LLNDK implementation libraries depend on LLNDK headers" into main
diff --git a/cc/cc.go b/cc/cc.go
index 2fa4b3b..2ff8bce 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -136,6 +136,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.
@@ -191,6 +197,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
@@ -789,6 +799,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 {
@@ -2278,6 +2289,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) {
@@ -2548,6 +2560,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}
@@ -3104,6 +3125,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 {
diff --git a/cc/library.go b/cc/library.go
index 3887c7a..9119821 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -859,6 +859,8 @@
deps.ReexportSharedLibHeaders = append(deps.ReexportSharedLibHeaders, library.SharedProperties.Shared.Export_shared_lib_headers...)
deps.ReexportStaticLibHeaders = append(deps.ReexportStaticLibHeaders, library.SharedProperties.Shared.Export_static_lib_headers...)
+
+ deps.LlndkHeaderLibs = append(deps.LlndkHeaderLibs, library.Properties.Llndk.Export_llndk_headers...)
}
if ctx.inVendor() {
deps.WholeStaticLibs = removeListFromList(deps.WholeStaticLibs, library.baseLinker.Properties.Target.Vendor.Exclude_static_libs)