]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/Python/Workspace/BuildClassObject.py
BaseTools: Don't save unused workspace data
[mirror_edk2.git] / BaseTools / Source / Python / Workspace / BuildClassObject.py
CommitLineData
30fdf114
LG
1## @file\r
2# This file is used to define each component of the build database\r
3#\r
c33081c9 4# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
40d841f6 5# This program and the accompanying materials\r
30fdf114
LG
6# are licensed and made available under the terms and conditions of the BSD License\r
7# which accompanies this distribution. The full text of the license may be found at\r
8# http://opensource.org/licenses/bsd-license.php\r
9#\r
10# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12#\r
13\r
b0a26451 14from collections import OrderedDict, namedtuple\r
8518bf0b 15from Common.DataType import *\r
30fdf114
LG
16\r
17## PcdClassObject\r
18#\r
19# This Class is used for PcdObject\r
20#\r
21# @param object: Inherited from object class\r
22# @param Name: Input value for Name of Pcd, default is None\r
23# @param Guid: Input value for Guid of Pcd, default is None\r
24# @param Type: Input value for Type of Pcd, default is None\r
25# @param DatumType: Input value for DatumType of Pcd, default is None\r
26# @param Value: Input value for Value of Pcd, default is None\r
27# @param Token: Input value for Token of Pcd, default is None\r
28# @param MaxDatumSize: Input value for MaxDatumSize of Pcd, default is None\r
29# @param SkuInfoList: Input value for SkuInfoList of Pcd, default is {}\r
30# @param IsOverrided: Input value for IsOverrided of Pcd, default is False\r
e56468c0 31# @param GuidValue: Input value for TokenSpaceGuidValue of Pcd, default is None\r
30fdf114
LG
32#\r
33# @var TokenCName: To store value for TokenCName\r
34# @var TokenSpaceGuidCName: To store value for TokenSpaceGuidCName\r
35# @var Type: To store value for Type\r
36# @var DatumType: To store value for DatumType\r
37# @var TokenValue: To store value for TokenValue\r
38# @var MaxDatumSize: To store value for MaxDatumSize\r
39# @var SkuInfoList: To store value for SkuInfoList\r
40# @var IsOverrided: To store value for IsOverrided\r
41# @var Phase: To store value for Phase, default is "DXE"\r
42#\r
43class PcdClassObject(object):\r
ced86858 44 def __init__(self, Name = None, Guid = None, Type = None, DatumType = None, Value = None, Token = None, MaxDatumSize = None, SkuInfoList = {}, IsOverrided = False, GuidValue = None, validateranges = [], validlists = [], expressions = [], IsDsc = False, UserDefinedDefaultStoresFlag = False):\r
30fdf114
LG
45 self.TokenCName = Name\r
46 self.TokenSpaceGuidCName = Guid\r
47 self.TokenSpaceGuidValue = GuidValue\r
48 self.Type = Type\r
49 self.DatumType = DatumType\r
50 self.DefaultValue = Value\r
51 self.TokenValue = Token\r
52 self.MaxDatumSize = MaxDatumSize\r
c33081c9 53 self.MaxSizeUserSet = None\r
30fdf114
LG
54 self.SkuInfoList = SkuInfoList\r
55 self.Phase = "DXE"\r
56 self.Pending = False\r
e56468c0 57 self.IsOverrided = IsOverrided\r
a0a2cd1e
FB
58 self.IsFromBinaryInf = False\r
59 self.IsFromDsc = False\r
82a6a960
BF
60 self.validateranges = validateranges\r
61 self.validlists = validlists\r
62 self.expressions = expressions\r
cc71d8b7 63 self.DscDefaultValue = None\r
71127ce8 64 self.DscRawValue = {}\r
cc71d8b7
YZ
65 if IsDsc:\r
66 self.DscDefaultValue = Value\r
0f228f19 67 self.PcdValueFromComm = ""\r
543f5ac3 68 self.PcdValueFromFdf = ""\r
ced86858 69 self.UserDefinedDefaultStoresFlag = UserDefinedDefaultStoresFlag\r
9904222d 70\r
cfed8a37
FB
71 @staticmethod\r
72 def GetPcdMaxSizeWorker(PcdString, MaxSize):\r
73 if PcdString.startswith("{") and PcdString.endswith("}"):\r
74 return max([len(PcdString.split(",")),MaxSize])\r
75\r
76 if PcdString.startswith("\"") or PcdString.startswith("\'"):\r
77 return max([len(PcdString)-2+1,MaxSize])\r
78\r
79 if PcdString.startswith("L\""):\r
80 return max([2*(len(PcdString)-3+1),MaxSize])\r
81\r
82 return max([len(PcdString),MaxSize])\r
83\r
5565a8c4
CJ
84 ## Get the maximum number of bytes\r
85 def GetPcdMaxSize(self):\r
86 if self.DatumType in TAB_PCD_NUMERIC_TYPES:\r
87 return MAX_SIZE_TYPE[self.DatumType]\r
88\r
ccaa7754 89 MaxSize = int(self.MaxDatumSize, 10) if self.MaxDatumSize else 0\r
543f5ac3 90 if self.PcdValueFromFdf:\r
cfed8a37 91 MaxSize = self.GetPcdMaxSizeWorker(self.PcdValueFromFdf,MaxSize)\r
5565a8c4 92 if self.PcdValueFromComm:\r
cfed8a37
FB
93 MaxSize = self.GetPcdMaxSizeWorker(self.PcdValueFromComm,MaxSize)\r
94 if hasattr(self, "DefaultValueFromDec"):\r
95 MaxSize = self.GetPcdMaxSizeWorker(self.DefaultValueFromDec,MaxSize)\r
5565a8c4
CJ
96 return MaxSize\r
97\r
98 ## Get the number of bytes\r
99 def GetPcdSize(self):\r
100 if self.DatumType in TAB_PCD_NUMERIC_TYPES:\r
101 return MAX_SIZE_TYPE[self.DatumType]\r
102 if not self.DefaultValue:\r
103 return 1\r
104 elif self.DefaultValue[0] == 'L':\r
105 return (len(self.DefaultValue) - 2) * 2\r
106 elif self.DefaultValue[0] == '{':\r
107 return len(self.DefaultValue.split(','))\r
108 else:\r
109 return len(self.DefaultValue) - 1\r
110\r
111\r
30fdf114
LG
112 ## Convert the class to a string\r
113 #\r
114 # Convert each member of the class to string\r
115 # Organize to a signle line format string\r
116 #\r
117 # @retval Rtn Formatted String\r
118 #\r
119 def __str__(self):\r
120 Rtn = '\tTokenCName=' + str(self.TokenCName) + ', ' + \\r
121 'TokenSpaceGuidCName=' + str(self.TokenSpaceGuidCName) + ', ' + \\r
122 'Type=' + str(self.Type) + ', ' + \\r
123 'DatumType=' + str(self.DatumType) + ', ' + \\r
124 'DefaultValue=' + str(self.DefaultValue) + ', ' + \\r
125 'TokenValue=' + str(self.TokenValue) + ', ' + \\r
126 'MaxDatumSize=' + str(self.MaxDatumSize) + ', '\r
127 for Item in self.SkuInfoList.values():\r
128 Rtn = Rtn + 'SkuId=' + Item.SkuId + ', ' + 'SkuIdName=' + Item.SkuIdName\r
e56468c0 129 Rtn = Rtn + ', IsOverrided=' + str(self.IsOverrided)\r
30fdf114
LG
130\r
131 return Rtn\r
132\r
133 ## Override __eq__ function\r
134 #\r
135 # Check whether pcds are the same\r
136 #\r
137 # @retval False The two pcds are different\r
138 # @retval True The two pcds are the same\r
139 #\r
140 def __eq__(self, Other):\r
141 return Other and self.TokenCName == Other.TokenCName and self.TokenSpaceGuidCName == Other.TokenSpaceGuidCName\r
142\r
143 ## Override __hash__ function\r
144 #\r
145 # Use (TokenCName, TokenSpaceGuidCName) as key in hash table\r
146 #\r
147 # @retval truple() Key for hash table\r
148 #\r
149 def __hash__(self):\r
150 return hash((self.TokenCName, self.TokenSpaceGuidCName))\r
151\r
ae7b6df8 152class StructurePcd(PcdClassObject):\r
9904222d 153 def __init__(self, StructuredPcdIncludeFile=None, Packages=None, Name=None, Guid=None, Type=None, DatumType=None, Value=None, Token=None, MaxDatumSize=None, SkuInfoList=None, IsOverrided=False, GuidValue=None, validateranges=None, validlists=None, expressions=None,default_store = TAB_DEFAULT_STORES_DEFAULT):\r
8ac64c5b
CJ
154 if SkuInfoList is None:\r
155 SkuInfoList = {}\r
156 if validateranges is None:\r
157 validateranges = []\r
158 if validlists is None:\r
159 validlists = []\r
160 if expressions is None:\r
161 expressions = []\r
162 if Packages is None:\r
163 Packages = []\r
ae7b6df8 164 super(StructurePcd, self).__init__(Name, Guid, Type, DatumType, Value, Token, MaxDatumSize, SkuInfoList, IsOverrided, GuidValue, validateranges, validlists, expressions)\r
81add864 165 self.StructuredPcdIncludeFile = [] if StructuredPcdIncludeFile is None else StructuredPcdIncludeFile\r
ae7b6df8 166 self.PackageDecs = Packages\r
8518bf0b 167 self.DefaultStoreName = [default_store]\r
b0a26451 168 self.DefaultValues = OrderedDict()\r
ae7b6df8 169 self.PcdMode = None\r
b0a26451 170 self.SkuOverrideValues = OrderedDict()\r
e651d06c 171 self.StructName = None\r
6a103440
FB
172 self.PcdDefineLineNo = 0\r
173 self.PkgPath = ""\r
06140766 174 self.DefaultValueFromDec = ""\r
88252a90 175 self.ValueChain = set()\r
b0a26451
CJ
176 self.PcdFieldValueFromComm = OrderedDict()\r
177 self.PcdFieldValueFromFdf = OrderedDict()\r
ae7b6df8
LG
178 def __repr__(self):\r
179 return self.TypeName\r
180\r
181 def AddDefaultValue (self, FieldName, Value, FileName="", LineNo=0):\r
34952f49
LG
182 if FieldName in self.DefaultValues:\r
183 del self.DefaultValues[FieldName]\r
ae7b6df8
LG
184 self.DefaultValues[FieldName] = [Value.strip(), FileName, LineNo]\r
185 return self.DefaultValues[FieldName]\r
186\r
ccaa7754 187 def SetDecDefaultValue(self, DefaultValue):\r
06140766 188 self.DefaultValueFromDec = DefaultValue\r
8518bf0b 189 def AddOverrideValue (self, FieldName, Value, SkuName, DefaultStoreName, FileName="", LineNo=0):\r
ae7b6df8 190 if SkuName not in self.SkuOverrideValues:\r
b0a26451 191 self.SkuOverrideValues[SkuName] = OrderedDict()\r
8518bf0b 192 if DefaultStoreName not in self.SkuOverrideValues[SkuName]:\r
b0a26451 193 self.SkuOverrideValues[SkuName][DefaultStoreName] = OrderedDict()\r
8518bf0b
LG
194 if FieldName in self.SkuOverrideValues[SkuName][DefaultStoreName]:\r
195 del self.SkuOverrideValues[SkuName][DefaultStoreName][FieldName]\r
196 self.SkuOverrideValues[SkuName][DefaultStoreName][FieldName] = [Value.strip(), FileName, LineNo]\r
197 return self.SkuOverrideValues[SkuName][DefaultStoreName][FieldName]\r
ae7b6df8
LG
198\r
199 def SetPcdMode (self, PcdMode):\r
200 self.PcdMode = PcdMode\r
201\r
ae7b6df8
LG
202 def copy(self, PcdObject):\r
203 self.TokenCName = PcdObject.TokenCName if PcdObject.TokenCName else self.TokenCName\r
204 self.TokenSpaceGuidCName = PcdObject.TokenSpaceGuidCName if PcdObject.TokenSpaceGuidCName else PcdObject.TokenSpaceGuidCName\r
205 self.TokenSpaceGuidValue = PcdObject.TokenSpaceGuidValue if PcdObject.TokenSpaceGuidValue else self.TokenSpaceGuidValue\r
206 self.Type = PcdObject.Type if PcdObject.Type else self.Type\r
207 self.DatumType = PcdObject.DatumType if PcdObject.DatumType else self.DatumType\r
208 self.DefaultValue = PcdObject.DefaultValue if PcdObject.DefaultValue else self.DefaultValue\r
209 self.TokenValue = PcdObject.TokenValue if PcdObject.TokenValue else self.TokenValue\r
210 self.MaxDatumSize = PcdObject.MaxDatumSize if PcdObject.MaxDatumSize else self.MaxDatumSize\r
211 self.SkuInfoList = PcdObject.SkuInfoList if PcdObject.SkuInfoList else self.SkuInfoList\r
212 self.Phase = PcdObject.Phase if PcdObject.Phase else self.Phase\r
213 self.Pending = PcdObject.Pending if PcdObject.Pending else self.Pending\r
214 self.IsOverrided = PcdObject.IsOverrided if PcdObject.IsOverrided else self.IsOverrided\r
215 self.IsFromBinaryInf = PcdObject.IsFromBinaryInf if PcdObject.IsFromBinaryInf else self.IsFromBinaryInf\r
216 self.IsFromDsc = PcdObject.IsFromDsc if PcdObject.IsFromDsc else self.IsFromDsc\r
217 self.validateranges = PcdObject.validateranges if PcdObject.validateranges else self.validateranges\r
218 self.validlists = PcdObject.validlists if PcdObject.validlists else self.validlists\r
219 self.expressions = PcdObject.expressions if PcdObject.expressions else self.expressions\r
f3b31433 220 self.DscRawValue = PcdObject.DscRawValue if PcdObject.DscRawValue else self.DscRawValue\r
0f228f19 221 self.PcdValueFromComm = PcdObject.PcdValueFromComm if PcdObject.PcdValueFromComm else self.PcdValueFromComm\r
543f5ac3 222 self.PcdValueFromFdf = PcdObject.PcdValueFromFdf if PcdObject.PcdValueFromFdf else self.PcdValueFromFdf\r
ced86858 223 self.UserDefinedDefaultStoresFlag = PcdObject.UserDefinedDefaultStoresFlag if PcdObject.UserDefinedDefaultStoresFlag else self.UserDefinedDefaultStoresFlag\r
0d1f5b2b 224 if isinstance(PcdObject, StructurePcd):\r
ae7b6df8
LG
225 self.StructuredPcdIncludeFile = PcdObject.StructuredPcdIncludeFile if PcdObject.StructuredPcdIncludeFile else self.StructuredPcdIncludeFile\r
226 self.PackageDecs = PcdObject.PackageDecs if PcdObject.PackageDecs else self.PackageDecs\r
227 self.DefaultValues = PcdObject.DefaultValues if PcdObject.DefaultValues else self.DefaultValues\r
228 self.PcdMode = PcdObject.PcdMode if PcdObject.PcdMode else self.PcdMode\r
229 self.DefaultFromDSC=None\r
06140766 230 self.DefaultValueFromDec = PcdObject.DefaultValueFromDec if PcdObject.DefaultValueFromDec else self.DefaultValueFromDec\r
65eff519 231 self.SkuOverrideValues = PcdObject.SkuOverrideValues if PcdObject.SkuOverrideValues else self.SkuOverrideValues\r
e651d06c 232 self.StructName = PcdObject.DatumType if PcdObject.DatumType else self.StructName\r
6a103440
FB
233 self.PcdDefineLineNo = PcdObject.PcdDefineLineNo if PcdObject.PcdDefineLineNo else self.PcdDefineLineNo\r
234 self.PkgPath = PcdObject.PkgPath if PcdObject.PkgPath else self.PkgPath\r
f3b31433 235 self.ValueChain = PcdObject.ValueChain if PcdObject.ValueChain else self.ValueChain\r
b854e2bf 236 self.PcdFieldValueFromComm = PcdObject.PcdFieldValueFromComm if PcdObject.PcdFieldValueFromComm else self.PcdFieldValueFromComm\r
543f5ac3 237 self.PcdFieldValueFromFdf = PcdObject.PcdFieldValueFromFdf if PcdObject.PcdFieldValueFromFdf else self.PcdFieldValueFromFdf\r
ae7b6df8 238\r
b0a26451 239LibraryClassObject = namedtuple('LibraryClassObject', ['LibraryClass','SupModList'], verbose=False)\r
30fdf114
LG
240\r
241## ModuleBuildClassObject\r
242#\r
243# This Class defines ModuleBuildClass\r
244#\r
245# @param object: Inherited from object class\r
246#\r
247# @var MetaFile: To store value for module meta file path\r
248# @var BaseName: To store value for BaseName\r
249# @var ModuleType: To store value for ModuleType\r
250# @var Guid: To store value for Guid\r
251# @var Version: To store value for Version\r
252# @var PcdIsDriver: To store value for PcdIsDriver\r
253# @var BinaryModule: To store value for BinaryModule\r
254# @var CustomMakefile: To store value for CustomMakefile\r
255# @var Specification: To store value for Specification\r
256# @var Shadow To store value for Shadow\r
257# @var LibraryClass: To store value for LibraryClass, it is a list structure as\r
258# [ LibraryClassObject, ...]\r
259# @var ModuleEntryPointList: To store value for ModuleEntryPointList\r
260# @var ModuleUnloadImageList: To store value for ModuleUnloadImageList\r
261# @var ConstructorList: To store value for ConstructorList\r
262# @var DestructorList: To store value for DestructorList\r
263# @var Binaries: To store value for Binaries, it is a list structure as\r
264# [ ModuleBinaryClassObject, ...]\r
265# @var Sources: To store value for Sources, it is a list structure as\r
266# [ ModuleSourceFilesClassObject, ... ]\r
267# @var LibraryClasses: To store value for LibraryClasses, it is a set structure as\r
268# { [LibraryClassName, ModuleType] : LibraryClassInfFile }\r
269# @var Protocols: To store value for Protocols, it is a list structure as\r
270# [ ProtocolName, ... ]\r
271# @var Ppis: To store value for Ppis, it is a list structure as\r
272# [ PpiName, ... ]\r
273# @var Guids: To store value for Guids, it is a list structure as\r
274# [ GuidName, ... ]\r
275# @var Includes: To store value for Includes, it is a list structure as\r
276# [ IncludePath, ... ]\r
277# @var Packages: To store value for Packages, it is a list structure as\r
278# [ DecFileName, ... ]\r
279# @var Pcds: To store value for Pcds, it is a set structure as\r
280# { [(PcdCName, PcdGuidCName)] : PcdClassObject}\r
281# @var BuildOptions: To store value for BuildOptions, it is a set structure as\r
282# { [BuildOptionKey] : BuildOptionValue}\r
283# @var Depex: To store value for Depex\r
284#\r
285class ModuleBuildClassObject(object):\r
286 def __init__(self):\r
287 self.AutoGenVersion = 0\r
288 self.MetaFile = ''\r
289 self.BaseName = ''\r
290 self.ModuleType = ''\r
291 self.Guid = ''\r
292 self.Version = ''\r
293 self.PcdIsDriver = ''\r
294 self.BinaryModule = ''\r
295 self.Shadow = ''\r
296 self.SourceOverridePath = ''\r
297 self.CustomMakefile = {}\r
298 self.Specification = {}\r
299 self.LibraryClass = []\r
300 self.ModuleEntryPointList = []\r
301 self.ModuleUnloadImageList = []\r
302 self.ConstructorList = []\r
303 self.DestructorList = []\r
304\r
305 self.Binaries = []\r
306 self.Sources = []\r
b0a26451 307 self.LibraryClasses = OrderedDict()\r
30fdf114
LG
308 self.Libraries = []\r
309 self.Protocols = []\r
310 self.Ppis = []\r
311 self.Guids = []\r
312 self.Includes = []\r
313 self.Packages = []\r
314 self.Pcds = {}\r
315 self.BuildOptions = {}\r
316 self.Depex = {}\r
317\r
318 ## Convert the class to a string\r
319 #\r
320 # Convert member MetaFile of the class to a string\r
321 #\r
322 # @retval string Formatted String\r
323 #\r
324 def __str__(self):\r
325 return str(self.MetaFile)\r
326\r
327 ## Override __eq__ function\r
328 #\r
329 # Check whether ModuleBuildClassObjects are the same\r
330 #\r
331 # @retval False The two ModuleBuildClassObjects are different\r
332 # @retval True The two ModuleBuildClassObjects are the same\r
333 #\r
334 def __eq__(self, Other):\r
335 return self.MetaFile == Other\r
336\r
337 ## Override __hash__ function\r
338 #\r
339 # Use MetaFile as key in hash table\r
340 #\r
341 # @retval string Key for hash table\r
342 #\r
343 def __hash__(self):\r
344 return hash(self.MetaFile)\r
345\r
346## PackageBuildClassObject\r
347#\r
348# This Class defines PackageBuildClass\r
349#\r
350# @param object: Inherited from object class\r
351#\r
352# @var MetaFile: To store value for package meta file path\r
353# @var PackageName: To store value for PackageName\r
354# @var Guid: To store value for Guid\r
355# @var Version: To store value for Version\r
356# @var Protocols: To store value for Protocols, it is a set structure as\r
357# { [ProtocolName] : Protocol Guid, ... }\r
358# @var Ppis: To store value for Ppis, it is a set structure as\r
359# { [PpiName] : Ppi Guid, ... }\r
360# @var Guids: To store value for Guids, it is a set structure as\r
361# { [GuidName] : Guid, ... }\r
362# @var Includes: To store value for Includes, it is a list structure as\r
363# [ IncludePath, ... ]\r
364# @var LibraryClasses: To store value for LibraryClasses, it is a set structure as\r
365# { [LibraryClassName] : LibraryClassInfFile }\r
366# @var Pcds: To store value for Pcds, it is a set structure as\r
367# { [(PcdCName, PcdGuidCName)] : PcdClassObject}\r
368#\r
369class PackageBuildClassObject(object):\r
370 def __init__(self):\r
371 self.MetaFile = ''\r
372 self.PackageName = ''\r
373 self.Guid = ''\r
374 self.Version = ''\r
375\r
376 self.Protocols = {}\r
377 self.Ppis = {}\r
378 self.Guids = {}\r
379 self.Includes = []\r
380 self.LibraryClasses = {}\r
381 self.Pcds = {}\r
382\r
383 ## Convert the class to a string\r
384 #\r
385 # Convert member MetaFile of the class to a string\r
386 #\r
387 # @retval string Formatted String\r
388 #\r
389 def __str__(self):\r
390 return str(self.MetaFile)\r
391\r
392 ## Override __eq__ function\r
393 #\r
394 # Check whether PackageBuildClassObjects are the same\r
395 #\r
396 # @retval False The two PackageBuildClassObjects are different\r
397 # @retval True The two PackageBuildClassObjects are the same\r
398 #\r
399 def __eq__(self, Other):\r
400 return self.MetaFile == Other\r
401\r
402 ## Override __hash__ function\r
403 #\r
404 # Use MetaFile as key in hash table\r
405 #\r
406 # @retval string Key for hash table\r
407 #\r
408 def __hash__(self):\r
409 return hash(self.MetaFile)\r
410\r
411## PlatformBuildClassObject\r
412#\r
413# This Class defines PlatformBuildClass\r
414#\r
415# @param object: Inherited from object class\r
416#\r
417# @var MetaFile: To store value for platform meta-file path\r
418# @var PlatformName: To store value for PlatformName\r
419# @var Guid: To store value for Guid\r
420# @var Version: To store value for Version\r
421# @var DscSpecification: To store value for DscSpecification\r
422# @var OutputDirectory: To store value for OutputDirectory\r
423# @var FlashDefinition: To store value for FlashDefinition\r
424# @var BuildNumber: To store value for BuildNumber\r
425# @var MakefileName: To store value for MakefileName\r
426# @var SkuIds: To store value for SkuIds, it is a set structure as\r
427# { 'SkuName' : SkuId, '!include' : includefilename, ...}\r
428# @var Modules: To store value for Modules, it is a list structure as\r
429# [ InfFileName, ... ]\r
430# @var Libraries: To store value for Libraries, it is a list structure as\r
431# [ InfFileName, ... ]\r
432# @var LibraryClasses: To store value for LibraryClasses, it is a set structure as\r
433# { (LibraryClassName, ModuleType) : LibraryClassInfFile }\r
434# @var Pcds: To store value for Pcds, it is a set structure as\r
435# { [(PcdCName, PcdGuidCName)] : PcdClassObject }\r
436# @var BuildOptions: To store value for BuildOptions, it is a set structure as\r
437# { [BuildOptionKey] : BuildOptionValue }\r
438#\r
439class PlatformBuildClassObject(object):\r
440 def __init__(self):\r
441 self.MetaFile = ''\r
442 self.PlatformName = ''\r
443 self.Guid = ''\r
444 self.Version = ''\r
445 self.DscSpecification = ''\r
446 self.OutputDirectory = ''\r
447 self.FlashDefinition = ''\r
448 self.BuildNumber = ''\r
449 self.MakefileName = ''\r
450\r
451 self.SkuIds = {}\r
452 self.Modules = []\r
453 self.LibraryInstances = []\r
454 self.LibraryClasses = {}\r
455 self.Libraries = {}\r
456 self.Pcds = {}\r
457 self.BuildOptions = {}\r
458\r
459 ## Convert the class to a string\r
460 #\r
461 # Convert member MetaFile of the class to a string\r
462 #\r
463 # @retval string Formatted String\r
464 #\r
465 def __str__(self):\r
466 return str(self.MetaFile)\r
467\r
468 ## Override __eq__ function\r
469 #\r
470 # Check whether PlatformBuildClassObjects are the same\r
471 #\r
472 # @retval False The two PlatformBuildClassObjects are different\r
473 # @retval True The two PlatformBuildClassObjects are the same\r
474 #\r
475 def __eq__(self, Other):\r
476 return self.MetaFile == Other\r
477\r
478 ## Override __hash__ function\r
479 #\r
480 # Use MetaFile as key in hash table\r
481 #\r
482 # @retval string Key for hash table\r
483 #\r
484 def __hash__(self):\r
485 return hash(self.MetaFile)\r