BaseTools: Fix corner-cases of --hash feature

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

Consider modules with .inc source files as Binary Modules
and do not Skip by hash.

Contributed-under: TianoCore Contribution Agreement 1.1
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-05 00:04:20 +08:00 committed by Feng, Bob C
parent b1e27d175a
commit 2914e8153d
1 changed files with 14 additions and 0 deletions

View File

@ -3917,8 +3917,13 @@ class ModuleAutoGen(AutoGen):
shutil.copy2(File, FileDir)
def AttemptModuleCacheCopy(self):
# If library or Module is binary do not skip by hash
if self.IsBinaryModule:
return False
# .inc is contains binary information so do not skip by hash as well
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)
HashFile = path.join(FileDir, self.Name + '.hash')
if os.path.exists(HashFile):
@ -4120,7 +4125,16 @@ class ModuleAutoGen(AutoGen):
## Decide whether we can skip the ModuleAutoGen process
def CanSkipbyHash(self):
# If library or Module is binary do not skip by hash
if self.IsBinaryModule:
return False
# .inc is contains binary information so do not skip by hash as well
for f_ext in self.SourceFileList:
if '.inc' in str(f_ext):
return False
if GlobalData.gUseHashCache:
# If there is a valid hash or function generated a valid hash; function will return False
# and the statement below will return True
return not self.GenModuleHash()
return False