summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/CommonDataClass/PlatformClass.py
blob: 1966fb9f8c10ab30cc2dfa1671e16eb852320703 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
## @file
# This file is used to define a class object to describe a platform
#
# Copyright (c) 2007, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution.    The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

##
# Import Modules
#
from CommonClass import *

## SkuInfoListClass
#
# This class defined sku info list item used in platform file
# 
# @param IncludeStatementClass:  Inherited from IncludeStatementClass class
#
# @var SkuInfoList:              To store value for SkuInfoList, it is a set structure as
#                                { SkuName : SkuId }
#
class SkuInfoListClass(IncludeStatementClass):
    def __init__(self):
        IncludeStatementClass.__init__(self)
        self.SkuInfoList = {}

## PlatformHeaderClass
#
# This class defined header items used in Platform file
# 
# @param IdentificationClass:    Inherited from IdentificationClass class
# @param CommonHeaderClass:      Inherited from CommonHeaderClass class
# @param DefineClass:            Inherited from DefineClass class
#
# @var DscSpecification:         To store value for DscSpecification
# @var SupArchList:              To store value for SupArchList, selection scope is in below list
#                                EBC | IA32 | X64 | IPF | ARM | PPC
# @var BuildTargets:             To store value for BuildTargets, selection scope is in below list
#                                RELEASE | DEBUG
# @var IntermediateDirectories:  To store value for IntermediateDirectories, selection scope is in below list
#                                MODULE | UNIFIED
# @var OutputDirectory:          To store value for OutputDirectory
# @var ForceDebugTarget:         To store value for ForceDebugTarget
# @var SkuIdName:                To store value for SkuIdName
# @var BuildNumber:              To store value for BuildNumber
# @var MakefileName:             To store value for MakefileName
# @var ClonedFrom:               To store value for ClonedFrom, it is a list structure as
#                                [ ClonedRecordClass, ... ]
#
class PlatformHeaderClass(IdentificationClass, CommonHeaderClass, DefineClass):
    def __init__(self):
        IdentificationClass.__init__(self)
        CommonHeaderClass.__init__(self)
        DefineClass.__init__(self)
        self.DscSpecification = ''
        self.SupArchList = []
        self.BuildTargets = []
        self.IntermediateDirectories = ''
        self.OutputDirectory = ''                                                    
        self.ForceDebugTarget = ''
        self.SkuIdName = []
        self.BuildNumber = ''
        self.MakefileName = ''
        self.ClonedFrom = []

## PlatformFlashDefinitionFileClass
#
# This class defined FlashDefinitionFile item used in platform file
# 
# @param object:   Inherited from object class
#
# @var Id:         To store value for Id
# @var UiName:     To store value for UiName
# @var Preferred:  To store value for Preferred
# @var FilePath:   To store value for FilePath
#
class PlatformFlashDefinitionFileClass(object):
    def __init__(self):
        self.Id = ''
        self.UiName = ''
        self.Preferred = False
        self.FilePath = ''

## PlatformFvImageOptionClass
#
# This class defined FvImageOption item used in platform file
# 
# @param object:             Inherited from object class
#
# @var FvImageOptionName:    To store value for FvImageOptionName
# @var FvImageOptionValues:  To store value for FvImageOptionValues
#
class PlatformFvImageOptionClass(object):
    def __init__(self):
        self.FvImageOptionName = ''
        self.FvImageOptionValues = []

## PlatformFvImageClass
#
# This class defined FvImage item used in platform file
# 
# @param object:        Inherited from object class
#
# @var Name:            To store value for Name
# @var Value:           To store value for Value
# @var Type:            To store value for Type, selection scope is in below list
#                       Attributes | Options | Components | ImageName 
# @var FvImageNames:    To store value for FvImageNames
# @var FvImageOptions:  To store value for FvImageOptions, it is a list structure as
#                       [ PlatformFvImageOption, ...]
#
class PlatformFvImageClass(object):
    def __init__(self):
        self.Name = ''
        self.Value = ''
        self.Type = ''
        self.FvImageNames = []
        self.FvImageOptions = []

