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>
elif Line[0] == '!':\r
self._DirectiveParser()\r
continue\r
+ if Line[0] == TAB_OPTION_START and not self._InSubsection:\r
+ EdkLogger.error("Parser", FILE_READ_FAILURE, "Missing the '{' before %s in Line %s" % (Line, Index+1),ExtraData=self.MetaFile)\r
\r
if self._InSubsection:\r
SectionType = self._SubsectionType\r
return PlatformList\r
\r
def _MapPlatform(self, Dscfile):\r
- try:\r
- Platform = self.BuildObject[PathClass(Dscfile), 'COMMON']\r
- except:\r
- Platform = None\r
+ Platform = self.BuildObject[PathClass(Dscfile), 'COMMON']\r
+ if Platform == None:\r
+ EdkLogger.error('build', PARSER_ERROR, "Failed to parser DSC file: %s" % Dscfile)\r
return Platform\r
\r
PlatformList = property(_GetPlatformList)\r
\r
def InitPreBuild(self):\r
self.LoadConfiguration()\r
+ ErrorCode, ErrorInfo = self.PlatformFile.Validate(".dsc", False)\r
+ if ErrorCode != 0:\r
+ EdkLogger.error("build", ErrorCode, ExtraData=ErrorInfo)\r
if self.BuildTargetList:\r
GlobalData.gGlobalDefines['TARGET'] = self.BuildTargetList[0]\r
if self.ArchList:\r