Using property instead of vairable for DecPcds.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <[email protected]>
CC: Liming Gao <[email protected]>
---
BaseTools/Source/Python/Workspace/DscBuildData.py | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index b60c0fdf3..dcc70e8ba 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1010,11 +1010,11 @@ class DscBuildData(PlatformBuildClassObject):
else:
EdkLogger.error('build', PARSER_ERROR,
"Pcd (%s.%s) defined in DSC is not declared in DEC
files. Arch: ['%s']" % (str_pcd[0], str_pcd[1], self._Arch),
File=self.MetaFile,Line = StrPcdSet[str_pcd][0][5])
# Add the Structure PCD that only defined in DEC, don't have override
in DSC file
- for Pcd in self._DecPcds:
+ for Pcd in self.DecPcds:
if type (self._DecPcds[Pcd]) is StructurePcd:
if Pcd not in S_pcd_set:
str_pcd_obj_str = StructurePcd()
str_pcd_obj_str.copy(self._DecPcds[Pcd])
str_pcd_obj = Pcds.get(Pcd, None)
@@ -1987,11 +1987,25 @@ class DscBuildData(PlatformBuildClassObject):
#
def AddPcd(self, Name, Guid, Value):
if (Name, Guid) not in self.Pcds:
self.Pcds[Name, Guid] = PcdClassObject(Name, Guid, '', '', '', '',
'', {}, False, None)
self.Pcds[Name, Guid].DefaultValue = Value
-
+ @property
+ def DecPcds(self):
+ if self._DecPcds == None:
+ FdfInfList = []
+ if GlobalData.gFdfParser:
+ FdfInfList = GlobalData.gFdfParser.Profile.InfList
+ PkgSet = set()
+ for Inf in FdfInfList:
+ ModuleFile = PathClass(NormPath(Inf), GlobalData.gWorkspace,
Arch=self._Arch)
+ if ModuleFile in self._Modules:
+ continue
+ ModuleData = self._Bdb[ModuleFile, self._Arch, self._Target,
self._Toolchain]
+ PkgSet.update(ModuleData.Packages)
+ self._DecPcds = GetDeclaredPcd(self, self._Bdb, self._Arch,
self._Target, self._Toolchain,PkgSet)
+ return self._DecPcds
_Macros = property(_GetMacros)
Arch = property(_GetArch, _SetArch)
Platform = property(_GetPlatformName)
PlatformName = property(_GetPlatformName)
Guid = property(_GetFileGuid)
--
2.14.3.windows.1
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel