public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools: Enhance the report to not show the empty section
@ 2017-06-08 14:07 Yonghong Zhu
  2017-06-23  6:44 ` Gao, Liming
  0 siblings, 1 reply; 2+ messages in thread
From: Yonghong Zhu @ 2017-06-08 14:07 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao

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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] BaseTools: Enhance the report to not show the empty section
  2017-06-08 14:07 [Patch] BaseTools: Enhance the report to not show the empty section Yonghong Zhu
@ 2017-06-23  6:44 ` Gao, Liming
  0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2017-06-23  6:44 UTC (permalink / raw)
  To: Zhu, Yonghong, edk2-devel@lists.01.org

Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: Zhu, Yonghong
>Sent: Thursday, June 08, 2017 10:07 PM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming <liming.gao@intel.com>
>Subject: [Patch] BaseTools: Enhance the report to not show the empty section
>
>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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-23  6:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-08 14:07 [Patch] BaseTools: Enhance the report to not show the empty section Yonghong Zhu
2017-06-23  6:44 ` Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox