From 81add864f4af238a2dfb702904a6abec12738b9d Mon Sep 17 00:00:00 2001 From: "Feng, Bob C" Date: Mon, 29 Jan 2018 14:09:36 +0800 Subject: [PATCH] BaseTools: Support multiple .h file for structure Pcd declaration in DEC file. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bob Feng Cc: Liming Gao Reviewed-by: Liming Gao --- BaseTools/Source/Python/Workspace/BuildClassObject.py | 2 +- BaseTools/Source/Python/Workspace/DecBuildData.py | 2 +- BaseTools/Source/Python/Workspace/DscBuildData.py | 8 ++++---- BaseTools/Source/Python/Workspace/MetaFileParser.py | 4 +++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py index 3afb27a9c0..0e1161c96f 100644 --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py @@ -115,7 +115,7 @@ class StructurePcd(PcdClassObject): if validlists is None: validlists=[] if expressions is None : expressions=[] super(StructurePcd, self).__init__(Name, Guid, Type, DatumType, Value, Token, MaxDatumSize, SkuInfoList, IsOverrided, GuidValue, validateranges, validlists, expressions) - self.StructuredPcdIncludeFile = StructuredPcdIncludeFile + self.StructuredPcdIncludeFile = [] if StructuredPcdIncludeFile is None else StructuredPcdIncludeFile self.PackageDecs = Packages self.DefaultStoreName = [default_store] self.DefaultValues = collections.OrderedDict({}) diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py b/BaseTools/Source/Python/Workspace/DecBuildData.py index f6b908dee6..2fd3820dcc 100644 --- a/BaseTools/Source/Python/Workspace/DecBuildData.py +++ b/BaseTools/Source/Python/Workspace/DecBuildData.py @@ -376,7 +376,7 @@ class DecBuildData(PackageBuildClassObject): struct_pcd = StructurePcd() for item,LineNo in s_pcd_set[pcdname]: if "" in item.TokenCName: - struct_pcd.StructuredPcdIncludeFile = item.DefaultValue + struct_pcd.StructuredPcdIncludeFile.append(item.DefaultValue) elif "" in item.TokenCName: dep_pkgs.append(item.DefaultValue) elif item.DatumType == item.TokenCName: diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 8c5afb5bf4..84f7b6a237 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1470,10 +1470,10 @@ class DscBuildData(PlatformBuildClassObject): Includes = {} for PcdName in StructuredPcds: Pcd = StructuredPcds[PcdName] - IncludeFile = Pcd.StructuredPcdIncludeFile - if IncludeFile not in Includes: - Includes[IncludeFile] = True - CApp = CApp + '#include <%s>\n' % (IncludeFile) + for IncludeFile in Pcd.StructuredPcdIncludeFile: + if IncludeFile not in Includes: + Includes[IncludeFile] = True + CApp = CApp + '#include <%s>\n' % (IncludeFile) CApp = CApp + '\n' for PcdName in StructuredPcds: diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index c928cef70f..57642de4ee 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -1893,22 +1893,24 @@ class DecParser(MetaFileParser): if "|" not in self._CurrentLine: if "" == self._CurrentLine: self._include_flag = True + self._package_flag = False self._ValueList = None return if "" == self._CurrentLine: self._package_flag = True self._ValueList = None + self._include_flag = False return if self._include_flag: self._ValueList[1] = "_" + md5.new(self._CurrentLine).hexdigest() self._ValueList[2] = self._CurrentLine - self._include_flag = False if self._package_flag and "}" != self._CurrentLine: self._ValueList[1] = "_" + md5.new(self._CurrentLine).hexdigest() self._ValueList[2] = self._CurrentLine if self._CurrentLine == "}": self._package_flag = False + self._include_flag = False self._ValueList = None return else: -- 2.39.2