]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/build/build.py
BaseTools: Library hashing fix and optimization for --hash feature
[mirror_edk2.git] / BaseTools / Source / Python / build / build.py
index 71478b7268e364640ad43d3d8972c8540433ca7c..027061191c5eee3aa06867d83008f58a3b00ead8 100644 (file)
@@ -593,7 +593,7 @@ class BuildTask:
     #\r
     def AddDependency(self, Dependency):\r
         for Dep in Dependency:\r
-            if not Dep.BuildObject.IsBinaryModule:\r
+            if not Dep.BuildObject.IsBinaryModule and not Dep.BuildObject.CanSkipbyHash():\r
                 self.DependencyList.append(BuildTask.New(Dep))    # BuildTask list\r
 \r
     ## The thread wrapper of LaunchCommand function\r
@@ -605,6 +605,11 @@ class BuildTask:
         try:\r
             self.BuildItem.BuildObject.BuildTime = LaunchCommand(Command, WorkingDir)\r
             self.CompleteFlag = True\r
+\r
+            # Run hash operation post dependency, to account for libs\r
+            if GlobalData.gUseHashCache and self.BuildItem.BuildObject.IsLibrary:\r
+                HashFile = path.join(self.BuildItem.BuildObject.BuildDir, self.BuildItem.BuildObject.Name + ".hash")\r
+                SaveFileOnChange(HashFile, self.BuildItem.BuildObject.GenModuleHash(), True)\r
         except:\r
             #\r
             # TRICK: hide the output of threads left running, so that the user can\r
@@ -1165,8 +1170,8 @@ class Build():
                     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
+            if GlobalData.gBinCacheDest:\r
+                FileDir = path.join(GlobalData.gBinCacheDest, 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