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

Commit a0463d3c authored by Cole Faust's avatar Cole Faust
Browse files

Use AddReverseVariationDependency to avoid 1-variant fallback

Currently, reverse dependencies fallback to the only variant of a module
if only 1 variant exists, regardless of what the requested variations
were. This causes problems for the "base configuration" feature and
incremental soong, so properly specify the variant we want in the
apex vndk mutator.

Bug: 369916167
Test: m nothing --no-skip-soong-tests
Change-Id: I3e27c6a8a0b016c963a3c41aad1ce7953aa07e49
parent 7fb4e6ca
Loading
Loading
Loading
Loading
+9 −1
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ import (
	"android/soong/android"
	"android/soong/android"
	"android/soong/cc"
	"android/soong/cc"


	"github.com/google/blueprint"
	"github.com/google/blueprint/proptools"
	"github.com/google/blueprint/proptools"
)
)


@@ -66,7 +67,14 @@ func apexVndkDepsMutator(mctx android.BottomUpMutatorContext) {
		vndkApexName := "com.android.vndk." + vndkVersion
		vndkApexName := "com.android.vndk." + vndkVersion


		if mctx.OtherModuleExists(vndkApexName) {
		if mctx.OtherModuleExists(vndkApexName) {
			mctx.AddReverseDependency(mctx.Module(), sharedLibTag, vndkApexName)
			// Reverse dependencies must exactly specify the variant they want, starting from the
			// current module's variant. But unlike cc modules, the vndk apex doesn't have
			// arch/image/link variations, so we explicitly remove them here.
			mctx.AddReverseVariationDependency([]blueprint.Variation{
				{Mutator: "arch", Variation: "common"},
				{Mutator: "image", Variation: ""},
				{Mutator: "link", Variation: ""},
			}, sharedLibTag, vndkApexName)
		}
		}
	} else if a, ok := mctx.Module().(*apexBundle); ok && a.vndkApex {
	} else if a, ok := mctx.Module().(*apexBundle); ok && a.vndkApex {
		if a.IsNativeBridgeSupported() {
		if a.IsNativeBridgeSupported() {