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

Commit fb545bf2 authored by LuK1337's avatar LuK1337
Browse files

Make sure prebuilt modules are exported before attempting to use them

Fixes an issue where prebuilt module under unexported soong
namespace overrides source modules when flag `prefer` was set.

Test: Create two modules under the same name, use cc_library_shared
      for first one and cc_prebuilt_library_shared with `prefer` set
      to true.
      Then put the prebuilt module under `soong_namespace {}` and
      attempt to compile it without appending the namespace path to
      product namespaces.
      Without this change it should fail to resolve the
      cc_library_shared module even if it should be available.

Change-Id: I506641218e6af94a0b5f048e09e06d83602e50f5
parent d466b4a1
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -339,6 +339,13 @@ func (p *Prebuilt) usePrebuilt(ctx TopDownMutatorContext, source Module, prebuil
		return false
	}

	// Skip prebuilt modules under unexported namespaces so that we won't
	// end up shadowing non-prebuilt module when prebuilt module under same
	// name happens to have a `Prefer` property set to true.
	if ctx.Config().KatiEnabled() && !prebuilt.ExportedToMake() {
		return false
	}

	// TODO: use p.Properties.Name and ctx.ModuleDir to override preference
	if Bool(p.properties.Prefer) {
		return true