[edk2] [Patch] BaseTools: Enhance the report to not show the empty section

Yonghong Zhu posted 1 patch 6 years, 10 months ago
Failed in applying to current master (apply log)
BaseTools/Source/Python/build/BuildReport.py | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
[edk2] [Patch] BaseTools: Enhance the report to not show the empty section
Posted by Yonghong Zhu 6 years, 10 months ago
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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] BaseTools: Enhance the report to not show the empty section
Posted by Gao, Liming 6 years, 10 months ago
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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel