mirror of https://github.com/acidanthera/audk.git
BaseTools: AutoGen refactor WorkspaceAutoGen class
Update the WorkspaceAutoGen class to use caching decorators and remove the no longer needed private variables. 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:
parent
e6eae3b4c7
commit
e6c62ab768
|
@ -278,10 +278,6 @@ class WorkspaceAutoGen(AutoGen):
|
||||||
self.FvTargetList = Fvs if Fvs else []
|
self.FvTargetList = Fvs if Fvs else []
|
||||||
self.CapTargetList = Caps if Caps else []
|
self.CapTargetList = Caps if Caps else []
|
||||||
self.AutoGenObjectList = []
|
self.AutoGenObjectList = []
|
||||||
self._BuildDir = None
|
|
||||||
self._FvDir = None
|
|
||||||
self._MakeFileDir = None
|
|
||||||
self._BuildCommand = None
|
|
||||||
self._GuidDict = {}
|
self._GuidDict = {}
|
||||||
|
|
||||||
# there's many relative directory operations, so ...
|
# there's many relative directory operations, so ...
|
||||||
|
@ -810,54 +806,56 @@ class WorkspaceAutoGen(AutoGen):
|
||||||
return "%s [%s]" % (self.MetaFile, ", ".join(self.ArchList))
|
return "%s [%s]" % (self.MetaFile, ", ".join(self.ArchList))
|
||||||
|
|
||||||
## Return the directory to store FV files
|
## Return the directory to store FV files
|
||||||
def _GetFvDir(self):
|
@cached_property
|
||||||
if self._FvDir is None:
|
def FvDir(self):
|
||||||
self._FvDir = path.join(self.BuildDir, TAB_FV_DIRECTORY)
|
return path.join(self.BuildDir, TAB_FV_DIRECTORY)
|
||||||
return self._FvDir
|
|
||||||
|
|
||||||
## Return the directory to store all intermediate and final files built
|
## Return the directory to store all intermediate and final files built
|
||||||
def _GetBuildDir(self):
|
@cached_property
|
||||||
if self._BuildDir is None:
|
def BuildDir(self):
|
||||||
return self.AutoGenObjectList[0].BuildDir
|
return self.AutoGenObjectList[0].BuildDir
|
||||||
|
|
||||||
## Return the build output directory platform specifies
|
## Return the build output directory platform specifies
|
||||||
def _GetOutputDir(self):
|
@cached_property
|
||||||
|
def OutputDir(self):
|
||||||
return self.Platform.OutputDirectory
|
return self.Platform.OutputDirectory
|
||||||
|
|
||||||
## Return platform name
|
## Return platform name
|
||||||
def _GetName(self):
|
@cached_property
|
||||||
|
def Name(self):
|
||||||
return self.Platform.PlatformName
|
return self.Platform.PlatformName
|
||||||
|
|
||||||
## Return meta-file GUID
|
## Return meta-file GUID
|
||||||
def _GetGuid(self):
|
@cached_property
|
||||||
|
def Guid(self):
|
||||||
return self.Platform.Guid
|
return self.Platform.Guid
|
||||||
|
|
||||||
## Return platform version
|
## Return platform version
|
||||||
def _GetVersion(self):
|
@cached_property
|
||||||
|
def Version(self):
|
||||||
return self.Platform.Version
|
return self.Platform.Version
|
||||||
|
|
||||||
## Return paths of tools
|
## Return paths of tools
|
||||||
def _GetToolDefinition(self):
|
@cached_property
|
||||||
|
def ToolDefinition(self):
|
||||||
return self.AutoGenObjectList[0].ToolDefinition
|
return self.AutoGenObjectList[0].ToolDefinition
|
||||||
|
|
||||||
## Return directory of platform makefile
|
## Return directory of platform makefile
|
||||||
#
|
#
|
||||||
# @retval string Makefile directory
|
# @retval string Makefile directory
|
||||||
#
|
#
|
||||||
def _GetMakeFileDir(self):
|
@cached_property
|
||||||
if self._MakeFileDir is None:
|
def MakeFileDir(self):
|
||||||
self._MakeFileDir = self.BuildDir
|
return self.BuildDir
|
||||||
return self._MakeFileDir
|
|
||||||
|
|
||||||
## Return build command string
|
## Return build command string
|
||||||
#
|
#
|
||||||
# @retval string Build command string
|
# @retval string Build command string
|
||||||
#
|
#
|
||||||
def _GetBuildCommand(self):
|
@cached_property
|
||||||
if self._BuildCommand is None:
|
def BuildCommand(self):
|
||||||
# BuildCommand should be all the same. So just get one from platform AutoGen
|
# BuildCommand should be all the same. So just get one from platform AutoGen
|
||||||
self._BuildCommand = self.AutoGenObjectList[0].BuildCommand
|
return self.AutoGenObjectList[0].BuildCommand
|
||||||
return self._BuildCommand
|
|
||||||
|
|
||||||
## Check the PCDs token value conflict in each DEC file.
|
## Check the PCDs token value conflict in each DEC file.
|
||||||
#
|
#
|
||||||
|
@ -933,7 +931,8 @@ class WorkspaceAutoGen(AutoGen):
|
||||||
)
|
)
|
||||||
Count += 1
|
Count += 1
|
||||||
## Generate fds command
|
## Generate fds command
|
||||||
def _GenFdsCommand(self):
|
@property
|
||||||
|
def GenFdsCommand(self):
|
||||||
return (GenMake.TopLevelMakefile(self)._TEMPLATE_.Replace(GenMake.TopLevelMakefile(self)._TemplateDict)).strip()
|
return (GenMake.TopLevelMakefile(self)._TEMPLATE_.Replace(GenMake.TopLevelMakefile(self)._TemplateDict)).strip()
|
||||||
|
|
||||||
## Create makefile for the platform and modules in it
|
## Create makefile for the platform and modules in it
|
||||||
|
@ -966,18 +965,6 @@ class WorkspaceAutoGen(AutoGen):
|
||||||
def CreateAsBuiltInf(self):
|
def CreateAsBuiltInf(self):
|
||||||
return
|
return
|
||||||
|
|
||||||
Name = property(_GetName)
|
|
||||||
Guid = property(_GetGuid)
|
|
||||||
Version = property(_GetVersion)
|
|
||||||
OutputDir = property(_GetOutputDir)
|
|
||||||
|
|
||||||
ToolDefinition = property(_GetToolDefinition) # toolcode : tool path
|
|
||||||
|
|
||||||
BuildDir = property(_GetBuildDir)
|
|
||||||
FvDir = property(_GetFvDir)
|
|
||||||
MakeFileDir = property(_GetMakeFileDir)
|
|
||||||
BuildCommand = property(_GetBuildCommand)
|
|
||||||
GenFdsCommand = property(_GenFdsCommand)
|
|
||||||
|
|
||||||
## AutoGen class for platform
|
## AutoGen class for platform
|
||||||
#
|
#
|
||||||
|
@ -2593,7 +2580,7 @@ class ModuleAutoGen(AutoGen):
|
||||||
## Return the module build data object
|
## Return the module build data object
|
||||||
@cached_property
|
@cached_property
|
||||||
def Module(self):
|
def Module(self):
|
||||||
return self.Workspace.BuildDatabase[self.MetaFile, self.Arch, self.BuildTarget, self.ToolChain]
|
return self.BuildDatabase[self.MetaFile, self.Arch, self.BuildTarget, self.ToolChain]
|
||||||
|
|
||||||
## Return the module name
|
## Return the module name
|
||||||
@cached_property
|
@cached_property
|
||||||
|
@ -2941,7 +2928,7 @@ class ModuleAutoGen(AutoGen):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
FlagOption = ''
|
FlagOption = ''
|
||||||
|
|
||||||
if self.PlatformInfo.ToolChainFamily != 'RVCT':
|
if self.ToolChainFamily != 'RVCT':
|
||||||
IncPathList = [NormPath(Path, self.Macros) for Path in BuildOptIncludeRegEx.findall(FlagOption)]
|
IncPathList = [NormPath(Path, self.Macros) for Path in BuildOptIncludeRegEx.findall(FlagOption)]
|
||||||
else:
|
else:
|
||||||
#
|
#
|
||||||
|
@ -3857,7 +3844,7 @@ class ModuleAutoGen(AutoGen):
|
||||||
if os.path.exists(ModuleFile):
|
if os.path.exists(ModuleFile):
|
||||||
shutil.copy2(ModuleFile, FileDir)
|
shutil.copy2(ModuleFile, FileDir)
|
||||||
if not self.OutputFile:
|
if not self.OutputFile:
|
||||||
Ma = self.Workspace.BuildDatabase[PathClass(ModuleFile), self.Arch, self.BuildTarget, self.ToolChain]
|
Ma = self.BuildDatabase[PathClass(ModuleFile), self.Arch, self.BuildTarget, self.ToolChain]
|
||||||
self.OutputFile = Ma.Binaries
|
self.OutputFile = Ma.Binaries
|
||||||
if self.OutputFile:
|
if self.OutputFile:
|
||||||
for File in self.OutputFile:
|
for File in self.OutputFile:
|
||||||
|
|
Loading…
Reference in New Issue