public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch V3] BaseTools: Fix checking for Sources section in INF file
@ 2019-08-12 15:32 Christian Rodriguez
  2019-08-12 15:39 ` Liming Gao
  2019-08-14  2:34 ` Bob Feng
  0 siblings, 2 replies; 3+ messages in thread
From: Christian Rodriguez @ 2019-08-12 15:32 UTC (permalink / raw)
  To: devel; +Cc: Bob Feng, Liming Gao

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

The check to see if [Sources] section lists all the header type
files of a module is missing the exclusion of source files that
fall under the scope of Package includes. This change adds the
exclusions.

Signed-off-by: Christian Rodriguez <christian.rodriguez@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
 BaseTools/Source/Python/AutoGen/GenMake.py       | 25 ++++++++++++++++++++++---
 BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 15 +++++++++++++++
 2 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
index 5802ae5ae4..499ef82aea 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -906,8 +906,14 @@ cleanlib:
                                     self._AutoGenObject.IncludePathList + self._AutoGenObject.BuildOptionIncPathList
                                     )
 
+        # Get a set of unique package includes from MetaFile
+        parentMetaFileIncludes = set()
+        for aInclude in self._AutoGenObject.PackageIncludePathList:
+            aIncludeName = str(aInclude)
+            parentMetaFileIncludes.add(aIncludeName.lower())
+
         # Check if header files are listed in metafile
-        # Get a list of unique module header source files from MetaFile
+        # Get a set of unique module header source files from MetaFile
         headerFilesInMetaFileSet = set()
         for aFile in self._AutoGenObject.SourceFileList:
             aFileName = str(aFile)
@@ -915,24 +921,37 @@ cleanlib:
                 continue
             headerFilesInMetaFileSet.add(aFileName.lower())
 
-        # Get a list of unique module autogen files
+        # Get a set of unique module autogen files
         localAutoGenFileSet = set()
         for aFile in self._AutoGenObject.AutoGenFileList:
             localAutoGenFileSet.add(str(aFile).lower())
 
-        # Get a list of unique module dependency header files
+        # Get a set of unique module dependency header files
         # Exclude autogen files and files not in the source directory
+        # and files that are under the package include list
         headerFileDependencySet = set()
         localSourceDir = str(self._AutoGenObject.SourceDir).lower()
         for Dependency in FileDependencyDict.values():
             for aFile in Dependency:
                 aFileName = str(aFile).lower()
+                # Exclude non-header files
                 if not aFileName.endswith('.h'):
                     continue
+                # Exclude autogen files
                 if aFileName in localAutoGenFileSet:
                     continue
+                # Exclude include out of local scope
                 if localSourceDir not in aFileName:
                     continue
+                # Exclude files covered by package includes
+                pathNeeded = True
+                for aIncludePath in parentMetaFileIncludes:
+                    if aIncludePath in aFileName:
+                        pathNeeded = False
+                        break
+                if not pathNeeded:
+                    continue
+                # Keep the file to be checked
                 headerFileDependencySet.add(aFileName)
 
         # Ensure that gModuleBuildTracking has been initialized per architecture
diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
index ed6822334e..aaea8767ef 100644
--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
@@ -1114,6 +1114,21 @@ class ModuleAutoGen(AutoGen):
     def IncludePathLength(self):
         return sum(len(inc)+1 for inc in self.IncludePathList)
 
+    ## Get the list of include paths from the packages
+    #
+    #   @IncludesList     list             The list path
+    #
+    @cached_property
+    def PackageIncludePathList(self):
+        IncludesList = []
+        for Package in self.Module.Packages:
+            PackageDir = mws.join(self.WorkspaceDir, Package.MetaFile.Dir)
+            IncludesList = Package.Includes
+            if Package._PrivateIncludes:
+                if not self.MetaFile.Path.startswith(PackageDir):
+                    IncludesList = list(set(Package.Includes).difference(set(Package._PrivateIncludes)))
+        return IncludesList
+
     ## Get HII EX PCDs which maybe used by VFR
     #
     #  efivarstore used by VFR may relate with HII EX PCDs
-- 
2.22.0.windows.1


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

* Re: [Patch V3] BaseTools: Fix checking for Sources section in INF file
  2019-08-12 15:32 [Patch V3] BaseTools: Fix checking for Sources section in INF file Christian Rodriguez
@ 2019-08-12 15:39 ` Liming Gao
  2019-08-14  2:34 ` Bob Feng
  1 sibling, 0 replies; 3+ messages in thread
From: Liming Gao @ 2019-08-12 15:39 UTC (permalink / raw)
  To: Rodriguez, Christian, devel@edk2.groups.io; +Cc: Feng, Bob C

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

