]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Fix checking for Sources section in INF file
authorRodriguez, Christian <christian.rodriguez@intel.com>
Mon, 12 Aug 2019 15:32:11 +0000 (23:32 +0800)
committerFeng, Bob C <bob.c.feng@intel.com>
Wed, 14 Aug 2019 02:59:08 +0000 (10:59 +0800)
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>
Tested-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
BaseTools/Source/Python/AutoGen/GenMake.py
BaseTools/Source/Python/AutoGen/ModuleAutoGen.py

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