## PlatformFvImageNameClass
#
# This class defined FvImageName item used in platform file
# 
# @param object:        Inherited from object class
#
# @var Name:            To store value for Name
# @var Type:            To store value for Type, selection scope is in below list
#                       FV_MAIN | FV_MAIN_COMPACT | NV_STORAGE | FV_RECOVERY | FV_RECOVERY_FLOPPY | FV_FILE | CAPSULE_CARGO | NULL | USER_DEFINED 
# @var FvImageOptions:  To store value for FvImageOptions, it is a list structure as
#                       [ PlatformFvImageOption, ...]
#
class PlatformFvImageNameClass(object):
    def __init__(self):
        self.Name = ''
        self.Type = ''
        self.FvImageOptions = []

## PlatformFvImagesClass
#
# This class defined FvImages item used in platform file
# 
# @param object:  Inherited from object class
#
# @var FvImages:  To store value for FvImages
#
class PlatformFvImagesClass(object):
    def __init__(self):
        self.FvImages = []

## PlatformAntTaskClass
#
# This class defined AntTask item used in platform file
# 
# @param object:       Inherited from object class
#
# @var Id:             To store value for Id
# @var AntCmdOptions:  To store value for AntCmdOptions
# @var FilePath:       To store value for FilePath
#
class PlatformAntTaskClass(object):
    def __init__(self):
        self.Id = ''
        self.AntCmdOptions = ''
        self.FilePath = ''

## PlatformFfsSectionClass
#
# This class defined FfsSection item used in platform file
# 
# @param CommonClass:        Inherited from CommonClass class
#
# @var BindingOrder:         To store value for BindingOrder
# @var Compressible:         To store value for Compressible
# @var SectionType:          To store value for SectionType
# @var EncapsulationType:    To store value for EncapsulationType
# @var ToolName:             To store value for ToolName
# @var Filenames:            To store value for Filenames
# @var Args:                 To store value for Args
# @var OutFile:              To store value for OutFile
# @var OutputFileExtension:  To store value for OutputFileExtension
# @var ToolNameElement:      To store value for ToolNameElement
#
class PlatformFfsSectionClass(CommonClass):
    def __init__(self):
        CommonClass.__init__(self)
        self.BindingOrder = ''
        self.Compressible = ''
        self.SectionType  = ''
        self.EncapsulationType  = ''
        self.ToolName = ''
        self.Filenames = []
        self.Args = ''
        self.OutFile = ''
        self.OutputFileExtension = ''
        self.ToolNameElement = ''

## PlatformFfsSectionsClass
#
# This class defined FfsSections item used in platform file
# 
# @param CommonClass:      Inherited from CommonClass class
#
# @var BindingOrder:       To store value for BindingOrder
# @var Compressible:       To store value for Compressible
# @var SectionType:        To store value for SectionType
# @var EncapsulationType:  To store value for EncapsulationType
# @var ToolName:           To store value for ToolName
# @var Section:            To store value for Section, it is a list structure as
#                          [ PlatformFfsSectionClass, ... ]
# @var Sections:           To store value for Sections, it is a list structure as
#                          [ PlatformFfsSectionsClass, ...]
#
class PlatformFfsSectionsClass(CommonClass):
    def __init__(self):
        CommonClass.__init__(self)
        self.BindingOrder = ''
        self.Compressible = ''
        self.SectionType = ''
        self.EncapsulationType = ''
        self.ToolName = ''
        self.Section = []
        self.Sections = []

