]>
git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/Workspace/BuildClassObject.py
2 # This file is used to define each component of the build database
4 # Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
5 # This program and the accompanying materials
6 # are licensed and made available under the terms and conditions of the BSD License
7 # which accompanies this distribution. The full text of the license may be found at
8 # http://opensource.org/licenses/bsd-license.php
10 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 import Common
.LongFilePathOs
as os
16 from Common
.Misc
import sdict
17 from Common
.Misc
import RealPath2
18 from Common
.BuildToolError
import *
22 # This Class is used for PcdObject
24 # @param object: Inherited from object class
25 # @param Name: Input value for Name of Pcd, default is None
26 # @param Guid: Input value for Guid of Pcd, default is None
27 # @param Type: Input value for Type of Pcd, default is None
28 # @param DatumType: Input value for DatumType of Pcd, default is None
29 # @param Value: Input value for Value of Pcd, default is None
30 # @param Token: Input value for Token of Pcd, default is None
31 # @param MaxDatumSize: Input value for MaxDatumSize of Pcd, default is None
32 # @param SkuInfoList: Input value for SkuInfoList of Pcd, default is {}
33 # @param IsOverrided: Input value for IsOverrided of Pcd, default is False
34 # @param GuidValue: Input value for TokenSpaceGuidValue of Pcd, default is None
36 # @var TokenCName: To store value for TokenCName
37 # @var TokenSpaceGuidCName: To store value for TokenSpaceGuidCName
38 # @var Type: To store value for Type
39 # @var DatumType: To store value for DatumType
40 # @var TokenValue: To store value for TokenValue
41 # @var MaxDatumSize: To store value for MaxDatumSize
42 # @var SkuInfoList: To store value for SkuInfoList
43 # @var IsOverrided: To store value for IsOverrided
44 # @var Phase: To store value for Phase, default is "DXE"
46 class PcdClassObject(object):
47 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
= []):
48 self
.TokenCName
= Name
49 self
.TokenSpaceGuidCName
= Guid
50 self
.TokenSpaceGuidValue
= GuidValue
52 self
.DatumType
= DatumType
53 self
.DefaultValue
= Value
54 self
.TokenValue
= Token
55 self
.MaxDatumSize
= MaxDatumSize
56 self
.SkuInfoList
= SkuInfoList
59 self
.IsOverrided
= IsOverrided
60 self
.IsFromBinaryInf
= False
61 self
.IsFromDsc
= False
62 self
.validateranges
= validateranges
63 self
.validlists
= validlists
64 self
.expressions
= expressions
66 ## Convert the class to a string
68 # Convert each member of the class to string
69 # Organize to a signle line format string
71 # @retval Rtn Formatted String
74 Rtn
= '\tTokenCName=' + str(self
.TokenCName
) + ', ' + \
75 'TokenSpaceGuidCName=' + str(self
.TokenSpaceGuidCName
) + ', ' + \
76 'Type=' + str(self
.Type
) + ', ' + \
77 'DatumType=' + str(self
.DatumType
) + ', ' + \
78 'DefaultValue=' + str(self
.DefaultValue
) + ', ' + \
79 'TokenValue=' + str(self
.TokenValue
) + ', ' + \
80 'MaxDatumSize=' + str(self
.MaxDatumSize
) + ', '
81 for Item
in self
.SkuInfoList
.values():
82 Rtn
= Rtn
+ 'SkuId=' + Item
.SkuId
+ ', ' + 'SkuIdName=' + Item
.SkuIdName
83 Rtn
= Rtn
+ ', IsOverrided=' + str(self
.IsOverrided
)
87 ## Override __eq__ function
89 # Check whether pcds are the same
91 # @retval False The two pcds are different
92 # @retval True The two pcds are the same
94 def __eq__(self
, Other
):
95 return Other
and self
.TokenCName
== Other
.TokenCName
and self
.TokenSpaceGuidCName
== Other
.TokenSpaceGuidCName
97 ## Override __hash__ function
99 # Use (TokenCName, TokenSpaceGuidCName) as key in hash table
101 # @retval truple() Key for hash table
104 return hash((self
.TokenCName
, self
.TokenSpaceGuidCName
))
106 ## LibraryClassObject
108 # This Class defines LibraryClassObject used in BuildDatabase
110 # @param object: Inherited from object class
111 # @param Name: Input value for LibraryClassName, default is None
112 # @param SupModList: Input value for SupModList, default is []
113 # @param Type: Input value for Type, default is None
115 # @var LibraryClass: To store value for LibraryClass
116 # @var SupModList: To store value for SupModList
117 # @var Type: To store value for Type
119 class LibraryClassObject(object):
120 def __init__(self
, Name
= None, SupModList
= [], Type
= None):
121 self
.LibraryClass
= Name
122 self
.SupModList
= SupModList
124 self
.SupModList
= CleanString(Type
).split(DataType
.TAB_SPACE_SPLIT
)
126 ## ModuleBuildClassObject
128 # This Class defines ModuleBuildClass
130 # @param object: Inherited from object class
132 # @var MetaFile: To store value for module meta file path
133 # @var BaseName: To store value for BaseName
134 # @var ModuleType: To store value for ModuleType
135 # @var Guid: To store value for Guid
136 # @var Version: To store value for Version
137 # @var PcdIsDriver: To store value for PcdIsDriver
138 # @var BinaryModule: To store value for BinaryModule
139 # @var CustomMakefile: To store value for CustomMakefile
140 # @var Specification: To store value for Specification
141 # @var Shadow To store value for Shadow
142 # @var LibraryClass: To store value for LibraryClass, it is a list structure as
143 # [ LibraryClassObject, ...]
144 # @var ModuleEntryPointList: To store value for ModuleEntryPointList
145 # @var ModuleUnloadImageList: To store value for ModuleUnloadImageList
146 # @var ConstructorList: To store value for ConstructorList
147 # @var DestructorList: To store value for DestructorList
148 # @var Binaries: To store value for Binaries, it is a list structure as
149 # [ ModuleBinaryClassObject, ...]
150 # @var Sources: To store value for Sources, it is a list structure as
151 # [ ModuleSourceFilesClassObject, ... ]
152 # @var LibraryClasses: To store value for LibraryClasses, it is a set structure as
153 # { [LibraryClassName, ModuleType] : LibraryClassInfFile }
154 # @var Protocols: To store value for Protocols, it is a list structure as
155 # [ ProtocolName, ... ]
156 # @var Ppis: To store value for Ppis, it is a list structure as
158 # @var Guids: To store value for Guids, it is a list structure as
160 # @var Includes: To store value for Includes, it is a list structure as
161 # [ IncludePath, ... ]
162 # @var Packages: To store value for Packages, it is a list structure as
163 # [ DecFileName, ... ]
164 # @var Pcds: To store value for Pcds, it is a set structure as
165 # { [(PcdCName, PcdGuidCName)] : PcdClassObject}
166 # @var BuildOptions: To store value for BuildOptions, it is a set structure as
167 # { [BuildOptionKey] : BuildOptionValue}
168 # @var Depex: To store value for Depex
170 class ModuleBuildClassObject(object):
172 self
.AutoGenVersion
= 0
178 self
.PcdIsDriver
= ''
179 self
.BinaryModule
= ''
181 self
.SourceOverridePath
= ''
182 self
.CustomMakefile
= {}
183 self
.Specification
= {}
184 self
.LibraryClass
= []
185 self
.ModuleEntryPointList
= []
186 self
.ModuleUnloadImageList
= []
187 self
.ConstructorList
= []
188 self
.DestructorList
= []
192 self
.LibraryClasses
= sdict()
200 self
.BuildOptions
= {}
203 ## Convert the class to a string
205 # Convert member MetaFile of the class to a string
207 # @retval string Formatted String
210 return str(self
.MetaFile
)
212 ## Override __eq__ function
214 # Check whether ModuleBuildClassObjects are the same
216 # @retval False The two ModuleBuildClassObjects are different
217 # @retval True The two ModuleBuildClassObjects are the same
219 def __eq__(self
, Other
):
220 return self
.MetaFile
== Other
222 ## Override __hash__ function
224 # Use MetaFile as key in hash table
226 # @retval string Key for hash table
229 return hash(self
.MetaFile
)
231 ## PackageBuildClassObject
233 # This Class defines PackageBuildClass
235 # @param object: Inherited from object class
237 # @var MetaFile: To store value for package meta file path
238 # @var PackageName: To store value for PackageName
239 # @var Guid: To store value for Guid
240 # @var Version: To store value for Version
241 # @var Protocols: To store value for Protocols, it is a set structure as
242 # { [ProtocolName] : Protocol Guid, ... }
243 # @var Ppis: To store value for Ppis, it is a set structure as
244 # { [PpiName] : Ppi Guid, ... }
245 # @var Guids: To store value for Guids, it is a set structure as
246 # { [GuidName] : Guid, ... }
247 # @var Includes: To store value for Includes, it is a list structure as
248 # [ IncludePath, ... ]
249 # @var LibraryClasses: To store value for LibraryClasses, it is a set structure as
250 # { [LibraryClassName] : LibraryClassInfFile }
251 # @var Pcds: To store value for Pcds, it is a set structure as
252 # { [(PcdCName, PcdGuidCName)] : PcdClassObject}
254 class PackageBuildClassObject(object):
257 self
.PackageName
= ''
265 self
.LibraryClasses
= {}
268 ## Convert the class to a string
270 # Convert member MetaFile of the class to a string
272 # @retval string Formatted String
275 return str(self
.MetaFile
)
277 ## Override __eq__ function
279 # Check whether PackageBuildClassObjects are the same
281 # @retval False The two PackageBuildClassObjects are different
282 # @retval True The two PackageBuildClassObjects are the same
284 def __eq__(self
, Other
):
285 return self
.MetaFile
== Other
287 ## Override __hash__ function
289 # Use MetaFile as key in hash table
291 # @retval string Key for hash table
294 return hash(self
.MetaFile
)
296 ## PlatformBuildClassObject
298 # This Class defines PlatformBuildClass
300 # @param object: Inherited from object class
302 # @var MetaFile: To store value for platform meta-file path
303 # @var PlatformName: To store value for PlatformName
304 # @var Guid: To store value for Guid
305 # @var Version: To store value for Version
306 # @var DscSpecification: To store value for DscSpecification
307 # @var OutputDirectory: To store value for OutputDirectory
308 # @var FlashDefinition: To store value for FlashDefinition
309 # @var BuildNumber: To store value for BuildNumber
310 # @var MakefileName: To store value for MakefileName
311 # @var SkuIds: To store value for SkuIds, it is a set structure as
312 # { 'SkuName' : SkuId, '!include' : includefilename, ...}
313 # @var Modules: To store value for Modules, it is a list structure as
314 # [ InfFileName, ... ]
315 # @var Libraries: To store value for Libraries, it is a list structure as
316 # [ InfFileName, ... ]
317 # @var LibraryClasses: To store value for LibraryClasses, it is a set structure as
318 # { (LibraryClassName, ModuleType) : LibraryClassInfFile }
319 # @var Pcds: To store value for Pcds, it is a set structure as
320 # { [(PcdCName, PcdGuidCName)] : PcdClassObject }
321 # @var BuildOptions: To store value for BuildOptions, it is a set structure as
322 # { [BuildOptionKey] : BuildOptionValue }
324 class PlatformBuildClassObject(object):
327 self
.PlatformName
= ''
330 self
.DscSpecification
= ''
331 self
.OutputDirectory
= ''
332 self
.FlashDefinition
= ''
333 self
.BuildNumber
= ''
334 self
.MakefileName
= ''
338 self
.LibraryInstances
= []
339 self
.LibraryClasses
= {}
342 self
.BuildOptions
= {}
344 ## Convert the class to a string
346 # Convert member MetaFile of the class to a string
348 # @retval string Formatted String
351 return str(self
.MetaFile
)
353 ## Override __eq__ function
355 # Check whether PlatformBuildClassObjects are the same
357 # @retval False The two PlatformBuildClassObjects are different
358 # @retval True The two PlatformBuildClassObjects are the same
360 def __eq__(self
, Other
):
361 return self
.MetaFile
== Other
363 ## Override __hash__ function
365 # Use MetaFile as key in hash table
367 # @retval string Key for hash table
370 return hash(self
.MetaFile
)