git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@383 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                 self.Fdf = pb.FlashDefinition\r
280                 \r
281                 #SkuId\r
282                 for index in range(len(dscObj.Contents[key].SkuIds)):\r
283                     SkuInfo = dscObj.Contents[key].SkuIds[index]\r
284                     SkuName = ''\r
285                     SkuId = ''\r
286                     if SkuInfo.find('!include') > -1:\r
287                         SkuName = '!include'\r
288                         SkuId = NormPath(CleanString(SkuInfo[SkuInfo.find('!include') + len('!include'):]))\r
289                     elif len(SkuInfo.split(DataType.TAB_VALUE_SPLIT)) == 2:\r
290                         SkuName = CleanString(SkuInfo.split(DataType.TAB_VALUE_SPLIT)[1])\r
291                         SkuId = CleanString(SkuInfo.split(DataType.TAB_VALUE_SPLIT)[0])\r
292                     else:\r
293                         raise ParseError('Wrong defintion for SkuId: %s' % SkuInfo)\r
294                     pb.SkuIds[SkuName] = SkuId\r
295                 \r
296                 #Module\r
297                 for index in range(len(dscObj.Contents[key].Components)):\r
298                     pb.Modules.append(NormPath(dscObj.Contents[key].Components[index][0]))\r
299                 \r
300                 #BuildOptions\r
301                 for index in range(len(dscObj.Contents[key].BuildOptions)):\r
302                     b = dscObj.Contents[key].BuildOptions[index].split(DataType.TAB_EQUAL_SPLIT, 1)\r
303                     Family = ''\r
304                     ToolChain = ''\r
305                     Flag = ''\r
306                     if b[0].find(':') > -1:\r
307                         Family = CleanString(b[0][ : b[0].find(':')])\r
308                         ToolChain = CleanString(b[0][b[0].find(':') + 1 : ])\r
309                     else:\r
310                         ToolChain = CleanString(b[0])\r
311                     Flag = CleanString(b[1])\r
312                     pb.BuildOptions[(Family, ToolChain)] = Flag\r
313                     \r
314                 #LibraryClass\r
315                 for index in range(len(dscObj.Contents[key].LibraryClasses)):\r
316                     #['DebugLib|MdePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf', ['DXE_CORE']]\r
317                     print dscObj.Contents[key].LibraryClasses[index]\r
318                     list = dscObj.Contents[key].LibraryClasses[index][0].split(DataType.TAB_VALUE_SPLIT, 1)\r
319                     type = dscObj.Contents[key].LibraryClasses[index][1][0]\r
320                     pb.LibraryClasses[(list[0], type)] = NormPath(list[1])\r
321 \r
322                 #Pcds\r
323                 for index in range(len(dscObj.Contents[key].PcdsFixedAtBuild)):\r
324                     pcd = dscObj.Contents[key].PcdsFixedAtBuild[index].split(DataType.TAB_VALUE_SPLIT)\r
325                     pcd.append(None)\r
326                     pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_FIXED_AT_BUILD, None, pcd[2], None, pcd[3])\r
327                 for index in range(len(dscObj.Contents[key].PcdsPatchableInModule)):\r
328                     pcd = dscObj.Contents[key].PcdsPatchableInModule[index].split(DataType.TAB_VALUE_SPLIT)\r
329                     pcd.append(None)\r
330                     pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_PATCHABLE_IN_MODULE, None, pcd[2], None, pcd[3])\r
331                 for index in range(len(dscObj.Contents[key].PcdsFeatureFlag)):\r
332                     pcd = dscObj.Contents[key].PcdsFeatureFlag[index].split(DataType.TAB_VALUE_SPLIT)\r
333                     pcd.append(None)                    \r
334                     pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_FEATURE_FLAG, None, pcd[2], None, pcd[3])\r
335                 #\r
336                 # PcdsDynamic\r
337                 #\r
338                 for index in range(len(dscObj.Contents[key].PcdsDynamicDefault)):\r
339                     pcd = dscObj.Contents[key].PcdsDynamicDefault[index][0].split(DataType.TAB_VALUE_SPLIT)\r
340                     pcd.append(None)\r
341                     SkuName = dscObj.Contents[key].PcdsDynamicDefault[index][1]\r
342                     SkuInfoList = []\r
343                     if SkuName == None:\r
344                         SkuName = ['DEFAULT']\r
345                     SkuNameList = map(lambda l: l.strip(), SkuName.split(DataType.TAB_VALUE_SPLIT))\r
346                     for Item in SkuNameList:\r
347                         SkuInfo = SkuInfoClassObject()\r
348                         SkuInfo.SkuId = pb.SkuIds[Item]\r
349                         SkuInfo.DefaultValue = pcd[2]\r
350                         SkuInfoList.append(SkuInfo)\r
351                     pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_DEFAULT, None, None, None, pcd[3], SkuInfoList)\r
352                 for index in range(len(dscObj.Contents[key].PcdsDynamicVpd)):\r
353                     pcd = dscObj.Contents[key].PcdsDynamicVpd[index][0].split(DataType.TAB_VALUE_SPLIT)\r
354                     pcd.append(None)\r
355                     SkuId = dscObj.Contents[key].PcdsDynamicVpd[index][1]\r
356                     SkuInfoList = []\r
357                     if SkuId == None:\r
358                         SkuId = 'DEFAULT'\r
359                     SkuIdList = map(lambda l: l.strip(), SkuId.split(DataType.TAB_VALUE_SPLIT))\r
360                     for Item in SkuIdList:\r
361                         SkuInfo = SkuInfoClassObject()\r
362                         SkuInfo.SkuId = Item\r
363                         SkuInfo.VpdOffset = pcd[2]\r
364                         SkuInfoList.append(SkuInfo)\r
365                     pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_VPD, None, None, None, pcd[3], SkuInfoList)\r
366                 for index in range(len(dscObj.Contents[key].PcdsDynamicHii)):\r
367                     pcd = dscObj.Contents[key].PcdsDynamicHii[index][0].split(DataType.TAB_VALUE_SPLIT)\r
368                     pcd.append(None)\r
369                     SkuId = dscObj.Contents[key].PcdsDynamicHii[index][1]\r
370                     SkuInfoList = []\r
371                     if SkuId == None:\r
372                         SkuId = 'DEFAULT'\r
373                     SkuIdList = map(lambda l: l.strip(), SkuId.split(DataType.TAB_VALUE_SPLIT))\r
374                     for Item in SkuIdList:\r
375                         SkuInfo = SkuInfoClassObject()\r
376                         SkuInfo.SkuId = Item\r
377                         SkuInfo.VariableName = pcd[2]\r
378                         SkuInfo.VariableGuid = pcd[3]\r
379                         SkuInfo.VariableOffset = pcd[4]\r
380                         SkuInfo.HiiDefaultValue = pcd[5]                                                \r
381                         SkuInfoList.append(SkuInfo)\r
382                     pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_HII, None, None, None, pcd[6], SkuInfoList)\r
383                 #\r
384                 # PcdsDynamicEx\r
385                 #\r
386                 for index in range(len(dscObj.Contents[key].PcdsDynamicExDefault)):\r
387                     pcd = dscObj.Contents[key].PcdsDynamicExDefault[index][0].split(DataType.TAB_VALUE_SPLIT)\r
388                     pcd.append(None)\r
389                     SkuId = dscObj.Contents[key].PcdsDynamicExDefault[index][1]\r
390                     SkuInfoList = []\r
391                     if SkuId == None:\r
392                         SkuId = 'DEFAULT'\r
393                     SkuIdList = map(lambda l: l.strip(), SkuId.split(DataType.TAB_VALUE_SPLIT))\r
394                     for Item in SkuIdList:\r
395                         SkuInfo = SkuInfoClassObject()\r
396                         SkuInfo.SkuId = Item\r
397                         SkuInfo.DefaultValue = pcd[2]\r
398                         SkuInfoList.append(SkuInfo)\r
399                     pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_EX_DEFAULT, None, None, None, pcd[3], SkuInfoList)\r
400                 for index in range(len(dscObj.Contents[key].PcdsDynamicExVpd)):\r
401                     pcd = dscObj.Contents[key].PcdsDynamicExVpd[index][0].split(DataType.TAB_VALUE_SPLIT)\r
402                     pcd.append(None)\r
403                     SkuId = dscObj.Contents[key].PcdsDynamicExVpd[index][1]\r
404                     SkuInfoList = []\r
405                     if SkuId == None:\r
406                         SkuId = 'DEFAULT'\r
407                     SkuIdList = map(lambda l: l.strip(), SkuId.split(DataType.TAB_VALUE_SPLIT))\r
408                     for Item in SkuIdList:\r
409                         SkuInfo = SkuInfoClassObject()\r
410                         SkuInfo.SkuId = Item\r
411                         SkuInfo.VpdOffset = pcd[2]\r
412                         SkuInfoList.append(SkuInfo)\r
413                     pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_EX_VPD, None, None, None, pcd[3], SkuInfoList)\r
414                 for index in range(len(dscObj.Contents[key].PcdsDynamicExHii)):\r
415                     pcd = dscObj.Contents[key].PcdsDynamicExHii[index][0].split(DataType.TAB_VALUE_SPLIT)\r
416                     pcd.append(None)\r
417                     SkuId = dscObj.Contents[key].PcdsDynamicExHii[index][1]\r
418                     SkuInfoList = []\r
419                     if SkuId == None:\r
420                         SkuId = 'DEFAULT'\r
421                     SkuIdList = map(lambda l: l.strip(), SkuId.split(DataType.TAB_VALUE_SPLIT))\r
422                     for Item in SkuIdList:\r
423                         SkuInfo = SkuInfoClassObject()\r
424                         SkuInfo.SkuId = Item\r
425                         SkuInfo.VariableName = pcd[2]\r
426                         SkuInfo.VariableGuid = pcd[3]\r
427                         SkuInfo.VariableOffset = pcd[4]\r
428                         SkuInfo.HiiDefaultValue = pcd[5]                                                \r
429                         SkuInfoList.append(SkuInfo)\r
430                     pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_EX_HII, None, None, None, pcd[6], SkuInfoList)\r
431               \r
432                 self.Build[key].PlatformDatabase[dsc] = pb\r
433                 pb = None    \r
434             #End of Arch List Go Through    \r
435                 \r
436         #End of Dsc Go Through\r
437         \r
438         #End of build PlatformDatabase\r
439         \r
440         #Build PackageDatabase\r
441         for dec in self.DecDatabase.keys():\r
442             decObj = self.DecDatabase[dec]\r
443 \r
444             for key in DataType.ARCH_LIST:\r
445                 pb = PackageBuildClassObject()\r
446                 #Defines\r
447                 pb.DescFilePath = dec\r
448                 pb.PackageName = decObj.Defines.DefinesDictionary[TAB_DEC_DEFINES_PACKAGE_NAME][0]\r
449                 pb.Guid = decObj.Defines.DefinesDictionary[TAB_DEC_DEFINES_PACKAGE_GUID][0]\r
450                 pb.Version = decObj.Defines.DefinesDictionary[TAB_DEC_DEFINES_PACKAGE_VERSION][0]\r
451                 \r
452                 #Protocols\r
453                 for index in range(len(decObj.Contents[key].Protocols)):\r
454                     list = decObj.Contents[key].Protocols[index].split(DataType.TAB_EQUAL_SPLIT)\r
455                     pb.Protocols[CleanString(list[0])] = CleanString(list[1])\r
456 \r
457                 #Ppis\r
458                 for index in range(len(decObj.Contents[key].Ppis)):\r
459                     list = decObj.Contents[key].Ppis[index].split(DataType.TAB_EQUAL_SPLIT)\r
460                     pb.Ppis[CleanString(list[0])] = CleanString(list[1])            \r
461 \r
462                 #Guids\r
463                 for index in range(len(decObj.Contents[key].Guids)):\r
464                     list = decObj.Contents[key].Guids[index].split(DataType.TAB_EQUAL_SPLIT)\r
465                     pb.Guids[CleanString(list[0])] = CleanString(list[1])        \r
466                 \r
467                 #Includes\r
468                 for index in range(len(decObj.Contents[key].Includes)):\r
469                     pb.Includes.append(NormPath(decObj.Contents[key].Includes[index]))\r
470             \r
471                 #LibraryClasses\r
472                 for index in range(len(decObj.Contents[key].LibraryClasses)):\r
473                     list = decObj.Contents[key].LibraryClasses[index].split(DataType.TAB_VALUE_SPLIT)\r
474                     pb.LibraryClasses[CleanString(list[0])] = NormPath(CleanString(list[1]))\r
475                                                 \r
476                 #Pcds\r
477                 for index in range(len(decObj.Contents[key].PcdsFixedAtBuild)):\r
478                     pcd = decObj.Contents[key].PcdsFixedAtBuild[index].split(DataType.TAB_VALUE_SPLIT)\r
479                     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
480                 for index in range(len(decObj.Contents[key].PcdsPatchableInModule)):\r
481                     pcd = decObj.Contents[key].PcdsPatchableInModule[index].split(DataType.TAB_VALUE_SPLIT)\r
482                     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
483                 for index in range(len(decObj.Contents[key].PcdsFeatureFlag)):\r
484                     pcd = decObj.Contents[key].PcdsFeatureFlag[index].split(DataType.TAB_VALUE_SPLIT)\r
485                     pb.Pcds[(pcd[0], pcd[2])] = PcdClassObject(pcd[0], pcd[2], DataType.TAB_PCDS_FEATURE_FLAG, pcd[3], pcd[4], pcd[1], None)\r
486                 for index in range(len(decObj.Contents[key].PcdsDynamic)):\r
487                     pcd = decObj.Contents[key].PcdsDynamic[index].split(DataType.TAB_VALUE_SPLIT)\r
488                     pb.Pcds[(pcd[0], pcd[2])] = PcdClassObject(pcd[0], pcd[2], DataType.TAB_PCDS_DYNAMIC, pcd[3], pcd[4], pcd[1], None)\r
489                 for index in range(len(decObj.Contents[key].PcdsDynamicEx)):\r
490                     pcd = decObj.Contents[key].PcdsDynamicEx[index].split(DataType.TAB_VALUE_SPLIT)\r
491                     pb.Pcds[(pcd[0], pcd[2])] = PcdClassObject(pcd[0], pcd[2], DataType.TAB_PCDS_DYNAMIC_EX, pcd[3], pcd[4], pcd[1], None)\r
492             \r
493                 #Add to database\r
494                 self.Build[key].PackageDatabase[dec] = pb\r
495                 pb = None    \r
496             #End of Arch List Go Through\r
497         \r
498         #End of Dec Go Through    \r
499         \r
500         #End of build PackageDatabase\r
501     \r
502         #Build ModuleDatabase\r
503         for inf in self.InfDatabase.keys():\r
504             infObj = self.InfDatabase[inf]\r
505             \r
506             for key in DataType.ARCH_LIST:\r
507                 #Defines\r
508                 pb = ModuleBuildClassObject()\r
509                 pb.DescFilePath = inf\r
510                 pb.BaseName = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_BASE_NAME][0]\r
511                 pb.Guid = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_FILE_GUID][0]\r
512                 pb.Version = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_VERSION_STRING][0]\r
513                 pb.ModuleType = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_MODULE_TYPE][0]\r
514                 pb.PcdIsDriver = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_PCD_IS_DRIVER][0]\r
515                 pb.BinaryModule = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_BINARY_MODULE][0]\r
516                 \r
517                 for Index in range(len(infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_CUSTOM_MAKEFILE])):\r
518                     Makefile = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_CUSTOM_MAKEFILE][Index]\r
519                     if Makefile != '':\r
520                         MakefileList = Makefile.split(DataType.TAB_VALUE_SPLIT)\r
521                         if len(MakefileList) == 2:\r
522                             pb.CustomMakefile[CleanString(MakefileList[0])] = CleanString(MakefileList[1])\r
523                         else:\r
524                             raise ParseError('Wrong custom makefile defined in file ' + inf + ', correct format is CUSTOM_MAKEFILE = Family|Filename')\r
525                 \r
526                 if infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_EDK_RELEASE_VERSION][0] != '':\r
527                     pb.Specification[TAB_INF_DEFINES_EDK_RELEASE_VERSION] = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_EDK_RELEASE_VERSION][0]\r
528                 if infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION][0] != '':\r
529                     pb.Specification[TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION] = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION][0]                \r
530                 \r
531                 LibraryClass = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_LIBRARY_CLASS][0]\r
532                 if LibraryClass != '':\r
533                     l = LibraryClass.split(DataType.TAB_VALUE_SPLIT, 1)\r
534                     if len(l) == 1:\r
535                         pb.LibraryClass = LibraryClassObject(l[0], DataType.SUP_MODULE_LIST_STRING)\r
536                     else:\r
537                         pb.LibraryClass = LibraryClassObject(l[0], l[1])\r
538 \r
539                 pb.ModuleEntryPointList.extend(infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_ENTRY_POINT])\r
540                 pb.ModuleUnloadImageList.extend(infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_UNLOAD_IMAGE])\r
541                 pb.ConstructorList.extend(infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_CONSTRUCTOR])\r
542                 pb.DestructorList.extend(infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_DESTRUCTOR])\r
543 \r
544                 #Binaries\r
545                 for index in range(len(infObj.Contents[key].Binaries)):\r
546                     BinaryFile = infObj.Contents[key].Binaries[index].split(DataType.TAB_VALUE_SPLIT)\r
547                     BinaryFile.append('')\r
548                     FileType = BinaryFile[0].strip()\r
549                     Target = BinaryFile[1].strip()\r
550                     FileName = NormPath(BinaryFile[2].strip())\r
551                     PcdFeatureFlag = BinaryFile[3].strip()\r
552                     pb.Binaries.append(ModuleBinaryFilesClassObject(FileName, FileType, Target, PcdFeatureFlag))\r
553                     \r
554                 #Sources\r
555                 for index in range(len(infObj.Contents[key].Sources)):\r
556                     SourceFile = infObj.Contents[key].Sources[index].split(DataType.TAB_VALUE_SPLIT)\r
557                     if len(SourceFile) == 6:\r
558                         FileName = NormPath(SourceFile[0].strip())\r
559                         PcdFeatureFlag = SourceFile[1].strip()\r
560                         TagName = SourceFile[3].strip()\r
561                         ToolCode = SourceFile[4].strip()\r
562                         ToolChainFamily = SourceFile[2].strip()\r
563                         String = SourceFile[5].strip()\r
564                         pb.Sources.append(ModuleSourceFilesClassObject(FileName, PcdFeatureFlag, TagName, ToolCode, ToolChainFamily, String))\r
565                     elif len(SourceFile) == 1:\r
566                         pb.Sources.append(ModuleSourceFilesClassObject(NormPath(infObj.Contents[key].Sources[index])))\r
567                     else:\r
568                         raise ParseError("Inconsistent '|' value defined in SourceFiles." + key + " section in file " + inf)\r
569 \r
570                 #Protocols\r
571                 for index in range(len(infObj.Contents[key].Protocols)):\r
572                     pb.Protocols.append(infObj.Contents[key].Protocols[index])\r
573             \r
574                 #Ppis\r
575                 for index in range(len(infObj.Contents[key].Ppis)):\r
576                     pb.Ppis.append(infObj.Contents[key].Ppis[index])\r
577                                 \r
578                 #Guids\r
579                 for index in range(len(infObj.Contents[key].Guids)):\r
580                     pb.Guids.append(infObj.Contents[key].Guids[index])\r
581             \r
582                 #Includes\r
583                 for index in range(len(infObj.Contents[key].Includes)):\r
584                     pb.Includes.append(NormPath(infObj.Contents[key].Includes[index]))\r
585             \r
586                 #Packages\r
587                 for index in range(len(infObj.Contents[key].Packages)):\r
588                     pb.Packages.append(NormPath(infObj.Contents[key].Packages[index]))\r
589                     \r
590                 #BuildOptions\r
591                 for index in range(len(infObj.Contents[key].BuildOptions)):\r
592                     b = infObj.Contents[key].BuildOptions[index].split(DataType.TAB_EQUAL_SPLIT, 1)\r
593                     Family = ''\r
594                     ToolChain = ''\r
595                     Flag = ''\r
596                     if b[0].find(':') > -1:\r
597                         Family = CleanString(b[0][ : b[0].find(':')])\r
598                         ToolChain = CleanString(b[0][b[0].find(':') + 1 : ])\r
599                     else:\r
600                         ToolChain = CleanString(b[0])\r
601                     Flag = CleanString(b[1])\r
602                     pb.BuildOptions[(Family, ToolChain)] = Flag\r
603                 self.FindBuildOptions(key, inf, pb.BuildOptions)\r
604                 \r
605                 #Depex\r
606                 pb.Depex = ' '.join(infObj.Contents[key].Depex)\r
607                 \r
608                 #LibraryClasses\r
609                 for index in range(len(infObj.Contents[key].LibraryClasses)):\r
610                     #Get LibraryClass name and default instance if existing\r
611                     list = infObj.Contents[key].LibraryClasses[index].split(DataType.TAB_VALUE_SPLIT)\r
612                     if len(list) < 2:\r
613                         v = ''\r
614                     else:\r
615                         v = list[1]\r
616                     \r
617                     if pb.LibraryClass != None:\r
618                         #For Library\r
619                         for type in pb.LibraryClass.SupModList:\r
620                             instance = self.FindLibraryClassInstanceOfLibrary(CleanString(list[0]), key, type)\r
621                             if instance != None:\r
622                                 v = instance\r
623                                 pb.LibraryClasses[(CleanString(list[0]), type)] = NormPath(CleanString(v))\r
624                     else:\r
625                         #For Module                        \r
626                         instance = self.FindLibraryClassInstanceOfModule(CleanString(list[0]), key, pb.ModuleType, inf) \r
627                         if instance != None:\r
628                             v = instance\r
629                             pb.LibraryClasses[(CleanString(list[0]), pb.ModuleType)] = NormPath(CleanString(v))\r
630 \r
631                 #Pcds\r
632                 for index in range(len(infObj.Contents[key].PcdsFixedAtBuild)):\r
633                     pcd = infObj.Contents[key].PcdsFixedAtBuild[index].split(DataType.TAB_VALUE_SPLIT)\r
634                     pb.Pcds[(pcd[0], pcd[1])] = self.FindPcd(key, pcd[0], pcd[1], DataType.TAB_PCDS_FIXED_AT_BUILD)\r
635                 for index in range(len(infObj.Contents[key].PcdsPatchableInModule)):\r
636                     pcd = infObj.Contents[key].PcdsPatchableInModule[index].split(DataType.TAB_VALUE_SPLIT)\r
637                     pb.Pcds[(pcd[0], pcd[1])] = self.FindPcd(key, pcd[0], pcd[1], DataType.TAB_PCDS_PATCHABLE_IN_MODULE)\r
638                     #pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_PATCHABLE_IN_MODULE, None, None, None, None)                    \r
639                 for index in range(len(infObj.Contents[key].PcdsFeatureFlag)):\r
640                     pcd = infObj.Contents[key].PcdsFeatureFlag[index].split(DataType.TAB_VALUE_SPLIT)\r
641                     pb.Pcds[(pcd[0], pcd[1])] = self.FindPcd(key, pcd[0], pcd[1], DataType.TAB_PCDS_FEATURE_FLAG)\r
642                     #pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_FEATURE_FLAG, None, None, None, None)                    \r
643                 for index in range(len(infObj.Contents[key].PcdsDynamic)):\r
644                     pcd = infObj.Contents[key].PcdsDynamic[index].split(DataType.TAB_VALUE_SPLIT)\r
645                     pb.Pcds[(pcd[0], pcd[1])] = self.FindPcd(key, pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC)\r
646                     #pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC, None, None, None, None)\r
647                 for index in range(len(infObj.Contents[key].PcdsDynamicEx)):\r
648                     pcd = infObj.Contents[key].PcdsDynamicEx[index].split(DataType.TAB_VALUE_SPLIT)\r
649                     pb.Pcds[(pcd[0], pcd[1])] = self.FindPcd(key, pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_EX)\r
650                     #pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_EX, None, None, None, None)\r
651                                         \r
652                 #Add to database\r
653                 self.Build[key].ModuleDatabase[inf] = pb\r
654                 pb = None    \r
655             #End of Arch List Go Through\r
656         \r
657         #End of Inf Go Through\r
658         \r
659         #End of build ModuleDatabase    \r
660     \r
661 \r
662     \r
663     def UpdateInfDatabase(self, infFileName, LibraryClass, Arch):\r
664         infFileName = NormPath(infFileName)\r
665         LibList = self.InfDatabase[infFileName].Contents[Arch].LibraryClasses\r
666         NotFound = True\r
667         for Item in LibList:\r
668             LibName = Item[0].split(DataType.TAB_VALUE_SPLIT)[0].strip()\r
669             if LibName == LibraryClass:\r
670                 return\r
671         \r
672         if NotFound:\r
673             self.InfDatabase[infFileName].Contents[Arch].LibraryClasses.extend([LibraryClass])\r
674     \r
675     def AddToInfDatabase(self, infFileName):\r
676         infFileName = NormPath(infFileName)\r
677         file = self.WorkspaceFile(infFileName)\r
678         if os.path.exists(file) and os.path.isfile(file):\r
679             if infFileName not in self.InfDatabase:\r
680                 self.InfDatabase[infFileName] = Inf(file, True)\r
681                 \r
682     def AddToDecDatabase(self, decFileName):\r
683         decFileName = NormPath(decFileName)\r
684         file = self.WorkspaceFile(decFileName)\r
685         if os.path.exists(file) and os.path.isfile(file):\r
686             if decFileName not in self.DecDatabase:\r
687                 self.DecDatabase[decFileName] = Dec(file, True)\r
688                 \r
689     def FindLibraryClassInstanceOfModule(self, lib, arch, moduleType, moduleName):\r
690         for dsc in self.DscDatabase.keys():\r
691             #First find if exist in <LibraryClass> of <Components> from dsc file            \r
692             dscObj = self.DscDatabase[dsc]\r
693             for index in range(len(dscObj.Contents[arch].Components)):\r
694                 if NormPath(dscObj.Contents[arch].Components[index][0]) == moduleName and len(dscObj.Contents[arch].Components[index][1]) > 0:\r
695                     #Search each library class\r
696                     LibList = dscObj.Contents[arch].Components[index][1]\r
697                     for indexOfLib in range(len(LibList)):\r
698                         if LibList[indexOfLib].split(DataType.TAB_VALUE_SPLIT)[0].strip() == lib:\r
699                             return LibList[indexOfLib].split(DataType.TAB_VALUE_SPLIT)[1].strip()\r
700             \r
701             #Second find if exist in <LibraryClass> of <LibraryClasses> from dsc file            \r
702             if (lib, moduleType) in self.Build[arch].PlatformDatabase[dsc].LibraryClasses:\r
703                 return self.Build[arch].PlatformDatabase[dsc].LibraryClasses[(lib, moduleType)]\r
704             elif (lib, None) in self.Build[arch].PlatformDatabase[dsc].LibraryClasses:\r
705                 return self.Build[arch].PlatformDatabase[dsc].LibraryClasses[(lib, None)]\r
706             \r
707     def FindLibraryClassInstanceOfLibrary(self, lib, arch, type):\r
708         for dsc in self.DscDatabase.keys():\r
709             dscObj = self.DscDatabase[dsc]\r
710             if (lib, type) in self.Build[arch].PlatformDatabase[dsc].LibraryClasses:\r
711                 return self.Build[arch].PlatformDatabase[dsc].LibraryClasses[(lib, type)]\r
712             elif (lib, None) in self.Build[arch].PlatformDatabase[dsc].LibraryClasses:\r
713                 return self.Build[arch].PlatformDatabase[dsc].LibraryClasses[(lib, None)]\r
714             \r
715     def FindBuildOptions(self, arch, moduleName, BuildOptions):\r
716         for dsc in self.DscDatabase.keys():\r
717             #First find if exist in <BuildOptions> of <Components> from dsc file\r
718             dscObj = self.DscDatabase[dsc]\r
719             for index in range(len(dscObj.Contents[arch].Components)):\r
720                 if NormPath(dscObj.Contents[arch].Components[index][0]) == moduleName and len(dscObj.Contents[arch].Components[index][2]) > 0:\r
721                     list = dscObj.Contents[arch].Components[index][2]\r
722                     for l in list:\r
723                         b = l.split(DataType.TAB_EQUAL_SPLIT, 1)\r
724                         Family = ''\r
725                         ToolChain = ''\r
726                         Flag = ''\r
727                         if b[0].find(':') > -1:\r
728                             Family = CleanString(b[0][ : b[0].find(':')])\r
729                             ToolChain = CleanString(b[0][b[0].find(':') + 1 : ])\r
730                         else:\r
731                             ToolChain = CleanString(b[0])\r
732                         Flag = CleanString(b[1])\r
733                         BuildOptions[(Family, ToolChain)] = Flag\r
734                         \r
735     def FindPcd(self, arch, CName, GuidCName, Type):\r
736         DatumType = ''\r
737         DefaultValue = ''\r
738         TokenValue = ''\r
739         MaxDatumSize = ''\r
740         SkuInfoList = None\r
741         for dsc in self.Build[arch].PlatformDatabase.keys():\r
742             platform = self.Build[arch].PlatformDatabase[dsc]\r
743             pcds = platform.Pcds\r
744             if (CName, GuidCName) in pcds:\r
745                 Type = pcds[(CName, GuidCName)].Type\r
746                 DatumType = pcds[(CName, GuidCName)].DatumType\r
747                 DefaultValue = pcds[(CName, GuidCName)].DefaultValue\r
748                 TokenValue = pcds[(CName, GuidCName)].TokenValue\r
749                 MaxDatumSize = pcds[(CName, GuidCName)].MaxDatumSize\r
750                 SkuInfoList =  pcds[(CName, GuidCName)].SkuInfoList\r
751                 break\r
752 \r
753         for dec in self.Build[arch].PackageDatabase.keys():\r
754             package = self.Build[arch].PackageDatabase[dec]\r
755             pcds = package.Pcds\r
756             if (CName, GuidCName) in pcds:\r
757                 DatumType = pcds[(CName, GuidCName)].DatumType\r
758                 #DefaultValue = pcds[(CName, GuidCName)].DefaultValue\r
759                 TokenValue = pcds[(CName, GuidCName)].TokenValue\r
760                 #MaxDatumSize = pcds[(CName, GuidCName)].MaxDatumSize\r
761                 break\r
762         \r
763         return PcdClassObject(CName, GuidCName, Type, DatumType, DefaultValue, TokenValue, MaxDatumSize, SkuInfoList)\r
764     \r
765     def ReloadPcd(self, FvDict):\r
766         pass\r
767                 \r
768 # This acts like the main() function for the script, unless it is 'import'ed into another\r
769 # script.\r
770 if __name__ == '__main__':\r
771 \r
772     # Nothing to do here. Could do some unit tests.\r
773     ewb = WorkspaceBuild('EdkModulePkg/EdkModulePkg.dsc', 'C:/MyWorkspace')\r
774     ewb.GenBuildDatabase()\r
775     #print ewb.DscDatabase\r
776     #print ewb.InfDatabase\r
777     #print ewb.DecDatabase\r
778     print 'SupArchList', ewb.SupArchList\r
779     print 'BuildTarget', ewb.BuildTarget\r
780     print 'SkuId', ewb.SkuId\r
781     \r
782     #\r
783     for arch in DataType.ARCH_LIST:\r
784         print arch\r
785         print 'Platform'\r
786         for platform in ewb.Build[arch].PlatformDatabase.keys():\r
787             p = ewb.Build[arch].PlatformDatabase[platform]\r
788             print 'DescFilePath = ', p.DescFilePath     \r
789             print 'PlatformName = ', p.PlatformName     \r
790             print 'Guid = ', p.Guid                     \r
791             print 'Version = ', p.Version\r
792             print 'OutputDirectory = ', p.OutputDirectory                \r
793             print 'FlashDefinition = ', p.FlashDefinition\r
794             print 'SkuIds = ', p.SkuIds\r
795             print 'Modules = ', p.Modules\r
796             print 'LibraryClasses = ', p.LibraryClasses \r
797             print 'Pcds = ', p.Pcds\r
798             for item in p.Pcds.keys():\r
799                 print p.Pcds[item]\r
800             print 'BuildOptions = ', p.BuildOptions\r
801             print ''   \r
802         #End of Platform\r
803     \r
804         print 'package'\r
805         for package in ewb.Build[arch].PackageDatabase.keys():\r
806             p = ewb.Build[arch].PackageDatabase[package]\r
807             print 'DescFilePath = ', p.DescFilePath    \r
808             print 'PackageName = ', p.PackageName     \r
809             print 'Guid = ', p.Guid                    \r
810             print 'Version = ', p.Version             \r
811             print 'Protocols = ', p.Protocols         \r
812             print 'Ppis = ', p.Ppis                    \r
813             print 'Guids = ', p.Guids                 \r
814             print 'Includes = ', p.Includes            \r
815             print 'LibraryClasses = ', p.LibraryClasses\r
816             print 'Pcds = ', p.Pcds\r
817             print ''                    \r
818         #End of Package\r
819         \r
820         print 'module'\r
821         for module in ewb.Build[arch].ModuleDatabase.keys():\r
822             p = ewb.Build[arch].ModuleDatabase[module]\r
823             print 'DescFilePath = ', p.DescFilePath                    \r
824             print 'BaseName = ', p.BaseName                         \r
825             print 'ModuleType = ', p.ModuleType                     \r
826             print 'Guid = ', p.Guid                                 \r
827             print 'Version = ', p.Version\r
828             print 'CustomMakefile = ', p.CustomMakefile\r
829             print 'Specification = ', p.Specification\r
830             print 'PcdIsDriver = ', p.PcdIsDriver\r
831             if p.LibraryClass != None:\r
832                 print 'LibraryClass = ', p.LibraryClass.LibraryClass\r
833                 print 'SupModList = ', p.LibraryClass.SupModList\r
834             print 'ModuleEntryPointList = ', p.ModuleEntryPointList \r
835             print 'ModuleUnloadImageList = ', p.ModuleUnloadImageList\r
836             print 'ConstructorList = ', p.ConstructorList            \r
837             print 'DestructorList = ', p.DestructorList             \r
838                                                                      \r
839             print 'Binaries = '\r
840             for item in p.Binaries:\r
841                 print str(item)\r
842             print 'Sources = '\r
843             for item in p.Sources:\r
844                 print str(item)\r
845             print 'LibraryClasses = ', p.LibraryClasses             \r
846             print 'Protocols = ', p.Protocols                        \r
847             print 'Ppis = ', p.Ppis                                 \r
848             print 'Guids = ', p.Guids                                \r
849             print 'Includes = ', p.Includes                         \r
850             print 'Packages = ', p.Packages                         \r
851             print 'Pcds = ', p.Pcds\r
852             print 'BuildOptions = ', p.BuildOptions\r
853             print 'Depex = ', p.Depex\r
854             print ''\r
855         #End of Module    \r
856             \r
857     #End of Arch List\r