Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d22fcc42 authored by Hsin-Yi Chen's avatar Hsin-Yi Chen Committed by Gerrit Code Review
Browse files

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

parents afacc090 715142a2
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -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 {
+2 −0
Original line number Diff line number Diff line
@@ -859,6 +859,8 @@ func (library *libraryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {

		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)