- if GlobalData.gUseHashCache:\r
- # If there is a valid hash or function generated a valid hash; function will return False\r
- # and the statement below will return True\r
- return not self.GenModuleHash()\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