git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@381 7335b...
[people/mcb30/basetools.git] / Source / Python / Common / EdkIIWorkspaceBuild.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 each component of the build database\r
12 #\r
13 \r
14 #\r
15 # Import Modules\r
16 #\r
17 import os, string, copy, pdb\r
18 import EdkLogger\r
19 import DataType\r
20 from EdkIIWorkspace import *\r
21 from TargetTxtClassObject import *\r
22 from ToolDefClassObject import *\r
23 from InfClassObject import *\r
24 from DecClassObject import *\r
25 from DscClassObject import *\r
26 from String import *\r
27 from BuildToolError import *\r
28 \r
29 \r
30 class ModuleSourceFilesClassObject(object):\r
31     def __init__(self, SourceFile = '', PcdFeatureFlag = '', TagName = '', ToolCode = '', ToolChainFamily = '', String = ''):\r
32         self.SourceFile         = SourceFile\r
33         self.TagName            = TagName\r
34         self.ToolCode           = ToolCode\r
35         self.ToolChainFamily    = ToolChainFamily\r
36         self.String             = String\r
37         self.PcdFeatureFlag     = PcdFeatureFlag\r
38     \r
39     def __str__(self):\r
40         return self.SourceFile\r
41     \r
42     def __repr__(self):\r
43         rtn = self.SourceFile + DataType.TAB_VALUE_SPLIT + \\r
44               self.PcdFeatureFlag + DataType.TAB_VALUE_SPLIT + \\r
45               self.ToolChainFamily +  DataType.TAB_VALUE_SPLIT + \\r
46               self.TagName + DataType.TAB_VALUE_SPLIT + \\r
47               self.ToolCode + DataType.TAB_VALUE_SPLIT + \\r
48               self.String\r
49         return rtn\r
50 \r
51 class ModuleBinaryFilesClassObject(object):\r
52     def __init__(self, BinaryFile = '', FileType = '', Target = '', PcdFeatureFlag = ''):\r
53         self.BinaryFile = BinaryFile\r
54         self.FileType =FileType\r
55         self.Target = Target\r
56         self.PcdFeatureFlag = PcdFeatureFlag\r
57     \r
58     def __str__(self):\r
59         rtn = self.BinaryFile + DataType.TAB_VALUE_SPLIT + \\r
60               self.FileType + DataType.TAB_VALUE_SPLIT + \\r
61               self.Target +  DataType.TAB_VALUE_SPLIT + \\r
62               self.PcdFeatureFlag\r
63         return rtn\r
64         \r
65 class PcdClassObject(object):\r
66     def __init__(self, Name = None, Guid = None, Type = None, DatumType = None, Value = None, Token = None, MaxDatumSize = None, SkuInfoList = []):\r
67         self.TokenCName = Name\r
68         self.TokenSpaceGuidCName = Guid\r
69         self.Type = Type\r
70         self.DatumType = DatumType\r
71         self.DefaultValue = Value\r
72         self.TokenValue = Token\r
73         self.MaxDatumSize = MaxDatumSize\r
74         self.SkuInfoList = SkuInfoList\r
75         self.Phase = "DXE"\r
76         \r
77     def __str__(self):\r
78         rtn = str(self.TokenCName) + DataType.TAB_VALUE_SPLIT + \\r
79               str(self.TokenSpaceGuidCName) + DataType.TAB_VALUE_SPLIT + \\r
80               str(self.Type) + DataType.TAB_VALUE_SPLIT + \\r
81               str(self.DatumType) + DataType.TAB_VALUE_SPLIT + \\r
82               str(self.DefaultValue) + DataType.TAB_VALUE_SPLIT + \\r
83               str(self.TokenValue) + DataType.TAB_VALUE_SPLIT + \\r
84               str(self.MaxDatumSize) + DataType.TAB_VALUE_SPLIT\r
85         for Item in self.SkuInfoList:\r
86             rtn = rtn + str(Item)\r
87         return rtn\r
88 \r
89     def __eq__(self, other):\r
90         return other != None and self.TokenCName == other.TokenCName and self.TokenSpaceGuidCName == other.TokenSpaceGuidCName\r
91 \r
92     def __hash__(self):\r
93         return hash((self.TokenCName, self.TokenSpaceGuidCName))\r
94 \r
95 class LibraryClassObject(object):\r
96     def __init__(self, Name = None, Type = None):\r
97         self.LibraryClass = Name\r
98         self.SupModList = []\r
99         if Type != None:\r
100             self.SupModList = CleanString(Type).split(DataType.TAB_SPACE_SPLIT)\r
101         \r
102 class ModuleBuildClassObject(object):\r
103     def __init__(self):\r
104         self.DescFilePath            = ''\r
105         self.BaseName                = ''\r
106         self.ModuleType              = ''\r
107         self.Guid                    = ''\r
108         self.Version                 = ''\r
109         self.PcdIsDriver             = ''\r
110         self.BinaryModule            = ''\r
111         self.CustomMakefile          = {}\r
112         self.Specification           = {}\r
113         self.LibraryClass            = None      # LibraryClassObject\r
114         self.ModuleEntryPointList    = []\r
115         self.ModuleUnloadImageList   = []\r
116         self.ConstructorList         = []\r
117         self.DestructorList          = []\r
118         \r
119         self.Binaries                = []        #[ ModuleBinaryClassObject, ...]\r
120         self.Sources                 = []        #[ ModuleSourceFilesClassObject, ... ]\r
121         self.LibraryClasses          = {}        #{ [LibraryClassName, ModuleType] : LibraryClassInfFile }\r
122         self.Protocols               = []        #[ ProtocolName, ... ]\r
123         self.Ppis                    = []        #[ PpiName, ... ]\r
124         self.Guids                   = []        #[ GuidName, ... ]\r
125         self.Includes                = []        #[ IncludePath, ... ]\r
126         self.Packages                = []        #[ DecFileName, ... ]\r
127         self.Pcds                    = {}        #{ [(PcdCName, PcdGuidCName)] : PcdClassObject}\r
128         self.BuildOptions            = {}        #{ [BuildOptionKey] : BuildOptionValue}\r
129         self.Depex                   = ''\r
130 \r
131     def __str__(self):\r
132         return self.DescFilePath\r
133 \r
134     def __eq__(self, other):\r
135         return self.DescFilePath == str(other)\r
136 \r
137     def __hash__(self):\r
138         return hash(self.DescFilePath)\r
139 \r
140 class PackageBuildClassObject(object):\r
141     def __init__(self):\r
142         self.DescFilePath            = ''\r
143         self.PackageName             = ''\r
144         self.Guid                    = ''\r
145         self.Version                 = ''\r
146         \r
147         self.Protocols               = {}       #{ [ProtocolName] : Protocol Guid, ... }\r
148         self.Ppis                    = {}       #{ [PpiName] : Ppi Guid, ... }\r
149         self.Guids                   = {}       #{ [GuidName] : Guid, ... }\r
150         self.Includes                = []       #[ IncludePath, ... ]        \r
151         self.LibraryClasses          = {}       #{ [LibraryClassName] : LibraryClassInfFile }\r
152         self.Pcds                    = {}       #{ [(PcdCName, PcdGuidCName)] : PcdClassObject}\r
153         \r
154     def __str__(self):\r
155         return self.DescFilePath\r
156 \r
157     def __eq__(self, other):\r
158         return self.DescFilePath == str(other)\r
159 \r
160     def __hash__(self):\r
161         return hash(self.DescFilePath)\r
162 \r
163 class PlatformBuildClassObject(object):\r
164     def __init__(self):\r
165         self.DescFilePath            = ''\r
166         self.PlatformName            = ''\r
167         self.Guid                    = ''\r
168         self.Version                 = ''\r
169         self.DscSpecification        = ''\r
170         self.OutputDirectory         = ''\r
171         self.FlashDefinition         = ''\r
172         self.BuildNumber             = ''\r
173         self.MakefileName            = ''\r
174                 \r
175         self.SkuIds                  = {}       #{ 'SkuName' : SkuId, '!include' : includefilename, ...}\r
176         self.Modules                 = []       #[ InfFileName, ... ]\r
177         self.LibraryClasses          = {}       #{ (LibraryClassName, ModuleType) : LibraryClassInfFile }\r
178         self.Pcds                    = {}       #{ [(PcdCName, PcdGuidCName)] : PcdClassObject }\r
179         self.BuildOptions            = {}       #{ [BuildOptionKey] : BuildOptionValue }    \r
180 \r
181     def __str__(self):\r
182         return self.DescFilePath\r
183 \r
184     def __eq__(self, other):\r
185         return self.DescFilePath == str(other)\r
186 \r
187     def __hash__(self):\r
188         return hash(self.DescFilePath)\r
189 \r
190 class ItemBuild(object):\r
191     def __init__(self, arch, platform = None, package = None, module = None):\r
192         self.Arch                    = arch\r
193         self.PlatformDatabase        = {}        #{ [DscFileName] : PlatformBuildClassObject, ...}\r
194         self.PackageDatabase         = {}        #{ [DecFileName] : PacakgeBuildClassObject, ...}\r
195         self.ModuleDatabase          = {}        #{ [InfFileName] : ModuleBuildClassObject, ...}\r
196         \r
197 class WorkspaceBuild(object):\r
198     def __init__(self, ActivePlatform, WorkspaceDir):\r
199         self.WorkspaceDir            = NormPath(WorkspaceDir)\r
200         self.SupArchList             = []        #[ 'IA32', 'X64', ...]\r
201         self.BuildTarget             = []        #[ 'RELEASE', 'DEBUG']\r
202         self.SkuId                   = ''\r
203         self.Fdf                     = ''\r
204         \r
205         self.InfDatabase             = {}        #{ [InfFileName] : InfClassObject}\r
206         self.DecDatabase             = {}        #{ [DecFileName] : DecClassObject}\r
207         self.DscDatabase             = {}        #{ [DscFileName] : DscClassObject}\r
208         \r
209         self.Build                   = {}\r
210         for key in DataType.ARCH_LIST:\r
211             self.Build[key] = ItemBuild(key)\r
212         \r
213         # Get active platform\r
214         dscFileName = NormPath(ActivePlatform)\r
215         File = self.WorkspaceFile(dscFileName)\r
216         if os.path.exists(File) and os.path.isfile(File):\r
217             self.DscDatabase[dscFileName] = Dsc(File, True)\r
218         else:\r
219             raise ParserError(FILE_NOT_FOUND, name = File)\r
220         \r
221         # parse platform to get module\r
222         for dsc in self.DscDatabase.keys():\r
223             dscObj = self.DscDatabase[dsc]\r
224             \r
225             #\r
226             # Get global information\r
227             #\r
228             self.SupArchList = dscObj.Defines.DefinesDictionary[TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES]\r
229             self.BuildTarget = dscObj.Defines.DefinesDictionary[TAB_DSC_DEFINES_BUILD_TARGETS]\r
230             self.SkuId = dscObj.Defines.DefinesDictionary[TAB_DSC_DEFINES_SKUID_IDENTIFIER][0]\r
231             \r
232             #Get all inf\r
233             for key in DataType.ARCH_LIST:\r
234                 for index in range(len(dscObj.Contents[key].LibraryClasses)):\r
235                     self.AddToInfDatabase(dscObj.Contents[key].LibraryClasses[index][0].split(DataType.TAB_VALUE_SPLIT, 1)[1])\r
236                 for index in range(len(dscObj.Contents[key].Components)):\r
237                     Module = dscObj.Contents[key].Components[index][0]\r
238                     LibList = dscObj.Contents[key].Components[index][1]\r
239                     self.AddToInfDatabase(Module)\r
240                     for indexOfLib in range(len(LibList)):\r
241                         Lib = LibList[indexOfLib]\r
242                         if len(Lib.split(DataType.TAB_VALUE_SPLIT)) == 2:\r
243                             self.AddToInfDatabase(CleanString(Lib.split(DataType.TAB_VALUE_SPLIT)[1]))\r
244                             self.UpdateInfDatabase(Module, CleanString(Lib.split(DataType.TAB_VALUE_SPLIT)[0]), key)\r
245         #End For of Dsc\r
246         \r
247         #parse module to get package\r
248         for inf in self.InfDatabase.keys():\r
249             infObj = self.InfDatabase[inf]\r
250             #Get all dec\r
251             for key in DataType.ARCH_LIST:\r
252                 for index in range(len(infObj.Contents[key].Packages)):\r
253                     self.AddToDecDatabase(infObj.Contents[key].Packages[index])\r
254     #End of self.Init()\r
255     \r
256     #\r
257     # Return a full path with workspace dir\r
258     #\r
259     def WorkspaceFile(self, Filename):\r
260         return os.path.join(self.WorkspaceDir, Filename)\r
261     \r
262     def GenBuildDatabase(self, PcdsSet = {}):\r
263         #Build databases\r
264         #Build PlatformDatabase\r
265         for dsc in self.DscDatabase.keys():\r
266             dscObj = self.DscDatabase[dsc]\r
267             \r
268             for key in DataType.ARCH_LIST:\r
269                 pb = PlatformBuildClassObject()\r
270                 pb.DescFilePath = dsc\r
271                 pb.PlatformName = dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_PLATFORM_NAME][0]\r
272                 pb.Guid = dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_PLATFORM_GUID][0]\r
273                 pb.Version = dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_PLATFORM_VERSION][0]\r
274                 pb.DscSpecification = dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_DSC_SPECIFICATION][0]\r
275                 pb.OutputDirectory = NormPath(dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_OUTPUT_DIRECTORY][0])\r
276                 pb.FlashDefinition = NormPath(dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_FLASH_DEFINITION][0])\r
277                 pb.BuildNumber = dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_BUILD_NUMBER][0]\r
278                 pb.MakefileName = NormPath(dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_MAKEFILE_NAME][0])\r
279         \r
280                 #SkuId\r
281                 for index in range(len(dscObj.Contents[key].SkuIds)):\r
282                     SkuInfo = dscObj.Contents[key].SkuIds[index]\r
283                     SkuName = ''\r
284                     SkuId = ''\r
285                     if SkuInfo.find('!include') > -1:\r
286                         SkuName = '!include'\r
287                         SkuId = NormPath(CleanString(SkuInfo[SkuInfo.find('!include') + len('!include'):]))\r
288                     elif len(SkuInfo.split(DataType.TAB_VALUE_SPLIT)) == 2:\r
289                         SkuName = CleanString(SkuInfo.split(DataType.TAB_VALUE_SPLIT)[1])\r
290                         SkuId = CleanString(SkuInfo.split(DataType.TAB_VALUE_SPLIT)[0])\r
291                     else:\r
292                         raise ParseError('Wrong defintion for SkuId: %s' % SkuInfo)\r
293                     pb.SkuIds[SkuName] = SkuId\r
294                 \r
295                 #Module\r
296                 for index in range(len(dscObj.Contents[key].Components)):\r
297                     pb.Modules.append(NormPath(dscObj.Contents[key].Components[index][0]))\r
298                 \r
299                 #BuildOptions\r
300                 for index in range(len(dscObj.Contents[key].BuildOptions)):\r
301                     b = dscObj.Contents[key].BuildOptions[index].split(DataType.TAB_EQUAL_SPLIT, 1)\r
302                     Family = ''\r
303                     ToolChain = ''\r
304                     Flag = ''\r
305                     if b[0].find(':') > -1:\r
306                         Family = CleanString(b[0][ : b[0].find(':')])\r
307                         ToolChain = CleanString(b[0][b[0].find(':') + 1 : ])\r
308                     else:\r
309                         ToolChain = CleanString(b[0])\r
310                     Flag = CleanString(b[1])\r
311                     pb.BuildOptions[(Family, ToolChain)] = Flag\r
312                     \r
313                 #LibraryClass\r
314                 for index in range(len(dscObj.Contents[key].LibraryClasses)):\r
315                     #['DebugLib|MdePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf', ['DXE_CORE']]\r
316                     print dscObj.Contents[key].LibraryClasses[index]\r
317                     list = dscObj.Contents[key].LibraryClasses[index][0].split(DataType.TAB_VALUE_SPLIT, 1)\r
318                     type = dscObj.Contents[key].LibraryClasses[index][1][0]\r
319                     pb.LibraryClasses[(list[0], type)] = NormPath(list[1])\r
320 \r
321                 #Pcds\r
322                 for index in range(len(dscObj.Contents[key].PcdsFixedAtBuild)):\r
323                     pcd = dscObj.Contents[key].PcdsFixedAtBuild[index].split(DataType.TAB_VALUE_SPLIT)\r
324                     pcd.append(None)\r
325                     pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_FIXED_AT_BUILD, None, pcd[2], None, pcd[3])\r
326                 for index in range(len(dscObj.Contents[key].PcdsPatchableInModule)):\r
327                     pcd = dscObj.Contents[key].PcdsPatchableInModule[index].split(DataType.TAB_VALUE_SPLIT)\r
328                     pcd.append(None)\r
329                     pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_PATCHABLE_IN_MODULE, None, pcd[2], None, pcd[3])\r
330                 for index in range(len(dscObj.Contents[key].PcdsFeatureFlag)):\r
331                     pcd = dscObj.Contents[key].PcdsFeatureFlag[index].split(DataType.TAB_VALUE_SPLIT)\r
332                     pcd.append(None)                    \r
333                     pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_FEATURE_FLAG, None, pcd[2], None, pcd[3])\r
334                 #\r
335                 # PcdsDynamic\r
336                 #\r
337                 for index in range(len(dscObj.Contents[key].PcdsDynamicDefault)):\r
338                     pcd = dscObj.Contents[key].PcdsDynamicDefault[index][0].split(DataType.TAB_VALUE_SPLIT)\r
339                     pcd.append(None)\r
340                     SkuName = dscObj.Contents[key].PcdsDynamicDefault[index][1]\r
341                     SkuInfoList = []\r
342                     if SkuName == None:\r
343                         SkuName = 'DEFAULT'\r
344                     SkuNameList = map(lambda l: l.strip(), SkuName.split(DataType.TAB_VALUE_SPLIT))\r
345                     for Item in SkuNameList:\r
346                         SkuInfo = SkuInfoClassObject()\r
347                         SkuInfo.SkuId = pb.SkuIds[Item]\r
348                         SkuInfo.DefaultValue = pcd[2]\r
349                         SkuInfoList.append(SkuInfo)\r
350                     pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_DEFAULT, None, None, None, pcd[3], SkuInfoList)\r
351                 for index in range(len(dscObj.Contents[key].PcdsDynamicVpd)):\r
352                     pcd = dscObj.Contents[key].PcdsDynamicVpd[index][0].split(DataType.TAB_VALUE_SPLIT)\r
353                     pcd.append(None)\r
354                     SkuId = dscObj.Contents[key].PcdsDynamicVpd[index][1]\r
355                     SkuInfoList = []\r
356                     if SkuId == None:\r
357                         SkuId = 'DEFAULT'\r
358                     SkuIdList = map(lambda l: l.strip(), SkuId.split(DataType.TAB_VALUE_SPLIT))\r
359                     for Item in SkuIdList:\r
360                         SkuInfo = SkuInfoClassObject()\r
361                         SkuInfo.SkuId = Item\r
362                         SkuInfo.VpdOffset = pcd[2]\r
363                         SkuInfoList.append(SkuInfo)\r
364                     pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_VPD, None, None, None, pcd[3], SkuInfoList)\r
365                 for index in range(len(dscObj.Contents[key].PcdsDynamicHii)):\r
366                     pcd = dscObj.Contents[key].PcdsDynamicHii[index][0].split(DataType.TAB_VALUE_SPLIT)\r
367                     pcd.append(None)\r
368                     SkuId = dscObj.Contents[key].PcdsDynamicHii[index][1]\r
369                     SkuInfoList = []\r
370                     if SkuId == None:\r
371                         SkuId = 'DEFAULT'\r
372                     SkuIdList = map(lambda l: l.strip(), SkuId.split(DataType.TAB_VALUE_SPLIT))\r
373                     for Item in SkuIdList:\r
374                         SkuInfo = SkuInfoClassObject()\r
375                         SkuInfo.SkuId = Item\r
376                         SkuInfo.VariableName = pcd[2]\r
377                         SkuInfo.VariableGuid = pcd[3]\r
378                         SkuInfo.VariableOffset = pcd[4]\r
379                         SkuInfo.HiiDefaultValue = pcd[5]                                                \r
380                         SkuInfoList.append(SkuInfo)\r
381                     pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_HII, None, None, None, pcd[6], SkuInfoList)\r
382                 #\r
383                 # PcdsDynamicEx\r
384                 #\r
385                 for index in range(len(dscObj.Contents[key].PcdsDynamicExDefault)):\r
386                     pcd = dscObj.Contents[key].PcdsDynamicExDefault[index][0].split(DataType.TAB_VALUE_SPLIT)\r
387                     pcd.append(None)\r
388                     SkuId = dscObj.Contents[key].PcdsDynamicExDefault[index][1]\r
389                     SkuInfoList = []\r
390                     if SkuId == None:\r
391                         SkuId = 'DEFAULT'\r
392                     SkuIdList = map(lambda l: l.strip(), SkuId.split(DataType.TAB_VALUE_SPLIT))\r
393                     for Item in SkuIdList:\r
394                         SkuInfo = SkuInfoClassObject()\r
395                         SkuInfo.SkuId = Item\r
396                         SkuInfo.DefaultValue = pcd[2]\r
397                         SkuInfoList.append(SkuInfo)\r
398                     pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_EX_DEFAULT, None, None, None, pcd[3], SkuInfoList)\r
399                 for index in range(len(dscObj.Contents[key].PcdsDynamicExVpd)):\r
400                     pcd = dscObj.Contents[key].PcdsDynamicExVpd[index][0].split(DataType.TAB_VALUE_SPLIT)\r
401                     pcd.append(None)\r
402                     SkuId = dscObj.Contents[key].PcdsDynamicExVpd[index][1]\r
403                     SkuInfoList = []\r
404                     if SkuId == None:\r
405                         SkuId = 'DEFAULT'\r
406                     SkuIdList = map(lambda l: l.strip(), SkuId.split(DataType.TAB_VALUE_SPLIT))\r
407                     for Item in SkuIdList:\r
408                         SkuInfo = SkuInfoClassObject()\r
409                         SkuInfo.SkuId = Item\r
410                         SkuInfo.VpdOffset = pcd[2]\r
411                         SkuInfoList.append(SkuInfo)\r
412                     pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_EX_VPD, None, None, None, pcd[3], SkuInfoList)\r
413                 for index in range(len(dscObj.Contents[key].PcdsDynamicExHii)):\r
414                     pcd = dscObj.Contents[key].PcdsDynamicExHii[index][0].split(DataType.TAB_VALUE_SPLIT)\r
415                     pcd.append(None)\r
416                     SkuId = dscObj.Contents[key].PcdsDynamicExHii[index][1]\r
417                     SkuInfoList = []\r
418                     if SkuId == None:\r
419                         SkuId = 'DEFAULT'\r
420                     SkuIdList = map(lambda l: l.strip(), SkuId.split(DataType.TAB_VALUE_SPLIT))\r
421                     for Item in SkuIdList:\r
422                         SkuInfo = SkuInfoClassObject()\r
423                         SkuInfo.SkuId = Item\r
424                         SkuInfo.VariableName = pcd[2]\r
425                         SkuInfo.VariableGuid = pcd[3]\r
426                         SkuInfo.VariableOffset = pcd[4]\r
427                         SkuInfo.HiiDefaultValue = pcd[5]                                                \r
428                         SkuInfoList.append(SkuInfo)\r
429                     pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_EX_HII, None, None, None, pcd[6], SkuInfoList)\r
430               \r
431                 self.Build[key].PlatformDatabase[dsc] = pb\r
432                 pb = None    \r
433             #End of Arch List Go Through    \r
434                 \r
435         #End of Dsc Go Through\r
436         \r
437         #End of build PlatformDatabase\r
438         \r
439         #Build PackageDatabase\r
440         for dec in self.DecDatabase.keys():\r
441             decObj = self.DecDatabase[dec]\r
442 \r
443             for key in DataType.ARCH_LIST:\r
444                 pb = PackageBuildClassObject()\r
445                 #Defines\r
446                 pb.DescFilePath = dec\r
447                 pb.PackageName = decObj.Defines.DefinesDictionary[TAB_DEC_DEFINES_PACKAGE_NAME][0]\r
448                 pb.Guid = decObj.Defines.DefinesDictionary[TAB_DEC_DEFINES_PACKAGE_GUID][0]\r
449                 pb.Version = decObj.Defines.DefinesDictionary[TAB_DEC_DEFINES_PACKAGE_VERSION][0]\r
450                 \r
451                 #Protocols\r
452                 for index in range(len(decObj.Contents[key].Protocols)):\r
453                     list = decObj.Contents[key].Protocols[index].split(DataType.TAB_EQUAL_SPLIT)\r
454                     pb.Protocols[CleanString(list[0])] = CleanString(list[1])\r
455 \r
456                 #Ppis\r
457                 for index in range(len(decObj.Contents[key].Ppis)):\r
458                     list = decObj.Contents[key].Ppis[index].split(DataType.TAB_EQUAL_SPLIT)\r
459                     pb.Ppis[CleanString(list[0])] = CleanString(list[1])            \r
460 \r
461                 #Guids\r
462                 for index in range(len(decObj.Contents[key].Guids)):\r
463                     list = decObj.Contents[key].Guids[index].split(DataType.TAB_EQUAL_SPLIT)\r
464                     pb.Guids[CleanString(list[0])] = CleanString(list[1])        \r
465                 \r
466                 #Includes\r
467                 for index in range(len(decObj.Contents[key].Includes)):\r
468                     pb.Includes.append(NormPath(decObj.Contents[key].Includes[index]))\r
469             \r
470                 #LibraryClasses\r
471                 for index in range(len(decObj.Contents[key].LibraryClasses)):\r
472                     list = decObj.Contents[key].LibraryClasses[index].split(DataType.TAB_VALUE_SPLIT)\r
473                     pb.LibraryClasses[CleanString(list[0])] = NormPath(CleanString(list[1]))\r
474                                                 \r
475                 #Pcds\r
476                 for index in range(len(decObj.Contents[key].PcdsFixedAtBuild)):\r
477                     pcd = decObj.Contents[key].PcdsFixedAtBuild[index].split(DataType.TAB_VALUE_SPLIT)\r
478                     pb.Pcds[(pcd[0], pcd[2])] = PcdClassObject(pcd[0], pcd[2], DataType.TAB_PCDS_FIXED_AT_BUILD, pcd[3], pcd[4], pcd[1], None)\r
479                 for index in range(len(decObj.Contents[key].PcdsPatchableInModule)):\r
480                     pcd = decObj.Contents[key].PcdsPatchableInModule[index].split(DataType.TAB_VALUE_SPLIT)\r
481                     pb.Pcds[(pcd[0], pcd[2])] = PcdClassObject(pcd[0], pcd[2], DataType.TAB_PCDS_PATCHABLE_IN_MODULE, pcd[3], pcd[4], pcd[1], None)\r
482                 for index in range(len(decObj.Contents[key].PcdsFeatureFlag)):\r
483                     pcd = decObj.Contents[key].PcdsFeatureFlag[index].split(DataType.TAB_VALUE_SPLIT)\r
484                     pb.Pcds[(pcd[0], pcd[2])] = PcdClassObject(pcd[0], pcd[2], DataType.TAB_PCDS_FEATURE_FLAG, pcd[3], pcd[4], pcd[1], None)\r
485                 for index in range(len(decObj.Contents[key].PcdsDynamic)):\r
486                     pcd = decObj.Contents[key].PcdsDynamic[index].split(DataType.TAB_VALUE_SPLIT)\r
487                     pb.Pcds[(pcd[0], pcd[2])] = PcdClassObject(pcd[0], pcd[2], DataType.TAB_PCDS_DYNAMIC, pcd[3], pcd[4], pcd[1], None)\r
488                 for index in range(len(decObj.Contents[key].PcdsDynamicEx)):\r
489                     pcd = decObj.Contents[key].PcdsDynamicEx[index].split(DataType.TAB_VALUE_SPLIT)\r
490                     pb.Pcds[(pcd[0], pcd[2])] = PcdClassObject(pcd[0], pcd[2], DataType.TAB_PCDS_DYNAMIC_EX, pcd[3], pcd[4], pcd[1], None)\r
491             \r
492                 #Add to database\r
493                 self.Build[key].PackageDatabase[dec] = pb\r
494                 pb = None    \r
495             #End of Arch List Go Through\r
496         \r
497         #End of Dec Go Through    \r
498         \r
499         #End of build PackageDatabase\r
500     \r
501         #Build ModuleDatabase\r
502         for inf in self.InfDatabase.keys():\r
503             infObj = self.InfDatabase[inf]\r
504             \r
505             for key in DataType.ARCH_LIST:\r
506                 #Defines\r
507                 pb = ModuleBuildClassObject()\r
508                 pb.DescFilePath = inf\r
509                 pb.BaseName = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_BASE_NAME][0]\r
510                 pb.Guid = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_FILE_GUID][0]\r
511                 pb.Version = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_VERSION_STRING][0]\r
512                 pb.ModuleType = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_MODULE_TYPE][0]\r
513                 pb.PcdIsDriver = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_PCD_IS_DRIVER][0]\r
514                 pb.BinaryModule = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_BINARY_MODULE][0]\r
515                 \r
516                 for Index in range(len(infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_CUSTOM_MAKEFILE])):\r
517                     Makefile = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_CUSTOM_MAKEFILE][Index]\r
518                     if Makefile != '':\r
519                         MakefileList = Makefile.split(DataType.TAB_VALUE_SPLIT)\r
520                         if len(MakefileList) == 2:\r
521                             pb.CustomMakefile[CleanString(MakefileList[0])] = CleanString(MakefileList[1])\r
522                         else:\r
523                             raise ParseError('Wrong custom makefile defined in file ' + inf + ', correct format is CUSTOM_MAKEFILE = Family|Filename')\r
524                 \r
525                 if infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_EDK_RELEASE_VERSION][0] != '':\r
526                     pb.Specification[TAB_INF_DEFINES_EDK_RELEASE_VERSION] = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_EDK_RELEASE_VERSION][0]\r
527                 if infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION][0] != '':\r
528                     pb.Specification[TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION] = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION][0]                \r
529                 \r
530                 LibraryClass = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_LIBRARY_CLASS][0]\r
531                 if LibraryClass != '':\r
532                     l = LibraryClass.split(DataType.TAB_VALUE_SPLIT, 1)\r
533                     if len(l) == 1:\r
534                         pb.LibraryClass = LibraryClassObject(l[0], DataType.SUP_MODULE_LIST_STRING)\r
535                     else:\r
536                         pb.LibraryClass = LibraryClassObject(l[0], l[1])\r
537 \r
538                 pb.ModuleEntryPointList.extend(infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_ENTRY_POINT])\r
539                 pb.ModuleUnloadImageList.extend(infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_UNLOAD_IMAGE])\r
540                 pb.ConstructorList.extend(infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_CONSTRUCTOR])\r
541                 pb.DestructorList.extend(infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_DESTRUCTOR])\r
542 \r
543                 #Binaries\r
544                 for index in range(len(infObj.Contents[key].Binaries)):\r
545                     BinaryFile = infObj.Contents[key].Binaries[index].split(DataType.TAB_VALUE_SPLIT)\r
546                     BinaryFile.append('')\r
547                     FileType = BinaryFile[0].strip()\r
548                     Target = BinaryFile[1].strip()\r
549                     FileName = NormPath(BinaryFile[2].strip())\r
550                     PcdFeatureFlag = BinaryFile[3].strip()\r
551                     pb.Binaries.append(ModuleBinaryFilesClassObject(FileName, FileType, Target, PcdFeatureFlag))\r
552                     \r
553                 #Sources\r
554                 for index in range(len(infObj.Contents[key].Sources)):\r
555                     SourceFile = infObj.Contents[key].Sources[index].split(DataType.TAB_VALUE_SPLIT)\r
556                     if len(SourceFile) == 6:\r
557                         FileName = NormPath(SourceFile[0].strip())\r
558                         PcdFeatureFlag = SourceFile[1].strip()\r
559                         TagName = SourceFile[3].strip()\r
560                         ToolCode = SourceFile[4].strip()\r
561                         ToolChainFamily = SourceFile[2].strip()\r
562                         String = SourceFile[5].strip()\r
563                         pb.Sources.append(ModuleSourceFilesClassObject(FileName, PcdFeatureFlag, TagName, ToolCode, ToolChainFamily, String))\r
564                     elif len(SourceFile) == 1:\r
565                         pb.Sources.append(ModuleSourceFilesClassObject(NormPath(infObj.Contents[key].Sources[index])))\r
566                     else:\r
567                         raise ParseError("Inconsistent '|' value defined in SourceFiles." + key + " section in file " + inf)\r
568 \r
569                 #Protocols\r
570                 for index in range(len(infObj.Contents[key].Protocols)):\r
571                     pb.Protocols.append(infObj.Contents[key].Protocols[index])\r
572             \r
573                 #Ppis\r
574                 for index in range(len(infObj.Contents[key].Ppis)):\r
575                     pb.Ppis.append(infObj.Contents[key].Ppis[index])\r
576                                 \r
577                 #Guids\r
578                 for index in range(len(infObj.Contents[key].Guids)):\r
579                     pb.Guids.append(infObj.Contents[key].Guids[index])\r
580             \r
581                 #Includes\r
582                 for index in range(len(infObj.Contents[key].Includes)):\r
583                     pb.Includes.append(NormPath(infObj.Contents[key].Includes[index]))\r
584             \r
585                 #Packages\r
586                 for index in range(len(infObj.Contents[key].Packages)):\r
587                     pb.Packages.append(NormPath(infObj.Contents[key].Packages[index]))\r
588                     \r
589                 #BuildOptions\r
590                 for index in range(len(infObj.Contents[key].BuildOptions)):\r
591                     b = infObj.Contents[key].BuildOptions[index].split(DataType.TAB_EQUAL_SPLIT, 1)\r
592                     Family = ''\r
593                     ToolChain = ''\r
594                     Flag = ''\r
595                     if b[0].find(':') > -1:\r
596                         Family = CleanString(b[0][ : b[0].find(':')])\r
597                         ToolChain = CleanString(b[0][b[0].find(':') + 1 : ])\r
598                     else:\r
599                         ToolChain = CleanString(b[0])\r
600                     Flag = CleanString(b[1])\r
601                     pb.BuildOptions[(Family, ToolChain)] = Flag\r
602                 self.FindBuildOptions(key, inf, pb.BuildOptions)\r
603                 \r
604                 #Depex\r
605                 pb.Depex = ' '.join(infObj.Contents[key].Depex)\r
606                 \r
607                 #LibraryClasses\r
608                 for index in range(len(infObj.Contents[key].LibraryClasses)):\r
609                     #Get LibraryClass name and default instance if existing\r
610                     list = infObj.Contents[key].LibraryClasses[index].split(DataType.TAB_VALUE_SPLIT)\r
611                     if len(list) < 2:\r
612                         v = ''\r
613                     else:\r
614                         v = list[1]\r
615                     \r
616                     if pb.LibraryClass != None:\r
617                         #For Library\r
618                         for type in pb.LibraryClass.SupModList:\r
619                             instance = self.FindLibraryClassInstanceOfLibrary(CleanString(list[0]), key, type)\r
620                             if instance != None:\r
621                                 v = instance\r
622                                 pb.LibraryClasses[(CleanString(list[0]), type)] = NormPath(CleanString(v))\r
623                     else:\r
624                         #For Module                        \r
625                         instance = self.FindLibraryClassInstanceOfModule(CleanString(list[0]), key, pb.ModuleType, inf) \r
626                         if instance != None:\r
627                             v = instance\r
628                             pb.LibraryClasses[(CleanString(list[0]), pb.ModuleType)] = NormPath(CleanString(v))\r
629 \r
630                 #Pcds\r
631                 for index in range(len(infObj.Contents[key].PcdsFixedAtBuild)):\r
632                     pcd = infObj.Contents[key].PcdsFixedAtBuild[index].split(DataType.TAB_VALUE_SPLIT)\r
633                     pb.Pcds[(pcd[0], pcd[1])] = self.FindPcd(key, pcd[0], pcd[1], DataType.TAB_PCDS_FIXED_AT_BUILD)\r
634                 for index in range(len(infObj.Contents[key].PcdsPatchableInModule)):\r
635                     pcd = infObj.Contents[key].PcdsPatchableInModule[index].split(DataType.TAB_VALUE_SPLIT)\r
636                     pb.Pcds[(pcd[0], pcd[1])] = self.FindPcd(key, pcd[0], pcd[1], DataType.TAB_PCDS_PATCHABLE_IN_MODULE)\r
637                     #pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_PATCHABLE_IN_MODULE, None, None, None, None)                    \r
638                 for index in range(len(infObj.Contents[key].PcdsFeatureFlag)):\r
639                     pcd = infObj.Contents[key].PcdsFeatureFlag[index].split(DataType.TAB_VALUE_SPLIT)\r
640                     pb.Pcds[(pcd[0], pcd[1])] = self.FindPcd(key, pcd[0], pcd[1], DataType.TAB_PCDS_FEATURE_FLAG)\r
641                     #pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_FEATURE_FLAG, None, None, None, None)                    \r
642                 for index in range(len(infObj.Contents[key].PcdsDynamic)):\r
643                     pcd = infObj.Contents[key].PcdsDynamic[index].split(DataType.TAB_VALUE_SPLIT)\r
644                     pb.Pcds[(pcd[0], pcd[1])] = self.FindPcd(key, pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC)\r
645                     #pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC, None, None, None, None)\r
646                 for index in range(len(infObj.Contents[key].PcdsDynamicEx)):\r
647                     pcd = infObj.Contents[key].PcdsDynamicEx[index].split(DataType.TAB_VALUE_SPLIT)\r
648                     pb.Pcds[(pcd[0], pcd[1])] = self.FindPcd(key, pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_EX)\r
649                     #pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_EX, None, None, None, None)\r
650                                         \r
651                 #Add to database\r
652                 self.Build[key].ModuleDatabase[inf] = pb\r
653                 pb = None    \r
654             #End of Arch List Go Through\r
655         \r
656         #End of Inf Go Through\r
657         \r
658         #End of build ModuleDatabase    \r
659     \r
660 \r
661     \r
662     def UpdateInfDatabase(self, infFileName, LibraryClass, Arch):\r
663         infFileName = NormPath(infFileName)\r
664         LibList = self.InfDatabase[infFileName].Contents[Arch].LibraryClasses\r
665         NotFound = True\r
666         for Item in LibList:\r
667             LibName = Item[0].split(DataType.TAB_VALUE_SPLIT)[0].strip()\r
668             if LibName == LibraryClass:\r
669                 return\r
670         \r
671         if NotFound:\r
672             self.InfDatabase[infFileName].Contents[Arch].LibraryClasses.extend([LibraryClass])\r
673     \r
674     def AddToInfDatabase(self, infFileName):\r
675         infFileName = NormPath(infFileName)\r
676         file = self.WorkspaceFile(infFileName)\r
677         if os.path.exists(file) and os.path.isfile(file):\r
678             if infFileName not in self.InfDatabase:\r
679                 self.InfDatabase[infFileName] = Inf(file, True)\r
680                 \r
681     def AddToDecDatabase(self, decFileName):\r
682         decFileName = NormPath(decFileName)\r
683         file = self.WorkspaceFile(decFileName)\r
684         if os.path.exists(file) and os.path.isfile(file):\r
685             if decFileName not in self.DecDatabase:\r
686                 self.DecDatabase[decFileName] = Dec(file, True)\r
687                 \r
688     def FindLibraryClassInstanceOfModule(self, lib, arch, moduleType, moduleName):\r
689         for dsc in self.DscDatabase.keys():\r
690             #First find if exist in <LibraryClass> of <Components> from dsc file            \r
691             dscObj = self.DscDatabase[dsc]\r
692             for index in range(len(dscObj.Contents[arch].Components)):\r
693                 if NormPath(dscObj.Contents[arch].Components[index][0]) == moduleName and len(dscObj.Contents[arch].Components[index][1]) > 0:\r
694                     #Search each library class\r
695                     LibList = dscObj.Contents[arch].Components[index][1]\r
696                     for indexOfLib in range(len(LibList)):\r
697                         if LibList[indexOfLib].split(DataType.TAB_VALUE_SPLIT)[0].strip() == lib:\r
698                             return LibList[indexOfLib].split(DataType.TAB_VALUE_SPLIT)[1].strip()\r
699             \r
700             #Second find if exist in <LibraryClass> of <LibraryClasses> from dsc file            \r
701             if (lib, moduleType) in self.Build[arch].PlatformDatabase[dsc].LibraryClasses:\r
702                 return self.Build[arch].PlatformDatabase[dsc].LibraryClasses[(lib, moduleType)]\r
703             elif (lib, None) in self.Build[arch].PlatformDatabase[dsc].LibraryClasses:\r
704                 return self.Build[arch].PlatformDatabase[dsc].LibraryClasses[(lib, None)]\r
705             \r
706     def FindLibraryClassInstanceOfLibrary(self, lib, arch, type):\r
707         for dsc in self.DscDatabase.keys():\r
708             dscObj = self.DscDatabase[dsc]\r
709             if (lib, type) in self.Build[arch].PlatformDatabase[dsc].LibraryClasses:\r
710                 return self.Build[arch].PlatformDatabase[dsc].LibraryClasses[(lib, type)]\r
711             elif (lib, None) in self.Build[arch].PlatformDatabase[dsc].LibraryClasses:\r
712                 return self.Build[arch].PlatformDatabase[dsc].LibraryClasses[(lib, None)]\r
713             \r
714     def FindBuildOptions(self, arch, moduleName, BuildOptions):\r
715         for dsc in self.DscDatabase.keys():\r
716             #First find if exist in <BuildOptions> of <Components> from dsc file\r
717             dscObj = self.DscDatabase[dsc]\r
718             for index in range(len(dscObj.Contents[arch].Components)):\r
719                 if NormPath(dscObj.Contents[arch].Components[index][0]) == moduleName and len(dscObj.Contents[arch].Components[index][2]) > 0:\r
720                     list = dscObj.Contents[arch].Components[index][2]\r
721                     for l in list:\r
722                         b = l.split(DataType.TAB_EQUAL_SPLIT, 1)\r
723                         Family = ''\r
724                         ToolChain = ''\r
725                         Flag = ''\r
726                         if b[0].find(':') > -1:\r
727                             Family = CleanString(b[0][ : b[0].find(':')])\r
728                             ToolChain = CleanString(b[0][b[0].find(':') + 1 : ])\r
729                         else:\r
730                             ToolChain = CleanString(b[0])\r
731                         Flag = CleanString(b[1])\r
732                         BuildOptions[(Family, ToolChain)] = Flag\r
733                         \r
734     def FindPcd(self, arch, CName, GuidCName, Type):\r
735         DatumType = ''\r
736         DefaultValue = ''\r
737         TokenValue = ''\r
738         MaxDatumSize = ''\r
739         SkuInfoList = None\r
740         for dsc in self.Build[arch].PlatformDatabase.keys():\r
741             platform = self.Build[arch].PlatformDatabase[dsc]\r
742             pcds = platform.Pcds\r
743             if (CName, GuidCName) in pcds:\r
744                 Type = pcds[(CName, GuidCName)].Type\r
745                 DatumType = pcds[(CName, GuidCName)].DatumType\r
746                 DefaultValue = pcds[(CName, GuidCName)].DefaultValue\r
747                 TokenValue = pcds[(CName, GuidCName)].TokenValue\r
748                 MaxDatumSize = pcds[(CName, GuidCName)].MaxDatumSize\r
749                 SkuInfoList =  pcds[(CName, GuidCName)].SkuInfoList\r
750                 break\r
751 \r
752         for dec in self.Build[arch].PackageDatabase.keys():\r
753             package = self.Build[arch].PackageDatabase[dec]\r
754             pcds = package.Pcds\r
755             if (CName, GuidCName) in pcds:\r
756                 DatumType = pcds[(CName, GuidCName)].DatumType\r
757                 #DefaultValue = pcds[(CName, GuidCName)].DefaultValue\r
758                 TokenValue = pcds[(CName, GuidCName)].TokenValue\r
759                 #MaxDatumSize = pcds[(CName, GuidCName)].MaxDatumSize\r
760                 break\r
761         \r
762         return PcdClassObject(CName, GuidCName, Type, DatumType, DefaultValue, TokenValue, MaxDatumSize, SkuInfoList)\r
763     \r
764     def ReloadPcd(self, FvDict):\r
765         pass\r
766                 \r
767 # This acts like the main() function for the script, unless it is 'import'ed into another\r
768 # script.\r
769 if __name__ == '__main__':\r
770 \r
771     # Nothing to do here. Could do some unit tests.\r
772     ewb = WorkspaceBuild('EdkModulePkg/EdkModulePkg.dsc', 'C:/MyWorkspace')\r
773     ewb.GenBuildDatabase()\r
774     #print ewb.DscDatabase\r
775     #print ewb.InfDatabase\r
776     #print ewb.DecDatabase\r
777     print 'SupArchList', ewb.SupArchList\r
778     print 'BuildTarget', ewb.BuildTarget\r
779     print 'SkuId', ewb.SkuId\r
780     \r
781     #\r
782     for arch in DataType.ARCH_LIST:\r
783         print arch\r
784         print 'Platform'\r
785         for platform in ewb.Build[arch].PlatformDatabase.keys():\r
786             p = ewb.Build[arch].PlatformDatabase[platform]\r
787             print 'DescFilePath = ', p.DescFilePath     \r
788             print 'PlatformName = ', p.PlatformName     \r
789             print 'Guid = ', p.Guid                     \r
790             print 'Version = ', p.Version\r
791             print 'OutputDirectory = ', p.OutputDirectory                \r
792             print 'FlashDefinition = ', p.FlashDefinition\r
793             print 'SkuIds = ', p.SkuIds\r
794             print 'Modules = ', p.Modules\r
795             print 'LibraryClasses = ', p.LibraryClasses \r
796             print 'Pcds = ', p.Pcds\r
797             for item in p.Pcds.keys():\r
798                 print p.Pcds[item]\r
799             print 'BuildOptions = ', p.BuildOptions\r
800             print ''   \r
801         #End of Platform\r
802     \r
803         print 'package'\r
804         for package in ewb.Build[arch].PackageDatabase.keys():\r
805             p = ewb.Build[arch].PackageDatabase[package]\r
806             print 'DescFilePath = ', p.DescFilePath    \r
807             print 'PackageName = ', p.PackageName     \r
808             print 'Guid = ', p.Guid                    \r
809             print 'Version = ', p.Version             \r
810             print 'Protocols = ', p.Protocols         \r
811             print 'Ppis = ', p.Ppis                    \r
812             print 'Guids = ', p.Guids                 \r
813             print 'Includes = ', p.Includes            \r
814             print 'LibraryClasses = ', p.LibraryClasses\r
815             print 'Pcds = ', p.Pcds\r
816             print ''                    \r
817         #End of Package\r
818         \r
819         print 'module'\r
820         for module in ewb.Build[arch].ModuleDatabase.keys():\r
821             p = ewb.Build[arch].ModuleDatabase[module]\r
822             print 'DescFilePath = ', p.DescFilePath                    \r
823             print 'BaseName = ', p.BaseName                         \r
824             print 'ModuleType = ', p.ModuleType                     \r
825             print 'Guid = ', p.Guid                                 \r
826             print 'Version = ', p.Version\r
827             print 'CustomMakefile = ', p.CustomMakefile\r
828             print 'Specification = ', p.Specification\r
829             print 'PcdIsDriver = ', p.PcdIsDriver\r
830             if p.LibraryClass != None:\r
831                 print 'LibraryClass = ', p.LibraryClass.LibraryClass\r
832                 print 'SupModList = ', p.LibraryClass.SupModList\r
833             print 'ModuleEntryPointList = ', p.ModuleEntryPointList \r
834             print 'ModuleUnloadImageList = ', p.ModuleUnloadImageList\r
835             print 'ConstructorList = ', p.ConstructorList            \r
836             print 'DestructorList = ', p.DestructorList             \r
837                                                                      \r
838             print 'Binaries = '\r
839             for item in p.Binaries:\r
840                 print str(item)\r
841             print 'Sources = '\r
842             for item in p.Sources:\r
843                 print str(item)\r
844             print 'LibraryClasses = ', p.LibraryClasses             \r
845             print 'Protocols = ', p.Protocols                        \r
846             print 'Ppis = ', p.Ppis                                 \r
847             print 'Guids = ', p.Guids                                \r
848             print 'Includes = ', p.Includes                         \r
849             print 'Packages = ', p.Packages                         \r
850             print 'Pcds = ', p.Pcds\r
851             print 'BuildOptions = ', p.BuildOptions\r
852             print 'Depex = ', p.Depex\r
853             print ''\r
854         #End of Module    \r
855             \r
856     #End of Arch List\r