diff options
author | Yonghong Zhu <yonghong.zhu@intel.com> | 2016-04-15 16:46:48 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2016-07-13 09:32:05 +0800 |
commit | 4c4f3d120c989b4e8e31b50e1bdc7c9135a22597 (patch) | |
tree | a0012a561a3d7e8dc2b0ff8d200e7e8761d06dbc /BaseTools | |
parent | fb78cbe3ed4759ef259bdc16cabb9c4e113edae0 (diff) | |
download | edk2-platforms-4c4f3d120c989b4e8e31b50e1bdc7c9135a22597.tar.xz |
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>
(cherry picked from commit d429fcd0d25936ff5861e9c6e37f7cf9285217b2)
Diffstat (limited to 'BaseTools')
-rw-r--r-- | BaseTools/Source/Python/Workspace/MetaFileParser.py | 2 | ||||
-rw-r--r-- | BaseTools/Source/Python/Workspace/WorkspaceDatabase.py | 7 | ||||
-rw-r--r-- | BaseTools/Source/Python/build/build.py | 3 |
3 files changed, 8 insertions, 4 deletions
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index 3b6a3c0dfa..2811fd1ba3 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -915,6 +915,8 @@ class DscParser(MetaFileParser): elif Line[0] == '!':
self._DirectiveParser()
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:
SectionType = self._SubsectionType
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py index 34bc48a0d3..6c548ac709 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py @@ -3012,10 +3012,9 @@ determine whether database file is out of date!\n") return PlatformList
def _MapPlatform(self, Dscfile):
- try:
- Platform = self.BuildObject[PathClass(Dscfile), 'COMMON']
- except:
- Platform = None
+ Platform = self.BuildObject[PathClass(Dscfile), 'COMMON']
+ if Platform == None:
+ EdkLogger.error('build', PARSER_ERROR, "Failed to parser DSC file: %s" % Dscfile)
return Platform
PlatformList = property(_GetPlatformList)
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index 37ce8e16aa..07891dafdb 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -920,6 +920,9 @@ class Build(): def InitPreBuild(self):
self.LoadConfiguration()
+ ErrorCode, ErrorInfo = self.PlatformFile.Validate(".dsc", False)
+ if ErrorCode != 0:
+ EdkLogger.error("build", ErrorCode, ExtraData=ErrorInfo)
if self.BuildTargetList:
GlobalData.gGlobalDefines['TARGET'] = self.BuildTargetList[0]
if self.ArchList:
|