public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Steven Shi" <steven.shi@intel.com>
To: devel@edk2.groups.io
Cc: liming.gao@intel.com, bob.c.feng@intel.com,
	christian.rodriguez@intel.com, michael.johnson@intel.com, "Shi,
	Steven" <steven.shi@intel.com>
Subject: [PATCH 4/4] BaseTools: Add GenFds multi-thread support in build cache
Date: Thu,  8 Aug 2019 20:25:19 +0800	[thread overview]
Message-ID: <20190808122519.25516-5-steven.shi@intel.com> (raw)
In-Reply-To: <20190808122519.25516-1-steven.shi@intel.com>

From: "Shi, Steven" <steven.shi@intel.com>

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>
---
 BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
index 67875f7532..e73664f3b0 100755
--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
@@ -1248,11 +1248,13 @@ class ModuleAutoGen(AutoGen):
         fStringIO.close ()
         fInputfile.close ()
         return OutputName
+
     @cached_property
     def OutputFile(self):
         retVal = set()
         OutputDir = self.OutputDir.replace('\\', '/').strip('/')
         DebugDir = self.DebugDir.replace('\\', '/').strip('/')
+        FfsOutputDir = self.FfsOutputDir.replace('\\', '/').rstrip('/')
         for Item in self.CodaTargetList:
             File = Item.Target.Path.replace('\\', '/').strip('/').replace(DebugDir, '').replace(OutputDir, '').strip('/')
             retVal.add(File)
@@ -1268,6 +1270,12 @@ class ModuleAutoGen(AutoGen):
                 if File.lower().endswith('.pdb'):
                     retVal.add(File)
 
+        for Root, Dirs, Files in os.walk(FfsOutputDir):
+            for File in Files:
+                if File.lower().endswith('.ffs') or File.lower().endswith('.offset') or File.lower().endswith('.raw') \
+                    or File.lower().endswith('.raw.txt'):
+                    retVal.add(File)
+
         return retVal
 
     ## Create AsBuilt INF file the module
@@ -1638,13 +1646,16 @@ class ModuleAutoGen(AutoGen):
         for File in self.OutputFile:
             File = str(File)
             if not os.path.isabs(File):
-                File = os.path.join(self.OutputDir, File)
+                NewFile = os.path.join(self.OutputDir, File)
+                if not os.path.exists(NewFile):
+                    NewFile = os.path.join(self.FfsOutputDir, File)
+                File = NewFile
             if os.path.exists(File):
-                sub_dir = os.path.relpath(File, self.OutputDir)
-                destination_file = os.path.join(FileDir, sub_dir)
-                destination_dir = os.path.dirname(destination_file)
-                CreateDirectory(destination_dir)
-                CopyFileOnChange(File, destination_dir)
+                if File.lower().endswith('.ffs') or File.lower().endswith('.offset') or File.lower().endswith('.raw') \
+                    or File.lower().endswith('.raw.txt'):
+                    self.CacheCopyFile(FfsDir, self.FfsOutputDir, File)
+                else:
+                    self.CacheCopyFile(FileDir, self.OutputDir, File)
 
     def SaveHashChainFileToCache(self, gDict):
         if not GlobalData.gBinCacheDest:
-- 
2.17.1


  parent reply	other threads:[~2019-08-08 12:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-08 12:25 [PATCH 0/4] Build cache enhancement Steven Shi
2019-08-08 12:25 ` [PATCH 1/4] BaseTools: Improve the cache hit in the edk2 build cache Steven Shi
2019-09-06 20:45   ` commit "BaseTools: Improve the cache hit in the edk2 build cache" causes build.py unknown fatal error vladimir.olovyannikov
2019-09-07  2:16     ` Steven Shi
2019-09-09  1:22       ` Bob Feng
2019-09-09 20:14         ` Vladimir Olovyannikov
2019-09-10  1:25           ` Steven Shi
2019-09-10  1:57           ` Bob Feng
2019-08-08 12:25 ` [PATCH 2/4] BaseTools: Print first cache missing file for build cachle Steven Shi
2019-08-08 12:25 ` [PATCH 3/4] BaseTools: Change the [Arch][Name] module key in Build cache Steven Shi
2019-08-08 12:25 ` Steven Shi [this message]
2019-08-08 20:43 ` [edk2-devel] [PATCH 0/4] Build cache enhancement Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190808122519.25516-5-steven.shi@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox