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

Commit d4c1058c authored by Martin Stjernholm's avatar Martin Stjernholm Committed by Automerger Merge Worker
Browse files

Merge "Avoid conflicting shared libraries from SDK snapshots." am: 3c72ce86...

Merge "Avoid conflicting shared libraries from SDK snapshots." am: 3c72ce86 am: ff4181eb am: 091c1bd0

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1450116

Change-Id: I8cb74650f4fa48876c1118935d2e72ab4b7e8311
parents ca0091c7 091c1bd0
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -167,7 +167,9 @@ func collectAllSharedDependencies(ctx android.SingletonContext, module android.M
// that should be installed in the fuzz target output directories. This function
// returns true, unless:
//  - The module is not a shared library, or
//  - The module is a header, stub, or vendor-linked library.
//  - The module is a header, stub, or vendor-linked library, or
//  - The module is a prebuilt and its source is available, or
//  - The module is a versioned member of an SDK snapshot.
func isValidSharedDependency(dependency android.Module) bool {
	// TODO(b/144090547): We should be parsing these modules using
	// ModuleDependencyTag instead of the current brute-force checking.
@@ -190,6 +192,20 @@ func isValidSharedDependency(dependency android.Module) bool {
		}
	}

	// If the same library is present both as source and a prebuilt we must pick
	// only one to avoid a conflict. Always prefer the source since the prebuilt
	// probably won't be built with sanitizers enabled.
	if prebuilt, ok := dependency.(android.PrebuiltInterface); ok &&
		prebuilt.Prebuilt() != nil && prebuilt.Prebuilt().SourceExists() {
		return false
	}

	// Discard versioned members of SDK snapshots, because they will conflict with
	// unversioned ones.
	if sdkMember, ok := dependency.(android.SdkAware); ok && !sdkMember.ContainingSdk().Unversioned() {
		return false
	}

	return true
}