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 v3 4/5] BaseTools: Add GenFds multi-thread support in build cache
Date: Tue, 13 Aug 2019 16:50:54 +0800	[thread overview]
Message-ID: <20190813085055.23208-5-steven.shi@intel.com> (raw)
In-Reply-To: <20190813085055.23208-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 a73a8a53a0..ee8518e19c 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-13  8:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-13  8:50 [PATCH v3 0/5] Build cache enhancement Steven Shi
2019-08-13  8:50 ` [PATCH v3 1/5] BaseTools: Improve the cache hit in the edk2 build cache Steven Shi
2019-08-13  8:50 ` [PATCH v3 2/5] BaseTools: Print first cache missing file for build cachle Steven Shi
2019-08-13  8:50 ` [PATCH v3 3/5] BaseTools: Change the [Arch][Name] module key in Build cache Steven Shi
2019-08-13  8:50 ` Steven Shi [this message]
2019-08-13  8:50 ` [PATCH v3 5/5] BaseTools: Improve the file saving and copying reliability Steven Shi

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=20190813085055.23208-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