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

Commit 81aeb9e2 authored by Jihoon Kang's avatar Jihoon Kang
Browse files

Use ModuleName() instead of Module().Name() in collectDepsMutator

ctx.Module().Name() may return a value different from the name property
defined in the bp module definition, in which case the module would not
be added as deps even if it's listed in PRODUCT_PACKAGES. To prevent
this issue, use ModuleName() instead of Module().Name().

Test: m soong_generated_product_filesystem_test
Bug: 376502478
Change-Id: I68d8e320878695969a6651f535b062bd643f646b
parent add2bb26
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -160,16 +160,17 @@ func checkDepModuleInMultipleNamespaces(mctx android.BottomUpMutatorContext, fou
}

func appendDepIfAppropriate(mctx android.BottomUpMutatorContext, deps *multilibDeps, installPartition string) {
	checkDepModuleInMultipleNamespaces(mctx, *deps, mctx.Module().Name(), installPartition)
	if _, ok := (*deps)[mctx.Module().Name()]; ok {
	moduleName := mctx.ModuleName()
	checkDepModuleInMultipleNamespaces(mctx, *deps, moduleName, installPartition)
	if _, ok := (*deps)[moduleName]; ok {
		// Prefer the namespace-specific module over the platform module
		if mctx.Namespace().Path != "." {
			(*deps)[mctx.Module().Name()].Namespace = mctx.Namespace().Path
			(*deps)[moduleName].Namespace = mctx.Namespace().Path
		}
		(*deps)[mctx.Module().Name()].Arch = append((*deps)[mctx.Module().Name()].Arch, mctx.Module().Target().Arch.ArchType)
		(*deps)[moduleName].Arch = append((*deps)[moduleName].Arch, mctx.Module().Target().Arch.ArchType)
	} else {
		multilib, _ := mctx.Module().DecodeMultilib(mctx)
		(*deps)[mctx.Module().Name()] = &depCandidateProps{
		(*deps)[moduleName] = &depCandidateProps{
			Namespace: mctx.Namespace().Path,
			Multilib:  multilib,
			Arch:      []android.ArchType{mctx.Module().Target().Arch.ArchType},
@@ -181,7 +182,7 @@ func collectDepsMutator(mctx android.BottomUpMutatorContext) {
	fsGenState := mctx.Config().Get(fsGenStateOnceKey).(*FsGenState)

	m := mctx.Module()
	if m.Target().Os.Class == android.Device && slices.Contains(fsGenState.depCandidates, m.Name()) {
	if m.Target().Os.Class == android.Device && slices.Contains(fsGenState.depCandidates, mctx.ModuleName()) {
		installPartition := m.PartitionTag(mctx.DeviceConfig())
		fsGenState.fsDepsMutex.Lock()
		// Only add the module as dependency when: