BaseTools: Enhance Bin Cache database to support save the cache

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

V2: Added the platform name to the path
Add more level sub-directories in the database to support save
the cache for multiple platforms with multiple tool-chains and
targets, just like edk2 Build output.

Signed-off-by: Christian Rodriguez <christian.rodriguez@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
Rodriguez, Christian 2019-04-18 22:16:10 +08:00 committed by Feng, Bob C
parent 0b836855fb
commit 452b5ad61d

View File

@ -3897,18 +3897,17 @@ class ModuleAutoGen(AutoGen):
self.CopyModuleToCache()
def CopyModuleToCache(self):
FileDir = path.join(GlobalData.gBinCacheDest, self.Arch, self.SourceDir, self.MetaFile.BaseName)
FileDir = path.join(GlobalData.gBinCacheDest, self.PlatformInfo.Name, self.BuildTarget + "_" + self.ToolChain, self.Arch, self.SourceDir, self.MetaFile.BaseName)
CreateDirectory (FileDir)
HashFile = path.join(self.BuildDir, self.Name + '.hash')
if os.path.exists(HashFile):
shutil.copy2(HashFile, FileDir)
if self.IsLibrary:
return
ModuleFile = path.join(self.OutputDir, self.Name + '.inf')
if os.path.exists(ModuleFile):
shutil.copy2(ModuleFile, FileDir)
if not self.IsLibrary:
ModuleFile = path.join(self.OutputDir, self.Name + '.inf')
if os.path.exists(ModuleFile):
shutil.copy2(ModuleFile, FileDir)
if not self.OutputFile:
Ma = self.BuildDatabase[PathClass(ModuleFile), self.Arch, self.BuildTarget, self.ToolChain]
Ma = self.BuildDatabase[self.MetaFile, self.Arch, self.BuildTarget, self.ToolChain]
self.OutputFile = Ma.Binaries
if self.OutputFile:
for File in self.OutputFile:
@ -3930,7 +3929,7 @@ class ModuleAutoGen(AutoGen):
for f_ext in self.SourceFileList:
if '.inc' in str(f_ext):
return False
FileDir = path.join(GlobalData.gBinCacheSource, self.Arch, self.SourceDir, self.MetaFile.BaseName)
FileDir = path.join(GlobalData.gBinCacheSource, self.PlatformInfo.Name, self.BuildTarget + "_" + self.ToolChain, self.Arch, self.SourceDir, self.MetaFile.BaseName)
HashFile = path.join(FileDir, self.Name + '.hash')
if os.path.exists(HashFile):
f = open(HashFile, 'r')