BaseTools: Fixed issue of incorrect Module Unique Name

https://bugzilla.tianocore.org/show_bug.cgi?id=2088
If there are more than one override instance for a same module,
the Module Unique Name is generated incorrectly.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Steven Shi <steven.shi@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Feng, Bob C 2019-08-16 13:52:46 +08:00
parent 5726bdd9a2
commit 76e12fa334
2 changed files with 4 additions and 3 deletions

View File

@ -295,7 +295,7 @@ class ModuleAutoGen(AutoGen):
ModuleNames = self.DataPipe.Get("M_Name")
if not ModuleNames:
return self.Name
return ModuleNames.get(self.Name,self.Name)
return ModuleNames.get((self.Name,self.MetaFile),self.Name)
# Macros could be used in build_rule.txt (also Makefile)
@cached_property

View File

@ -1366,14 +1366,15 @@ class PlatformAutoGen(AutoGen):
UniqueName[Module.BaseName] = set()
UniqueName[Module.BaseName].add((self.ModuleGuid(Module),Module.MetaFile))
for module_paths in ModuleNameDict.values():
if len(module_paths) > 1 and len(set(module_paths))>1:
if len(set(module_paths))>1:
samemodules = list(set(module_paths))
EdkLogger.error("build", FILE_DUPLICATED, 'Modules have same BaseName and FILE_GUID:\n'
' %s\n %s' % (samemodules[0], samemodules[1]))
for name in UniqueName:
Guid_Path = UniqueName[name]
if len(Guid_Path) > 1:
retVal[name] = '%s_%s' % (name,Guid_Path.pop()[0])
for guid,mpath in Guid_Path:
retVal[(name,mpath)] = '%s_%s' % (name,guid)
return retVal
## Expand * in build option key
#