mirror of https://github.com/acidanthera/audk.git
BaseTools: Fix checking for Sources section in INF file
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>
This commit is contained in:
parent
2b4c07bc22
commit
82407bd129
|
@ -906,8 +906,14 @@ cleanlib:
|
||||||
self._AutoGenObject.IncludePathList + self._AutoGenObject.BuildOptionIncPathList
|
self._AutoGenObject.IncludePathList + self._AutoGenObject.BuildOptionIncPathList
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Get a set of unique package includes from MetaFile
|
||||||
|
parentMetaFileIncludes = set()
|
||||||
|
for aInclude in self._AutoGenObject.PackageIncludePathList:
|
||||||
|
aIncludeName = str(aInclude)
|
||||||
|
parentMetaFileIncludes.add(aIncludeName.lower())
|
||||||
|
|
||||||
# Check if header files are listed in metafile
|
# Check if header files are listed in metafile
|
||||||
# Get a list of unique module header source files from MetaFile
|
# Get a set of unique module header source files from MetaFile
|
||||||
headerFilesInMetaFileSet = set()
|
headerFilesInMetaFileSet = set()
|
||||||
for aFile in self._AutoGenObject.SourceFileList:
|
for aFile in self._AutoGenObject.SourceFileList:
|
||||||
aFileName = str(aFile)
|
aFileName = str(aFile)
|
||||||
|
@ -915,24 +921,37 @@ cleanlib:
|
||||||
continue
|
continue
|
||||||
headerFilesInMetaFileSet.add(aFileName.lower())
|
headerFilesInMetaFileSet.add(aFileName.lower())
|
||||||
|
|
||||||
# Get a list of unique module autogen files
|
# Get a set of unique module autogen files
|
||||||
localAutoGenFileSet = set()
|
localAutoGenFileSet = set()
|
||||||
for aFile in self._AutoGenObject.AutoGenFileList:
|
for aFile in self._AutoGenObject.AutoGenFileList:
|
||||||
localAutoGenFileSet.add(str(aFile).lower())
|
localAutoGenFileSet.add(str(aFile).lower())
|
||||||
|
|
||||||
# Get a list of unique module dependency header files
|
# Get a set of unique module dependency header files
|
||||||
# Exclude autogen files and files not in the source directory
|
# Exclude autogen files and files not in the source directory
|
||||||
|
# and files that are under the package include list
|
||||||
headerFileDependencySet = set()
|
headerFileDependencySet = set()
|
||||||
localSourceDir = str(self._AutoGenObject.SourceDir).lower()
|
localSourceDir = str(self._AutoGenObject.SourceDir).lower()
|
||||||
for Dependency in FileDependencyDict.values():
|
for Dependency in FileDependencyDict.values():
|
||||||
for aFile in Dependency:
|
for aFile in Dependency:
|
||||||
aFileName = str(aFile).lower()
|
aFileName = str(aFile).lower()
|
||||||
|
# Exclude non-header files
|
||||||
if not aFileName.endswith('.h'):
|
if not aFileName.endswith('.h'):
|
||||||
continue
|
continue
|
||||||
|
# Exclude autogen files
|
||||||
if aFileName in localAutoGenFileSet:
|
if aFileName in localAutoGenFileSet:
|
||||||
continue
|
continue
|
||||||
|
# Exclude include out of local scope
|
||||||
if localSourceDir not in aFileName:
|
if localSourceDir not in aFileName:
|
||||||
continue
|
continue
|
||||||
|
# Exclude files covered by package includes
|
||||||
|
pathNeeded = True
|
||||||
|
for aIncludePath in parentMetaFileIncludes:
|
||||||
|
if aIncludePath in aFileName:
|
||||||
|
pathNeeded = False
|
||||||
|
break
|
||||||
|
if not pathNeeded:
|
||||||
|
continue
|
||||||
|
# Keep the file to be checked
|
||||||
headerFileDependencySet.add(aFileName)
|
headerFileDependencySet.add(aFileName)
|
||||||
|
|
||||||
# Ensure that gModuleBuildTracking has been initialized per architecture
|
# Ensure that gModuleBuildTracking has been initialized per architecture
|
||||||
|
|
|
@ -1113,6 +1113,21 @@ class ModuleAutoGen(AutoGen):
|
||||||
def IncludePathLength(self):
|
def IncludePathLength(self):
|
||||||
return sum(len(inc)+1 for inc in self.IncludePathList)
|
return sum(len(inc)+1 for inc in self.IncludePathList)
|
||||||
|
|
||||||
|
## Get the list of include paths from the packages
|
||||||
|
#
|
||||||
|
# @IncludesList list The list path
|
||||||
|
#
|
||||||
|
@cached_property
|
||||||
|
def PackageIncludePathList(self):
|
||||||
|
IncludesList = []
|
||||||
|
for Package in self.Module.Packages:
|
||||||
|
PackageDir = mws.join(self.WorkspaceDir, Package.MetaFile.Dir)
|
||||||
|
IncludesList = Package.Includes
|
||||||
|
if Package._PrivateIncludes:
|
||||||
|
if not self.MetaFile.Path.startswith(PackageDir):
|
||||||
|
IncludesList = list(set(Package.Includes).difference(set(Package._PrivateIncludes)))
|
||||||
|
return IncludesList
|
||||||
|
|
||||||
## Get HII EX PCDs which maybe used by VFR
|
## Get HII EX PCDs which maybe used by VFR
|
||||||
#
|
#
|
||||||
# efivarstore used by VFR may relate with HII EX PCDs
|
# efivarstore used by VFR may relate with HII EX PCDs
|
||||||
|
|
Loading…
Reference in New Issue