public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Yonghong Zhu <yonghong.zhu@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>
Subject: [Patch] BaseTools: Enhance the report to not show the empty section
Date: Thu,  8 Jun 2017 22:07:19 +0800	[thread overview]
Message-ID: <1496930839-16612-1-git-send-email-yonghong.zhu@intel.com> (raw)

Enhance the report to not show the empty section, eg: Module Library
Sub-section, if there is nothing in this section, we will not show it
in the report.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/build/BuildReport.py | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index 91d1e93..d700d6f 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -316,13 +316,13 @@ class LibraryReport(object):
     #
     # @param self            The object pointer
     # @param File            The file object for report
     #
     def GenerateReport(self, File):
-        FileWrite(File, gSubSectionStart)
-        FileWrite(File, TAB_BRG_LIBRARY)
         if len(self.LibraryList) > 0:
+            FileWrite(File, gSubSectionStart)
+            FileWrite(File, TAB_BRG_LIBRARY)
             FileWrite(File, gSubSectionSep)
             for LibraryItem in self.LibraryList:
                 LibInfPath = LibraryItem[0]
                 FileWrite(File, LibInfPath)
 
@@ -345,11 +345,11 @@ class LibraryReport(object):
                     if EdkIILibInfo:
                         FileWrite(File, "{%s: %s}" % (LibClass, EdkIILibInfo))
                     else:
                         FileWrite(File, "{%s}" % LibClass)
 
-        FileWrite(File, gSubSectionEnd)
+            FileWrite(File, gSubSectionEnd)
 
 ##
 # Reports dependency expression information
 #
 # This class reports the module dependency expression subsection in the build report file.
@@ -409,13 +409,10 @@ class DepexReport(object):
     # @param File              The file object for report
     # @param GlobalDepexParser The platform global Dependency expression parser object
     #
     def GenerateReport(self, File, GlobalDepexParser):
         if not self.Depex:
-            FileWrite(File, gSubSectionStart)
-            FileWrite(File, TAB_DEPEX)
-            FileWrite(File, gSubSectionEnd)
             return
         FileWrite(File, gSubSectionStart)
         if os.path.isfile(self._DepexFileName):
             try:
                 DepexStatements = GlobalDepexParser.ParseDepexFile(self._DepexFileName)
@@ -864,11 +861,11 @@ class PcdReport(object):
             FileWrite(File, "  *F  - Platform scoped PCD override in FDF file")
             if not ReportSubType:
                 FileWrite(File, "  *M  - Module scoped PCD override")
             FileWrite(File, gSectionSep)
         else:
-            if not ReportSubType:
+            if not ReportSubType and ModulePcdSet:
                 #
                 # For module PCD sub-section
                 #
                 FileWrite(File, gSubSectionStart)
                 FileWrite(File, TAB_BRG_PCD)
@@ -1009,11 +1006,11 @@ class PcdReport(object):
                                 FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 19, ModulePath, ModuleDefault.strip()))
 
         if ModulePcdSet == None:
             FileWrite(File, gSectionEnd)
         else:
-            if not ReportSubType:
+            if not ReportSubType and ModulePcdSet:
                 FileWrite(File, gSubSectionEnd)
 
 
 
 ##
-- 
2.6.1.windows.1



             reply	other threads:[~2017-06-08 14:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08 14:07 Yonghong Zhu [this message]
2017-06-23  6:44 ` [Patch] BaseTools: Enhance the report to not show the empty section Gao, Liming

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=1496930839-16612-1-git-send-email-yonghong.zhu@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