[edk2-devel] [Patch V4 1/2] BaseTools: Add a checking for Sources section in INF file

Bob Feng bob.c.feng at intel.com
Thu May 30 06:17:54 UTC 2019


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

-----Original Message-----
From: Rodriguez, Christian 
Sent: Thursday, May 30, 2019 12:27 AM
To: devel at edk2.groups.io
Cc: Feng, Bob C <bob.c.feng at intel.com>; Gao, Liming <liming.gao at intel.com>; Zhu, Yonghong <yonghong.zhu at intel.com>
Subject: [Patch V4 1/2] BaseTools: Add a checking for Sources section in INF file

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 at intel.com>
Cc: Bob Feng <bob.c.feng at intel.com>
Cc: Liming Gao <liming.gao at intel.com>
Cc: Yonghong Zhu <yonghong.zhu at intel.com>
---
 BaseTools/Source/Python/AutoGen/GenMake.py | 38 ++++++++++++++++++++
 1 file changed, 38 insertions(+)

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


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#41663): https://edk2.groups.io/g/devel/message/41663
Mute This Topic: https://groups.io/mt/31835555/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list