Home | History | Annotate | Download | only in CommonDataClass
      1 ## @file

      2 # This file is used to define a class object to describe a platform

      3 #

      4 # Copyright (c) 2007, 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

      9 #

     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.

     12 
     13 ##

     14 # Import Modules

     15 #

     16 from CommonClass import *
     17 
     18 ## SkuInfoListClass

     19 #

     20 # This class defined sku info list item used in platform file

     21 # 

     22 # @param IncludeStatementClass:  Inherited from IncludeStatementClass class

     23 #

     24 # @var SkuInfoList:              To store value for SkuInfoList, it is a set structure as

     25 #                                { SkuName : SkuId }

     26 #

     27 class SkuInfoListClass(IncludeStatementClass):
     28     def __init__(self):
     29         IncludeStatementClass.__init__(self)
     30         self.SkuInfoList = {}
     31 
     32 ## PlatformHeaderClass

     33 #

     34 # This class defined header items used in Platform file

     35 # 

     36 # @param IdentificationClass:    Inherited from IdentificationClass class

     37 # @param CommonHeaderClass:      Inherited from CommonHeaderClass class

     38 # @param DefineClass:            Inherited from DefineClass class

     39 #

     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

     44 #                                RELEASE | DEBUG

     45 # @var IntermediateDirectories:  To store value for IntermediateDirectories, selection scope is in below list

     46 #                                MODULE | UNIFIED

     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, ... ]

     54 #

     55 class PlatformHeaderClass(IdentificationClass, CommonHeaderClass, DefineClass):
     56     def __init__(self):
     57         IdentificationClass.__init__(self)
     58         CommonHeaderClass.__init__(self)
     59         DefineClass.__init__(self)
     60         self.DscSpecification = ''
     61         self.SupArchList = []
     62         self.BuildTargets = []
     63         self.IntermediateDirectories = ''
     64         self.OutputDirectory = ''                                                    
     65         self.ForceDebugTarget = ''
     66         self.SkuIdName = []
     67         self.BuildNumber = ''
     68         self.MakefileName = ''
     69         self.ClonedFrom = []
     70 
     71 ## PlatformFlashDefinitionFileClass

     72 #

     73 # This class defined FlashDefinitionFile item used in platform file

     74 # 

     75 # @param object:   Inherited from object class

     76 #

     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

     81 #

     82 class PlatformFlashDefinitionFileClass(object):
     83     def __init__(self):
     84         self.Id = ''
     85         self.UiName = ''
     86         self.Preferred = False
     87         self.FilePath = ''
     88 
     89 ## PlatformFvImageOptionClass

     90 #

     91 # This class defined FvImageOption item used in platform file

     92 # 

     93 # @param object:             Inherited from object class

     94 #

     95 # @var FvImageOptionName:    To store value for FvImageOptionName

     96 # @var FvImageOptionValues:  To store value for FvImageOptionValues

     97 #

     98 class PlatformFvImageOptionClass(object):
     99     def __init__(self):
    100         self.FvImageOptionName = ''
    101         self.FvImageOptionValues = []
    102 
    103 ## PlatformFvImageClass

    104 #

    105 # This class defined FvImage item used in platform file

    106 # 

    107 # @param object:        Inherited from object class

    108 #

    109 # @var Name:            To store value for Name

    110 # @var Value:           To store value for Value

    111 # @var Type:            To store value for Type, selection scope is in below list

    112 #                       Attributes | Options | Components | ImageName 

    113 # @var FvImageNames:    To store value for FvImageNames

    114 # @var FvImageOptions:  To store value for FvImageOptions, it is a list structure as

    115 #                       [ PlatformFvImageOption, ...]

    116 #

    117 class PlatformFvImageClass(object):
    118     def __init__(self):
    119         self.Name = ''
    120         self.Value = ''
    121         self.Type = ''
    122         self.FvImageNames = []
    123         self.FvImageOptions = []
    124 
    125 ## PlatformFvImageNameClass

    126 #

    127 # This class defined FvImageName item used in platform file

    128 # 

    129 # @param object:        Inherited from object class

    130 #

    131 # @var Name:            To store value for Name

    132 # @var Type:            To store value for Type, selection scope is in below list

    133 #                       FV_MAIN | FV_MAIN_COMPACT | NV_STORAGE | FV_RECOVERY | FV_RECOVERY_FLOPPY | FV_FILE | CAPSULE_CARGO | NULL | USER_DEFINED 

    134 # @var FvImageOptions:  To store value for FvImageOptions, it is a list structure as

    135 #                       [ PlatformFvImageOption, ...]

    136 #

    137 class PlatformFvImageNameClass(object):
    138     def __init__(self):
    139         self.Name = ''
    140         self.Type = ''
    141         self.FvImageOptions = []
    142 
    143 ## PlatformFvImagesClass

    144 #

    145 # This class defined FvImages item used in platform file

    146 # 

    147 # @param object:  Inherited from object class

    148 #

    149 # @var FvImages:  To store value for FvImages

    150 #

    151 class PlatformFvImagesClass(object):
    152     def __init__(self):
    153         self.FvImages = []
    154 
    155 ## PlatformAntTaskClass

    156 #

    157 # This class defined AntTask item used in platform file

    158 # 

    159 # @param object:       Inherited from object class

    160 #

    161 # @var Id:             To store value for Id

    162 # @var AntCmdOptions:  To store value for AntCmdOptions

    163 # @var FilePath:       To store value for FilePath

    164 #

    165 class PlatformAntTaskClass(object):
    166     def __init__(self):
    167         self.Id = ''
    168         self.AntCmdOptions = ''
    169         self.FilePath = ''
    170 
    171 ## PlatformFfsSectionClass

    172 #

    173 # This class defined FfsSection item used in platform file

    174 # 

    175 # @param CommonClass:        Inherited from CommonClass class

    176 #

    177 # @var BindingOrder:         To store value for BindingOrder

    178 # @var Compressible:         To store value for Compressible

    179 # @var SectionType:          To store value for SectionType

    180 # @var EncapsulationType:    To store value for EncapsulationType

    181 # @var ToolName:             To store value for ToolName

    182 # @var Filenames:            To store value for Filenames

    183 # @var Args:                 To store value for Args

    184 # @var OutFile:              To store value for OutFile

    185 # @var OutputFileExtension:  To store value for OutputFileExtension

    186 # @var ToolNameElement:      To store value for ToolNameElement

    187 #

    188 class PlatformFfsSectionClass(CommonClass):
    189     def __init__(self):
    190         CommonClass.__init__(self)
    191         self.BindingOrder = ''
    192         self.Compressible = ''
    193         self.SectionType  = ''
    194         self.EncapsulationType  = ''
    195         self.ToolName = ''
    196         self.Filenames = []
    197         self.Args = ''
    198         self.OutFile = ''
    199         self.OutputFileExtension = ''
    200         self.ToolNameElement = ''
    201 
    202 ## PlatformFfsSectionsClass

    203 #

    204 # This class defined FfsSections item used in platform file

    205 # 

    206 # @param CommonClass:      Inherited from CommonClass class

    207 #

    208 # @var BindingOrder:       To store value for BindingOrder

    209 # @var Compressible:       To store value for Compressible

    210 # @var SectionType:        To store value for SectionType

    211 # @var EncapsulationType:  To store value for EncapsulationType

    212 # @var ToolName:           To store value for ToolName

    213 # @var Section:            To store value for Section, it is a list structure as

    214 #                          [ PlatformFfsSectionClass, ... ]

    215 # @var Sections:           To store value for Sections, it is a list structure as

    216 #                          [ PlatformFfsSectionsClass, ...]

    217 #

    218 class PlatformFfsSectionsClass(CommonClass):
    219     def __init__(self):
    220         CommonClass.__init__(self)
    221         self.BindingOrder = ''
    222         self.Compressible = ''
    223         self.SectionType = ''
    224         self.EncapsulationType = ''
    225         self.ToolName = ''
    226         self.Section = []
    227         self.Sections = []
    228 
    229 ## PlatformFfsClass

    230 #

    231 # This class defined Ffs item used in platform file

    232 # 

    233 # @param object:   Inherited from object class

    234 #

    235 # @var Attribute:  To store value for Attribute, it is a set structure as

    236 #                  { [(Name, PlatformFfsSectionsClass)] : Value}

    237 # @var Sections:   To store value for Sections, it is a list structure as

    238 #                  [ PlatformFfsSectionsClass]

    239 # @var ToolName:   To store value for ToolName

    240 #

    241 class PlatformFfsClass(object):
    242     def __init__(self):
    243         self.Attribute = {}
    244         self.Sections = []
    245         self.Key = ''
    246 
    247 ## PlatformBuildOptionClass

    248 #

    249 # This class defined BuildOption item used in platform file

    250 # 

    251 # @param object:             Inherited from object class

    252 #

    253 # @var UserDefinedAntTasks:  To store value for UserDefinedAntTasks, it is a set structure as

    254 #                            { [Id] : PlatformAntTaskClass, ...}

    255 # @var Options:              To store value for Options, it is a list structure as

    256 #                            [ BuildOptionClass, ...]

    257 # @var UserExtensions:       To store value for UserExtensions, it is a set structure as

    258 #                            { [(UserID, Identifier)] : UserExtensionsClass, ...}

    259 # @var FfsKeyList:           To store value for FfsKeyList, it is a set structure as

    260 #                            { [FfsKey]: PlatformFfsClass, ...} 

    261 #

    262 class PlatformBuildOptionClass(object):
    263     def __init__(self):
    264         self.UserDefinedAntTasks = {}
    265         self.Options = []
    266         self.UserExtensions = {}
    267         self.FfsKeyList = {}
    268 
    269 ## PlatformBuildOptionClasses

    270 #

    271 # This class defined BuildOption item list used in platform file

    272 # 

    273 # @param IncludeStatementClass:  Inherited from IncludeStatementClass class

    274 #

    275 # @var FvBinding:                To store value for FvBinding

    276 # @var FfsFileNameGuid:          To store value for FfsFileNameGuid

    277 # @var FfsFormatKey:             To store value for FfsFormatKey

    278 # @var BuildOptionList:          To store value for BuildOptionList, it is a list structure as

    279 #                                [ BuildOptionClass, ... ]

    280 #

    281 class PlatformBuildOptionClasses(IncludeStatementClass):
    282     def __init__(self):
    283         IncludeStatementClass.__init__(self)
    284         self.FvBinding = ''
    285         self.FfsFileNameGuid = ''
    286         self.FfsFormatKey = ''
    287         self.BuildOptionList = []
    288 
    289 ## PlatformLibraryClass

    290 #

    291 # This class defined Library item used in platform file

    292 # 

    293 # @param CommonClass:   Inherited from CommonClass class

    294 # @param DefineClass:   Inherited from DefineClass class

    295 # @param Name:          Input value for Name, default is ''

    296 # @param FilePath:      Input value for FilePath, default is ''

    297 #

    298 # @var Name:            To store value for Name

    299 # @var FilePath:        To store value for FilePath

    300 # @var ModuleType:      To store value for ModuleType

    301 # @var SupModuleList:   To store value for SupModuleList

    302 # @var ModuleGuid:      To store value for ModuleGuid

    303 # @var ModuleVersion:   To store value for ModuleVersion

    304 # @var PackageGuid:     To store value for PackageGuid

    305 # @var PackageVersion:  To store value for PackageVersion

    306 #

    307 class PlatformLibraryClass(CommonClass, DefineClass):
    308     def __init__(self, Name = '', FilePath = ''):
    309         CommonClass.__init__(self)
    310         DefineClass.__init__(self)
    311         self.Name = Name
    312         self.FilePath = FilePath
    313         self.ModuleType = []
    314         self.SupModuleList = []
    315         self.ModuleGuid = ''
    316         self.ModuleVersion = ''
    317         self.PackageGuid = ''
    318         self.PackageVersion = ''
    319 
    320 ## PlatformLibraryClasses

    321 #

    322 # This class defined Library item list used in platform file

    323 # 

    324 # @param IncludeStatementClass:  Inherited from IncludeStatementClass class

    325 #

    326 # @var LibraryList:              To store value for LibraryList, it is a list structure as

    327 #                                [ PlatformLibraryClass, ... ]

    328 #

    329 class PlatformLibraryClasses(IncludeStatementClass):
    330     def __init__(self):
    331         IncludeStatementClass.__init__(self)
    332         self.LibraryList = []
    333 
    334 ## PlatformModuleClass

    335 #

    336 # This class defined Module item used in platform file

    337 # 

    338 # @param CommonClass:            Inherited from CommonClass class

    339 # @param DefineClass:            Inherited from DefineClass class

    340 # @param IncludeStatementClass:  Inherited from IncludeStatementClass class

    341 #

    342 # @var Name:                     To store value for Name (Library name or libraryclass name or module name)

    343 # @var FilePath:                 To store value for FilePath

    344 # @var Type:                     To store value for Type, selection scope is in below list

    345 #                                LIBRARY | LIBRARY_CLASS | MODULE

    346 # @var ModuleType:               To store value for ModuleType

    347 # @var ExecFilePath:             To store value for ExecFilePath

    348 # @var LibraryClasses:           To store value for LibraryClasses, it is a structure as

    349 #                                PlatformLibraryClasses

    350 # @var PcdBuildDefinitions:      To store value for PcdBuildDefinitions, it is a list structure as

    351 #                                [ PcdClass, ...]

    352 # @var ModuleSaBuildOption:      To store value for ModuleSaBuildOption, it is a structure as

    353 #                                PlatformBuildOptionClasses

    354 # @var Specifications:           To store value for Specifications, it is a list structure as

    355 #                                [ '', '', ...]

    356 #

    357 class PlatformModuleClass(CommonClass, DefineClass, IncludeStatementClass):
    358     def __init__(self):
    359         CommonClass.__init__(self)
    360         DefineClass.__init__(self)
    361         self.Name = ''
    362         self.FilePath = ''
    363         self.Type = ''
    364         self.ModuleType = ''
    365         self.ExecFilePath = ''
    366         self.LibraryClasses = PlatformLibraryClasses()
    367         self.PcdBuildDefinitions = []
    368         self.ModuleSaBuildOption = PlatformBuildOptionClasses()
    369         self.Specifications = []
    370         self.SourceOverridePath = ''
    371 
    372 ## PlatformModuleClasses

    373 #

    374 # This class defined Module item list used in platform file

    375 # 

    376 # @param IncludeStatementClass:  Inherited from IncludeStatementClass class

    377 #

    378 # @var ModuleList:               To store value for ModuleList, it is a list structure as

    379 #                                [ PlatformModuleClass, ... ]

    380 #

    381 class PlatformModuleClasses(IncludeStatementClass):
    382     def __init__(self):
    383         IncludeStatementClass.__init__(self)
    384         self.ModuleList = []
    385 
    386 ## PlatformClass

    387 #

    388 # This class defined a complete platform item

    389 # 

    390 # @param object:                    Inherited from object class

    391 #

    392 # @var Header:                      To store value for Header, it is a structure as

    393 #                                   {Arch : PlatformHeaderClass()}

    394 # @var SkuInfos:                    To store value for SkuInfos, it is a structure as

    395 #                                   SkuInfoListClass

    396 # @var Libraries:                   To store value for Libraries, it is a structure as

    397 #                                   PlatformLibraryClasses

    398 # @var LibraryClasses:              To store value for LibraryClasses, it is a structure as

    399 #                                   PlatformLibraryClasses

    400 # @var Modules:                     To store value for Modules, it is a structure as

    401 #                                   PlatformModuleClasses

    402 # @var FlashDefinitionFile:         To store value for FlashDefinitionFile, it is a structure as

    403 #                                   PlatformFlashDefinitionFileClass

    404 # @var BuildOptions:                To store value for BuildOptions, it is a structure as

    405 #                                   PlatformBuildOptionClasses

    406 # @var DynamicPcdBuildDefinitions:  To store value for DynamicPcdBuildDefinitions, it is a list structure as

    407 #                                   [ PcdClass, ...]

    408 # @var Fdf:                         To store value for Fdf, it is a list structure as

    409 #                                   [ FdfClass, ...]

    410 # @var UserExtensions:              To store value for UserExtensions, it is a list structure as

    411 #                                   [ UserExtensionsClass, ...]

    412 #

    413 class PlatformClass(object):
    414     def __init__(self):
    415         self.Header = {}
    416         self.SkuInfos = SkuInfoListClass()
    417         self.Libraries = PlatformLibraryClasses()
    418         self.LibraryClasses = PlatformLibraryClasses()
    419         self.Modules = PlatformModuleClasses()
    420         self.FlashDefinitionFile = PlatformFlashDefinitionFileClass()
    421         self.BuildOptions = PlatformBuildOptionClasses()
    422         self.DynamicPcdBuildDefinitions = []
    423         self.Fdf = []
    424         self.UserExtensions = []
    425 
    426 ##

    427 #

    428 # This acts like the main() function for the script, unless it is 'import'ed into another

    429 # script.

    430 #

    431 if __name__ == '__main__':
    432     P = PlatformClass()
    433