2 # This file is used to define a class object to describe a platform
4 # Copyright (c) 2007 - 2016, 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 CommonClass
import *
20 # This class defined sku info list item used in platform file
22 # @param IncludeStatementClass: Inherited from IncludeStatementClass class
24 # @var SkuInfoList: To store value for SkuInfoList, it is a set structure as
27 class SkuInfoListClass(IncludeStatementClass
):
29 IncludeStatementClass
.__init
__(self
)
32 ## PlatformHeaderClass
34 # This class defined header items used in Platform file
36 # @param IdentificationClass: Inherited from IdentificationClass class
37 # @param CommonHeaderClass: Inherited from CommonHeaderClass class
38 # @param DefineClass: Inherited from DefineClass class
40 # @var DscSpecification: To store value for DscSpecification
41 # @var SupArchList: To store value for SupArchList, selection scope is in below list
42 # EBC | IA32 | X64 | IPF | ARM | PPC | AARCH64
43 # @var BuildTargets: To store value for BuildTargets, selection scope is in below list
45 # @var IntermediateDirectories: To store value for IntermediateDirectories, selection scope is in below list
47 # @var OutputDirectory: To store value for OutputDirectory
48 # @var ForceDebugTarget: To store value for ForceDebugTarget
49 # @var SkuIdName: To store value for SkuIdName
50 # @var BuildNumber: To store value for BuildNumber
51 # @var MakefileName: To store value for MakefileName
52 # @var ClonedFrom: To store value for ClonedFrom, it is a list structure as
53 # [ ClonedRecordClass, ... ]
55 class PlatformHeaderClass(IdentificationClass
, CommonHeaderClass
, DefineClass
):
57 IdentificationClass
.__init
__(self
)
58 CommonHeaderClass
.__init
__(self
)
59 DefineClass
.__init
__(self
)
60 self
.DscSpecification
= ''
62 self
.BuildTargets
= []
63 self
.IntermediateDirectories
= ''
64 self
.OutputDirectory
= ''
65 self
.ForceDebugTarget
= ''
68 self
.MakefileName
= ''
71 ## PlatformFlashDefinitionFileClass
73 # This class defined FlashDefinitionFile item used in platform file
75 # @param object: Inherited from object class
77 # @var Id: To store value for Id
78 # @var UiName: To store value for UiName
79 # @var Preferred: To store value for Preferred
80 # @var FilePath: To store value for FilePath
82 class PlatformFlashDefinitionFileClass(object):
86 self
.Preferred
= False
91 # This class defined PREBUILD/POSTBUILD item used in platform file
93 # @param object: Inherited from object class
95 # @var Id: To store value for Id
96 # @var UiName: To store value for UiName
97 # @var Preferred: To store value for Preferred
98 # @var FilePath: To store value for FilePath
100 class BuildScriptClass(object):
104 self
.Preferred
= False
107 ## PlatformFvImageOptionClass
109 # This class defined FvImageOption item used in platform file
111 # @param object: Inherited from object class
113 # @var FvImageOptionName: To store value for FvImageOptionName
114 # @var FvImageOptionValues: To store value for FvImageOptionValues
116 class PlatformFvImageOptionClass(object):
118 self
.FvImageOptionName
= ''
119 self
.FvImageOptionValues
= []
121 ## PlatformFvImageClass
123 # This class defined FvImage item used in platform file
125 # @param object: Inherited from object class
127 # @var Name: To store value for Name
128 # @var Value: To store value for Value
129 # @var Type: To store value for Type, selection scope is in below list
130 # Attributes | Options | Components | ImageName
131 # @var FvImageNames: To store value for FvImageNames
132 # @var FvImageOptions: To store value for FvImageOptions, it is a list structure as
133 # [ PlatformFvImageOption, ...]
135 class PlatformFvImageClass(object):
140 self
.FvImageNames
= []
141 self
.FvImageOptions
= []
143 ## PlatformFvImageNameClass
145 # This class defined FvImageName item used in platform file
147 # @param object: Inherited from object class
149 # @var Name: To store value for Name
150 # @var Type: To store value for Type, selection scope is in below list
151 # FV_MAIN | FV_MAIN_COMPACT | NV_STORAGE | FV_RECOVERY | FV_RECOVERY_FLOPPY | FV_FILE | CAPSULE_CARGO | NULL | USER_DEFINED
152 # @var FvImageOptions: To store value for FvImageOptions, it is a list structure as
153 # [ PlatformFvImageOption, ...]
155 class PlatformFvImageNameClass(object):
159 self
.FvImageOptions
= []
161 ## PlatformFvImagesClass
163 # This class defined FvImages item used in platform file
165 # @param object: Inherited from object class
167 # @var FvImages: To store value for FvImages
169 class PlatformFvImagesClass(object):
173 ## PlatformAntTaskClass
175 # This class defined AntTask item used in platform file
177 # @param object: Inherited from object class
179 # @var Id: To store value for Id
180 # @var AntCmdOptions: To store value for AntCmdOptions
181 # @var FilePath: To store value for FilePath
183 class PlatformAntTaskClass(object):
186 self
.AntCmdOptions
= ''
189 ## PlatformFfsSectionClass
191 # This class defined FfsSection item used in platform file
193 # @param CommonClass: Inherited from CommonClass class
195 # @var BindingOrder: To store value for BindingOrder
196 # @var Compressible: To store value for Compressible
197 # @var SectionType: To store value for SectionType
198 # @var EncapsulationType: To store value for EncapsulationType
199 # @var ToolName: To store value for ToolName
200 # @var Filenames: To store value for Filenames
201 # @var Args: To store value for Args
202 # @var OutFile: To store value for OutFile
203 # @var OutputFileExtension: To store value for OutputFileExtension
204 # @var ToolNameElement: To store value for ToolNameElement
206 class PlatformFfsSectionClass(CommonClass
):
208 CommonClass
.__init
__(self
)
209 self
.BindingOrder
= ''
210 self
.Compressible
= ''
211 self
.SectionType
= ''
212 self
.EncapsulationType
= ''
217 self
.OutputFileExtension
= ''
218 self
.ToolNameElement
= ''
220 ## PlatformFfsSectionsClass
222 # This class defined FfsSections item used in platform file
224 # @param CommonClass: Inherited from CommonClass class
226 # @var BindingOrder: To store value for BindingOrder
227 # @var Compressible: To store value for Compressible
228 # @var SectionType: To store value for SectionType
229 # @var EncapsulationType: To store value for EncapsulationType
230 # @var ToolName: To store value for ToolName
231 # @var Section: To store value for Section, it is a list structure as
232 # [ PlatformFfsSectionClass, ... ]
233 # @var Sections: To store value for Sections, it is a list structure as
234 # [ PlatformFfsSectionsClass, ...]
236 class PlatformFfsSectionsClass(CommonClass
):
238 CommonClass
.__init
__(self
)
239 self
.BindingOrder
= ''
240 self
.Compressible
= ''
241 self
.SectionType
= ''
242 self
.EncapsulationType
= ''
249 # This class defined Ffs item used in platform file
251 # @param object: Inherited from object class
253 # @var Attribute: To store value for Attribute, it is a set structure as
254 # { [(Name, PlatformFfsSectionsClass)] : Value}
255 # @var Sections: To store value for Sections, it is a list structure as
256 # [ PlatformFfsSectionsClass]
257 # @var ToolName: To store value for ToolName
259 class PlatformFfsClass(object):
265 ## PlatformBuildOptionClass
267 # This class defined BuildOption item used in platform file
269 # @param object: Inherited from object class
271 # @var UserDefinedAntTasks: To store value for UserDefinedAntTasks, it is a set structure as
272 # { [Id] : PlatformAntTaskClass, ...}
273 # @var Options: To store value for Options, it is a list structure as
274 # [ BuildOptionClass, ...]
275 # @var UserExtensions: To store value for UserExtensions, it is a set structure as
276 # { [(UserID, Identifier)] : UserExtensionsClass, ...}
277 # @var FfsKeyList: To store value for FfsKeyList, it is a set structure as
278 # { [FfsKey]: PlatformFfsClass, ...}
280 class PlatformBuildOptionClass(object):
282 self
.UserDefinedAntTasks
= {}
284 self
.UserExtensions
= {}
287 ## PlatformBuildOptionClasses
289 # This class defined BuildOption item list used in platform file
291 # @param IncludeStatementClass: Inherited from IncludeStatementClass class
293 # @var FvBinding: To store value for FvBinding
294 # @var FfsFileNameGuid: To store value for FfsFileNameGuid
295 # @var FfsFormatKey: To store value for FfsFormatKey
296 # @var BuildOptionList: To store value for BuildOptionList, it is a list structure as
297 # [ BuildOptionClass, ... ]
299 class PlatformBuildOptionClasses(IncludeStatementClass
):
301 IncludeStatementClass
.__init
__(self
)
303 self
.FfsFileNameGuid
= ''
304 self
.FfsFormatKey
= ''
305 self
.BuildOptionList
= []
307 ## PlatformLibraryClass
309 # This class defined Library item used in platform file
311 # @param CommonClass: Inherited from CommonClass class
312 # @param DefineClass: Inherited from DefineClass class
313 # @param Name: Input value for Name, default is ''
314 # @param FilePath: Input value for FilePath, default is ''
316 # @var Name: To store value for Name
317 # @var FilePath: To store value for FilePath
318 # @var ModuleType: To store value for ModuleType
319 # @var SupModuleList: To store value for SupModuleList
320 # @var ModuleGuid: To store value for ModuleGuid
321 # @var ModuleVersion: To store value for ModuleVersion
322 # @var PackageGuid: To store value for PackageGuid
323 # @var PackageVersion: To store value for PackageVersion
325 class PlatformLibraryClass(CommonClass
, DefineClass
):
326 def __init__(self
, Name
= '', FilePath
= ''):
327 CommonClass
.__init
__(self
)
328 DefineClass
.__init
__(self
)
330 self
.FilePath
= FilePath
332 self
.SupModuleList
= []
334 self
.ModuleVersion
= ''
335 self
.PackageGuid
= ''
336 self
.PackageVersion
= ''
338 ## PlatformLibraryClasses
340 # This class defined Library item list used in platform file
342 # @param IncludeStatementClass: Inherited from IncludeStatementClass class
344 # @var LibraryList: To store value for LibraryList, it is a list structure as
345 # [ PlatformLibraryClass, ... ]
347 class PlatformLibraryClasses(IncludeStatementClass
):
349 IncludeStatementClass
.__init
__(self
)
350 self
.LibraryList
= []
352 ## PlatformModuleClass
354 # This class defined Module item used in platform file
356 # @param CommonClass: Inherited from CommonClass class
357 # @param DefineClass: Inherited from DefineClass class
358 # @param IncludeStatementClass: Inherited from IncludeStatementClass class
360 # @var Name: To store value for Name (Library name or libraryclass name or module name)
361 # @var FilePath: To store value for FilePath
362 # @var Type: To store value for Type, selection scope is in below list
363 # LIBRARY | LIBRARY_CLASS | MODULE
364 # @var ModuleType: To store value for ModuleType
365 # @var ExecFilePath: To store value for ExecFilePath
366 # @var LibraryClasses: To store value for LibraryClasses, it is a structure as
367 # PlatformLibraryClasses
368 # @var PcdBuildDefinitions: To store value for PcdBuildDefinitions, it is a list structure as
370 # @var ModuleSaBuildOption: To store value for ModuleSaBuildOption, it is a structure as
371 # PlatformBuildOptionClasses
372 # @var Specifications: To store value for Specifications, it is a list structure as
375 class PlatformModuleClass(CommonClass
, DefineClass
, IncludeStatementClass
):
377 CommonClass
.__init
__(self
)
378 DefineClass
.__init
__(self
)
383 self
.ExecFilePath
= ''
384 self
.LibraryClasses
= PlatformLibraryClasses()
385 self
.PcdBuildDefinitions
= []
386 self
.ModuleSaBuildOption
= PlatformBuildOptionClasses()
387 self
.Specifications
= []
388 self
.SourceOverridePath
= ''
390 ## PlatformModuleClasses
392 # This class defined Module item list used in platform file
394 # @param IncludeStatementClass: Inherited from IncludeStatementClass class
396 # @var ModuleList: To store value for ModuleList, it is a list structure as
397 # [ PlatformModuleClass, ... ]
399 class PlatformModuleClasses(IncludeStatementClass
):
401 IncludeStatementClass
.__init
__(self
)
406 # This class defined a complete platform item
408 # @param object: Inherited from object class
410 # @var Header: To store value for Header, it is a structure as
411 # {Arch : PlatformHeaderClass()}
412 # @var SkuInfos: To store value for SkuInfos, it is a structure as
414 # @var Libraries: To store value for Libraries, it is a structure as
415 # PlatformLibraryClasses
416 # @var LibraryClasses: To store value for LibraryClasses, it is a structure as
417 # PlatformLibraryClasses
418 # @var Modules: To store value for Modules, it is a structure as
419 # PlatformModuleClasses
420 # @var FlashDefinitionFile: To store value for FlashDefinitionFile, it is a structure as
421 # PlatformFlashDefinitionFileClass
422 # @var Prebuild: To store value for PREBUILD, it is a structure as
424 # @var Postbuild: To store value for POSTBUILD, it is a structure as
426 # @var BuildOptions: To store value for BuildOptions, it is a structure as
427 # PlatformBuildOptionClasses
428 # @var DynamicPcdBuildDefinitions: To store value for DynamicPcdBuildDefinitions, it is a list structure as
430 # @var Fdf: To store value for Fdf, it is a list structure as
432 # @var UserExtensions: To store value for UserExtensions, it is a list structure as
433 # [ UserExtensionsClass, ...]
435 class PlatformClass(object):
438 self
.SkuInfos
= SkuInfoListClass()
439 self
.Libraries
= PlatformLibraryClasses()
440 self
.LibraryClasses
= PlatformLibraryClasses()
441 self
.Modules
= PlatformModuleClasses()
442 self
.FlashDefinitionFile
= PlatformFlashDefinitionFileClass()
443 self
.Prebuild
= BuildScriptClass()
444 self
.Postbuild
= BuildScriptClass()
445 self
.BuildOptions
= PlatformBuildOptionClasses()
446 self
.DynamicPcdBuildDefinitions
= []
448 self
.UserExtensions
= []
452 # This acts like the main() function for the script, unless it is 'import'ed into another
455 if __name__
== '__main__':