## PlatformFfsClass
#
# This class defined Ffs item used in platform file
# 
# @param object:   Inherited from object class
#
# @var Attribute:  To store value for Attribute, it is a set structure as
#                  { [(Name, PlatformFfsSectionsClass)] : Value}
# @var Sections:   To store value for Sections, it is a list structure as
#                  [ PlatformFfsSectionsClass]
# @var ToolName:   To store value for ToolName
#
class PlatformFfsClass(object):
    def __init__(self):
        self.Attribute = {}
        self.Sections = []
        self.Key = ''

## PlatformBuildOptionClass
#
# This class defined BuildOption item used in platform file
# 
# @param object:             Inherited from object class
#
# @var UserDefinedAntTasks:  To store value for UserDefinedAntTasks, it is a set structure as
#                            { [Id] : PlatformAntTaskClass, ...}
# @var Options:              To store value for Options, it is a list structure as
#                            [ BuildOptionClass, ...]
# @var UserExtensions:       To store value for UserExtensions, it is a set structure as
#                            { [(UserID, Identifier)] : UserExtensionsClass, ...}
# @var FfsKeyList:           To store value for FfsKeyList, it is a set structure as
#                            { [FfsKey]: PlatformFfsClass, ...} 
#
class PlatformBuildOptionClass(object):
    def __init__(self):
        self.UserDefinedAntTasks = {}
        self.Options = []
        self.UserExtensions = {}
        self.FfsKeyList = {}

## PlatformBuildOptionClasses
#
# This class defined BuildOption item list used in platform file
# 
# @param IncludeStatementClass:  Inherited from IncludeStatementClass class
#
# @var FvBinding:                To store value for FvBinding
# @var FfsFileNameGuid:          To store value for FfsFileNameGuid
# @var FfsFormatKey:             To store value for FfsFormatKey
# @var BuildOptionList:          To store value for BuildOptionList, it is a list structure as
#                                [ BuildOptionClass, ... ]
#
class PlatformBuildOptionClasses(IncludeStatementClass):
    def __init__(self):
        IncludeStatementClass.__init__(self)
        self.FvBinding = ''
        self.FfsFileNameGuid = ''
        self.FfsFormatKey = ''
        self.BuildOptionList = []

## PlatformLibraryClass
#
# This class defined Library item used in platform file
# 
# @param CommonClass:   Inherited from CommonClass class
# @param DefineClass:   Inherited from DefineClass class
# @param Name:          Input value for Name, default is ''
# @param FilePath:      Input value for FilePath, default is ''
#
# @var Name:            To store value for Name
# @var FilePath:        To store value for FilePath
# @var ModuleType:      To store value for ModuleType
# @var SupModuleList:   To store value for SupModuleList
# @var ModuleGuid:      To store value for ModuleGuid
# @var ModuleVersion:   To store value for ModuleVersion
# @var PackageGuid:     To store value for PackageGuid
# @var PackageVersion:  To store value for PackageVersion
#
class PlatformLibraryClass(CommonClass, DefineClass):
    def __init__(self, Name = '', FilePath = ''):
        CommonClass.__init__(self)
        DefineClass.__init__(self)
        self.Name = Name
        self.FilePath = FilePath
        self.ModuleType = []
        self.SupModuleList = []
        self.ModuleGuid = ''
        self.ModuleVersion = ''
        self.PackageGuid = ''
        self.PackageVersion = ''

## PlatformLibraryClasses
#
# This class defined Library item list used in platform file
# 
# @param IncludeStatementClass:  Inherited from IncludeStatementClass class
#
# @var LibraryList:              To store value for LibraryList, it is a list structure as
#                                [ PlatformLibraryClass, ... ]
#
class PlatformLibraryClasses(IncludeStatementClass):
    def __init__(self):
        IncludeStatementClass.__init__(self)
        self.LibraryList = []

