]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/build/BuildReport.py
Sync EDKII BaseTools to BaseTools project r1971
[mirror_edk2.git] / BaseTools / Source / Python / build / BuildReport.py
index 329352204dc4267a2965ccd116095de99fd797ef..af03e1f982d04291f4b94e6702dce847e30e47df 100644 (file)
@@ -4,8 +4,8 @@
 # This module contains the functionality to generate build report after\r
 # build all target completes successfully.\r
 #\r
-# Copyright (c) 2010, Intel Corporation\r
-# All rights reserved. This program and the accompanying materials\r
+# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+# This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution.  The full text of the license may be found at\r
 # http://opensource.org/licenses/bsd-license.php\r
@@ -22,12 +22,14 @@ import platform
 import textwrap\r
 import traceback\r
 import sys\r
+import time\r
 from datetime import datetime\r
+from StringIO import StringIO\r
 from Common import EdkLogger\r
+from Common.Misc import SaveFileOnChange\r
 from Common.Misc import GuidStructureByteArrayToGuidString\r
 from Common.Misc import GuidStructureStringToGuidString\r
 from Common.InfClassObject import gComponentType2ModuleType\r
-from Common.BuildToolError import FILE_OPEN_FAILURE\r
 from Common.BuildToolError import FILE_WRITE_FAILURE\r
 from Common.BuildToolError import CODE_ERROR\r
 \r
@@ -578,7 +580,8 @@ class PcdReport(object):
         for Platform in Wa.BuildDatabase.WorkspaceDb.PlatformList:\r
             for (TokenCName, TokenSpaceGuidCName) in Platform.Pcds:\r
                 DscDefaultValue = Platform.Pcds[(TokenCName, TokenSpaceGuidCName)].DefaultValue\r
-                self.DscPcdDefault[(TokenCName, TokenSpaceGuidCName)] = DscDefaultValue\r
+                if DscDefaultValue:\r
+                    self.DscPcdDefault[(TokenCName, TokenSpaceGuidCName)] = DscDefaultValue\r
 \r
     ##\r
     # Generate report for PCD information\r
@@ -765,6 +768,13 @@ class PredictionReport(object):
         for Pa in Wa.AutoGenObjectList:\r
             for Module in Pa.LibraryAutoGenList + Pa.ModuleAutoGenList:\r
                 #\r
+                # BASE typed modules are EFI agnostic, so we need not scan\r
+                # their source code to find PPI/Protocol produce or consume\r
+                # information.\r
+                #\r
+                if Module.ModuleType == "BASE":\r
+                    continue\r
+                #\r
                 # Add module referenced source files\r
                 #\r
                 self._SourceList.append(str(Module))\r
@@ -889,12 +899,17 @@ class PredictionReport(object):
 \r
         try:\r
             from Eot.Eot import Eot\r
+\r
             #\r
-            # Invoke EOT tool\r
+            # Invoke EOT tool and echo its runtime performance\r
             #\r
+            EotStartTime = time.time()\r
             Eot(CommandLineOption=False, SourceFileList=SourceList, GuidList=GuidList,\r
                 FvFileList=' '.join(FvFileList), Dispatch=DispatchList, IsInit=True)\r
-\r
+            EotEndTime = time.time()\r
+            EotDuration = time.strftime("%H:%M:%S", time.gmtime(int(round(EotEndTime - EotStartTime))))\r
+            EdkLogger.quiet("EOT run time: %s\n" % EotDuration)\r
+            \r
             #\r
             # Parse the output of EOT tool\r
             #\r
@@ -1415,13 +1430,11 @@ class BuildReport(object):
     def GenerateReport(self, BuildDuration):\r
         if self.ReportFile:\r
             try:\r
-                File = open(self.ReportFile, "w+")\r
-            except IOError:\r
-                EdkLogger.error(None, FILE_OPEN_FAILURE, ExtraData=self.ReportFile)\r
-            try:\r
+                File = StringIO('')\r
                 for (Wa, MaList) in self.ReportList:\r
                     PlatformReport(Wa, MaList, self.ReportType).GenerateReport(File, BuildDuration, self.ReportType)\r
-                EdkLogger.quiet("Report successfully saved to %s" % os.path.abspath(self.ReportFile))\r
+                SaveFileOnChange(self.ReportFile, File.getvalue(), False)\r
+                EdkLogger.quiet("Build report can be found at %s" % os.path.abspath(self.ReportFile))\r
             except IOError:\r
                 EdkLogger.error(None, FILE_WRITE_FAILURE, ExtraData=self.ReportFile)\r
             except:\r