]>
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 ~ 2008, Intel Corporation
5 # All rights reserved. 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
35 # @var TokenCName: To store value for TokenCName
36 # @var TokenSpaceGuidCName: To store value for TokenSpaceGuidCName
37 # @var Type: To store value for Type
38 # @var DatumType: To store value for DatumType
39 # @var TokenValue: To store value for TokenValue
40 # @var MaxDatumSize: To store value for MaxDatumSize
41 # @var SkuInfoList: To store value for SkuInfoList
42 # @var IsOverrided: To store value for IsOverrided
43 # @var Phase: To store value for Phase, default is "DXE"
45 class PcdClassObject(object):
46 def __init__(self
, Name
= None, Guid
= None, Type
= None, DatumType
= None, Value
= None, Token
= None, MaxDatumSize
= None, SkuInfoList
= {}, GuidValue
= None):
47 self
.TokenCName
= Name
48 self
.TokenSpaceGuidCName
= Guid
49 self
.TokenSpaceGuidValue
= GuidValue
51 self
.DatumType
= DatumType
52 self
.DefaultValue
= Value
53 self
.TokenValue
= Token
54 self
.MaxDatumSize
= MaxDatumSize
55 self
.SkuInfoList
= SkuInfoList
59 ## Convert the class to a string
61 # Convert each member of the class to string
62 # Organize to a signle line format string
64 # @retval Rtn Formatted String
67 Rtn
= '\tTokenCName=' + str(self
.TokenCName
) + ', ' + \
68 'TokenSpaceGuidCName=' + str(self
.TokenSpaceGuidCName
) + ', ' + \
69 'Type=' + str(self
.Type
) + ', ' + \
70 'DatumType=' + str(self
.DatumType
) + ', ' + \
71 'DefaultValue=' + str(self
.DefaultValue
) + ', ' + \
72 'TokenValue=' + str(self
.TokenValue
) + ', ' + \
73 'MaxDatumSize=' + str(self
.MaxDatumSize
) + ', '
74 for Item
in self
.SkuInfoList
.values():
75 Rtn
= Rtn
+ 'SkuId=' + Item
.SkuId
+ ', ' + 'SkuIdName=' + Item
.SkuIdName
76 Rtn
= Rtn
+ str(self
.IsOverrided
)
80 ## Override __eq__ function
82 # Check whether pcds are the same
84 # @retval False The two pcds are different
85 # @retval True The two pcds are the same
87 def __eq__(self
, Other
):
88 return Other
and self
.TokenCName
== Other
.TokenCName
and self
.TokenSpaceGuidCName
== Other
.TokenSpaceGuidCName
90 ## Override __hash__ function
92 # Use (TokenCName, TokenSpaceGuidCName) as key in hash table
94 # @retval truple() Key for hash table
97 return hash((self
.TokenCName
, self
.TokenSpaceGuidCName
))
101 # This Class defines LibraryClassObject used in BuildDatabase
103 # @param object: Inherited from object class
104 # @param Name: Input value for LibraryClassName, default is None
105 # @param SupModList: Input value for SupModList, default is []
106 # @param Type: Input value for Type, default is None
108 # @var LibraryClass: To store value for LibraryClass
109 # @var SupModList: To store value for SupModList
110 # @var Type: To store value for Type
112 class LibraryClassObject(object):
113 def __init__(self
, Name
= None, SupModList
= [], Type
= None):
114 self
.LibraryClass
= Name
115 self
.SupModList
= SupModList
117 self
.SupModList
= CleanString(Type
).split(DataType
.TAB_SPACE_SPLIT
)
119 ## ModuleBuildClassObject
121 # This Class defines ModuleBuildClass
123 # @param object: Inherited from object class
125 # @var MetaFile: To store value for module meta file path
126 # @var BaseName: To store value for BaseName
127 # @var ModuleType: To store value for ModuleType
128 # @var Guid: To store value for Guid
129 # @var Version: To store value for Version
130 # @var PcdIsDriver: To store value for PcdIsDriver
131 # @var BinaryModule: To store value for BinaryModule
132 # @var CustomMakefile: To store value for CustomMakefile
133 # @var Specification: To store value for Specification
134 # @var Shadow To store value for Shadow
135 # @var LibraryClass: To store value for LibraryClass, it is a list structure as
136 # [ LibraryClassObject, ...]
137 # @var ModuleEntryPointList: To store value for ModuleEntryPointList
138 # @var ModuleUnloadImageList: To store value for ModuleUnloadImageList
139 # @var ConstructorList: To store value for ConstructorList
140 # @var DestructorList: To store value for DestructorList
141 # @var Binaries: To store value for Binaries, it is a list structure as
142 # [ ModuleBinaryClassObject, ...]
143 # @var Sources: To store value for Sources, it is a list structure as
144 # [ ModuleSourceFilesClassObject, ... ]
145 # @var LibraryClasses: To store value for LibraryClasses, it is a set structure as
146 # { [LibraryClassName, ModuleType] : LibraryClassInfFile }
147 # @var Protocols: To store value for Protocols, it is a list structure as
148 # [ ProtocolName, ... ]
149 # @var Ppis: To store value for Ppis, it is a list structure as
151 # @var Guids: To store value for Guids, it is a list structure as
153 # @var Includes: To store value for Includes, it is a list structure as
154 # [ IncludePath, ... ]
155 # @var Packages: To store value for Packages, it is a list structure as
156 # [ DecFileName, ... ]
157 # @var Pcds: To store value for Pcds, it is a set structure as
158 # { [(PcdCName, PcdGuidCName)] : PcdClassObject}
159 # @var BuildOptions: To store value for BuildOptions, it is a set structure as
160 # { [BuildOptionKey] : BuildOptionValue}
161 # @var Depex: To store value for Depex
163 class ModuleBuildClassObject(object):
165 self
.AutoGenVersion
= 0
171 self
.PcdIsDriver
= ''
172 self
.BinaryModule
= ''
174 self
.SourceOverridePath
= ''
175 self
.CustomMakefile
= {}
176 self
.Specification
= {}
177 self
.LibraryClass
= []
178 self
.ModuleEntryPointList
= []
179 self
.ModuleUnloadImageList
= []
180 self
.ConstructorList
= []
181 self
.DestructorList
= []
185 self
.LibraryClasses
= sdict()
193 self
.BuildOptions
= {}
196 ## Convert the class to a string
198 # Convert member MetaFile of the class to a string
200 # @retval string Formatted String
203 return str(self
.MetaFile
)
205 ## Override __eq__ function
207 # Check whether ModuleBuildClassObjects are the same
209 # @retval False The two ModuleBuildClassObjects are different
210 # @retval True The two ModuleBuildClassObjects are the same
212 def __eq__(self
, Other
):
213 return self
.MetaFile
== Other
215 ## Override __hash__ function
217 # Use MetaFile as key in hash table
219 # @retval string Key for hash table
222 return hash(self
.MetaFile
)
224 ## PackageBuildClassObject
226 # This Class defines PackageBuildClass
228 # @param object: Inherited from object class
230 # @var MetaFile: To store value for package meta file path
231 # @var PackageName: To store value for PackageName
232 # @var Guid: To store value for Guid
233 # @var Version: To store value for Version
234 # @var Protocols: To store value for Protocols, it is a set structure as
235 # { [ProtocolName] : Protocol Guid, ... }
236 # @var Ppis: To store value for Ppis, it is a set structure as
237 # { [PpiName] : Ppi Guid, ... }
238 # @var Guids: To store value for Guids, it is a set structure as
239 # { [GuidName] : Guid, ... }
240 # @var Includes: To store value for Includes, it is a list structure as
241 # [ IncludePath, ... ]
242 # @var LibraryClasses: To store value for LibraryClasses, it is a set structure as
243 # { [LibraryClassName] : LibraryClassInfFile }
244 # @var Pcds: To store value for Pcds, it is a set structure as
245 # { [(PcdCName, PcdGuidCName)] : PcdClassObject}
247 class PackageBuildClassObject(object):
250 self
.PackageName
= ''
258 self
.LibraryClasses
= {}
261 ## Convert the class to a string
263 # Convert member MetaFile of the class to a string
265 # @retval string Formatted String
268 return str(self
.MetaFile
)
270 ## Override __eq__ function
272 # Check whether PackageBuildClassObjects are the same
274 # @retval False The two PackageBuildClassObjects are different
275 # @retval True The two PackageBuildClassObjects are the same
277 def __eq__(self
, Other
):
278 return self
.MetaFile
== Other
280 ## Override __hash__ function
282 # Use MetaFile as key in hash table
284 # @retval string Key for hash table
287 return hash(self
.MetaFile
)
289 ## PlatformBuildClassObject
291 # This Class defines PlatformBuildClass
293 # @param object: Inherited from object class
295 # @var MetaFile: To store value for platform meta-file path
296 # @var PlatformName: To store value for PlatformName
297 # @var Guid: To store value for Guid
298 # @var Version: To store value for Version
299 # @var DscSpecification: To store value for DscSpecification
300 # @var OutputDirectory: To store value for OutputDirectory
301 # @var FlashDefinition: To store value for FlashDefinition
302 # @var BuildNumber: To store value for BuildNumber
303 # @var MakefileName: To store value for MakefileName
304 # @var SkuIds: To store value for SkuIds, it is a set structure as
305 # { 'SkuName' : SkuId, '!include' : includefilename, ...}
306 # @var Modules: To store value for Modules, it is a list structure as
307 # [ InfFileName, ... ]
308 # @var Libraries: To store value for Libraries, it is a list structure as
309 # [ InfFileName, ... ]
310 # @var LibraryClasses: To store value for LibraryClasses, it is a set structure as
311 # { (LibraryClassName, ModuleType) : LibraryClassInfFile }
312 # @var Pcds: To store value for Pcds, it is a set structure as
313 # { [(PcdCName, PcdGuidCName)] : PcdClassObject }
314 # @var BuildOptions: To store value for BuildOptions, it is a set structure as
315 # { [BuildOptionKey] : BuildOptionValue }
317 class PlatformBuildClassObject(object):
320 self
.PlatformName
= ''
323 self
.DscSpecification
= ''
324 self
.OutputDirectory
= ''
325 self
.FlashDefinition
= ''
326 self
.BuildNumber
= ''
327 self
.MakefileName
= ''
331 self
.LibraryInstances
= []
332 self
.LibraryClasses
= {}
335 self
.BuildOptions
= {}
337 ## Convert the class to a string
339 # Convert member MetaFile of the class to a string
341 # @retval string Formatted String
344 return str(self
.MetaFile
)
346 ## Override __eq__ function
348 # Check whether PlatformBuildClassObjects are the same
350 # @retval False The two PlatformBuildClassObjects are different
351 # @retval True The two PlatformBuildClassObjects are the same
353 def __eq__(self
, Other
):
354 return self
.MetaFile
== Other
356 ## Override __hash__ function
358 # Use MetaFile as key in hash table
360 # @retval string Key for hash table
363 return hash(self
.MetaFile
)