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

Commit f8fab9b8 authored by Jiyong Park's avatar Jiyong Park Committed by Steven Moreland
Browse files

ndk_library depends on the correct arch variant of cc_library_headers

Previously before aosp/3249712, ndk_library was assumed to depend only
on ndk_headers, which do not have any variants.

As ndk_library can now depend on cc_library_headers which has many
variants for arch, sdk, and more, the previous assumption no longer
holds.

Therefore, when ndk_library makes a dependency to its
export_lib_headers, it now uses either AddFarVariationDependency with
(for ndk_headers) or AddVariationDependency (for others) depending on
which module type it depends on.

Bug: 357711733
Test: build with  https://r.android.com/q/topic:%22no-cpp-in-ndk-2%22
Change-Id: Id0957e82736bd458e15674ffc45ca32b1e3a7250
parent 24bf5a76
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -2507,8 +2507,14 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
		}

		if c.isNDKStubLibrary() {
			// ndk_headers do not have any variations
			variationExists := actx.OtherModuleDependencyVariantExists(nil, lib)
			if variationExists {
				actx.AddVariationDependencies(nil, depTag, lib)
			} else {
				// dependencies to ndk_headers fall here as ndk_headers do not have
				// any variants.
				actx.AddFarVariationDependencies([]blueprint.Variation{}, depTag, lib)
			}
		} else if c.IsStubs() && !c.isImportedApiLibrary() {
			actx.AddFarVariationDependencies(append(ctx.Target().Variations(), c.ImageVariation()),
				depTag, lib)