public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Christian Rodriguez" <christian.rodriguez@intel.com>
To: devel@edk2.groups.io
Cc: Bob Feng <bob.c.feng@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [PATCH] BaseTools: Fix checking for Sources section in INF file
Date: Wed, 31 Jul 2019 11:01:01 -0700	[thread overview]
Message-ID: <20190731180101.613-1-christian.rodriguez@intel.com> (raw)

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>
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 15 +++++++++++++++
 BaseTools/Source/Python/AutoGen/GenMake.py | 15 ++++++++++++---
 2 files changed, 27 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):
         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
     #
     #  efivarstore used by VFR may relate with HII EX PCDs
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
index 5802ae5ae4..8dd08201aa 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
                                     )
 
+        # 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
-        # Get a list of unique module header source files from MetaFile
+        # Get a set of unique module header source files from MetaFile
         headerFilesInMetaFileSet = set()
         for aFile in self._AutoGenObject.SourceFileList:
             aFileName = str(aFile)
@@ -915,24 +921,27 @@ cleanlib:
                 continue
             headerFilesInMetaFileSet.add(aFileName.lower())
 
-        # Get a list of unique module autogen files
+        # Get a set 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
+        # Get a set 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()
+                aFileDirectory = os.path.dirname(aFileName)
                 if not aFileName.endswith('.h'):
                     continue
                 if aFileName in localAutoGenFileSet:
                     continue
                 if localSourceDir not in aFileName:
                     continue
+                if aFileDirectory in parentMetaFileIncludes:
+                    continue
                 headerFileDependencySet.add(aFileName)
 
         # Ensure that gModuleBuildTracking has been initialized per architecture
-- 
2.22.0.windows.1


                 reply	other threads:[~2019-07-31 18:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190731180101.613-1-christian.rodriguez@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox