BaseTools: Support more file types in build cache

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1958

Current build cache does not store and restore all
types file of Hii/vfr, version and dpx. This patch
adds more file types to support them in build cache.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Steven Shi <steven.shi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Shi, Steven 2019-08-27 13:16:46 +08:00 committed by Liming Gao
parent 47f167f47e
commit 40db176d9d
1 changed files with 14 additions and 20 deletions

View File

@ -1267,29 +1267,30 @@ class ModuleAutoGen(AutoGen):
@cached_property @cached_property
def OutputFile(self): def OutputFile(self):
retVal = set() retVal = set()
OutputDir = self.OutputDir.replace('\\', '/').strip('/') OutputDir = self.OutputDir.replace('\\', '/').strip('/')
DebugDir = self.DebugDir.replace('\\', '/').strip('/') DebugDir = self.DebugDir.replace('\\', '/').strip('/')
FfsOutputDir = self.FfsOutputDir.replace('\\', '/').rstrip('/')
for Item in self.CodaTargetList: for Item in self.CodaTargetList:
File = Item.Target.Path.replace('\\', '/').strip('/').replace(DebugDir, '').replace(OutputDir, '').strip('/') File = Item.Target.Path.replace('\\', '/').strip('/').replace(DebugDir, '').replace(OutputDir, '').strip('/')
retVal.add(File) NewFile = path.join(self.OutputDir, File)
if self.DepexGenerated: retVal.add(NewFile)
retVal.add(self.Name + '.depex')
Bin = self._GenOffsetBin() Bin = self._GenOffsetBin()
if Bin: if Bin:
retVal.add(Bin) NewFile = path.join(self.OutputDir, Bin)
retVal.add(NewFile)
for Root, Dirs, Files in os.walk(OutputDir): for Root, Dirs, Files in os.walk(self.OutputDir):
for File in Files: for File in Files:
if File.lower().endswith('.pdb'): # lib file is already added through above CodaTargetList, skip it here
retVal.add(File) if not (File.lower().endswith('.obj') or File.lower().endswith('.lib')):
NewFile = path.join(self.OutputDir, File)
retVal.add(NewFile)
for Root, Dirs, Files in os.walk(FfsOutputDir): for Root, Dirs, Files in os.walk(self.FfsOutputDir):
for File in Files: for File in Files:
if File.lower().endswith('.ffs') or File.lower().endswith('.offset') or File.lower().endswith('.raw') \ NewFile = path.join(self.FfsOutputDir, File)
or File.lower().endswith('.raw.txt'): retVal.add(NewFile)
retVal.add(File)
return retVal return retVal
@ -1659,15 +1660,8 @@ class ModuleAutoGen(AutoGen):
Ma = self.BuildDatabase[self.MetaFile, self.Arch, self.BuildTarget, self.ToolChain] Ma = self.BuildDatabase[self.MetaFile, self.Arch, self.BuildTarget, self.ToolChain]
self.OutputFile = Ma.Binaries self.OutputFile = Ma.Binaries
for File in self.OutputFile: for File in self.OutputFile:
File = str(File)
if not os.path.isabs(File):
NewFile = os.path.join(self.OutputDir, File)
if not os.path.exists(NewFile):
NewFile = os.path.join(self.FfsOutputDir, File)
File = NewFile
if os.path.exists(File): if os.path.exists(File):
if File.lower().endswith('.ffs') or File.lower().endswith('.offset') or File.lower().endswith('.raw') \ if File.startswith(os.path.abspath(self.FfsOutputDir)+os.sep):
or File.lower().endswith('.raw.txt'):
self.CacheCopyFile(FfsDir, self.FfsOutputDir, File) self.CacheCopyFile(FfsDir, self.FfsOutputDir, File)
else: else:
self.CacheCopyFile(FileDir, self.OutputDir, File) self.CacheCopyFile(FileDir, self.OutputDir, File)