> -----Original Message-----
> From: Rodriguez, Christian
> Sent: Monday, August 12, 2019 11:32 PM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: [Patch V3] BaseTools: Fix checking for Sources section in INF file
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1804
> 
> The check to see if [Sources] section lists all the header type
> files of a module is missing the exclusion of source files that
> fall under the scope of Package includes. This change adds the
> exclusions.
> 
> Signed-off-by: Christian Rodriguez <christian.rodriguez@intel.com>
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> ---
>  BaseTools/Source/Python/AutoGen/GenMake.py       | 25 ++++++++++++++++++++++---
>  BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 15 +++++++++++++++
>  2 files changed, 37 insertions(+), 3 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
> index 5802ae5ae4..499ef82aea 100644
> --- a/BaseTools/Source/Python/AutoGen/GenMake.py
> +++ b/BaseTools/Source/Python/AutoGen/GenMake.py
> @@ -906,8 +906,14 @@ cleanlib:
>                                      self._AutoGenObject.IncludePathList + self._AutoGenObject.BuildOptionIncPathList
> 
>                                      )
> 
> 
> 
> +        # Get a set of unique package includes from MetaFile
> 
> +        parentMetaFileIncludes = set()
> 
> +        for aInclude in self._AutoGenObject.PackageIncludePathList:
> 
> +            aIncludeName = str(aInclude)
> 
> +            parentMetaFileIncludes.add(aIncludeName.lower())
> 
> +
> 
>          # Check if header files are listed in metafile
> 
> -        # Get a list of unique module header source files from MetaFile
> 
> +        # Get a set of unique module header source files from MetaFile
> 
>          headerFilesInMetaFileSet = set()
> 
>          for aFile in self._AutoGenObject.SourceFileList:
> 
>              aFileName = str(aFile)
> 
> @@ -915,24 +921,37 @@ cleanlib:
>                  continue
> 
>              headerFilesInMetaFileSet.add(aFileName.lower())
> 
> 
> 
> -        # Get a list of unique module autogen files
> 
> +        # Get a set of unique module autogen files
> 
>          localAutoGenFileSet = set()
> 
>          for aFile in self._AutoGenObject.AutoGenFileList:
> 
>              localAutoGenFileSet.add(str(aFile).lower())
> 
> 
> 
> -        # Get a list of unique module dependency header files
> 
> +        # Get a set of unique module dependency header files
> 
>          # Exclude autogen files and files not in the source directory
> 
> +        # and files that are under the package include list
> 
>          headerFileDependencySet = set()
> 
>          localSourceDir = str(self._AutoGenObject.SourceDir).lower()
> 
>          for Dependency in FileDependencyDict.values():
> 
>              for aFile in Dependency:
> 
>                  aFileName = str(aFile).lower()
> 
> +                # Exclude non-header files
> 
>                  if not aFileName.endswith('.h'):
> 
>                      continue
> 
> +                # Exclude autogen files
> 
>                  if aFileName in localAutoGenFileSet:
> 
>                      continue
> 
> +                # Exclude include out of local scope
> 
>                  if localSourceDir not in aFileName:
> 
>                      continue
> 
> +                # Exclude files covered by package includes
> 
> +                pathNeeded = True
> 
> +                for aIncludePath in parentMetaFileIncludes:
> 
> +                    if aIncludePath in aFileName:
> 
> +                        pathNeeded = False
> 
> +                        break
> 
> +                if not pathNeeded:
> 
> +                    continue
> 
> +                # Keep the file to be checked
> 
>                  headerFileDependencySet.add(aFileName)
> 
> 
> 
>          # Ensure that gModuleBuildTracking has been initialized per architecture
> 
> diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
> index ed6822334e..aaea8767ef 100644
> --- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
> @@ -1114,6 +1114,21 @@ class ModuleAutoGen(AutoGen):
>      def IncludePathLength(self):
> 
>          return sum(len(inc)+1 for inc in self.IncludePathList)
> 
> 
> 
> +    ## Get the list of include paths from the packages
> 
> +    #
> 
> +    #   @IncludesList     list             The list path
> 
> +    #
> 
> +    @cached_property
> 
> +    def PackageIncludePathList(self):
> 
> +        IncludesList = []
> 
> +        for Package in self.Module.Packages:
> 
> +            PackageDir = mws.join(self.WorkspaceDir, Package.MetaFile.Dir)
> 
> +            IncludesList = Package.Includes
> 
> +            if Package._PrivateIncludes:
> 
> +                if not self.MetaFile.Path.startswith(PackageDir):
> 
> +                    IncludesList = list(set(Package.Includes).difference(set(Package._PrivateIncludes)))
> 
> +        return IncludesList
> 
> +
> 
>      ## Get HII EX PCDs which maybe used by VFR
> 
>      #
> 
>      #  efivarstore used by VFR may relate with HII EX PCDs
> 
> --
> 2.22.0.windows.1


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

