From: Jaben Carsey <jaben.carsey@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>,
Yonghong Zhu <yonghong.zhu@intel.com>,
Bob Feng <bob.c.feng@intel.com>
Subject: [PATCH v2 8/9] BaseTools: refactor to not overcreate ModuleAutoGen objects
Date: Mon, 10 Sep 2018 15:18:08 -0700 [thread overview]
Message-ID: <feea185f012f3bc5600dda1450e0570ec46af489.1536175711.git.jaben.carsey@intel.com> (raw)
In-Reply-To: <cover.1536175710.git.jaben.carsey@intel.com>
In-Reply-To: <cover.1536175710.git.jaben.carsey@intel.com>
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>
---
BaseTools/Source/Python/AutoGen/AutoGen.py | 58 +++++++++-----------
1 file changed, 25 insertions(+), 33 deletions(-)
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 35dab75785eb..4e9fc54dbaf3 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1085,21 +1085,19 @@ class PlatformAutoGen(AutoGen):
def GenFdsCommand(self):
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
# modules will be created as well
#
def CreateMakeFile(self, CreateModuleMakeFile=False, FfsCommand = {}):
if CreateModuleMakeFile:
- for ModuleFile in self.Platform.Modules:
- Ma = ModuleAutoGen(self.Workspace, ModuleFile, self.BuildTarget,
- self.ToolChain, self.Arch, self.MetaFile)
- if (ModuleFile.File, self.Arch) in FfsCommand:
- Ma.CreateMakeFile(True, FfsCommand[ModuleFile.File, self.Arch])
+ for Ma in self._MaList:
+ key = (Ma.MetaFile.File, self.Arch)
+ if key in FfsCommand:
+ Ma.CreateMakeFile(True, FfsCommand[key])
else:
Ma.CreateMakeFile(True)
- #Ma.CreateAsBuiltInf()
# no need to create makefile for the platform more than once
if self.IsMakeFileCreated:
@@ -1231,16 +1229,12 @@ class PlatformAutoGen(AutoGen):
for InfName in self._AsBuildInfList:
InfName = mws.join(self.WorkspaceDir, InfName)
FdfModuleList.append(os.path.normpath(InfName))
- for F in self.Platform.Modules.keys():
- M = ModuleAutoGen(self.Workspace, F, self.BuildTarget, self.ToolChain, self.Arch, self.MetaFile)
- #GuidValue.update(M.Guids)
-
- self.Platform.Modules[F].M = M
-
+ for M in self._MaList:
+# F is the Module for which M is the module autogen
for PcdFromModule in M.ModulePcdList + M.LibraryPcdList:
# make sure that the "VOID*" kind of datum has MaxDatumSize set
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
if M.IsBinaryModule == True:
@@ -1250,7 +1244,7 @@ class PlatformAutoGen(AutoGen):
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 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
# 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
@@ -1930,19 +1924,25 @@ class PlatformAutoGen(AutoGen):
TokenNumber += 1
return RetVal
+ @cached_property
+ def _MaList(self):
+ for ModuleFile in self.Platform.Modules:
+ Ma = ModuleAutoGen(
+ self.Workspace,
+ ModuleFile,
+ self.BuildTarget,
+ self.ToolChain,
+ self.Arch,
+ 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 ModuleFile in self.Platform.Modules:
- Ma = ModuleAutoGen(
- self.Workspace,
- ModuleFile,
- self.BuildTarget,
- self.ToolChain,
- self.Arch,
- self.MetaFile
- )
+ for Ma in self._MaList:
if Ma not in RetVal:
RetVal.append(Ma)
return RetVal
@@ -1951,15 +1951,7 @@ class PlatformAutoGen(AutoGen):
@cached_property
def LibraryAutoGenList(self):
RetVal = []
- for ModuleFile in self.Platform.Modules:
- Ma = ModuleAutoGen(
- self.Workspace,
- ModuleFile,
- self.BuildTarget,
- self.ToolChain,
- self.Arch,
- self.MetaFile
- )
+ for Ma in self._MaList:
for La in Ma.LibraryAutoGenList:
if La not in RetVal:
RetVal.append(La)
--
2.16.2.windows.1
next prev parent reply other threads:[~2018-09-10 22:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-10 22:18 [PATCH v2 0/9] BaseTools: refactor Workspace classes Jaben Carsey
2018-09-10 22:18 ` [PATCH v2 1/9] BaseTools: Refactor PlatformAutoGen Jaben Carsey
2018-09-10 22:18 ` [PATCH v2 2/9] BaseTools: AutoGen refactor WorkspaceAutoGen class Jaben Carsey
2018-09-10 22:18 ` [PATCH v2 3/9] BaseTools: AutoGen - refactor class properties Jaben Carsey
2018-09-10 22:18 ` [PATCH v2 4/9] BaseTools: " Jaben Carsey
2018-09-10 22:18 ` [PATCH v2 5/9] BaseTools: Workspace classes refactor properties Jaben Carsey
2018-09-10 22:18 ` [PATCH v2 6/9] BaseTools: refactor Build Database objects Jaben Carsey
2018-09-10 22:18 ` [PATCH v2 7/9] BaseTools: Don't save unused workspace data Jaben Carsey
2018-09-10 22:18 ` Jaben Carsey [this message]
2018-09-10 22:18 ` [PATCH v2 9/9] BaseTools: refactor to cache InfBuildData data Jaben Carsey
2018-09-20 7:01 ` [PATCH v2 0/9] BaseTools: refactor Workspace classes Zhu, Yonghong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=feea185f012f3bc5600dda1450e0570ec46af489.1536175711.git.jaben.carsey@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox