From 40d841f6a8f84e75409178e19e69b95e01bada0f Mon Sep 17 00:00:00 2001 From: lgao4 Date: Tue, 18 May 2010 05:04:32 +0000 Subject: Sync EDKII BaseTools to BaseTools project r1971 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10502 6f19259b-4bc3-4df7-8a09-765794883524 --- BaseTools/Source/Python/build/BuildReport.py | 35 +++++++++++++++++++--------- BaseTools/Source/Python/build/__init__.py | 4 ++-- BaseTools/Source/Python/build/build.py | 12 ++++------ 3 files changed, 31 insertions(+), 20 deletions(-) (limited to 'BaseTools/Source/Python/build') diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index 329352204d..af03e1f982 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -4,8 +4,8 @@ # This module contains the functionality to generate build report after # build all target completes successfully. # -# Copyright (c) 2010, Intel Corporation -# All rights reserved. This program and the accompanying materials +# Copyright (c) 2010, Intel Corporation. All rights reserved.
+# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php @@ -22,12 +22,14 @@ import platform import textwrap import traceback import sys +import time from datetime import datetime +from StringIO import StringIO from Common import EdkLogger +from Common.Misc import SaveFileOnChange from Common.Misc import GuidStructureByteArrayToGuidString from Common.Misc import GuidStructureStringToGuidString from Common.InfClassObject import gComponentType2ModuleType -from Common.BuildToolError import FILE_OPEN_FAILURE from Common.BuildToolError import FILE_WRITE_FAILURE from Common.BuildToolError import CODE_ERROR @@ -578,7 +580,8 @@ class PcdReport(object): for Platform in Wa.BuildDatabase.WorkspaceDb.PlatformList: for (TokenCName, TokenSpaceGuidCName) in Platform.Pcds: DscDefaultValue = Platform.Pcds[(TokenCName, TokenSpaceGuidCName)].DefaultValue - self.DscPcdDefault[(TokenCName, TokenSpaceGuidCName)] = DscDefaultValue + if DscDefaultValue: + self.DscPcdDefault[(TokenCName, TokenSpaceGuidCName)] = DscDefaultValue ## # Generate report for PCD information @@ -765,6 +768,13 @@ class PredictionReport(object): for Pa in Wa.AutoGenObjectList: for Module in Pa.LibraryAutoGenList + Pa.ModuleAutoGenList: # + # BASE typed modules are EFI agnostic, so we need not scan + # their source code to find PPI/Protocol produce or consume + # information. + # + if Module.ModuleType == "BASE": + continue + # # Add module referenced source files # self._SourceList.append(str(Module)) @@ -889,12 +899,17 @@ class PredictionReport(object): try: from Eot.Eot import Eot + # - # Invoke EOT tool + # Invoke EOT tool and echo its runtime performance # + EotStartTime = time.time() Eot(CommandLineOption=False, SourceFileList=SourceList, GuidList=GuidList, FvFileList=' '.join(FvFileList), Dispatch=DispatchList, IsInit=True) - + EotEndTime = time.time() + EotDuration = time.strftime("%H:%M:%S", time.gmtime(int(round(EotEndTime - EotStartTime)))) + EdkLogger.quiet("EOT run time: %s\n" % EotDuration) + # # Parse the output of EOT tool # @@ -1415,13 +1430,11 @@ class BuildReport(object): def GenerateReport(self, BuildDuration): if self.ReportFile: try: - File = open(self.ReportFile, "w+") - except IOError: - EdkLogger.error(None, FILE_OPEN_FAILURE, ExtraData=self.ReportFile) - try: + File = StringIO('') for (Wa, MaList) in self.ReportList: PlatformReport(Wa, MaList, self.ReportType).GenerateReport(File, BuildDuration, self.ReportType) - EdkLogger.quiet("Report successfully saved to %s" % os.path.abspath(self.ReportFile)) + SaveFileOnChange(self.ReportFile, File.getvalue(), False) + EdkLogger.quiet("Build report can be found at %s" % os.path.abspath(self.ReportFile)) except IOError: EdkLogger.error(None, FILE_WRITE_FAILURE, ExtraData=self.ReportFile) except: diff --git a/BaseTools/Source/Python/build/__init__.py b/BaseTools/Source/Python/build/__init__.py index 1c7f31a8bc..64cf63b635 100644 --- a/BaseTools/Source/Python/build/__init__.py +++ b/BaseTools/Source/Python/build/__init__.py @@ -4,8 +4,8 @@ # This file is required to make Python interpreter treat the directory # as containing package. # -# Copyright (c) 2007 - 2010, Intel Corporation
-# All rights reserved. This program and the accompanying materials +# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index f608dee9b8..545ffa39aa 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -1,9 +1,9 @@ ## @file # build a platform or a module # -# Copyright (c) 2007 - 2010, Intel Corporation +# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
# -# All rights reserved. This program and the accompanying materials +# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php @@ -1289,12 +1289,10 @@ class Build(): # # Save address map into MAP file. # - MapFile = open(MapFilePath, "wb") - MapFile.write(MapBuffer.getvalue()) - MapFile.close() - MapBuffer.close() + SaveFileOnChange(MapFilePath, MapBuffer.getvalue(), False) + MapBuffer.close() if self.LoadFixAddress != 0: - sys.stdout.write ("\nLoad Module At Fix Address Map file saved to %s\n" %(MapFilePath)) + sys.stdout.write ("\nLoad Module At Fix Address Map file can be found at %s\n" %(MapFilePath)) sys.stdout.flush() ## Build active platform for different build targets and different tool chains -- cgit v1.2.3