* Re: [Patch V3] BaseTools: Fix checking for Sources section in INF file
  2019-08-12 15:32 [Patch V3] BaseTools: Fix checking for Sources section in INF file Christian Rodriguez
  2019-08-12 15:39 ` Liming Gao
@ 2019-08-14  2:34 ` Bob Feng
  1 sibling, 0 replies; 3+ messages in thread
From: Bob Feng @ 2019-08-14  2:34 UTC (permalink / raw)
  To: Rodriguez, Christian, devel@edk2.groups.io; +Cc: Gao, Liming

 Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: Rodriguez, Christian 
Sent: Monday, August 12, 2019 11:32 PM
To: devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [Patch V3] BaseTools: Fix checking for Sources section in INF file

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

The check to see if [Sources] section lists all the header type files of a module is missing the exclusion of source files that fall under the scope of Package includes. This change adds the exclusions.

Signed-off-by: Christian Rodriguez <christian.rodriguez@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
 BaseTools/Source/Python/AutoGen/GenMake.py       | 25 ++++++++++++++++++++++---
 BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 15 +++++++++++++++
 2 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
index 5802ae5ae4..499ef82aea 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -906,8 +906,14 @@ cleanlib:
                                     self._AutoGenObject.IncludePathList + self._AutoGenObject.BuildOptionIncPathList                                     ) +        # Get a set of unique package includes from MetaFile+        parentMetaFileIncludes = set()+        for aInclude in self._AutoGenObject.PackageIncludePathList:+            aIncludeName = str(aInclude)+            parentMetaFileIncludes.add(aIncludeName.lower())+         # Check if header files are listed in metafile-        # Get a list of unique module header source files from MetaFile+        # Get a set of unique module header source files from MetaFile         headerFilesInMetaFileSet = set()         for aFile in self._AutoGenObject.SourceFileList:             aFileName = str(aFile)@@ -915,24 +921,37 @@ cleanlib:
                 continue             headerFilesInMetaFileSet.add(aFileName.lower()) -        # Get a list of unique module autogen files+        # Get a set of unique module autogen files         localAutoGenFileSet = set()         for aFile in self._AutoGenObject.AutoGenFileList:             localAutoGenFileSet.add(str(aFile).lower()) -        # Get a list of unique module dependency header files+        # Get a set of unique module dependency header files         # Exclude autogen files and files not in the source directory+        # and files that are under the package include list         headerFileDependencySet = set()         localSourceDir = str(self._AutoGenObject.SourceDir).lower()         for Dependency in FileDependencyDict.values():             for aFile in Dependency:                 aFileName = str(aFile).lower()+                # Exclude non-header files                 if not aFileName.endswith('.h'):                     continue+                # Exclude autogen files                 if aFileName in localAutoGenFileSet:                     continue+                # Exclude include out of local scope                 if localSourceDir not in aFileName:                     continue+                # Exclude files covered by package includes+                pathNeeded = True+                for aIncludePath in parentMetaFileIncludes:+                    if aIncludePath in aFileName:+                        pathNeeded = False+                        break+                if not pathNeeded:+                    continue+                # Keep the file to be checked                 headerFileDependencySet.add(aFileName)          # Ensure that gModuleBuildTracking has been initialized per architecturediff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
index ed6822334e..aaea8767ef 100644
--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
@@ -1114,6 +1114,21 @@ class ModuleAutoGen(AutoGen):
     def IncludePathLength(self):         return sum(len(inc)+1 for inc in self.IncludePathList) +    ## Get the list of include paths from the packages+    #+    #   @IncludesList     list             The list path+    #+    @cached_property+    def PackageIncludePathList(self):+        IncludesList = []+        for Package in self.Module.Packages:+            PackageDir = mws.join(self.WorkspaceDir, Package.MetaFile.Dir)+            IncludesList = Package.Includes+            if Package._PrivateIncludes:+                if not self.MetaFile.Path.startswith(PackageDir):+                    IncludesList = list(set(Package.Includes).difference(set(Package._PrivateIncludes)))+        return IncludesList+     ## Get HII EX PCDs which maybe used by VFR     #     #  efivarstore used by VFR may relate with HII EX PCDs-- 
2.22.0.windows.1


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

end of thread, other threads:[~2019-08-14  2:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-12 15:32 [Patch V3] BaseTools: Fix checking for Sources section in INF file Christian Rodriguez
2019-08-12 15:39 ` Liming Gao
2019-08-14  2:34 ` Bob Feng

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