BaseTools: refactor to not overcreate ModuleAutoGen objects
currently created for 3 different purposes and saved once. this makes it created once and saved and then referenced. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
committed by
Yonghong Zhu
parent
6f73a03665
commit
4def57d98c
@ -1085,21 +1085,19 @@ class PlatformAutoGen(AutoGen):
|
|||||||
def GenFdsCommand(self):
|
def GenFdsCommand(self):
|
||||||
return self.Workspace.GenFdsCommand
|
return self.Workspace.GenFdsCommand
|
||||||
|
|
||||||
## Create makefile for the platform and mdoules in it
|
## Create makefile for the platform and modules in it
|
||||||
#
|
#
|
||||||
# @param CreateModuleMakeFile Flag indicating if the makefile for
|
# @param CreateModuleMakeFile Flag indicating if the makefile for
|
||||||
# modules will be created as well
|
# modules will be created as well
|
||||||
#
|
#
|
||||||
def CreateMakeFile(self, CreateModuleMakeFile=False, FfsCommand = {}):
|
def CreateMakeFile(self, CreateModuleMakeFile=False, FfsCommand = {}):
|
||||||
if CreateModuleMakeFile:
|
if CreateModuleMakeFile:
|
||||||
for ModuleFile in self.Platform.Modules:
|
for Ma in self._MaList:
|
||||||
Ma = ModuleAutoGen(self.Workspace, ModuleFile, self.BuildTarget,
|
key = (Ma.MetaFile.File, self.Arch)
|
||||||
self.ToolChain, self.Arch, self.MetaFile)
|
if key in FfsCommand:
|
||||||
if (ModuleFile.File, self.Arch) in FfsCommand:
|
Ma.CreateMakeFile(True, FfsCommand[key])
|
||||||
Ma.CreateMakeFile(True, FfsCommand[ModuleFile.File, self.Arch])
|
|
||||||
else:
|
else:
|
||||||
Ma.CreateMakeFile(True)
|
Ma.CreateMakeFile(True)
|
||||||
#Ma.CreateAsBuiltInf()
|
|
||||||
|
|
||||||
# no need to create makefile for the platform more than once
|
# no need to create makefile for the platform more than once
|
||||||
if self.IsMakeFileCreated:
|
if self.IsMakeFileCreated:
|
||||||
@ -1231,16 +1229,12 @@ class PlatformAutoGen(AutoGen):
|
|||||||
for InfName in self._AsBuildInfList:
|
for InfName in self._AsBuildInfList:
|
||||||
InfName = mws.join(self.WorkspaceDir, InfName)
|
InfName = mws.join(self.WorkspaceDir, InfName)
|
||||||
FdfModuleList.append(os.path.normpath(InfName))
|
FdfModuleList.append(os.path.normpath(InfName))
|
||||||
for F in self.Platform.Modules.keys():
|
for M in self._MaList:
|
||||||
M = ModuleAutoGen(self.Workspace, F, self.BuildTarget, self.ToolChain, self.Arch, self.MetaFile)
|
# F is the Module for which M is the module autogen
|
||||||
#GuidValue.update(M.Guids)
|
|
||||||
|
|
||||||
self.Platform.Modules[F].M = M
|
|
||||||
|
|
||||||
for PcdFromModule in M.ModulePcdList + M.LibraryPcdList:
|
for PcdFromModule in M.ModulePcdList + M.LibraryPcdList:
|
||||||
# make sure that the "VOID*" kind of datum has MaxDatumSize set
|
# make sure that the "VOID*" kind of datum has MaxDatumSize set
|
||||||
if PcdFromModule.DatumType == TAB_VOID and not PcdFromModule.MaxDatumSize:
|
if PcdFromModule.DatumType == TAB_VOID and not PcdFromModule.MaxDatumSize:
|
||||||
NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, F))
|
NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, M.MetaFile))
|
||||||
|
|
||||||
# Check the PCD from Binary INF or Source INF
|
# Check the PCD from Binary INF or Source INF
|
||||||
if M.IsBinaryModule == True:
|
if M.IsBinaryModule == True:
|
||||||
@ -1250,7 +1244,7 @@ class PlatformAutoGen(AutoGen):
|
|||||||
PcdFromModule.IsFromDsc = (PcdFromModule.TokenCName, PcdFromModule.TokenSpaceGuidCName) in self.Platform.Pcds
|
PcdFromModule.IsFromDsc = (PcdFromModule.TokenCName, PcdFromModule.TokenSpaceGuidCName) in self.Platform.Pcds
|
||||||
|
|
||||||
if PcdFromModule.Type in PCD_DYNAMIC_TYPE_SET or PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET:
|
if PcdFromModule.Type in PCD_DYNAMIC_TYPE_SET or PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET:
|
||||||
if F.Path not in FdfModuleList:
|
if M.MetaFile.Path not in FdfModuleList:
|
||||||
# If one of the Source built modules listed in the DSC is not listed
|
# If one of the Source built modules listed in the DSC is not listed
|
||||||
# in FDF modules, and the INF lists a PCD can only use the PcdsDynamic
|
# in FDF modules, and the INF lists a PCD can only use the PcdsDynamic
|
||||||
# access method (it is only listed in the DEC file that declares the
|
# access method (it is only listed in the DEC file that declares the
|
||||||
@ -1934,10 +1928,8 @@ class PlatformAutoGen(AutoGen):
|
|||||||
TokenNumber += 1
|
TokenNumber += 1
|
||||||
return RetVal
|
return RetVal
|
||||||
|
|
||||||
## Summarize ModuleAutoGen objects of all modules to be built for this platform
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def ModuleAutoGenList(self):
|
def _MaList(self):
|
||||||
RetVal = []
|
|
||||||
for ModuleFile in self.Platform.Modules:
|
for ModuleFile in self.Platform.Modules:
|
||||||
Ma = ModuleAutoGen(
|
Ma = ModuleAutoGen(
|
||||||
self.Workspace,
|
self.Workspace,
|
||||||
@ -1947,6 +1939,14 @@ class PlatformAutoGen(AutoGen):
|
|||||||
self.Arch,
|
self.Arch,
|
||||||
self.MetaFile
|
self.MetaFile
|
||||||
)
|
)
|
||||||
|
self.Platform.Modules[ModuleFile].M = Ma
|
||||||
|
return [x.M for x in self.Platform.Modules.values()]
|
||||||
|
|
||||||
|
## Summarize ModuleAutoGen objects of all modules to be built for this platform
|
||||||
|
@cached_property
|
||||||
|
def ModuleAutoGenList(self):
|
||||||
|
RetVal = []
|
||||||
|
for Ma in self._MaList:
|
||||||
if Ma not in RetVal:
|
if Ma not in RetVal:
|
||||||
RetVal.append(Ma)
|
RetVal.append(Ma)
|
||||||
return RetVal
|
return RetVal
|
||||||
@ -1955,15 +1955,7 @@ class PlatformAutoGen(AutoGen):
|
|||||||
@cached_property
|
@cached_property
|
||||||
def LibraryAutoGenList(self):
|
def LibraryAutoGenList(self):
|
||||||
RetVal = []
|
RetVal = []
|
||||||
for ModuleFile in self.Platform.Modules:
|
for Ma in self._MaList:
|
||||||
Ma = ModuleAutoGen(
|
|
||||||
self.Workspace,
|
|
||||||
ModuleFile,
|
|
||||||
self.BuildTarget,
|
|
||||||
self.ToolChain,
|
|
||||||
self.Arch,
|
|
||||||
self.MetaFile
|
|
||||||
)
|
|
||||||
for La in Ma.LibraryAutoGenList:
|
for La in Ma.LibraryAutoGenList:
|
||||||
if La not in RetVal:
|
if La not in RetVal:
|
||||||
RetVal.append(La)
|
RetVal.append(La)
|
||||||
|
Reference in New Issue
Block a user