]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Add GenFds multi-thread support in build cache
authorShi, Steven <steven.shi@intel.com>
Thu, 15 Aug 2019 14:26:20 +0000 (22:26 +0800)
committerFeng, Bob C <bob.c.feng@intel.com>
Tue, 20 Aug 2019 06:06:07 +0000 (14:06 +0800)
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1923

Fix the issue that the GenFds multi-thread will build fail
if enable the build cache together.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Steven Shi <steven.shi@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
BaseTools/Source/Python/AutoGen/ModuleAutoGen.py

index dd833208b0279ff3a45591e4885a04595d267b79..ffa4727e59eda6004f8b9d81a446a4fc52d68666 100755 (executable)
@@ -1262,11 +1262,13 @@ class ModuleAutoGen(AutoGen):
         fStringIO.close ()\r
         fInputfile.close ()\r
         return OutputName\r
+\r
     @cached_property\r
     def OutputFile(self):\r
         retVal = set()\r
         OutputDir = self.OutputDir.replace('\\', '/').strip('/')\r
         DebugDir = self.DebugDir.replace('\\', '/').strip('/')\r
+        FfsOutputDir = self.FfsOutputDir.replace('\\', '/').rstrip('/')\r
         for Item in self.CodaTargetList:\r
             File = Item.Target.Path.replace('\\', '/').strip('/').replace(DebugDir, '').replace(OutputDir, '').strip('/')\r
             retVal.add(File)\r
@@ -1282,6 +1284,12 @@ class ModuleAutoGen(AutoGen):
                 if File.lower().endswith('.pdb'):\r
                     retVal.add(File)\r
 \r
+        for Root, Dirs, Files in os.walk(FfsOutputDir):\r
+            for File in Files:\r
+                if File.lower().endswith('.ffs') or File.lower().endswith('.offset') or File.lower().endswith('.raw') \\r
+                    or File.lower().endswith('.raw.txt'):\r
+                    retVal.add(File)\r
+\r
         return retVal\r
 \r
     ## Create AsBuilt INF file the module\r
@@ -1652,13 +1660,16 @@ class ModuleAutoGen(AutoGen):
         for File in self.OutputFile:\r
             File = str(File)\r
             if not os.path.isabs(File):\r
-                File = os.path.join(self.OutputDir, File)\r
+                NewFile = os.path.join(self.OutputDir, File)\r
+                if not os.path.exists(NewFile):\r
+                    NewFile = os.path.join(self.FfsOutputDir, File)\r
+                File = NewFile\r
             if os.path.exists(File):\r
-                sub_dir = os.path.relpath(File, self.OutputDir)\r
-                destination_file = os.path.join(FileDir, sub_dir)\r
-                destination_dir = os.path.dirname(destination_file)\r
-                CreateDirectory(destination_dir)\r
-                CopyFileOnChange(File, destination_dir)\r
+                if File.lower().endswith('.ffs') or File.lower().endswith('.offset') or File.lower().endswith('.raw') \\r
+                    or File.lower().endswith('.raw.txt'):\r
+                    self.CacheCopyFile(FfsDir, self.FfsOutputDir, File)\r
+                else:\r
+                    self.CacheCopyFile(FileDir, self.OutputDir, File)\r
 \r
     def SaveHashChainFileToCache(self, gDict):\r
         if not GlobalData.gBinCacheDest:\r