From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: christian.rodriguez@intel.com) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by groups.io with SMTP; Thu, 01 Aug 2019 08:33:21 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Aug 2019 08:33:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,334,1559545200"; d="scan'208";a="175285593" Received: from rodrigu3-desk.amr.corp.intel.com ([10.7.145.59]) by orsmga003.jf.intel.com with ESMTP; 01 Aug 2019 08:33:20 -0700 From: "Christian Rodriguez" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao Subject: [Patch V2] BaseTools: Fix checking for Sources section in INF file Date: Thu, 1 Aug 2019 08:33:12 -0700 Message-Id: <20190801153312.886-1-christian.rodriguez@intel.com> X-Mailer: git-send-email 2.22.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1804 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 Cc: Bob Feng Cc: Liming Gao --- BaseTools/Source/Python/AutoGen/AutoGen.py | 15 +++++++++++++++ BaseTools/Source/Python/AutoGen/GenMake.py | 25 ++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 2df055a109..02bf58160b 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -3454,6 +3454,21 @@ class ModuleAutoGen(AutoGen): def IncludePathLength(self):=0D return sum(len(inc)+1 for inc in self.IncludePathList)=0D =0D + ## Get the list of include paths from the packages=0D + #=0D + # @IncludesList list The list path=0D + #=0D + @cached_property=0D + def PackageIncludePathList(self):=0D + IncludesList =3D []=0D + for Package in self.Module.Packages:=0D + PackageDir =3D mws.join(self.WorkspaceDir, Package.MetaFile.Di= r)=0D + IncludesList =3D Package.Includes=0D + if Package._PrivateIncludes:=0D + if not self.MetaFile.Path.startswith(PackageDir):=0D + IncludesList =3D list(set(Package.Includes).difference= (set(Package._PrivateIncludes)))=0D + return IncludesList=0D +=0D ## Get HII EX PCDs which maybe used by VFR=0D #=0D # efivarstore used by VFR may relate with HII EX PCDs=0D diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/= Python/AutoGen/GenMake.py index 5802ae5ae4..1df55e5d61 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=0D )=0D =0D + # Get a set of unique package includes from MetaFile=0D + parentMetaFileIncludes =3D set()=0D + for aInclude in self._AutoGenObject.PackageIncludePathList:=0D + aIncludeName =3D str(aInclude)=0D + parentMetaFileIncludes.add(aIncludeName.lower())=0D +=0D # Check if header files are listed in metafile=0D - # Get a list of unique module header source files from MetaFile=0D + # Get a set of unique module header source files from MetaFile=0D headerFilesInMetaFileSet =3D set()=0D for aFile in self._AutoGenObject.SourceFileList:=0D aFileName =3D str(aFile)=0D @@ -915,24 +921,37 @@ cleanlib: continue=0D headerFilesInMetaFileSet.add(aFileName.lower())=0D =0D - # Get a list of unique module autogen files=0D + # Get a set of unique module autogen files=0D localAutoGenFileSet =3D set()=0D for aFile in self._AutoGenObject.AutoGenFileList:=0D localAutoGenFileSet.add(str(aFile).lower())=0D =0D - # Get a list of unique module dependency header files=0D + # Get a set of unique module dependency header files=0D # Exclude autogen files and files not in the source directory=0D + # and files that are under the package include list=0D headerFileDependencySet =3D set()=0D localSourceDir =3D str(self._AutoGenObject.SourceDir).lower()=0D for Dependency in FileDependencyDict.values():=0D for aFile in Dependency:=0D aFileName =3D str(aFile).lower()=0D + # Exclude non-header files=0D if not aFileName.endswith('.h'):=0D continue=0D + # Exclude autogen files=0D if aFileName in localAutoGenFileSet:=0D continue=0D + # Exclude include out of local scope=0D if localSourceDir not in aFileName:=0D continue=0D + # Exclude files covered by package includes=0D + pathNeeded =3D True=0D + for aIncludePath in parentMetaFileIncludes:=0D + if aIncludePath in aFileName:=0D + pathNeeded =3D False=0D + break=0D + if not pathNeeded:=0D + continue=0D + # Keep the file=0D headerFileDependencySet.add(aFileName)=0D =0D # Ensure that gModuleBuildTracking has been initialized per archit= ecture=0D --=20 2.22.0.windows.1