git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@412 7335b...
[people/mcb30/basetools.git] / Source / Python / CommonDataClass / PlatformClass.py
1 # Copyright (c) 2007, Intel Corporation\r
2 # All rights reserved. This program and the accompanying materials\r
3 # are licensed and made available under the terms and conditions of the BSD License\r
4 # which accompanies this distribution.    The full text of the license may be found at\r
5 # http://opensource.org/licenses/bsd-license.php\r
6 #\r
7 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
8 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
9 \r
10 #\r
11 # This file is used to define a class object to describe a platform\r
12 #\r
13 \r
14 from CommonClass import *\r
15 \r
16 class SkuInfoListClass(IncludeStatementClass):\r
17     def __init__(self):\r
18         IncludeStatementClass.__init__(self)\r
19         self.SkuInfoList = {}                                       #{ SkuName : SkuId }\r
20 \r
21 class PlatformHeaderClass(IdentificationClass, CommonHeaderClass, DefineClass):\r
22     def __init__(self):\r
23         IdentificationClass.__init__(self)\r
24         CommonHeaderClass.__init__(self)\r
25         DefineClass.__init__(self)\r
26         self.DscSpecification = ''\r
27         self.SupArchList = []                                        #EBC | IA32 | X64 | IPF | ARM | PPC\r
28         self.BuildTargets = []                                       #RELEASE | DEBUG\r
29         self.IntermediateDirectories = ''                            #MODULE | UNIFIED\r
30         self.OutputDirectory = ''                                                    \r
31         self.ForceDebugTarget = ''\r
32         self.SkuIdName = []\r
33         self.BuildNumber = ''\r
34         self.MakefileName = ''\r
35         self.ClonedFrom = []                                         #[ ClonedRecordClass, ...]\r
36 \r
37 class PlatformFlashDefinitionFileClass(object):\r
38     def __init__(self):\r
39         self.Id = ''\r
40         self.UiName = ''\r
41         self.Preferred = False\r
42         self.FilePath = ''\r
43 \r
44 class PlatformFvImageOption(object):\r
45     def __init__(self):\r
46         self.FvImageOptionName = ''\r
47         self.FvImageOptionValues = []\r
48         \r
49 class PlatformFvImageClass(object):\r
50     def __init__(self):\r
51         self.Name = ''\r
52         self.Value = ''\r
53         self.Type = ''                                               #Attributes | Options | Components | ImageName \r
54         self.FvImageNames = []\r
55         self.FvImageOptions = []                                     #[ PlatformFvImageOption, ...]\r
56 \r
57 class PlatformFvImageNameClass(object):\r
58     def __init__(self):\r
59         self.Name = ''\r
60         self.Type = ''                                               #FV_MAIN | FV_MAIN_COMPACT | NV_STORAGE | FV_RECOVERY | FV_RECOVERY_FLOPPY | FV_FILE | CAPSULE_CARGO | NULL | USER_DEFINED \r
61         self.FvImageOptions = []                                     #[ PlatformFvImageOption, ...]\r
62         \r
63 class PlatformFvImagesClass(object):\r
64     def __init__(self):\r
65         self.FvImages1 = []                                          #[ PlatformFvImageClass, ...]\r
66         self.FvImages2 = []                                          #[ PlatformFvImageNameClass, ...]\r
67 \r
68 class PlatformAntTaskClass(object):\r
69     def __init__(self):\r
70         self.Id = ''\r
71         self.AntCmdOptions = ''\r
72         self.FilePath = ''\r
73 \r
74 class PlatformFfsSectionClass(CommonClass):\r
75     def __init__(self):\r
76         CommonClass.__init__(self)\r
77         self.BindingOrder                = ''\r
78         self.Compressible                = ''\r
79         self.SectionType                 = ''\r
80         self.EncapsulationType     = ''\r
81         self.ToolName                        = ''\r
82         self.Filenames = []\r
83         self.Args                                = ''\r
84         self.OutFile                         = ''\r
85         self.OutputFileExtension = ''\r
86         self.ToolNameElement         = ''\r
87         \r
88 class PlatformFfsSectionsClass(CommonClass):\r
89     def __init__(self):\r
90         CommonClass.__init__(self)        \r
91         self.BindingOrder            = ''\r
92         self.Compressible            = ''\r
93         self.SectionType             = ''\r
94         self.EncapsulationType = ''\r
95         self.ToolName                    = ''\r
96         self.Section = []                                            #[ PlatformFfsSectionClass, ... ]\r
97         self.Sections = []                                           #[ PlatformFfsSectionsClass, ...]\r
98         \r
99 class PlatformFfsClass(object):\r
100     def __init__(self):\r
101         self.Attribute = {}                                          #{ [(Name, PlatformFfsSectionsClass)] : Value}\r
102         self.Sections = []                                           #[ PlatformFfsSectionsClass]\r
103             \r
104 class PlatformBuildOptionClass(object):\r
105     def __init__(self):\r
106         self.UserDefinedAntTasks = {}                                #{ [Id] : PlatformAntTaskClass, ...}\r
107         self.Options = []                                            #[ BuildOptionClass, ...]\r
108         self.UserExtensions = {}                                     #{ [(UserID, Identifier)] : UserExtensionsClass, ...}\r
109         self.FfsKeyList = {}                                         #{ [FfsKey]: PlatformFfsClass, ...} \r
110     \r
111 class PlatformBuildOptionClasses(IncludeStatementClass):\r
112     def __init__(self):\r
113         IncludeStatementClass.__init__(self)\r
114         self.FvBinding = ''\r
115         self.FfsFileNameGuid = ''\r
116         self.FfsFormatKey = ''\r
117         self.BuildOptionList = []                                    #[ BuildOptionClass, ...]\r
118 \r
119 class PlatformLibraryClass(CommonClass, DefineClass):\r
120     def __init__(self, Name = '', FilePath = ''):\r
121         CommonClass.__init__(self)\r
122         DefineClass.__init__(self)\r
123         self.Name = Name\r
124         self.FilePath = FilePath\r
125         self.ModuleType = []\r
126         self.ModuleGuid = ''\r
127         self.ModuleVersion = ''\r
128         self.PackageGuid = ''\r
129         self.PackageVersion = ''\r
130 \r
131 class PlatformLibraryClasses(IncludeStatementClass):\r
132     def __init__(self):\r
133         IncludeStatementClass.__init__(self)\r
134         self.LibraryList = []                                        #[ PlatformLibraryClass, ...]\r
135         \r
136 class PlatformModuleClass(CommonClass, DefineClass, IncludeStatementClass):\r
137     def __init__(self):\r
138         CommonClass.__init__(self)\r
139         DefineClass.__init__(self)\r
140         self.Name = ''                                               #Library name or libraryclass name or module name\r
141         self.FilePath = ''\r
142         self.Type = ''                                               #LIBRARY | LIBRARY_CLASS | MODULE, used by dsc\r
143         self.ModuleType = ''\r
144         self.ExecFilePath = ''\r
145         self.LibraryClasses = PlatformLibraryClasses()\r
146         self.PcdBuildDefinitions = []                                #[ PcdClass, ...]\r
147         self.ModuleSaBuildOption = PlatformBuildOptionClasses()\r
148         self.Specifications = []                                     #[ '', '', ...]\r
149 \r
150 class PlatformModuleClasses(IncludeStatementClass):\r
151     def __init__(self):\r
152         IncludeStatementClass.__init__(self)\r
153         self.ModuleList = []                                         #[ PlatformModuleClass, ...]\r
154 \r
155 class PlatformClass(object):\r
156     def __init__(self):\r
157         self.Header = PlatformHeaderClass()\r
158         self.SkuInfos = SkuInfoListClass()\r
159         self.Libraries = PlatformLibraryClasses()\r
160         self.LibraryClasses = PlatformLibraryClasses()\r
161         self.Modules = PlatformModuleClasses()\r
162         self.FlashDefinitionFile = PlatformFlashDefinitionFileClass()\r
163         self.FvImages = []                                           #[ PlatformFvImagesClass, ...]\r
164         self.BuildOptions = PlatformBuildOptionClasses()\r
165         self.DynamicPcdBuildDefinitions = []                         #[ PcdClass, ...] \r
166         self.Fdf = []                                                #[ FdfClass, ...]\r
167         self.UserExtensions = []                                     #[ UserExtensionsClass, ...]\r
168 \r
169 if __name__ == '__main__':\r
170     p = PlatformClass()\r