]>
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 - 2014, 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):
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
63 ## Convert the class to a string
65 # Convert each member of the class to string
66 # Organize to a signle line format string
68 # @retval Rtn Formatted String
71 Rtn
= '\tTokenCName=' + str(self
.TokenCName
) + ', ' + \
72 'TokenSpaceGuidCName=' + str(self
.TokenSpaceGuidCName
) + ', ' + \
73 'Type=' + str(self
.Type
) + ', ' + \
74 'DatumType=' + str(self
.DatumType
) + ', ' + \
75 'DefaultValue=' + str(self
.DefaultValue
) + ', ' + \
76 'TokenValue=' + str(self
.TokenValue
) + ', ' + \
77 'MaxDatumSize=' + str(self
.MaxDatumSize
) + ', '
78 for Item
in self
.SkuInfoList
.values():
79 Rtn
= Rtn
+ 'SkuId=' + Item
.SkuId
+ ', ' + 'SkuIdName=' + Item
.SkuIdName
80 Rtn
= Rtn
+ ', IsOverrided=' + str(self
.IsOverrided
)
84 ## Override __eq__ function
86 # Check whether pcds are the same
88 # @retval False The two pcds are different
89 # @retval True The two pcds are the same
91 def __eq__(self
, Other
):
92 return Other
and self
.TokenCName
== Other
.TokenCName
and self
.TokenSpaceGuidCName
== Other
.TokenSpaceGuidCName
94 ## Override __hash__ function
96 # Use (TokenCName, TokenSpaceGuidCName) as key in hash table
98 # @retval truple() Key for hash table
101 return hash((self
.TokenCName
, self
.TokenSpaceGuidCName
))
103 ## LibraryClassObject
105 # This Class defines LibraryClassObject used in BuildDatabase
107 # @param object: Inherited from object class
108 # @param Name: Input value for LibraryClassName, default is None
109 # @param SupModList: Input value for SupModList, default is []
110 # @param Type: Input value for Type, default is None
112 # @var LibraryClass: To store value for LibraryClass
113 # @var SupModList: To store value for SupModList
114 # @var Type: To store value for Type
116 class LibraryClassObject(object):
117 def __init__(self
, Name
= None, SupModList
= [], Type
= None):
118 self
.LibraryClass
= Name
119 self
.SupModList
= SupModList
121 self
.SupModList
= CleanString(Type
).split(DataType
.TAB_SPACE_SPLIT
)
123 ## ModuleBuildClassObject
125 # This Class defines ModuleBuildClass
127 # @param object: Inherited from object class
129 # @var MetaFile: To store value for module meta file path
130 # @var BaseName: To store value for BaseName
131 # @var ModuleType: To store value for ModuleType
132 # @var Guid: To store value for Guid
133 # @var Version: To store value for Version
134 # @var PcdIsDriver: To store value for PcdIsDriver
135 # @var BinaryModule: To store value for BinaryModule
136 # @var CustomMakefile: To store value for CustomMakefile
137 # @var Specification: To store value for Specification
138 # @var Shadow To store value for Shadow
139 # @var LibraryClass: To store value for LibraryClass, it is a list structure as
140 # [ LibraryClassObject, ...]
141 # @var ModuleEntryPointList: To store value for ModuleEntryPointList
142 # @var ModuleUnloadImageList: To store value for ModuleUnloadImageList
143 # @var ConstructorList: To store value for ConstructorList
144 # @var DestructorList: To store value for DestructorList
145 # @var Binaries: To store value for Binaries, it is a list structure as
146 # [ ModuleBinaryClassObject, ...]
147 # @var Sources: To store value for Sources, it is a list structure as
148 # [ ModuleSourceFilesClassObject, ... ]
149 # @var LibraryClasses: To store value for LibraryClasses, it is a set structure as
150 # { [LibraryClassName, ModuleType] : LibraryClassInfFile }
151 # @var Protocols: To store value for Protocols, it is a list structure as
152 # [ ProtocolName, ... ]
153 # @var Ppis: To store value for Ppis, it is a list structure as
155 # @var Guids: To store value for Guids, it is a list structure as
157 # @var Includes: To store value for Includes, it is a list structure as
158 # [ IncludePath, ... ]
159 # @var Packages: To store value for Packages, it is a list structure as
160 # [ DecFileName, ... ]
161 # @var Pcds: To store value for Pcds, it is a set structure as
162 # { [(PcdCName, PcdGuidCName)] : PcdClassObject}
163 # @var BuildOptions: To store value for BuildOptions, it is a set structure as
164 # { [BuildOptionKey] : BuildOptionValue}
165 # @var Depex: To store value for Depex
167 class ModuleBuildClassObject(object):
169 self
.AutoGenVersion
= 0
175 self
.PcdIsDriver
= ''
176 self
.BinaryModule
= ''
178 self
.SourceOverridePath
= ''
179 self
.CustomMakefile
= {}
180 self
.Specification
= {}
181 self
.LibraryClass
= []
182 self
.ModuleEntryPointList
= []
183 self
.ModuleUnloadImageList
= []
184 self
.ConstructorList
= []
185 self
.DestructorList
= []
189 self
.LibraryClasses
= sdict()
197 self
.BuildOptions
= {}
200 ## Convert the class to a string
202 # Convert member MetaFile of the class to a string
204 # @retval string Formatted String
207 return str(self
.MetaFile
)
209 ## Override __eq__ function
211 # Check whether ModuleBuildClassObjects are the same
213 # @retval False The two ModuleBuildClassObjects are different
214 # @retval True The two ModuleBuildClassObjects are the same
216 def __eq__(self
, Other
):
217 return self
.MetaFile
== Other
219 ## Override __hash__ function
221 # Use MetaFile as key in hash table
223 # @retval string Key for hash table
226 return hash(self
.MetaFile
)
228 ## PackageBuildClassObject
230 # This Class defines PackageBuildClass
232 # @param object: Inherited from object class
234 # @var MetaFile: To store value for package meta file path
235 # @var PackageName: To store value for PackageName
236 # @var Guid: To store value for Guid
237 # @var Version: To store value for Version
238 # @var Protocols: To store value for Protocols, it is a set structure as
239 # { [ProtocolName] : Protocol Guid, ... }
240 # @var Ppis: To store value for Ppis, it is a set structure as
241 # { [PpiName] : Ppi Guid, ... }
242 # @var Guids: To store value for Guids, it is a set structure as
243 # { [GuidName] : Guid, ... }
244 # @var Includes: To store value for Includes, it is a list structure as
245 # [ IncludePath, ... ]
246 # @var LibraryClasses: To store value for LibraryClasses, it is a set structure as
247 # { [LibraryClassName] : LibraryClassInfFile }
248 # @var Pcds: To store value for Pcds, it is a set structure as
249 # { [(PcdCName, PcdGuidCName)] : PcdClassObject}
251 class PackageBuildClassObject(object):
254 self
.PackageName
= ''
262 self
.LibraryClasses
= {}
265 ## Convert the class to a string
267 # Convert member MetaFile of the class to a string
269 # @retval string Formatted String
272 return str(self
.MetaFile
)
274 ## Override __eq__ function
276 # Check whether PackageBuildClassObjects are the same
278 # @retval False The two PackageBuildClassObjects are different
279 # @retval True The two PackageBuildClassObjects are the same
281 def __eq__(self
, Other
):
282 return self
.MetaFile
== Other
284 ## Override __hash__ function
286 # Use MetaFile as key in hash table
288 # @retval string Key for hash table
291 return hash(self
.MetaFile
)
293 ## PlatformBuildClassObject
295 # This Class defines PlatformBuildClass
297 # @param object: Inherited from object class
299 # @var MetaFile: To store value for platform meta-file path
300 # @var PlatformName: To store value for PlatformName
301 # @var Guid: To store value for Guid
302 # @var Version: To store value for Version
303 # @var DscSpecification: To store value for DscSpecification
304 # @var OutputDirectory: To store value for OutputDirectory
305 # @var FlashDefinition: To store value for FlashDefinition
306 # @var BuildNumber: To store value for BuildNumber
307 # @var MakefileName: To store value for MakefileName
308 # @var SkuIds: To store value for SkuIds, it is a set structure as
309 # { 'SkuName' : SkuId, '!include' : includefilename, ...}
310 # @var Modules: To store value for Modules, it is a list structure as
311 # [ InfFileName, ... ]
312 # @var Libraries: To store value for Libraries, it is a list structure as
313 # [ InfFileName, ... ]
314 # @var LibraryClasses: To store value for LibraryClasses, it is a set structure as
315 # { (LibraryClassName, ModuleType) : LibraryClassInfFile }
316 # @var Pcds: To store value for Pcds, it is a set structure as
317 # { [(PcdCName, PcdGuidCName)] : PcdClassObject }
318 # @var BuildOptions: To store value for BuildOptions, it is a set structure as
319 # { [BuildOptionKey] : BuildOptionValue }
321 class PlatformBuildClassObject(object):
324 self
.PlatformName
= ''
327 self
.DscSpecification
= ''
328 self
.OutputDirectory
= ''
329 self
.FlashDefinition
= ''
330 self
.BuildNumber
= ''
331 self
.MakefileName
= ''
335 self
.LibraryInstances
= []
336 self
.LibraryClasses
= {}
339 self
.BuildOptions
= {}
341 ## Convert the class to a string
343 # Convert member MetaFile of the class to a string
345 # @retval string Formatted String
348 return str(self
.MetaFile
)
350 ## Override __eq__ function
352 # Check whether PlatformBuildClassObjects are the same
354 # @retval False The two PlatformBuildClassObjects are different
355 # @retval True The two PlatformBuildClassObjects are the same
357 def __eq__(self
, Other
):
358 return self
.MetaFile
== Other
360 ## Override __hash__ function
362 # Use MetaFile as key in hash table
364 # @retval string Key for hash table
367 return hash(self
.MetaFile
)