mirror of https://github.com/acidanthera/audk.git
BaseTools: enhance error handling for DSC file
Add logic for DSC file validation for Prebuild init. Add logic to detect error for DSC parser when '{' is missing. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
74e8963c9b
commit
d429fcd0d2
|
@ -915,6 +915,8 @@ class DscParser(MetaFileParser):
|
||||||
elif Line[0] == '!':
|
elif Line[0] == '!':
|
||||||
self._DirectiveParser()
|
self._DirectiveParser()
|
||||||
continue
|
continue
|
||||||
|
if Line[0] == TAB_OPTION_START and not self._InSubsection:
|
||||||
|
EdkLogger.error("Parser", FILE_READ_FAILURE, "Missing the '{' before %s in Line %s" % (Line, Index+1),ExtraData=self.MetaFile)
|
||||||
|
|
||||||
if self._InSubsection:
|
if self._InSubsection:
|
||||||
SectionType = self._SubsectionType
|
SectionType = self._SubsectionType
|
||||||
|
|
|
@ -3012,10 +3012,9 @@ determine whether database file is out of date!\n")
|
||||||
return PlatformList
|
return PlatformList
|
||||||
|
|
||||||
def _MapPlatform(self, Dscfile):
|
def _MapPlatform(self, Dscfile):
|
||||||
try:
|
|
||||||
Platform = self.BuildObject[PathClass(Dscfile), 'COMMON']
|
Platform = self.BuildObject[PathClass(Dscfile), 'COMMON']
|
||||||
except:
|
if Platform == None:
|
||||||
Platform = None
|
EdkLogger.error('build', PARSER_ERROR, "Failed to parser DSC file: %s" % Dscfile)
|
||||||
return Platform
|
return Platform
|
||||||
|
|
||||||
PlatformList = property(_GetPlatformList)
|
PlatformList = property(_GetPlatformList)
|
||||||
|
|
|
@ -920,6 +920,9 @@ class Build():
|
||||||
|
|
||||||
def InitPreBuild(self):
|
def InitPreBuild(self):
|
||||||
self.LoadConfiguration()
|
self.LoadConfiguration()
|
||||||
|
ErrorCode, ErrorInfo = self.PlatformFile.Validate(".dsc", False)
|
||||||
|
if ErrorCode != 0:
|
||||||
|
EdkLogger.error("build", ErrorCode, ExtraData=ErrorInfo)
|
||||||
if self.BuildTargetList:
|
if self.BuildTargetList:
|
||||||
GlobalData.gGlobalDefines['TARGET'] = self.BuildTargetList[0]
|
GlobalData.gGlobalDefines['TARGET'] = self.BuildTargetList[0]
|
||||||
if self.ArchList:
|
if self.ArchList:
|
||||||
|
|
Loading…
Reference in New Issue