]>
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 - 2010, 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.
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):
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
61 ## Convert the class to a string
63 # Convert each member of the class to string
64 # Organize to a signle line format string
66 # @retval Rtn Formatted String
69 Rtn
= '\tTokenCName=' + str(self
.TokenCName
) + ', ' + \
70 'TokenSpaceGuidCName=' + str(self
.TokenSpaceGuidCName
) + ', ' + \
71 'Type=' + str(self
.Type
) + ', ' + \
72 'DatumType=' + str(self
.DatumType
) + ', ' + \
73 'DefaultValue=' + str(self
.DefaultValue
) + ', ' + \
74 'TokenValue=' + str(self
.TokenValue
) + ', ' + \
75 'MaxDatumSize=' + str(self
.MaxDatumSize
) + ', '
76 for Item
in self
.SkuInfoList
.values():
77 Rtn
= Rtn
+ 'SkuId=' + Item
.SkuId
+ ', ' + 'SkuIdName=' + Item
.SkuIdName
78 Rtn
= Rtn
+ ', IsOverrided=' + str(self
.IsOverrided
)
82 ## Override __eq__ function
84 # Check whether pcds are the same
86 # @retval False The two pcds are different
87 # @retval True The two pcds are the same
89 def __eq__(self
, Other
):
90 return Other
and self
.TokenCName
== Other
.TokenCName
and self
.TokenSpaceGuidCName
== Other
.TokenSpaceGuidCName
92 ## Override __hash__ function
94 # Use (TokenCName, TokenSpaceGuidCName) as key in hash table
96 # @retval truple() Key for hash table
99 return hash((self
.TokenCName
, self
.TokenSpaceGuidCName
))
101 ## LibraryClassObject
103 # This Class defines LibraryClassObject used in BuildDatabase
105 # @param object: Inherited from object class
106 # @param Name: Input value for LibraryClassName, default is None
107 # @param SupModList: Input value for SupModList, default is []
108 # @param Type: Input value for Type, default is None
110 # @var LibraryClass: To store value for LibraryClass
111 # @var SupModList: To store value for SupModList
112 # @var Type: To store value for Type
114 class LibraryClassObject(object):
115 def __init__(self
, Name
= None, SupModList
= [], Type
= None):
116 self
.LibraryClass
= Name
117 self
.SupModList
= SupModList
119 self
.SupModList
= CleanString(Type
).split(DataType
.TAB_SPACE_SPLIT
)
121 ## ModuleBuildClassObject
123 # This Class defines ModuleBuildClass
125 # @param object: Inherited from object class
127 # @var MetaFile: To store value for module meta file path
128 # @var BaseName: To store value for BaseName
129 # @var ModuleType: To store value for ModuleType
130 # @var Guid: To store value for Guid
131 # @var Version: To store value for Version
132 # @var PcdIsDriver: To store value for PcdIsDriver
133 # @var BinaryModule: To store value for BinaryModule
134 # @var CustomMakefile: To store value for CustomMakefile
135 # @var Specification: To store value for Specification
136 # @var Shadow To store value for Shadow
137 # @var LibraryClass: To store value for LibraryClass, it is a list structure as
138 # [ LibraryClassObject, ...]
139 # @var ModuleEntryPointList: To store value for ModuleEntryPointList
140 # @var ModuleUnloadImageList: To store value for ModuleUnloadImageList
141 # @var ConstructorList: To store value for ConstructorList
142 # @var DestructorList: To store value for DestructorList
143 # @var Binaries: To store value for Binaries, it is a list structure as
144 # [ ModuleBinaryClassObject, ...]
145 # @var Sources: To store value for Sources, it is a list structure as
146 # [ ModuleSourceFilesClassObject, ... ]
147 # @var LibraryClasses: To store value for LibraryClasses, it is a set structure as
148 # { [LibraryClassName, ModuleType] : LibraryClassInfFile }
149 # @var Protocols: To store value for Protocols, it is a list structure as
150 # [ ProtocolName, ... ]
151 # @var Ppis: To store value for Ppis, it is a list structure as
153 # @var Guids: To store value for Guids, it is a list structure as
155 # @var Includes: To store value for Includes, it is a list structure as
156 # [ IncludePath, ... ]
157 # @var Packages: To store value for Packages, it is a list structure as
158 # [ DecFileName, ... ]
159 # @var Pcds: To store value for Pcds, it is a set structure as
160 # { [(PcdCName, PcdGuidCName)] : PcdClassObject}
161 # @var BuildOptions: To store value for BuildOptions, it is a set structure as
162 # { [BuildOptionKey] : BuildOptionValue}
163 # @var Depex: To store value for Depex
165 class ModuleBuildClassObject(object):
167 self
.AutoGenVersion
= 0
173 self
.PcdIsDriver
= ''
174 self
.BinaryModule
= ''
176 self
.SourceOverridePath
= ''
177 self
.CustomMakefile
= {}
178 self
.Specification
= {}
179 self
.LibraryClass
= []
180 self
.ModuleEntryPointList
= []
181 self
.ModuleUnloadImageList
= []
182 self
.ConstructorList
= []
183 self
.DestructorList
= []
187 self
.LibraryClasses
= sdict()
195 self
.BuildOptions
= {}
198 ## Convert the class to a string
200 # Convert member MetaFile of the class to a string
202 # @retval string Formatted String
205 return str(self
.MetaFile
)
207 ## Override __eq__ function
209 # Check whether ModuleBuildClassObjects are the same
211 # @retval False The two ModuleBuildClassObjects are different
212 # @retval True The two ModuleBuildClassObjects are the same
214 def __eq__(self
, Other
):
215 return self
.MetaFile
== Other
217 ## Override __hash__ function
219 # Use MetaFile as key in hash table
221 # @retval string Key for hash table
224 return hash(self
.MetaFile
)
226 ## PackageBuildClassObject
228 # This Class defines PackageBuildClass
230 # @param object: Inherited from object class
232 # @var MetaFile: To store value for package meta file path
233 # @var PackageName: To store value for PackageName
234 # @var Guid: To store value for Guid
235 # @var Version: To store value for Version
236 # @var Protocols: To store value for Protocols, it is a set structure as
237 # { [ProtocolName] : Protocol Guid, ... }
238 # @var Ppis: To store value for Ppis, it is a set structure as
239 # { [PpiName] : Ppi Guid, ... }
240 # @var Guids: To store value for Guids, it is a set structure as
241 # { [GuidName] : Guid, ... }
242 # @var Includes: To store value for Includes, it is a list structure as
243 # [ IncludePath, ... ]
244 # @var LibraryClasses: To store value for LibraryClasses, it is a set structure as
245 # { [LibraryClassName] : LibraryClassInfFile }
246 # @var Pcds: To store value for Pcds, it is a set structure as
247 # { [(PcdCName, PcdGuidCName)] : PcdClassObject}
249 class PackageBuildClassObject(object):
252 self
.PackageName
= ''
260 self
.LibraryClasses
= {}
263 ## Convert the class to a string
265 # Convert member MetaFile of the class to a string
267 # @retval string Formatted String
270 return str(self
.MetaFile
)
272 ## Override __eq__ function
274 # Check whether PackageBuildClassObjects are the same
276 # @retval False The two PackageBuildClassObjects are different
277 # @retval True The two PackageBuildClassObjects are the same
279 def __eq__(self
, Other
):
280 return self
.MetaFile
== Other
282 ## Override __hash__ function
284 # Use MetaFile as key in hash table
286 # @retval string Key for hash table
289 return hash(self
.MetaFile
)
291 ## PlatformBuildClassObject
293 # This Class defines PlatformBuildClass
295 # @param object: Inherited from object class
297 # @var MetaFile: To store value for platform meta-file path
298 # @var PlatformName: To store value for PlatformName
299 # @var Guid: To store value for Guid
300 # @var Version: To store value for Version
301 # @var DscSpecification: To store value for DscSpecification
302 # @var OutputDirectory: To store value for OutputDirectory
303 # @var FlashDefinition: To store value for FlashDefinition
304 # @var BuildNumber: To store value for BuildNumber
305 # @var MakefileName: To store value for MakefileName
306 # @var SkuIds: To store value for SkuIds, it is a set structure as
307 # { 'SkuName' : SkuId, '!include' : includefilename, ...}
308 # @var Modules: To store value for Modules, it is a list structure as
309 # [ InfFileName, ... ]
310 # @var Libraries: To store value for Libraries, it is a list structure as
311 # [ InfFileName, ... ]
312 # @var LibraryClasses: To store value for LibraryClasses, it is a set structure as
313 # { (LibraryClassName, ModuleType) : LibraryClassInfFile }
314 # @var Pcds: To store value for Pcds, it is a set structure as
315 # { [(PcdCName, PcdGuidCName)] : PcdClassObject }
316 # @var BuildOptions: To store value for BuildOptions, it is a set structure as
317 # { [BuildOptionKey] : BuildOptionValue }
319 class PlatformBuildClassObject(object):
322 self
.PlatformName
= ''
325 self
.DscSpecification
= ''
326 self
.OutputDirectory
= ''
327 self
.FlashDefinition
= ''
328 self
.BuildNumber
= ''
329 self
.MakefileName
= ''
333 self
.LibraryInstances
= []
334 self
.LibraryClasses
= {}
337 self
.BuildOptions
= {}
339 ## Convert the class to a string
341 # Convert member MetaFile of the class to a string
343 # @retval string Formatted String
346 return str(self
.MetaFile
)
348 ## Override __eq__ function
350 # Check whether PlatformBuildClassObjects are the same
352 # @retval False The two PlatformBuildClassObjects are different
353 # @retval True The two PlatformBuildClassObjects are the same
355 def __eq__(self
, Other
):
356 return self
.MetaFile
== Other
358 ## Override __hash__ function
360 # Use MetaFile as key in hash table
362 # @retval string Key for hash table
365 return hash(self
.MetaFile
)