From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: bob.c.feng@intel.com) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by groups.io with SMTP; Wed, 29 May 2019 23:17:58 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 May 2019 23:17:57 -0700 X-ExtLoop1: 1 Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga006.fm.intel.com with ESMTP; 29 May 2019 23:17:57 -0700 Received: from fmsmsx162.amr.corp.intel.com (10.18.125.71) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 29 May 2019 23:17:57 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx162.amr.corp.intel.com (10.18.125.71) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 29 May 2019 23:17:56 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.10]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.187]) with mapi id 14.03.0415.000; Thu, 30 May 2019 14:17:55 +0800 From: "Bob Feng" To: "Rodriguez, Christian" , "devel@edk2.groups.io" CC: "Gao, Liming" , "Zhu, Yonghong" Subject: Re: [Patch V4 1/2] BaseTools: Add a checking for Sources section in INF file Thread-Topic: [Patch V4 1/2] BaseTools: Add a checking for Sources section in INF file Thread-Index: AQHVFjtXyGT2nWhukE6djOGoFnY6d6aDMkTg Date: Thu, 30 May 2019 06:17:54 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D16012830C@SHSMSX101.ccr.corp.intel.com> References: <20190529162649.3236-1-christian.rodriguez@intel.com> <20190529162649.3236-2-christian.rodriguez@intel.com> In-Reply-To: <20190529162649.3236-2-christian.rodriguez@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: bob.c.feng@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bob Feng -----Original Message----- From: Rodriguez, Christian=20 Sent: Thursday, May 30, 2019 12:27 AM To: devel@edk2.groups.io Cc: Feng, Bob C ; Gao, Liming ;= Zhu, Yonghong Subject: [Patch V4 1/2] BaseTools: Add a checking for Sources section in IN= F file BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1804 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 inform= ation 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 Cc: Bob Feng Cc: Liming Gao Cc: Yonghong Zhu --- 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 =3D set() + for aFile in self._AutoGenObject.SourceFileList: + aFileName =3D str(aFile) + if not aFileName.endswith('.h'): + continue + headerFilesInMetaFileSet.add(aFileName.lower()) + + # Get a list of unique module autogen files + localAutoGenFileSet =3D 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 =3D set() + localSourceDir =3D str(self._AutoGenObject.SourceDir).lower() + for Dependency in FileDependencyDict.values(): + for aFile in Dependency: + aFileName =3D 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 mod= ule's MetaFile + for aFile in headerFileDependencySet: + if aFile in headerFilesInMetaFileSet: + continue + EdkLogger.warn("build","Module MetaFile [Sources] is missing l= ocal header!", + ExtraData =3D "Local Header: " + aFile + " not fou= nd in " + self._AutoGenObject.MetaFile.Path + ) + DepSet =3D None for File,Dependency in FileDependencyDict.items(): if not Dependency: -- 2.21.0.windows.1