public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools: Support more file types in build cache
@ 2019-08-27  5:16 Steven Shi
  2019-09-02  1:48 ` Liming Gao
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Shi @ 2019-08-27  5:16 UTC (permalink / raw)
  To: devel; +Cc: liming.gao, bob.c.feng, Shi, Steven

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

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1958

Current build cache does not store and restore all
types file of Hii/vfr, version and dpx. This patch
adds more file types to support them in build cache.

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 | 34 ++++++++++++++--------------------
 1 file changed, 14 insertions(+), 20 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
index 2cd0d3859e..4f17dee9a4 100755
--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
@@ -1267,29 +1267,30 @@ class ModuleAutoGen(AutoGen):
     @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)
-        if self.DepexGenerated:
-            retVal.add(self.Name + '.depex')
+            NewFile = path.join(self.OutputDir, File)
+            retVal.add(NewFile)
 
         Bin = self._GenOffsetBin()
         if Bin:
-            retVal.add(Bin)
+            NewFile = path.join(self.OutputDir, Bin)
+            retVal.add(NewFile)
 
-        for Root, Dirs, Files in os.walk(OutputDir):
+        for Root, Dirs, Files in os.walk(self.OutputDir):
             for File in Files:
-                if File.lower().endswith('.pdb'):
-                    retVal.add(File)
+                # lib file is already added through above CodaTargetList, skip it here
+                if not (File.lower().endswith('.obj') or File.lower().endswith('.lib')):
+                    NewFile = path.join(self.OutputDir, File)
+                    retVal.add(NewFile)
 
-        for Root, Dirs, Files in os.walk(FfsOutputDir):
+        for Root, Dirs, Files in os.walk(self.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)
+                NewFile = path.join(self.FfsOutputDir, File)
+                retVal.add(NewFile)
 
         return retVal
 
@@ -1659,15 +1660,8 @@ class ModuleAutoGen(AutoGen):
             Ma = self.BuildDatabase[self.MetaFile, self.Arch, self.BuildTarget, self.ToolChain]
             self.OutputFile = Ma.Binaries
         for File in self.OutputFile:
-            File = str(File)
-            if not os.path.isabs(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):
-                if File.lower().endswith('.ffs') or File.lower().endswith('.offset') or File.lower().endswith('.raw') \
-                    or File.lower().endswith('.raw.txt'):
+                if File.startswith(os.path.abspath(self.FfsOutputDir)+os.sep):
                     self.CacheCopyFile(FfsDir, self.FfsOutputDir, File)
                 else:
                     self.CacheCopyFile(FileDir, self.OutputDir, File)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] BaseTools: Support more file types in build cache
  2019-08-27  5:16 [PATCH] BaseTools: Support more file types in build cache Steven Shi
@ 2019-09-02  1:48 ` Liming Gao
  0 siblings, 0 replies; 2+ messages in thread
From: Liming Gao @ 2019-09-02  1:48 UTC (permalink / raw)
  To: Shi, Steven, devel@edk2.groups.io; +Cc: Feng, Bob C

Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: Shi, Steven
> Sent: Tuesday, August 27, 2019 1:17 PM
> To: devel@edk2.groups.io
> Cc: Gao, Liming <liming.gao@intel.com>; Feng, Bob C <bob.c.feng@intel.com>; Shi, Steven <steven.shi@intel.com>
> Subject: [PATCH] BaseTools: Support more file types in build cache
> 
> From: "Shi, Steven" <steven.shi@intel.com>
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1958
> 
> Current build cache does not store and restore all
> types file of Hii/vfr, version and dpx. This patch
> adds more file types to support them in build cache.
> 
> 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 | 34 ++++++++++++++--------------------
>  1 file changed, 14 insertions(+), 20 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
> index 2cd0d3859e..4f17dee9a4 100755
> --- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
> @@ -1267,29 +1267,30 @@ class ModuleAutoGen(AutoGen):
>      @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)
> -        if self.DepexGenerated:
> -            retVal.add(self.Name + '.depex')
> +            NewFile = path.join(self.OutputDir, File)
> +            retVal.add(NewFile)
> 
>          Bin = self._GenOffsetBin()
>          if Bin:
> -            retVal.add(Bin)
> +            NewFile = path.join(self.OutputDir, Bin)
> +            retVal.add(NewFile)
> 
> -        for Root, Dirs, Files in os.walk(OutputDir):
> +        for Root, Dirs, Files in os.walk(self.OutputDir):
>              for File in Files:
> -                if File.lower().endswith('.pdb'):
> -                    retVal.add(File)
> +                # lib file is already added through above CodaTargetList, skip it here
> +                if not (File.lower().endswith('.obj') or File.lower().endswith('.lib')):
> +                    NewFile = path.join(self.OutputDir, File)
> +                    retVal.add(NewFile)
> 
> -        for Root, Dirs, Files in os.walk(FfsOutputDir):
> +        for Root, Dirs, Files in os.walk(self.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)
> +                NewFile = path.join(self.FfsOutputDir, File)
> +                retVal.add(NewFile)
> 
>          return retVal
> 
> @@ -1659,15 +1660,8 @@ class ModuleAutoGen(AutoGen):
>              Ma = self.BuildDatabase[self.MetaFile, self.Arch, self.BuildTarget, self.ToolChain]
>              self.OutputFile = Ma.Binaries
>          for File in self.OutputFile:
> -            File = str(File)
> -            if not os.path.isabs(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):
> -                if File.lower().endswith('.ffs') or File.lower().endswith('.offset') or File.lower().endswith('.raw') \
> -                    or File.lower().endswith('.raw.txt'):
> +                if File.startswith(os.path.abspath(self.FfsOutputDir)+os.sep):
>                      self.CacheCopyFile(FfsDir, self.FfsOutputDir, File)
>                  else:
>                      self.CacheCopyFile(FileDir, self.OutputDir, File)
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-02  1:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-27  5:16 [PATCH] BaseTools: Support more file types in build cache Steven Shi
2019-09-02  1:48 ` Liming Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox