Sync BaseTools Trunk (version r2518) to EDKII main trunk.
Signed-off-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13178 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -33,7 +33,12 @@ from Common.Misc import GuidStructureStringToGuidString
|
||||
from Common.InfClassObject import gComponentType2ModuleType
|
||||
from Common.BuildToolError import FILE_WRITE_FAILURE
|
||||
from Common.BuildToolError import CODE_ERROR
|
||||
|
||||
from Common.DataType import TAB_LINE_BREAK
|
||||
from Common.DataType import TAB_DEPEX
|
||||
from Common.DataType import TAB_SLASH
|
||||
from Common.DataType import TAB_SPACE_SPLIT
|
||||
from Common.DataType import TAB_BRG_PCD
|
||||
from Common.DataType import TAB_BRG_LIBRARY
|
||||
|
||||
## Pattern to extract contents in EDK DXS files
|
||||
gDxsDependencyPattern = re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL)
|
||||
@ -63,15 +68,19 @@ gIncludePattern2 = re.compile(r"#include\s+EFI_([A-Z_]+)\s*[(]\s*(\w+)\s*[)]")
|
||||
## Pattern to find the entry point for EDK module using EDKII Glue library
|
||||
gGlueLibEntryPoint = re.compile(r"__EDKII_GLUE_MODULE_ENTRY_POINT__\s*=\s*(\w+)")
|
||||
|
||||
## Tags for MaxLength of line in report
|
||||
gLineMaxLength = 120
|
||||
|
||||
## Tags for section start, end and separator
|
||||
gSectionStart = ">" + "=" * 118 + "<"
|
||||
gSectionEnd = "<" + "=" * 118 + ">" + "\n"
|
||||
gSectionSep = "=" * 120
|
||||
gSectionStart = ">" + "=" * (gLineMaxLength-2) + "<"
|
||||
gSectionEnd = "<" + "=" * (gLineMaxLength-2) + ">" + "\n"
|
||||
gSectionSep = "=" * gLineMaxLength
|
||||
|
||||
## Tags for subsection start, end and separator
|
||||
gSubSectionStart = ">" + "-" * 118 + "<"
|
||||
gSubSectionEnd = "<" + "-" * 118 + ">"
|
||||
gSubSectionSep = "-" * 120
|
||||
gSubSectionStart = ">" + "-" * (gLineMaxLength-2) + "<"
|
||||
gSubSectionEnd = "<" + "-" * (gLineMaxLength-2) + ">"
|
||||
gSubSectionSep = "-" * gLineMaxLength
|
||||
|
||||
|
||||
## The look up table to map PCD type to pair of report display type and DEC type
|
||||
gPcdTypeMap = {
|
||||
@ -166,6 +175,37 @@ def FindIncludeFiles(Source, IncludePathList, IncludeFiles):
|
||||
IncludeFiles[FullFileName.lower().replace("\\", "/")] = FullFileName
|
||||
break
|
||||
|
||||
## Split each lines in file
|
||||
#
|
||||
# This method is used to split the lines in file to make the length of each line
|
||||
# less than MaxLength.
|
||||
#
|
||||
# @param Content The content of file
|
||||
# @param MaxLength The Max Length of the line
|
||||
#
|
||||
def FileLinesSplit(Content=None, MaxLength=None):
|
||||
ContentList = Content.split(TAB_LINE_BREAK)
|
||||
NewContent = ''
|
||||
NewContentList = []
|
||||
for Line in ContentList:
|
||||
while len(Line.rstrip()) > MaxLength:
|
||||
LineSpaceIndex = Line.rfind(TAB_SPACE_SPLIT, 0, MaxLength)
|
||||
LineSlashIndex = Line.rfind(TAB_SLASH, 0, MaxLength)
|
||||
LineBreakIndex = MaxLength
|
||||
if LineSpaceIndex > LineSlashIndex:
|
||||
LineBreakIndex = LineSpaceIndex
|
||||
elif LineSlashIndex > LineSpaceIndex:
|
||||
LineBreakIndex = LineSlashIndex
|
||||
NewContentList.append(Line[:LineBreakIndex])
|
||||
Line = Line[LineBreakIndex:]
|
||||
if Line:
|
||||
NewContentList.append(Line)
|
||||
for NewLine in NewContentList:
|
||||
NewContent += NewLine + TAB_LINE_BREAK
|
||||
return NewContent
|
||||
|
||||
|
||||
|
||||
##
|
||||
# Parse binary dependency expression section
|
||||
#
|
||||
@ -263,7 +303,7 @@ class LibraryReport(object):
|
||||
#
|
||||
def GenerateReport(self, File):
|
||||
FileWrite(File, gSubSectionStart)
|
||||
FileWrite(File, "Library")
|
||||
FileWrite(File, TAB_BRG_LIBRARY)
|
||||
if len(self.LibraryList) > 0:
|
||||
FileWrite(File, gSubSectionSep)
|
||||
for LibraryItem in self.LibraryList:
|
||||
@ -355,8 +395,10 @@ class DepexReport(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:
|
||||
@ -685,7 +727,7 @@ class PcdReport(object):
|
||||
# For module PCD sub-section
|
||||
#
|
||||
FileWrite(File, gSubSectionStart)
|
||||
FileWrite(File, "PCD")
|
||||
FileWrite(File, TAB_BRG_PCD)
|
||||
FileWrite(File, gSubSectionSep)
|
||||
|
||||
for Key in self.AllPcds:
|
||||
@ -1511,7 +1553,8 @@ class BuildReport(object):
|
||||
File = StringIO('')
|
||||
for (Wa, MaList) in self.ReportList:
|
||||
PlatformReport(Wa, MaList, self.ReportType).GenerateReport(File, BuildDuration, self.ReportType)
|
||||
SaveFileOnChange(self.ReportFile, File.getvalue(), False)
|
||||
Content = FileLinesSplit(File.getvalue(), gLineMaxLength)
|
||||
SaveFileOnChange(self.ReportFile, Content, True)
|
||||
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)
|
||||
|
Reference in New Issue
Block a user