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