]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Add a checking for Sources section in INF file
authorRodriguez, Christian <christian.rodriguez@intel.com>
Wed, 29 May 2019 16:26:48 +0000 (00:26 +0800)
committerFeng, Bob C <bob.c.feng@intel.com>
Mon, 10 Jun 2019 11:48:51 +0000 (19:48 +0800)
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1804

Add a check to see if [Sources] section lists all the header type
files of a module. Performance impact should be minimal with this patch
since information is already being fetched for Makefile purposes. All
other information is already cached in memory. No extra IO time is needed.

Signed-off-by: Christian Rodriguez <christian.rodriguez@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
BaseTools/Source/Python/AutoGen/GenMake.py

index 0e0f9fd9b09a58cb361292ad193756a68e531c39..5c992d7c267437bcfe79c798f40e442f0c5f1c3b 100644 (file)
@@ -905,6 +905,44 @@ cleanlib:
                                     ForceIncludedFile,\r
                                     self._AutoGenObject.IncludePathList + self._AutoGenObject.BuildOptionIncPathList\r
                                     )\r
+\r
+        # Check if header files are listed in metafile\r
+        # Get a list of unique module header source files from MetaFile\r
+        headerFilesInMetaFileSet = set()\r
+        for aFile in self._AutoGenObject.SourceFileList:\r
+            aFileName = str(aFile)\r
+            if not aFileName.endswith('.h'):\r
+                continue\r
+            headerFilesInMetaFileSet.add(aFileName.lower())\r
+\r
+        # Get a list 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
+        # Exclude autogen files and files not in the source directory\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
+                if not aFileName.endswith('.h'):\r
+                    continue\r
+                if aFileName in localAutoGenFileSet:\r
+                    continue\r
+                if localSourceDir not in aFileName:\r
+                    continue\r
+                headerFileDependencySet.add(aFileName)\r
+\r
+        # Check if a module dependency header file is missing from the module's MetaFile\r
+        for aFile in headerFileDependencySet:\r
+            if aFile in headerFilesInMetaFileSet:\r
+                continue\r
+            EdkLogger.warn("build","Module MetaFile [Sources] is missing local header!",\r
+                        ExtraData = "Local Header: " + aFile + " not found in " + self._AutoGenObject.MetaFile.Path\r
+                        )\r
+\r
         DepSet = None\r
         for File,Dependency in FileDependencyDict.items():\r
             if not Dependency:\r