## PlatformModuleClass
#
# This class defined Module item used in platform file
# 
# @param CommonClass:            Inherited from CommonClass class
# @param DefineClass:            Inherited from DefineClass class
# @param IncludeStatementClass:  Inherited from IncludeStatementClass class
#
# @var Name:                     To store value for Name (Library name or libraryclass name or module name)
# @var FilePath:                 To store value for FilePath
# @var Type:                     To store value for Type, selection scope is in below list
#                                LIBRARY | LIBRARY_CLASS | MODULE
# @var ModuleType:               To store value for ModuleType
# @var ExecFilePath:             To store value for ExecFilePath
# @var LibraryClasses:           To store value for LibraryClasses, it is a structure as
#                                PlatformLibraryClasses
# @var PcdBuildDefinitions:      To store value for PcdBuildDefinitions, it is a list structure as
#                                [ PcdClass, ...]
# @var ModuleSaBuildOption:      To store value for ModuleSaBuildOption, it is a structure as
#                                PlatformBuildOptionClasses
# @var Specifications:           To store value for Specifications, it is a list structure as
#                                [ '', '', ...]
#
class PlatformModuleClass(CommonClass, DefineClass, IncludeStatementClass):
    def __init__(self):
        CommonClass.__init__(self)
        DefineClass.__init__(self)
        self.Name = ''
        self.FilePath = ''
        self.Type = ''
        self.ModuleType = ''
        self.ExecFilePath = ''
        self.LibraryClasses = PlatformLibraryClasses()
        self.PcdBuildDefinitions = []
        self.ModuleSaBuildOption = PlatformBuildOptionClasses()
        self.Specifications = []
        self.SourceOverridePath = ''

## PlatformModuleClasses
#
# This class defined Module item list used in platform file
# 
# @param IncludeStatementClass:  Inherited from IncludeStatementClass class
#
# @var ModuleList:               To store value for ModuleList, it is a list structure as
#                                [ PlatformModuleClass, ... ]
#
class PlatformModuleClasses(IncludeStatementClass):
    def __init__(self):
        IncludeStatementClass.__init__(self)
        self.ModuleList = []

## PlatformClass
#
# This class defined a complete platform item
# 
# @param object:                    Inherited from object class
#
# @var Header:                      To store value for Header, it is a structure as
#                                   {Arch : PlatformHeaderClass()}
# @var SkuInfos:                    To store value for SkuInfos, it is a structure as
#                                   SkuInfoListClass
# @var Libraries:                   To store value for Libraries, it is a structure as
#                                   PlatformLibraryClasses
# @var LibraryClasses:              To store value for LibraryClasses, it is a structure as
#                                   PlatformLibraryClasses
# @var Modules:                     To store value for Modules, it is a structure as
#                                   PlatformModuleClasses
# @var FlashDefinitionFile:         To store value for FlashDefinitionFile, it is a structure as
#                                   PlatformFlashDefinitionFileClass
# @var BuildOptions:                To store value for BuildOptions, it is a structure as
#                                   PlatformBuildOptionClasses
# @var DynamicPcdBuildDefinitions:  To store value for DynamicPcdBuildDefinitions, it is a list structure as
#                                   [ PcdClass, ...]
# @var Fdf:                         To store value for Fdf, it is a list structure as
#                                   [ FdfClass, ...]
# @var UserExtensions:              To store value for UserExtensions, it is a list structure as
#                                   [ UserExtensionsClass, ...]
#
class PlatformClass(object):
    def __init__(self):
        self.Header = {}
        self.SkuInfos = SkuInfoListClass()
        self.Libraries = PlatformLibraryClasses()
        self.LibraryClasses = PlatformLibraryClasses()
        self.Modules = PlatformModuleClasses()
        self.FlashDefinitionFile = PlatformFlashDefinitionFileClass()
        self.BuildOptions = PlatformBuildOptionClasses()
        self.DynamicPcdBuildDefinitions = []
        self.Fdf = []
        self.UserExtensions = []

##
#
# This acts like the main() function for the script, unless it is 'import'ed into another
# script.
#
if __name__ == '__main__':
    P = PlatformClass()