BuildTask._ErrorFlag.set()\r
BuildTask._ErrorMessage = "%s broken\n %s [%s]" % \\r
(threading.currentThread().getName(), Command, WorkingDir)\r
+ if self.BuildItem.BuildObject in GlobalData.gModuleBuildTracking and not BuildTask._ErrorFlag.isSet():\r
+ GlobalData.gModuleBuildTracking[self.BuildItem.BuildObject] = True\r
# indicate there's a thread is available for another build task\r
BuildTask._RunningQueueLock.acquire()\r
BuildTask._RunningQueue.pop(self.BuildItem)\r
if Process.returncode != 0 :\r
EdkLogger.error("Postbuild", POSTBUILD_ERROR, 'Postbuild process is not success!')\r
EdkLogger.info("\n- Postbuild Done -\n")\r
+\r
+ ## Error handling for hash feature\r
+ #\r
+ # On BuildTask error, iterate through the Module Build tracking\r
+ # dictionary to determine wheather a module failed to build. Invalidate\r
+ # the hash associated with that module by removing it from storage.\r
+ #\r
+ #\r
+ def invalidateHash(self):\r
+ # GlobalData.gModuleBuildTracking contains only modules that cannot be skipped by hash\r
+ for moduleAutoGenObj in GlobalData.gModuleBuildTracking.keys():\r
+ # False == FAIL : True == Success\r
+ # Skip invalidating for Successful module builds\r
+ if GlobalData.gModuleBuildTracking[moduleAutoGenObj] == True:\r
+ continue\r
+\r
+ # The module failed to build or failed to start building, from this point on\r
+\r
+ # Remove .hash from build\r
+ if GlobalData.gUseHashCache:\r
+ ModuleHashFile = path.join(moduleAutoGenObj.BuildDir, moduleAutoGenObj.Name + ".hash")\r
+ if os.path.exists(ModuleHashFile):\r
+ os.remove(ModuleHashFile)\r
+\r
+ # Remove .hash file from cache\r
+ if GlobalData.gBinCacheSource:\r
+ FileDir = path.join(GlobalData.gBinCacheSource, moduleAutoGenObj.Arch, moduleAutoGenObj.SourceDir, moduleAutoGenObj.MetaFile.BaseName)\r
+ HashFile = path.join(FileDir, moduleAutoGenObj.Name + '.hash')\r
+ if os.path.exists(HashFile):\r
+ os.remove(HashFile)\r
+\r
## Build a module or platform\r
#\r
# Create autogen code and makefile for a module or platform, and the launch\r
if self.Target == "genmake":\r
return True\r
self.BuildModules.append(Ma)\r
+ # Initialize all modules in tracking to False (FAIL)\r
+ if Ma not in GlobalData.gModuleBuildTracking:\r
+ GlobalData.gModuleBuildTracking[Ma] = False\r
self.AutoGenTime += int(round((time.time() - AutoGenStart)))\r
MakeStart = time.time()\r
for Ma in self.BuildModules:\r
# we need a full version of makefile for platform\r
ExitFlag.set()\r
BuildTask.WaitForComplete()\r
+ self.invalidateHash()\r
Pa.CreateMakeFile(False)\r
EdkLogger.error("build", BUILD_ERROR, "Failed to build module", ExtraData=GlobalData.gBuildingModule)\r
# Start task scheduler\r
# in case there's an interruption. we need a full version of makefile for platform\r
Pa.CreateMakeFile(False)\r
if BuildTask.HasError():\r
+ self.invalidateHash()\r
EdkLogger.error("build", BUILD_ERROR, "Failed to build module", ExtraData=GlobalData.gBuildingModule)\r
self.MakeTime += int(round((time.time() - MakeStart)))\r
\r
self.CreateAsBuiltInf()\r
self.MakeTime += int(round((time.time() - MakeContiue)))\r
if BuildTask.HasError():\r
+ self.invalidateHash()\r
EdkLogger.error("build", BUILD_ERROR, "Failed to build module", ExtraData=GlobalData.gBuildingModule)\r
\r
self.BuildReport.AddPlatformReport(Wa, MaList)\r
if self.Target == "genmake":\r
continue\r
self.BuildModules.append(Ma)\r
+ # Initialize all modules in tracking to False (FAIL)\r
+ if Ma not in GlobalData.gModuleBuildTracking:\r
+ GlobalData.gModuleBuildTracking[Ma] = False\r
self.Progress.Stop("done!")\r
self.AutoGenTime += int(round((time.time() - AutoGenStart)))\r
MakeStart = time.time()\r
# we need a full version of makefile for platform\r
ExitFlag.set()\r
BuildTask.WaitForComplete()\r
+ self.invalidateHash()\r
Pa.CreateMakeFile(False)\r
EdkLogger.error("build", BUILD_ERROR, "Failed to build module", ExtraData=GlobalData.gBuildingModule)\r
# Start task scheduler\r
# in case there's an interruption. we need a full version of makefile for platform\r
Pa.CreateMakeFile(False)\r
if BuildTask.HasError():\r
+ self.invalidateHash()\r
EdkLogger.error("build", BUILD_ERROR, "Failed to build module", ExtraData=GlobalData.gBuildingModule)\r
self.MakeTime += int(round((time.time() - MakeStart)))\r
\r
# has been signaled.\r
#\r
if BuildTask.HasError():\r
+ self.invalidateHash()\r
EdkLogger.error("build", BUILD_ERROR, "Failed to build module", ExtraData=GlobalData.gBuildingModule)\r
\r
# Create MAP file when Load Fix Address is enabled.\r