7fa455abb5f391c17caf6293c7ebcd0f9fa0c5f5
[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 ClassObjects.CommonClassObject import *\r
28 from FdfParser import *\r
29 from BuildToolError import *\r
30 from Region import *\r
31 \r
32 class ModuleSourceFilesClassObject(object):\r
33     def __init__(self, SourceFile = '', PcdFeatureFlag = '', TagName = '', ToolCode = '', ToolChainFamily = '', String = ''):\r
34         self.SourceFile         = SourceFile\r
35         self.TagName            = TagName\r
36         self.ToolCode           = ToolCode\r
37         self.ToolChainFamily    = ToolChainFamily\r
38         self.String             = String\r
39         self.PcdFeatureFlag     = PcdFeatureFlag\r
40     \r
41     def __str__(self):\r
42         rtn = self.SourceFile + DataType.TAB_VALUE_SPLIT + \\r
43               self.PcdFeatureFlag + DataType.TAB_VALUE_SPLIT + \\r
44               self.ToolChainFamily +  DataType.TAB_VALUE_SPLIT + \\r
45               self.TagName + DataType.TAB_VALUE_SPLIT + \\r
46               self.ToolCode + DataType.TAB_VALUE_SPLIT + \\r
47               self.String\r
48         return rtn\r
49 \r
50 class ModuleBinaryFilesClassObject(object):\r
51     def __init__(self, BinaryFile = '', FileType = '', Target = '', PcdFeatureFlag = ''):\r
52         self.BinaryFile = BinaryFile\r
53         self.FileType =FileType\r
54         self.Target = Target\r
55         self.PcdFeatureFlag = PcdFeatureFlag\r
56     \r
57     def __str__(self):\r
58         rtn = self.BinaryFile + DataType.TAB_VALUE_SPLIT + \\r
59               self.FileType + DataType.TAB_VALUE_SPLIT + \\r
60               self.Target +  DataType.TAB_VALUE_SPLIT + \\r
61               self.PcdFeatureFlag\r
62         return rtn\r
63         \r
64 class PcdClassObject(object):\r
65     def __init__(self, Name = None, Guid = None, Type = None, DatumType = None, Value = None, Token = None, MaxDatumSize = None, SkuInfoList = []):\r
66         self.TokenCName = Name\r
67         self.TokenSpaceGuidCName = Guid\r
68         self.Type = Type\r
69         self.DatumType = DatumType\r
70         self.DefaultValue = Value\r
71         self.TokenValue = Token\r
72         self.MaxDatumSize = MaxDatumSize\r
73         self.SkuInfoList = SkuInfoList\r
74         self.Phase = "DXE"\r
75         \r
76     def __str__(self):\r
77         rtn = str(self.TokenCName) + DataType.TAB_VALUE_SPLIT + \\r
78               str(self.TokenSpaceGuidCName) + DataType.TAB_VALUE_SPLIT + \\r
79               str(self.Type) + DataType.TAB_VALUE_SPLIT + \\r
80               str(self.DatumType) + DataType.TAB_VALUE_SPLIT + \\r
81               str(self.DefaultValue) + DataType.TAB_VALUE_SPLIT + \\r
82               str(self.TokenValue) + DataType.TAB_VALUE_SPLIT + \\r
83               str(self.MaxDatumSize) + DataType.TAB_VALUE_SPLIT\r
84         for Item in self.SkuInfoList:\r
85             rtn = rtn + str(Item)\r
86         return rtn\r
87 \r
88     def __eq__(self, other):\r
89         return self.TokenCName == other.TokenCName and self.TokenSpaceGuidCName == other.TokenSpaceGuidCName\r
90 \r
91     def __hash__(self):\r
92         return hash((self.TokenCName, self.TokenSpaceGuidCName))\r
93 \r
94 class LibraryClassObject(object):\r
95     def __init__(self, Name = None, Type = None):\r
96         self.LibraryClass = Name\r
97         self.SupModList = []\r
98         if Type != None:\r
99             self.SupModList = CleanString(Type).split(DataType.TAB_SPACE_SPLIT)\r
100         \r
101 class ModuleBuildClassObject(object):\r
102     def __init__(self):\r
103         self.DescFilePath            = ''\r
104         self.BaseName                = ''\r
105         self.ModuleType              = ''\r
106         self.Guid                    = ''\r
107         self.Version                 = ''\r
108         self.PcdIsDriver             = ''\r
109         self.BinaryModule            = ''\r
110         self.CustomMakefile          = {}\r
111         self.Specification           = {}\r
112         self.LibraryClass            = None      # LibraryClassObject\r
113         self.ModuleEntryPointList    = []\r
114         self.ModuleUnloadImageList   = []\r
115         self.ConstructorList         = []\r
116         self.DestructorList          = []\r
117         \r
118         self.Binaries                = []        #[ ModuleBinaryClassObject, ...]\r
119         self.Sources                 = []        #[ ModuleSourceFilesClassObject, ... ]\r
120         self.LibraryClasses          = {}        #{ [LibraryClassName, ModuleType] : LibraryClassInfFile }\r
121         self.Protocols               = []        #[ ProtocolName, ... ]\r
122         self.Ppis                    = []        #[ PpiName, ... ]\r
123         self.Guids                   = []        #[ GuidName, ... ]\r
124         self.Includes                = []        #[ IncludePath, ... ]\r
125         self.Packages                = []        #[ DecFileName, ... ]\r
126         self.Pcds                    = {}        #{ [(PcdCName, PcdGuidCName)] : PcdClassObject}\r
127         self.BuildOptions            = {}        #{ [BuildOptionKey] : BuildOptionValue}\r
128         self.Depex                   = ''\r
129 \r
130     def __str__(self):\r
131         return self.DescFilePath\r
132 \r
133     def __eq__(self, other):\r
134         return self.DescFilePath == str(other)\r
135 \r
136     def __hash__(self):\r
137         return hash(self.DescFilePath)\r
138 \r
139 class PackageBuildClassObject(object):\r
140     def __init__(self):\r
141         self.DescFilePath            = ''\r
142         self.PackageName             = ''\r
143         self.Guid                    = ''\r
144         self.Version                 = ''\r
145         \r
146         self.Protocols               = {}       #{ [ProtocolName] : Protocol Guid, ... }\r
147         self.Ppis                    = {}       #{ [PpiName] : Ppi Guid, ... }\r
148         self.Guids                   = {}       #{ [GuidName] : Guid, ... }\r
149         self.Includes                = []       #[ IncludePath, ... ]        \r
150         self.LibraryClasses          = {}       #{ [LibraryClassName] : LibraryClassInfFile }\r
151         self.Pcds                    = {}       #{ [(PcdCName, PcdGuidCName)] : PcdClassObject}\r
152         \r
153     def __str__(self):\r
154         return self.DescFilePath\r
155 \r
156     def __eq__(self, other):\r
157         return self.DescFilePath == str(other)\r
158 \r
159     def __hash__(self):\r
160         return hash(self.DescFilePath)\r
161 \r
162 class PlatformBuildClassObject(object):\r
163     def __init__(self):\r
164         self.DescFilePath            = ''\r
165         self.PlatformName            = ''\r
166         self.Guid                    = ''\r
167         self.Version                 = ''\r
168         self.DscSpecification        = ''\r
169         self.OutputDirectory         = ''\r
170         self.FlashDefinition         = ''\r
171         self.BuildNumber             = ''\r
172         self.MakefileName            = ''\r
173                 \r
174         self.SkuIds                  = {}       #{ 'SkuName' : SkuId, '!include' : includefilename, ...}\r
175         self.Modules                 = []       #[ InfFileName, ... ]\r
176         self.LibraryClasses          = {}       #{ (LibraryClassName, ModuleType) : LibraryClassInfFile }\r
177         self.Pcds                    = {}       #{ [(PcdCName, PcdGuidCName)] : PcdClassObject }\r
178         self.BuildOptions            = {}       #{ [BuildOptionKey] : BuildOptionValue }    \r
179 \r
180     def __str__(self):\r
181         return self.DescFilePath\r
182 \r
183     def __eq__(self, other):\r
184         return self.DescFilePath == str(other)\r
185 \r
186     def __hash__(self):\r
187         return hash(self.DescFilePath)\r
188 \r
189 class ItemBuild(object):\r
190     def __init__(self, arch, platform = None, package = None, module = None):\r
191         self.Arch                    = arch\r
192         self.PlatformDatabase        = {}        #{ [DscFileName] : PlatformBuildClassObject, ...}\r
193         self.PackageDatabase         = {}        #{ [DecFileName] : PacakgeBuildClassObject, ...}\r
194         self.ModuleDatabase          = {}        #{ [InfFileName] : ModuleBuildClassObject, ...}\r
195         \r
196 class WorkspaceBuild(object):\r
197     def __init__(self, ActivePlatform = None):\r
198         self.Workspace               = EdkIIWorkspace()\r
199         self.PrintRunTime            = True\r
200         self.PlatformBuild           = True\r
201         self.TargetTxt               = TargetTxtClassObject()\r
202         self.ToolDef                 = ToolDefClassObject()\r
203 \r
204         self.SupArchList             = []        #[ 'IA32', 'X64', ...]\r
205         self.BuildTarget             = []        #[ 'RELEASE', 'DEBUG']\r
206         self.SkuId                   = ''\r
207         \r
208         self.InfDatabase             = {}        #{ [InfFileName] : InfClassObject}\r
209         self.DecDatabase             = {}        #{ [DecFileName] : DecClassObject}\r
210         self.DscDatabase             = {}        #{ [DscFileName] : DscClassObject}\r
211         \r
212         self.Build                   = {}\r
213         for key in DataType.ARCH_LIST:\r
214             self.Build[key] = ItemBuild(key)\r
215         \r
216         self.TargetTxt.LoadTargetTxtFile(self.Workspace.WorkspaceFile('Conf/target.txt'))\r
217         self.ToolDef.LoadToolDefFile(self.Workspace.WorkspaceFile('Conf/tools_def.txt'))\r
218         \r
219         if ActivePlatform != None:\r
220             self.TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_ACTIVE_PLATFORM][0] = ActivePlatform\r
221         \r
222         #get active platform\r
223         dscFileName = NormPath(self.TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_ACTIVE_PLATFORM][0])\r
224         file = self.Workspace.WorkspaceFile(dscFileName)\r
225         if os.path.exists(file) and os.path.isfile(file):\r
226             self.DscDatabase[dscFileName] = Dsc(file, True)\r
227         else:\r
228             EdkLogger.verbose('No Active Platform')\r
229             return\r
230         \r
231         #parse platform to get module\r
232         for dsc in self.DscDatabase.keys():\r
233             dscObj = self.DscDatabase[dsc]\r
234             \r
235             #\r
236             # Get global information\r
237             #\r
238             self.SupArchList = dscObj.Defines.DefinesDictionary[TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES]\r
239             self.BuildTarget = dscObj.Defines.DefinesDictionary[TAB_DSC_DEFINES_BUILD_TARGETS]\r
240             self.SkuId = dscObj.Defines.DefinesDictionary[TAB_DSC_DEFINES_SKUID_IDENTIFIER][0]\r
241             \r
242             #Get all inf\r
243             for key in DataType.ARCH_LIST:\r
244                 for index in range(len(dscObj.Contents[key].LibraryClasses)):\r
245                     self.AddToInfDatabase(dscObj.Contents[key].LibraryClasses[index][0].split(DataType.TAB_VALUE_SPLIT, 1)[1])\r
246                 for index in range(len(dscObj.Contents[key].Components)):\r
247                     Module = dscObj.Contents[key].Components[index][0]\r
248                     LibList = dscObj.Contents[key].Components[index][1]\r
249                     self.AddToInfDatabase(Module)\r
250                     for indexOfLib in range(len(LibList)):\r
251                         Lib = LibList[indexOfLib]\r
252                         if len(Lib.split(DataType.TAB_VALUE_SPLIT)) == 2:\r
253                             self.AddToInfDatabase(CleanString(Lib.split(DataType.TAB_VALUE_SPLIT)[1]))\r
254                             self.UpdateInfDatabase(Module, CleanString(Lib.split(DataType.TAB_VALUE_SPLIT)[0]), key)\r
255         #End For of Dsc\r
256         \r
257         #parse module to get package\r
258         for inf in self.InfDatabase.keys():\r
259             infObj = self.InfDatabase[inf]\r
260             #Get all dec\r
261             for key in DataType.ARCH_LIST:\r
262                 for index in range(len(infObj.Contents[key].Packages)):\r
263                     self.AddToDecDatabase(infObj.Contents[key].Packages[index])\r
264         \r
265         #Build databases\r
266         #Build PlatformDatabase\r
267         for dsc in self.DscDatabase.keys():\r
268             dscObj = self.DscDatabase[dsc]\r
269             \r
270             for key in DataType.ARCH_LIST:\r
271                 pb = PlatformBuildClassObject()\r
272                 pb.DescFilePath = dsc\r
273                 pb.PlatformName = dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_PLATFORM_NAME][0]\r
274                 pb.Guid = dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_PLATFORM_GUID][0]\r
275                 pb.Version = dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_PLATFORM_VERSION][0]\r
276                 pb.DscSpecification = dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_DSC_SPECIFICATION][0]\r
277                 pb.OutputDirectory = NormPath(dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_OUTPUT_DIRECTORY][0])\r
278                 pb.FlashDefinition = NormPath(dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_FLASH_DEFINITION][0])\r
279                 pb.BuildNumber = dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_BUILD_NUMBER][0]\r
280                 pb.MakefileName = NormPath(dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_MAKEFILE_NAME][0])\r
281         \r
282                 #SkuId\r
283                 for index in range(len(dscObj.Contents[key].SkuIds)):\r
284                     SkuInfo = dscObj.Contents[key].SkuIds[index]\r
285                     SkuName = ''\r
286                     SkuId = ''\r
287                     if SkuInfo.find('!include') > -1:\r
288                         SkuName = '!include'\r
289                         SkuId = NormPath(CleanString(SkuInfo[SkuInfo.find('!include') + len('!include'):]))\r
290                     elif len(SkuInfo.split(DataType.TAB_VALUE_SPLIT)) == 2:\r
291                         SkuName = CleanString(SkuInfo.split(DataType.TAB_VALUE_SPLIT)[1])\r
292                         SkuId = CleanString(SkuInfo.split(DataType.TAB_VALUE_SPLIT)[0])\r
293                     else:\r
294                         raise ParseError('Wrong defintion for SkuId: %s' % SkuInfo)\r
295                     pb.SkuIds[SkuName] = SkuId\r
296                 \r
297                 #Module\r
298                 for index in range(len(dscObj.Contents[key].Components)):\r
299                     pb.Modules.append(NormPath(dscObj.Contents[key].Components[index][0]))\r
300                 \r
301                 #BuildOptions\r
302                 for index in range(len(dscObj.Contents[key].BuildOptions)):\r
303                     b = dscObj.Contents[key].BuildOptions[index].split(DataType.TAB_EQUAL_SPLIT, 1)\r
304                     Family = ''\r
305                     ToolChain = ''\r
306                     Flag = ''\r
307                     if b[0].find(':') > -1:\r
308                         Family = CleanString(b[0][ : b[0].find(':')])\r
309                         ToolChain = CleanString(b[0][b[0].find(':') + 1 : ])\r
310                     else:\r
311                         ToolChain = CleanString(b[0])\r
312                     Flag = CleanString(b[1])\r
313                     pb.BuildOptions[(Family, ToolChain)] = Flag\r
314                     \r
315                 #LibraryClass\r
316                 for index in range(len(dscObj.Contents[key].LibraryClasses)):\r
317                     #['DebugLib|MdePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf', 'DXE_CORE']\r
318                     list = dscObj.Contents[key].LibraryClasses[index][0].split(DataType.TAB_VALUE_SPLIT, 1)\r
319                     type = dscObj.Contents[key].LibraryClasses[index][1]\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     #End of self.Init\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.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.Workspace.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.Workspace.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()\r
774     #printDict(ewb.TargetTxt.TargetTxtDictionary)\r
775     #printDict(ewb.ToolDef.ToolsDefTxtDictionary)\r
776 #    print ewb.DscDatabase\r
777 #    print ewb.InfDatabase\r
778 #    print ewb.DecDatabase\r
779     print 'SupArchList', ewb.SupArchList\r
780     print 'BuildTarget', ewb.BuildTarget\r
781     print 'SkuId', ewb.SkuId\r
782     \r
783     #\r
784     for arch in DataType.ARCH_LIST:\r
785         print arch\r
786         print 'Platform'\r
787         for platform in ewb.Build[arch].PlatformDatabase.keys():\r
788             p = ewb.Build[arch].PlatformDatabase[platform]\r
789             print 'DescFilePath = ', p.DescFilePath     \r
790             print 'PlatformName = ', p.PlatformName     \r
791             print 'Guid = ', p.Guid                     \r
792             print 'Version = ', p.Version\r
793             print 'OutputDirectory = ', p.OutputDirectory                \r
794             print 'FlashDefinition = ', p.FlashDefinition\r
795             print 'SkuIds = ', p.SkuIds\r
796             print 'Modules = ', p.Modules\r
797             print 'LibraryClasses = ', p.LibraryClasses \r
798             print 'Pcds = ', p.Pcds\r
799             for item in p.Pcds.keys():\r
800                 print p.Pcds[item]\r
801             print 'BuildOptions = ', p.BuildOptions\r
802             print ''   \r
803         #End of Platform\r
804     \r
805         print 'package'\r
806         for package in ewb.Build[arch].PackageDatabase.keys():\r
807             p = ewb.Build[arch].PackageDatabase[package]\r
808             print 'DescFilePath = ', p.DescFilePath    \r
809             print 'PackageName = ', p.PackageName     \r
810             print 'Guid = ', p.Guid                    \r
811             print 'Version = ', p.Version             \r
812             print 'Protocols = ', p.Protocols         \r
813             print 'Ppis = ', p.Ppis                    \r
814             print 'Guids = ', p.Guids                 \r
815             print 'Includes = ', p.Includes            \r
816             print 'LibraryClasses = ', p.LibraryClasses\r
817             print 'Pcds = ', p.Pcds\r
818             print ''                    \r
819         #End of Package\r
820         \r
821         print 'module'\r
822         for module in ewb.Build[arch].ModuleDatabase.keys():\r
823             p = ewb.Build[arch].ModuleDatabase[module]\r
824             print 'DescFilePath = ', p.DescFilePath                    \r
825             print 'BaseName = ', p.BaseName                         \r
826             print 'ModuleType = ', p.ModuleType                     \r
827             print 'Guid = ', p.Guid                                 \r
828             print 'Version = ', p.Version\r
829             print 'CustomMakefile = ', p.CustomMakefile\r
830             print 'Specification = ', p.Specification\r
831             print 'PcdIsDriver = ', p.PcdIsDriver\r
832             if p.LibraryClass != None:\r
833                 print 'LibraryClass = ', p.LibraryClass.LibraryClass\r
834                 print 'SupModList = ', p.LibraryClass.SupModList\r
835             print 'ModuleEntryPointList = ', p.ModuleEntryPointList \r
836             print 'ModuleUnloadImageList = ', p.ModuleUnloadImageList\r
837             print 'ConstructorList = ', p.ConstructorList            \r
838             print 'DestructorList = ', p.DestructorList             \r
839                                                                      \r
840             print 'Binaries = '\r
841             for item in p.Binaries:\r
842                 print str(item)\r
843             print 'Sources = '\r
844             for item in p.Sources:\r
845                 print str(item)\r
846             print 'LibraryClasses = ', p.LibraryClasses             \r
847             print 'Protocols = ', p.Protocols                        \r
848             print 'Ppis = ', p.Ppis                                 \r
849             print 'Guids = ', p.Guids                                \r
850             print 'Includes = ', p.Includes                         \r
851             print 'Packages = ', p.Packages                         \r
852             print 'Pcds = ', p.Pcds\r
853             print 'BuildOptions = ', p.BuildOptions\r
854             print 'Depex = ', p.Depex\r
855             print ''\r
856         #End of Module    \r
857             \r
858     #End of Arch List\r