+ # Hashing feature is off\r
+ if not GlobalData.gUseHashCache:\r
+ return False\r
+\r
+ # Initialize a dictionary for each arch type\r
+ if self.Arch not in GlobalData.gBuildHashSkipTracking:\r
+ GlobalData.gBuildHashSkipTracking[self.Arch] = dict()\r
+\r
+ # If library or Module is binary do not skip by hash\r
+ if self.IsBinaryModule:\r
+ return False\r
+\r
+ # .inc is contains binary information so do not skip by hash as well\r
+ for f_ext in self.SourceFileList:\r
+ if '.inc' in str(f_ext):\r
+ return False\r
+\r
+ # Use Cache, if exists and if Module has a copy in cache\r
+ if GlobalData.gBinCacheSource and self.AttemptModuleCacheCopy():\r
+ return True\r
+\r
+ # Early exit for libraries that haven't yet finished building\r
+ HashFile = path.join(self.BuildDir, self.Name + ".hash")\r
+ if self.IsLibrary and not os.path.exists(HashFile):\r
+ return False\r
+\r
+ # Return a Boolean based on if can skip by hash, either from memory or from IO.\r
+ if self.Name not in GlobalData.gBuildHashSkipTracking[self.Arch]:\r
+ # If hashes are the same, SaveFileOnChange() will return False.\r
+ GlobalData.gBuildHashSkipTracking[self.Arch][self.Name] = not SaveFileOnChange(HashFile, self.GenModuleHash(), True)\r
+ return GlobalData.gBuildHashSkipTracking[self.Arch][self.Name]\r
+ else:\r
+ return GlobalData.gBuildHashSkipTracking[self.Arch][self.Name]\r