BaseTools: skip updating temporary variable.
[mirror_edk2.git] / BaseTools / Source / Python / CommonDataClass / PlatformClass.py
CommitLineData
30fdf114
LG
1## @file\r
2# This file is used to define a class object to describe a platform\r
3#\r
f0dc69e6 4# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
40d841f6 5# This program and the accompanying materials\r
30fdf114
LG
6# are licensed and made available under the terms and conditions of the BSD License\r
7# which accompanies this distribution. The full text of the license may be found at\r
8# http://opensource.org/licenses/bsd-license.php\r
9#\r
10# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13##\r
14# Import Modules\r
15#\r
16from CommonClass import *\r
17\r
18## SkuInfoListClass\r
19#\r
20# This class defined sku info list item used in platform file\r
21# \r
22# @param IncludeStatementClass: Inherited from IncludeStatementClass class\r
23#\r
24# @var SkuInfoList: To store value for SkuInfoList, it is a set structure as\r
25# { SkuName : SkuId }\r
26#\r
27class SkuInfoListClass(IncludeStatementClass):\r
28 def __init__(self):\r
29 IncludeStatementClass.__init__(self)\r
30 self.SkuInfoList = {}\r
31\r
32## PlatformHeaderClass\r
33#\r
34# This class defined header items used in Platform file\r
35# \r
36# @param IdentificationClass: Inherited from IdentificationClass class\r
37# @param CommonHeaderClass: Inherited from CommonHeaderClass class\r
38# @param DefineClass: Inherited from DefineClass class\r
39#\r
40# @var DscSpecification: To store value for DscSpecification\r
41# @var SupArchList: To store value for SupArchList, selection scope is in below list\r
4afd3d04 42# EBC | IA32 | X64 | IPF | ARM | PPC | AARCH64\r
30fdf114
LG
43# @var BuildTargets: To store value for BuildTargets, selection scope is in below list\r
44# RELEASE | DEBUG\r
45# @var IntermediateDirectories: To store value for IntermediateDirectories, selection scope is in below list\r
46# MODULE | UNIFIED\r
47# @var OutputDirectory: To store value for OutputDirectory\r
48# @var ForceDebugTarget: To store value for ForceDebugTarget\r
49# @var SkuIdName: To store value for SkuIdName\r
50# @var BuildNumber: To store value for BuildNumber\r
51# @var MakefileName: To store value for MakefileName\r
52# @var ClonedFrom: To store value for ClonedFrom, it is a list structure as\r
53# [ ClonedRecordClass, ... ]\r
54#\r
55class PlatformHeaderClass(IdentificationClass, CommonHeaderClass, DefineClass):\r
56 def __init__(self):\r
57 IdentificationClass.__init__(self)\r
58 CommonHeaderClass.__init__(self)\r
59 DefineClass.__init__(self)\r
60 self.DscSpecification = ''\r
61 self.SupArchList = []\r
62 self.BuildTargets = []\r
63 self.IntermediateDirectories = ''\r
64 self.OutputDirectory = '' \r
65 self.ForceDebugTarget = ''\r
66 self.SkuIdName = []\r
67 self.BuildNumber = ''\r
68 self.MakefileName = ''\r
69 self.ClonedFrom = []\r
70\r
71## PlatformFlashDefinitionFileClass\r
72#\r
73# This class defined FlashDefinitionFile item used in platform file\r
74# \r
75# @param object: Inherited from object class\r
76#\r
77# @var Id: To store value for Id\r
78# @var UiName: To store value for UiName\r
79# @var Preferred: To store value for Preferred\r
80# @var FilePath: To store value for FilePath\r
81#\r
82class PlatformFlashDefinitionFileClass(object):\r
83 def __init__(self):\r
84 self.Id = ''\r
85 self.UiName = ''\r
86 self.Preferred = False\r
87 self.FilePath = ''\r
88\r
f0dc69e6
YZ
89## BuildScriptClass\r
90#\r
91# This class defined PREBUILD/POSTBUILD item used in platform file\r
92#\r
93# @param object: Inherited from object class\r
94#\r
95# @var Id: To store value for Id\r
96# @var UiName: To store value for UiName\r
97# @var Preferred: To store value for Preferred\r
98# @var FilePath: To store value for FilePath\r
99#\r
100class BuildScriptClass(object):\r
101 def __init__(self):\r
102 self.Id = ''\r
103 self.UiName = ''\r
104 self.Preferred = False\r
105 self.FilePath = ''\r
106\r
30fdf114
LG
107## PlatformFvImageOptionClass\r
108#\r
109# This class defined FvImageOption item used in platform file\r
110# \r
111# @param object: Inherited from object class\r
112#\r
113# @var FvImageOptionName: To store value for FvImageOptionName\r
114# @var FvImageOptionValues: To store value for FvImageOptionValues\r
115#\r
116class PlatformFvImageOptionClass(object):\r
117 def __init__(self):\r
118 self.FvImageOptionName = ''\r
119 self.FvImageOptionValues = []\r
120\r
121## PlatformFvImageClass\r
122#\r
123# This class defined FvImage item used in platform file\r
124# \r
125# @param object: Inherited from object class\r
126#\r
127# @var Name: To store value for Name\r
128# @var Value: To store value for Value\r
129# @var Type: To store value for Type, selection scope is in below list\r
130# Attributes | Options | Components | ImageName \r
131# @var FvImageNames: To store value for FvImageNames\r
132# @var FvImageOptions: To store value for FvImageOptions, it is a list structure as\r
133# [ PlatformFvImageOption, ...]\r
134#\r
135class PlatformFvImageClass(object):\r
136 def __init__(self):\r
137 self.Name = ''\r
138 self.Value = ''\r
139 self.Type = ''\r
140 self.FvImageNames = []\r
141 self.FvImageOptions = []\r
142\r
143## PlatformFvImageNameClass\r
144#\r
145# This class defined FvImageName item used in platform file\r
146# \r
147# @param object: Inherited from object class\r
148#\r
149# @var Name: To store value for Name\r
150# @var Type: To store value for Type, selection scope is in below list\r
151# FV_MAIN | FV_MAIN_COMPACT | NV_STORAGE | FV_RECOVERY | FV_RECOVERY_FLOPPY | FV_FILE | CAPSULE_CARGO | NULL | USER_DEFINED \r
152# @var FvImageOptions: To store value for FvImageOptions, it is a list structure as\r
153# [ PlatformFvImageOption, ...]\r
154#\r
155class PlatformFvImageNameClass(object):\r
156 def __init__(self):\r
157 self.Name = ''\r
158 self.Type = ''\r
159 self.FvImageOptions = []\r
160\r
161## PlatformFvImagesClass\r
162#\r
163# This class defined FvImages item used in platform file\r
164# \r
165# @param object: Inherited from object class\r
166#\r
167# @var FvImages: To store value for FvImages\r
168#\r
169class PlatformFvImagesClass(object):\r
170 def __init__(self):\r
171 self.FvImages = []\r
172\r
173## PlatformAntTaskClass\r
174#\r
175# This class defined AntTask item used in platform file\r
176# \r
177# @param object: Inherited from object class\r
178#\r
179# @var Id: To store value for Id\r
180# @var AntCmdOptions: To store value for AntCmdOptions\r
181# @var FilePath: To store value for FilePath\r
182#\r
183class PlatformAntTaskClass(object):\r
184 def __init__(self):\r
185 self.Id = ''\r
186 self.AntCmdOptions = ''\r
187 self.FilePath = ''\r
188\r
189## PlatformFfsSectionClass\r
190#\r
191# This class defined FfsSection item used in platform file\r
192# \r
193# @param CommonClass: Inherited from CommonClass class\r
194#\r
195# @var BindingOrder: To store value for BindingOrder\r
196# @var Compressible: To store value for Compressible\r
197# @var SectionType: To store value for SectionType\r
198# @var EncapsulationType: To store value for EncapsulationType\r
199# @var ToolName: To store value for ToolName\r
200# @var Filenames: To store value for Filenames\r
201# @var Args: To store value for Args\r
202# @var OutFile: To store value for OutFile\r
203# @var OutputFileExtension: To store value for OutputFileExtension\r
204# @var ToolNameElement: To store value for ToolNameElement\r
205#\r
206class PlatformFfsSectionClass(CommonClass):\r
207 def __init__(self):\r
208 CommonClass.__init__(self)\r
209 self.BindingOrder = ''\r
210 self.Compressible = ''\r
211 self.SectionType = ''\r
212 self.EncapsulationType = ''\r
213 self.ToolName = ''\r
214 self.Filenames = []\r
215 self.Args = ''\r
216 self.OutFile = ''\r
217 self.OutputFileExtension = ''\r
218 self.ToolNameElement = ''\r
219\r
220## PlatformFfsSectionsClass\r
221#\r
222# This class defined FfsSections item used in platform file\r
223# \r
224# @param CommonClass: Inherited from CommonClass class\r
225#\r
226# @var BindingOrder: To store value for BindingOrder\r
227# @var Compressible: To store value for Compressible\r
228# @var SectionType: To store value for SectionType\r
229# @var EncapsulationType: To store value for EncapsulationType\r
230# @var ToolName: To store value for ToolName\r
231# @var Section: To store value for Section, it is a list structure as\r
232# [ PlatformFfsSectionClass, ... ]\r
233# @var Sections: To store value for Sections, it is a list structure as\r
234# [ PlatformFfsSectionsClass, ...]\r
235#\r
236class PlatformFfsSectionsClass(CommonClass):\r
237 def __init__(self):\r
238 CommonClass.__init__(self)\r
239 self.BindingOrder = ''\r
240 self.Compressible = ''\r
241 self.SectionType = ''\r
242 self.EncapsulationType = ''\r
243 self.ToolName = ''\r
244 self.Section = []\r
245 self.Sections = []\r
246\r
247## PlatformFfsClass\r
248#\r
249# This class defined Ffs item used in platform file\r
250# \r
251# @param object: Inherited from object class\r
252#\r
253# @var Attribute: To store value for Attribute, it is a set structure as\r
254# { [(Name, PlatformFfsSectionsClass)] : Value}\r
255# @var Sections: To store value for Sections, it is a list structure as\r
256# [ PlatformFfsSectionsClass]\r
257# @var ToolName: To store value for ToolName\r
258#\r
259class PlatformFfsClass(object):\r
260 def __init__(self):\r
261 self.Attribute = {}\r
262 self.Sections = []\r
263 self.Key = ''\r
264\r
265## PlatformBuildOptionClass\r
266#\r
267# This class defined BuildOption item used in platform file\r
268# \r
269# @param object: Inherited from object class\r
270#\r
271# @var UserDefinedAntTasks: To store value for UserDefinedAntTasks, it is a set structure as\r
272# { [Id] : PlatformAntTaskClass, ...}\r
273# @var Options: To store value for Options, it is a list structure as\r
274# [ BuildOptionClass, ...]\r
275# @var UserExtensions: To store value for UserExtensions, it is a set structure as\r
276# { [(UserID, Identifier)] : UserExtensionsClass, ...}\r
277# @var FfsKeyList: To store value for FfsKeyList, it is a set structure as\r
278# { [FfsKey]: PlatformFfsClass, ...} \r
279#\r
280class PlatformBuildOptionClass(object):\r
281 def __init__(self):\r
282 self.UserDefinedAntTasks = {}\r
283 self.Options = []\r
284 self.UserExtensions = {}\r
285 self.FfsKeyList = {}\r
286\r
287## PlatformBuildOptionClasses\r
288#\r
289# This class defined BuildOption item list used in platform file\r
290# \r
291# @param IncludeStatementClass: Inherited from IncludeStatementClass class\r
292#\r
293# @var FvBinding: To store value for FvBinding\r
294# @var FfsFileNameGuid: To store value for FfsFileNameGuid\r
295# @var FfsFormatKey: To store value for FfsFormatKey\r
296# @var BuildOptionList: To store value for BuildOptionList, it is a list structure as\r
297# [ BuildOptionClass, ... ]\r
298#\r
299class PlatformBuildOptionClasses(IncludeStatementClass):\r
300 def __init__(self):\r
301 IncludeStatementClass.__init__(self)\r
302 self.FvBinding = ''\r
303 self.FfsFileNameGuid = ''\r
304 self.FfsFormatKey = ''\r
305 self.BuildOptionList = []\r
306\r
307## PlatformLibraryClass\r
308#\r
309# This class defined Library item used in platform file\r
310# \r
311# @param CommonClass: Inherited from CommonClass class\r
312# @param DefineClass: Inherited from DefineClass class\r
313# @param Name: Input value for Name, default is ''\r
314# @param FilePath: Input value for FilePath, default is ''\r
315#\r
316# @var Name: To store value for Name\r
317# @var FilePath: To store value for FilePath\r
318# @var ModuleType: To store value for ModuleType\r
319# @var SupModuleList: To store value for SupModuleList\r
320# @var ModuleGuid: To store value for ModuleGuid\r
321# @var ModuleVersion: To store value for ModuleVersion\r
322# @var PackageGuid: To store value for PackageGuid\r
323# @var PackageVersion: To store value for PackageVersion\r
324#\r
325class PlatformLibraryClass(CommonClass, DefineClass):\r
326 def __init__(self, Name = '', FilePath = ''):\r
327 CommonClass.__init__(self)\r
328 DefineClass.__init__(self)\r
329 self.Name = Name\r
330 self.FilePath = FilePath\r
331 self.ModuleType = []\r
332 self.SupModuleList = []\r
333 self.ModuleGuid = ''\r
334 self.ModuleVersion = ''\r
335 self.PackageGuid = ''\r
336 self.PackageVersion = ''\r
337\r
338## PlatformLibraryClasses\r
339#\r
340# This class defined Library item list used in platform file\r
341# \r
342# @param IncludeStatementClass: Inherited from IncludeStatementClass class\r
343#\r
344# @var LibraryList: To store value for LibraryList, it is a list structure as\r
345# [ PlatformLibraryClass, ... ]\r
346#\r
347class PlatformLibraryClasses(IncludeStatementClass):\r
348 def __init__(self):\r
349 IncludeStatementClass.__init__(self)\r
350 self.LibraryList = []\r
351\r
352## PlatformModuleClass\r
353#\r
354# This class defined Module item used in platform file\r
355# \r
356# @param CommonClass: Inherited from CommonClass class\r
357# @param DefineClass: Inherited from DefineClass class\r
358# @param IncludeStatementClass: Inherited from IncludeStatementClass class\r
359#\r
360# @var Name: To store value for Name (Library name or libraryclass name or module name)\r
361# @var FilePath: To store value for FilePath\r
362# @var Type: To store value for Type, selection scope is in below list\r
363# LIBRARY | LIBRARY_CLASS | MODULE\r
364# @var ModuleType: To store value for ModuleType\r
365# @var ExecFilePath: To store value for ExecFilePath\r
366# @var LibraryClasses: To store value for LibraryClasses, it is a structure as\r
367# PlatformLibraryClasses\r
368# @var PcdBuildDefinitions: To store value for PcdBuildDefinitions, it is a list structure as\r
369# [ PcdClass, ...]\r
370# @var ModuleSaBuildOption: To store value for ModuleSaBuildOption, it is a structure as\r
371# PlatformBuildOptionClasses\r
372# @var Specifications: To store value for Specifications, it is a list structure as\r
373# [ '', '', ...]\r
374#\r
375class PlatformModuleClass(CommonClass, DefineClass, IncludeStatementClass):\r
376 def __init__(self):\r
377 CommonClass.__init__(self)\r
378 DefineClass.__init__(self)\r
379 self.Name = ''\r
380 self.FilePath = ''\r
381 self.Type = ''\r
382 self.ModuleType = ''\r
383 self.ExecFilePath = ''\r
384 self.LibraryClasses = PlatformLibraryClasses()\r
385 self.PcdBuildDefinitions = []\r
386 self.ModuleSaBuildOption = PlatformBuildOptionClasses()\r
387 self.Specifications = []\r
388 self.SourceOverridePath = ''\r
389\r
390## PlatformModuleClasses\r
391#\r
392# This class defined Module item list used in platform file\r
393# \r
394# @param IncludeStatementClass: Inherited from IncludeStatementClass class\r
395#\r
396# @var ModuleList: To store value for ModuleList, it is a list structure as\r
397# [ PlatformModuleClass, ... ]\r
398#\r
399class PlatformModuleClasses(IncludeStatementClass):\r
400 def __init__(self):\r
401 IncludeStatementClass.__init__(self)\r
402 self.ModuleList = []\r
403\r
404## PlatformClass\r
405#\r
406# This class defined a complete platform item\r
407# \r
408# @param object: Inherited from object class\r
409#\r
410# @var Header: To store value for Header, it is a structure as\r
411# {Arch : PlatformHeaderClass()}\r
412# @var SkuInfos: To store value for SkuInfos, it is a structure as\r
413# SkuInfoListClass\r
414# @var Libraries: To store value for Libraries, it is a structure as\r
415# PlatformLibraryClasses\r
416# @var LibraryClasses: To store value for LibraryClasses, it is a structure as\r
417# PlatformLibraryClasses\r
418# @var Modules: To store value for Modules, it is a structure as\r
419# PlatformModuleClasses\r
420# @var FlashDefinitionFile: To store value for FlashDefinitionFile, it is a structure as\r
421# PlatformFlashDefinitionFileClass\r
f0dc69e6
YZ
422# @var Prebuild: To store value for PREBUILD, it is a structure as\r
423# BuildScriptClass\r
424# @var Postbuild: To store value for POSTBUILD, it is a structure as\r
425# BuildScriptClass\r
30fdf114
LG
426# @var BuildOptions: To store value for BuildOptions, it is a structure as\r
427# PlatformBuildOptionClasses\r
428# @var DynamicPcdBuildDefinitions: To store value for DynamicPcdBuildDefinitions, it is a list structure as\r
429# [ PcdClass, ...]\r
430# @var Fdf: To store value for Fdf, it is a list structure as\r
431# [ FdfClass, ...]\r
432# @var UserExtensions: To store value for UserExtensions, it is a list structure as\r
433# [ UserExtensionsClass, ...]\r
434#\r
435class PlatformClass(object):\r
436 def __init__(self):\r
437 self.Header = {}\r
438 self.SkuInfos = SkuInfoListClass()\r
439 self.Libraries = PlatformLibraryClasses()\r
440 self.LibraryClasses = PlatformLibraryClasses()\r
441 self.Modules = PlatformModuleClasses()\r
442 self.FlashDefinitionFile = PlatformFlashDefinitionFileClass()\r
f0dc69e6
YZ
443 self.Prebuild = BuildScriptClass()\r
444 self.Postbuild = BuildScriptClass()\r
30fdf114
LG
445 self.BuildOptions = PlatformBuildOptionClasses()\r
446 self.DynamicPcdBuildDefinitions = []\r
447 self.Fdf = []\r
448 self.UserExtensions = []\r
449\r
450##\r
451#\r
452# This acts like the main() function for the script, unless it is 'import'ed into another\r
453# script.\r
454#\r
455if __name__ == '__main__':\r
456 P = PlatformClass()\r