git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@428 7335b...
authorhche10x <hche10x@7335b38e-4728-0410-8992-fb3ffe349368>
Fri, 27 Jul 2007 08:33:17 +0000 (08:33 +0000)
committerhche10x <hche10x@7335b38e-4728-0410-8992-fb3ffe349368>
Fri, 27 Jul 2007 08:33:17 +0000 (08:33 +0000)
Source/Python/Common/EdkIIWorkspaceBuild.py
Source/Python/Common/InfClassObject.py
Source/Python/CommonDataClass/CommonClass.py
Source/Python/CommonDataClass/ModuleClass.py

index c97c74f..9b32f97 100644 (file)
@@ -24,43 +24,11 @@ from String import *
 from BuildToolError import *\r
 from CommonDataClass.CommonClass import *\r
 \r
-class ModuleSourceFilesClassObject(object):\r
-    def __init__(self, SourceFile = '', PcdFeatureFlag = '', TagName = '', ToolCode = '', ToolChainFamily = '', String = ''):\r
-        self.SourceFile         = SourceFile\r
-        self.TagName            = TagName\r
-        self.ToolCode           = ToolCode\r
-        self.ToolChainFamily    = ToolChainFamily\r
-        self.String             = String\r
-        self.PcdFeatureFlag     = PcdFeatureFlag\r
-    \r
-    def __str__(self):\r
-        return self.SourceFile\r
-    \r
-    def __repr__(self):\r
-        rtn = self.SourceFile + DataType.TAB_VALUE_SPLIT + \\r
-              self.PcdFeatureFlag + DataType.TAB_VALUE_SPLIT + \\r
-              self.ToolChainFamily +  DataType.TAB_VALUE_SPLIT + \\r
-              self.TagName + DataType.TAB_VALUE_SPLIT + \\r
-              self.ToolCode + DataType.TAB_VALUE_SPLIT + \\r
-              self.String\r
-        return rtn\r
-\r
-class ModuleBinaryFilesClassObject(object):\r
-    def __init__(self, BinaryFile = '', FileType = '', Target = '', PcdFeatureFlag = ''):\r
-        self.BinaryFile = BinaryFile\r
-        self.FileType =FileType\r
-        self.Target = Target\r
-        self.PcdFeatureFlag = PcdFeatureFlag\r
-    \r
-    def __str__(self):\r
-        rtn = self.BinaryFile + DataType.TAB_VALUE_SPLIT + \\r
-              self.FileType + DataType.TAB_VALUE_SPLIT + \\r
-              self.Target +  DataType.TAB_VALUE_SPLIT + \\r
-              self.PcdFeatureFlag\r
-        return rtn\r
-        \r
+#\r
+# This Class is used for PcdObject \r
+#\r
 class PcdClassObject(object):\r
-    def __init__(self, Name = None, Guid = None, Type = None, DatumType = None, Value = None, Token = None, MaxDatumSize = None, SkuInfoList = []):\r
+    def __init__(self, Name = None, Guid = None, Type = None, DatumType = None, Value = None, Token = None, MaxDatumSize = None, SkuInfoList = {}):\r
         self.TokenCName = Name\r
         self.TokenSpaceGuidCName = Guid\r
         self.Type = Type\r
@@ -79,8 +47,8 @@ class PcdClassObject(object):
               str(self.DefaultValue) + DataType.TAB_VALUE_SPLIT + \\r
               str(self.TokenValue) + DataType.TAB_VALUE_SPLIT + \\r
               str(self.MaxDatumSize) + DataType.TAB_VALUE_SPLIT\r
-        for Item in self.SkuInfoList:\r
-            rtn = rtn + str(Item)\r
+        for Item in self.SkuInfoList.values():\r
+            rtn = rtn + Item.SkuId + DataType.TAB_VALUE_SPLIT + Item.SkuIdName\r
         return rtn\r
 \r
     def __eq__(self, other):\r
@@ -89,10 +57,13 @@ class PcdClassObject(object):
     def __hash__(self):\r
         return hash((self.TokenCName, self.TokenSpaceGuidCName))\r
 \r
+#\r
+# This Class is used for LibraryClassObject\r
+#\r
 class LibraryClassObject(object):\r
-    def __init__(self, Name = None, Type = None):\r
+    def __init__(self, Name = None, SupModList = [], Type = None):\r
         self.LibraryClass = Name\r
-        self.SupModList = []\r
+        self.SupModList = SupModList\r
         if Type != None:\r
             self.SupModList = CleanString(Type).split(DataType.TAB_SPACE_SPLIT)\r
         \r
@@ -191,6 +162,10 @@ class ItemBuild(object):
         self.PackageDatabase         = {}        #{ [DecFileName] : PacakgeBuildClassObject, ...}\r
         self.ModuleDatabase          = {}        #{ [InfFileName] : ModuleBuildClassObject, ...}\r
         \r
+#\r
+# This class is used to parse active platform to init all inf/dec/dsc files\r
+# Generate module/package/platform databases for build\r
+#\r
 class WorkspaceBuild(object):\r
     def __init__(self, ActivePlatform, WorkspaceDir):\r
         self.WorkspaceDir            = NormPath(WorkspaceDir)\r
@@ -205,6 +180,9 @@ class WorkspaceBuild(object):
         self.DecDatabase             = {}        #{ [DecFileName] : DecClassObject}\r
         self.DscDatabase             = {}        #{ [DscFileName] : DscClassObject}\r
         \r
+        #\r
+        # Init build for all arches\r
+        #\r
         self.Build                   = {}\r
         for Arch in DataType.ARCH_LIST:\r
             self.Build[Arch] = ItemBuild(Arch)\r
@@ -220,7 +198,7 @@ class WorkspaceBuild(object):
             raise ParserError(FILE_NOT_FOUND, name = File)\r
         \r
         #\r
-        # parse platform to get module\r
+        # Parse platform to get module\r
         #\r
         for DscFile in self.DscDatabase.keys():\r
             Platform = self.DscDatabase[DscFile].Platform\r
@@ -253,423 +231,281 @@ class WorkspaceBuild(object):
                     for Lib in Item.LibraryClasses.LibraryList:\r
                         self.AddToInfDatabase(Lib.FilePath)\r
                         self.UpdateLibraryClassOfModule(Module, Lib.Name, Arch)\r
-        #End For of Dsc\r
         \r
-        #parse module to get package\r
+        #\r
+        # Parse module to get package\r
+        #\r
         for InfFile in self.InfDatabase.keys():\r
             Module = self.InfDatabase[InfFile].Module\r
-            #Get all dec\r
+            #\r
+            # Get all dec\r
+            #\r
             for Item in Module.PackageDependencies:\r
                 for Arch in Item.SupArchList:\r
                     self.AddToDecDatabase(Item.FilePath)\r
-#            for key in DataType.ARCH_LIST:\r
-#                for index in range(len(infObj.Contents[key].Packages)):\r
-#                    self.AddToDecDatabase(infObj.Contents[key].Packages[index])\r
-    #End of self.Init()\r
+    # End of self.Init()\r
     \r
     #\r
-    # Return a full path with workspace dir\r
+    # Generate PlatformDatabase\r
     #\r
-    def WorkspaceFile(self, Filename):\r
-        return os.path.join(os.path.normpath(self.WorkspaceDir), os.path.normpath(Filename))\r
-    \r
-    def GenBuildDatabase(self, PcdsSet = {}):\r
-        #Build databases\r
-        #Build PlatformDatabase\r
-        for dsc in self.DscDatabase.keys():\r
-            dscObj = self.DscDatabase[dsc]\r
+    def GenPlatformDatabase(self):\r
+        for Dsc in self.DscDatabase.keys():\r
+            Platform = self.DscDatabase[Dsc].Platform\r
             \r
-            for key in DataType.ARCH_LIST:\r
+            for Arch in self.SupArchList:\r
                 pb = PlatformBuildClassObject()\r
-                pb.DescFilePath = dsc\r
-                pb.PlatformName = dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_PLATFORM_NAME][0]\r
-                pb.Guid = dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_PLATFORM_GUID][0]\r
-                pb.Version = dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_PLATFORM_VERSION][0]\r
-                pb.DscSpecification = dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_DSC_SPECIFICATION][0]\r
-                pb.OutputDirectory = NormPath(dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_OUTPUT_DIRECTORY][0])\r
-                pb.FlashDefinition = NormPath(dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_FLASH_DEFINITION][0])\r
-                pb.BuildNumber = dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_BUILD_NUMBER][0]\r
-                pb.MakefileName = NormPath(dscObj.Defines.DefinesDictionary[DataType.TAB_DSC_DEFINES_MAKEFILE_NAME][0])\r
                 \r
-                #SkuId\r
-                for index in range(len(dscObj.Contents[key].SkuIds)):\r
-                    SkuInfo = dscObj.Contents[key].SkuIds[index]\r
-                    SkuName = ''\r
-                    SkuId = ''\r
-                    if SkuInfo.find('!include') > -1:\r
-                        SkuName = '!include'\r
-                        SkuId = NormPath(CleanString(SkuInfo[SkuInfo.find('!include') + len('!include'):]))\r
-                    elif len(SkuInfo.split(DataType.TAB_VALUE_SPLIT)) == 2:\r
-                        SkuName = CleanString(SkuInfo.split(DataType.TAB_VALUE_SPLIT)[1])\r
-                        SkuId = CleanString(SkuInfo.split(DataType.TAB_VALUE_SPLIT)[0])\r
-                    else:\r
-                        raise ParseError('Wrong defintion for SkuId: %s' % SkuInfo)\r
-                    pb.SkuIds[SkuName] = SkuId\r
-                \r
-                #Module\r
-                for index in range(len(dscObj.Contents[key].Components)):\r
-                    pb.Modules.append(NormPath(dscObj.Contents[key].Components[index][0]))\r
+                # Defines\r
+                pb.DescFilePath = Dsc\r
+                pb.PlatformName = Platform.Header.Name\r
+                pb.Guid = Platform.Header.Guid\r
+                pb.Version = Platform.Header.Version\r
+                pb.DscSpecification = Platform.Header.DscSpecification\r
+                pb.OutputDirectory = NormPath(Platform.Header.OutputDirectory)\r
+                pb.FlashDefinition = NormPath(Platform.FlashDefinitionFile.FilePath)\r
+                pb.BuildNumber = Platform.Header.BuildNumber\r
+            \r
+                # SkuId\r
+                for Key in Platform.SkuInfos.SkuInfoList.keys():\r
+                    pb.SkuIds[Key] = Platform.SkuInfos.SkuInfoList[Key]\r
                 \r
-                #BuildOptions\r
-                for index in range(len(dscObj.Contents[key].BuildOptions)):\r
-                    b = dscObj.Contents[key].BuildOptions[index].split(DataType.TAB_EQUAL_SPLIT, 1)\r
-                    Family = ''\r
-                    ToolChain = ''\r
-                    Flag = ''\r
-                    if b[0].find(':') > -1:\r
-                        Family = CleanString(b[0][ : b[0].find(':')])\r
-                        ToolChain = CleanString(b[0][b[0].find(':') + 1 : ])\r
-                    else:\r
-                        ToolChain = CleanString(b[0])\r
-                    Flag = CleanString(b[1])\r
-                    pb.BuildOptions[(Family, ToolChain)] = Flag\r
+                # Module\r
+                for Item in Platform.Modules.ModuleList:\r
+                    if Arch in Item.SupArchList:\r
+                        pb.Modules.append(NormPath(Item.FilePath))\r
                     \r
-                #LibraryClass\r
-                for index in range(len(dscObj.Contents[key].LibraryClasses)):\r
-                    #['DebugLib|MdePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf', ['DXE_CORE']]\r
-                    list = dscObj.Contents[key].LibraryClasses[index][0].split(DataType.TAB_VALUE_SPLIT, 1)\r
-                    type = dscObj.Contents[key].LibraryClasses[index][1][0]\r
-                    pb.LibraryClasses[(list[0], type)] = NormPath(list[1])\r
-\r
-                #Pcds\r
-                for index in range(len(dscObj.Contents[key].PcdsFixedAtBuild)):\r
-                    pcd = dscObj.Contents[key].PcdsFixedAtBuild[index].split(DataType.TAB_VALUE_SPLIT)\r
-                    pcd.append(None)\r
-                    pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_FIXED_AT_BUILD, None, pcd[2], None, pcd[3])\r
-                for index in range(len(dscObj.Contents[key].PcdsPatchableInModule)):\r
-                    pcd = dscObj.Contents[key].PcdsPatchableInModule[index].split(DataType.TAB_VALUE_SPLIT)\r
-                    pcd.append(None)\r
-                    pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_PATCHABLE_IN_MODULE, None, pcd[2], None, pcd[3])\r
-                for index in range(len(dscObj.Contents[key].PcdsFeatureFlag)):\r
-                    pcd = dscObj.Contents[key].PcdsFeatureFlag[index].split(DataType.TAB_VALUE_SPLIT)\r
-                    pcd.append(None)                    \r
-                    pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_FEATURE_FLAG, None, pcd[2], None, pcd[3])\r
-                #\r
-                # PcdsDynamic\r
-                #\r
-                for index in range(len(dscObj.Contents[key].PcdsDynamicDefault)):\r
-                    pcd = dscObj.Contents[key].PcdsDynamicDefault[index][0].split(DataType.TAB_VALUE_SPLIT)\r
-                    pcd.append(None)\r
-                    SkuName = dscObj.Contents[key].PcdsDynamicDefault[index][1]\r
-                    SkuInfoList = []\r
-                    if SkuName == None or SkuName == [] or SkuName == ['']:\r
-                        SkuName = ['DEFAULT']\r
-                    SkuNameList = map(lambda l: l.strip(), SkuName[0].split(DataType.TAB_VALUE_SPLIT))\r
-                    for Item in SkuNameList:\r
-                        SkuInfo = SkuInfoClass()\r
-                        SkuInfo.SkuId = Item[1]\r
-                        SkuInfo.DefaultValue = pcd[2]\r
-                        SkuInfoList.append(SkuInfo)\r
-                    pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_DEFAULT, None, None, None, pcd[3], SkuInfoList)\r
-                for index in range(len(dscObj.Contents[key].PcdsDynamicVpd)):\r
-                    pcd = dscObj.Contents[key].PcdsDynamicVpd[index][0].split(DataType.TAB_VALUE_SPLIT)\r
-                    pcd.append(None)\r
-                    SkuId = dscObj.Contents[key].PcdsDynamicVpd[index][1]\r
-                    SkuInfoList = []\r
-                    if SkuId == None:\r
-                        SkuId = 'DEFAULT'\r
-                    SkuIdList = map(lambda l: l.strip(), SkuId.split(DataType.TAB_VALUE_SPLIT))\r
-                    for Item in SkuIdList:\r
-                        SkuInfo = SkuInfoClassObject()\r
-                        SkuInfo.SkuId = Item\r
-                        SkuInfo.VpdOffset = pcd[2]\r
-                        SkuInfoList.append(SkuInfo)\r
-                    pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_VPD, None, None, None, pcd[3], SkuInfoList)\r
-                for index in range(len(dscObj.Contents[key].PcdsDynamicHii)):\r
-                    pcd = dscObj.Contents[key].PcdsDynamicHii[index][0].split(DataType.TAB_VALUE_SPLIT)\r
-                    pcd.append(None)\r
-                    SkuId = dscObj.Contents[key].PcdsDynamicHii[index][1]\r
-                    SkuInfoList = []\r
-                    if SkuId == None:\r
-                        SkuId = 'DEFAULT'\r
-                    SkuIdList = map(lambda l: l.strip(), SkuId.split(DataType.TAB_VALUE_SPLIT))\r
-                    for Item in SkuIdList:\r
-                        SkuInfo = SkuInfoClassObject()\r
-                        SkuInfo.SkuId = Item\r
-                        SkuInfo.VariableName = pcd[2]\r
-                        SkuInfo.VariableGuid = pcd[3]\r
-                        SkuInfo.VariableOffset = pcd[4]\r
-                        SkuInfo.HiiDefaultValue = pcd[5]                                                \r
-                        SkuInfoList.append(SkuInfo)\r
-                    pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_HII, None, None, None, pcd[6], SkuInfoList)\r
-                #\r
-                # PcdsDynamicEx\r
-                #\r
-                for index in range(len(dscObj.Contents[key].PcdsDynamicExDefault)):\r
-                    pcd = dscObj.Contents[key].PcdsDynamicExDefault[index][0].split(DataType.TAB_VALUE_SPLIT)\r
-                    pcd.append(None)\r
-                    SkuId = dscObj.Contents[key].PcdsDynamicExDefault[index][1]\r
-                    SkuInfoList = []\r
-                    if SkuId == None:\r
-                        SkuId = 'DEFAULT'\r
-                    SkuIdList = map(lambda l: l.strip(), SkuId.split(DataType.TAB_VALUE_SPLIT))\r
-                    for Item in SkuIdList:\r
-                        SkuInfo = SkuInfoClassObject()\r
-                        SkuInfo.SkuId = Item\r
-                        SkuInfo.DefaultValue = pcd[2]\r
-                        SkuInfoList.append(SkuInfo)\r
-                    pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_EX_DEFAULT, None, None, None, pcd[3], SkuInfoList)\r
-                for index in range(len(dscObj.Contents[key].PcdsDynamicExVpd)):\r
-                    pcd = dscObj.Contents[key].PcdsDynamicExVpd[index][0].split(DataType.TAB_VALUE_SPLIT)\r
-                    pcd.append(None)\r
-                    SkuId = dscObj.Contents[key].PcdsDynamicExVpd[index][1]\r
-                    SkuInfoList = []\r
-                    if SkuId == None:\r
-                        SkuId = 'DEFAULT'\r
-                    SkuIdList = map(lambda l: l.strip(), SkuId.split(DataType.TAB_VALUE_SPLIT))\r
-                    for Item in SkuIdList:\r
-                        SkuInfo = SkuInfoClassObject()\r
-                        SkuInfo.SkuId = Item\r
-                        SkuInfo.VpdOffset = pcd[2]\r
-                        SkuInfoList.append(SkuInfo)\r
-                    pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_EX_VPD, None, None, None, pcd[3], SkuInfoList)\r
-                for index in range(len(dscObj.Contents[key].PcdsDynamicExHii)):\r
-                    pcd = dscObj.Contents[key].PcdsDynamicExHii[index][0].split(DataType.TAB_VALUE_SPLIT)\r
-                    pcd.append(None)\r
-                    SkuId = dscObj.Contents[key].PcdsDynamicExHii[index][1]\r
-                    SkuInfoList = []\r
-                    if SkuId == None:\r
-                        SkuId = 'DEFAULT'\r
-                    SkuIdList = map(lambda l: l.strip(), SkuId.split(DataType.TAB_VALUE_SPLIT))\r
-                    for Item in SkuIdList:\r
-                        SkuInfo = SkuInfoClassObject()\r
-                        SkuInfo.SkuId = Item\r
-                        SkuInfo.VariableName = pcd[2]\r
-                        SkuInfo.VariableGuid = pcd[3]\r
-                        SkuInfo.VariableOffset = pcd[4]\r
-                        SkuInfo.HiiDefaultValue = pcd[5]                                                \r
-                        SkuInfoList.append(SkuInfo)\r
-                    pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_EX_HII, None, None, None, pcd[6], SkuInfoList)\r
-              \r
-                self.Build[key].PlatformDatabase[dsc] = pb\r
-                pb = None    \r
-            #End of Arch List Go Through    \r
+                # BuildOptions\r
+                for Item in Platform.BuildOptions.BuildOptionList:\r
+                    if Arch in Item.SupArchList:\r
+                        pb.BuildOptions[(Item.ToolChainFamily, Item.ToolChain)] = Item.Option\r
+                  \r
+                # LibraryClass\r
+                for Item in Platform.LibraryClasses.LibraryList:\r
+                    if Arch in Item.SupArchList:\r
+                        for ModuleType in Item.ModuleType:\r
+                            pb.LibraryClasses[(Item.Name, ModuleType)] = NormPath(Item.FilePath)\r
+                    \r
+                # Pcds\r
+                for Item in Platform.DynamicPcdBuildDefinitions:\r
+                    if Arch in Item.SupArchList:\r
+                        Name = Item.CName\r
+                        Guid = Item.TokenSpaceGuidCName\r
+                        Type = Item.ItemType\r
+                        DatumType = ''\r
+                        Value = Item.DefaultValue\r
+                        Token = Item.Token\r
+                        MaxDatumSize = Item.MaxDatumSize\r
+                        SkuInfoList = Item.SkuInfoList\r
+                        pb.Pcds[(Name, Guid)] = PcdClassObject(Name, Guid, Type, DatumType, Value, Token, MaxDatumSize, SkuInfoList)\r
                 \r
-        #End of Dsc Go Through\r
-        \r
-        #End of build PlatformDatabase\r
+                # Add to database\r
+                self.Build[Arch].PlatformDatabase[Dsc] = pb\r
+                pb = None\r
+    \r
+    #\r
+    # Generate PackageDatabase\r
+    #    \r
+    def GenPackageDatabase(self):\r
+        for Dec in self.DecDatabase.keys():\r
+            Package = self.DecDatabase[Dec].Package\r
         \r
-        #Build PackageDatabase\r
-        for dec in self.DecDatabase.keys():\r
-            decObj = self.DecDatabase[dec]\r
-\r
-            for key in DataType.ARCH_LIST:\r
+            for Arch in self.SupArchList:\r
                 pb = PackageBuildClassObject()\r
-                #Defines\r
-                pb.DescFilePath = dec\r
-                pb.PackageName = decObj.Defines.DefinesDictionary[TAB_DEC_DEFINES_PACKAGE_NAME][0]\r
-                pb.Guid = decObj.Defines.DefinesDictionary[TAB_DEC_DEFINES_PACKAGE_GUID][0]\r
-                pb.Version = decObj.Defines.DefinesDictionary[TAB_DEC_DEFINES_PACKAGE_VERSION][0]\r
                 \r
-                #Protocols\r
-                for index in range(len(decObj.Contents[key].Protocols)):\r
-                    list = decObj.Contents[key].Protocols[index].split(DataType.TAB_EQUAL_SPLIT)\r
-                    pb.Protocols[CleanString(list[0])] = CleanString(list[1])\r
-\r
-                #Ppis\r
-                for index in range(len(decObj.Contents[key].Ppis)):\r
-                    list = decObj.Contents[key].Ppis[index].split(DataType.TAB_EQUAL_SPLIT)\r
-                    pb.Ppis[CleanString(list[0])] = CleanString(list[1])            \r
-\r
-                #Guids\r
-                for index in range(len(decObj.Contents[key].Guids)):\r
-                    list = decObj.Contents[key].Guids[index].split(DataType.TAB_EQUAL_SPLIT)\r
-                    pb.Guids[CleanString(list[0])] = CleanString(list[1])        \r
+                # Defines\r
+                pb.DescFilePath = Dec\r
+                pb.PackageName = Package.Header.Name\r
+                pb.Guid = Package.Header.Guid\r
+                pb.Version = Package.Header.Version\r
                 \r
-                #Includes\r
-                for index in range(len(decObj.Contents[key].Includes)):\r
-                    pb.Includes.append(NormPath(decObj.Contents[key].Includes[index]))\r
-            \r
-                #LibraryClasses\r
-                for index in range(len(decObj.Contents[key].LibraryClasses)):\r
-                    list = decObj.Contents[key].LibraryClasses[index].split(DataType.TAB_VALUE_SPLIT)\r
-                    pb.LibraryClasses[CleanString(list[0])] = NormPath(CleanString(list[1]))\r
-                                                \r
-                #Pcds\r
-                for index in range(len(decObj.Contents[key].PcdsFixedAtBuild)):\r
-                    pcd = decObj.Contents[key].PcdsFixedAtBuild[index].split(DataType.TAB_VALUE_SPLIT)\r
-                    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
-                for index in range(len(decObj.Contents[key].PcdsPatchableInModule)):\r
-                    pcd = decObj.Contents[key].PcdsPatchableInModule[index].split(DataType.TAB_VALUE_SPLIT)\r
-                    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
-                for index in range(len(decObj.Contents[key].PcdsFeatureFlag)):\r
-                    pcd = decObj.Contents[key].PcdsFeatureFlag[index].split(DataType.TAB_VALUE_SPLIT)\r
-                    pb.Pcds[(pcd[0], pcd[2])] = PcdClassObject(pcd[0], pcd[2], DataType.TAB_PCDS_FEATURE_FLAG, pcd[3], pcd[4], pcd[1], None)\r
-                for index in range(len(decObj.Contents[key].PcdsDynamic)):\r
-                    pcd = decObj.Contents[key].PcdsDynamic[index].split(DataType.TAB_VALUE_SPLIT)\r
-                    pb.Pcds[(pcd[0], pcd[2])] = PcdClassObject(pcd[0], pcd[2], DataType.TAB_PCDS_DYNAMIC, pcd[3], pcd[4], pcd[1], None)\r
-                for index in range(len(decObj.Contents[key].PcdsDynamicEx)):\r
-                    pcd = decObj.Contents[key].PcdsDynamicEx[index].split(DataType.TAB_VALUE_SPLIT)\r
-                    pb.Pcds[(pcd[0], pcd[2])] = PcdClassObject(pcd[0], pcd[2], DataType.TAB_PCDS_DYNAMIC_EX, pcd[3], pcd[4], pcd[1], None)\r
-            \r
-                #Add to database\r
-                self.Build[key].PackageDatabase[dec] = pb\r
-                pb = None    \r
-            #End of Arch List Go Through\r
-        \r
-        #End of Dec Go Through    \r
-        \r
-        #End of build PackageDatabase\r
+                # Protocols\r
+                for Item in Package.ProtocolDeclarations:\r
+                    if Arch in Item.SupArchList:\r
+                        pb.Protocols[Item.CName] = Item.Guid\r
+                        \r
+                # Ppis\r
+                for Item in Package.PpiDeclarations:\r
+                    if Arch in Item.SupArchList:\r
+                        pb.Ppis[Item.CName] = Item.Guid\r
+                \r
+                # Guids\r
+                for Item in Package.GuidDeclarations:\r
+                    if Arch in Item.SupArchList:\r
+                        pb.Ppis[Item.CName] = Item.Guid\r
+                \r
+                # Includes\r
+                for Item in Package.Includes:\r
+                    if Arch in Item.SupArchList:\r
+                        pb.Includes.append(NormPath(Item.FilePath))\r
+                        \r
+                # LibraryClasses\r
+                for Item in Package.LibraryClassDeclarations:\r
+                    if Arch in Item.SupArchList:\r
+                        pb.LibraryClasses[Item.LibraryClass] = NormPath(Item.RecommendedInstance)\r
+                \r
+                # Pcds\r
+                for Item in Package.PcdDeclarations:\r
+                    if Arch in Item.SupArchList:\r
+                        Name = Item.CName\r
+                        Guid = Item.TokenSpaceGuidCName\r
+                        Type = Item.ItemType\r
+                        DatumType = ''\r
+                        Value = Item.DefaultValue\r
+                        Token = Item.Token\r
+                        MaxDatumSize = Item.MaxDatumSize\r
+                        SkuInfoList = Item.SkuInfoList\r
+                        pb.Pcds[(Name, Guid)] = PcdClassObject(Name, Guid, Type, DatumType, Value, Token, MaxDatumSize, SkuInfoList)\r
+                \r
+                # Add to database\r
+                self.Build[Arch].PackageDatabase[Dec] = pb\r
+                pb = None\r
     \r
-        #Build ModuleDatabase\r
-        for inf in self.InfDatabase.keys():\r
-            infObj = self.InfDatabase[inf]\r
+    #\r
+    # Generate ModuleDatabase\r
+    #\r
+    def GenModuleDatabase(self, PcdsSet = {}):\r
+        for Inf in self.InfDatabase.keys():\r
+            Module = self.InfDatabase[Inf].Module\r
             \r
-            for key in DataType.ARCH_LIST:\r
-                #Defines\r
+            for Arch in self.SupArchList:\r
                 pb = ModuleBuildClassObject()\r
-                pb.DescFilePath = inf\r
-                pb.BaseName = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_BASE_NAME][0]\r
-                pb.Guid = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_FILE_GUID][0]\r
-                pb.Version = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_VERSION_STRING][0]\r
-                pb.ModuleType = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_MODULE_TYPE][0]\r
-                pb.PcdIsDriver = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_PCD_IS_DRIVER][0]\r
-                pb.BinaryModule = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_BINARY_MODULE][0]\r
                 \r
-                for Index in range(len(infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_CUSTOM_MAKEFILE])):\r
-                    Makefile = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_CUSTOM_MAKEFILE][Index]\r
-                    if Makefile != '':\r
-                        MakefileList = Makefile.split(DataType.TAB_VALUE_SPLIT)\r
-                        if len(MakefileList) == 2:\r
-                            pb.CustomMakefile[CleanString(MakefileList[0])] = CleanString(MakefileList[1])\r
-                        else:\r
-                            raise ParseError('Wrong custom makefile defined in file ' + inf + ', correct format is CUSTOM_MAKEFILE = Family|Filename')\r
+                # Defines\r
+                pb.DescFilePath = Inf\r
+                pb.BaseName = Module.Header.Name\r
+                pb.Guid = Module.Header.Guid\r
+                pb.Version = Module.Header.Version\r
+                pb.ModuleType = Module.Header.ModuleType\r
+                pb.PcdIsDriver = Module.Header.PcdIsDriver\r
+                pb.BinaryModule = Module.Header.BinaryModule\r
+                pb.CustomMakefile = Module.Header.CustomMakefile\r
                 \r
-                if infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_EDK_RELEASE_VERSION][0] != '':\r
-                    pb.Specification[TAB_INF_DEFINES_EDK_RELEASE_VERSION] = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_EDK_RELEASE_VERSION][0]\r
-                if infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION][0] != '':\r
-                    pb.Specification[TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION] = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION][0]                \r
+                # Specs os Defines\r
+                pb.Specification = Module.Header.Specification\r
+                pb.Specification[TAB_INF_DEFINES_EDK_RELEASE_VERSION] = Module.Header.EdkReleaseVersion\r
+                pb.Specification[TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION] = Module.Header.EfiSpecificationVersion\r
                 \r
-                LibraryClass = infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_LIBRARY_CLASS][0]\r
-                if LibraryClass != '':\r
-                    l = LibraryClass.split(DataType.TAB_VALUE_SPLIT, 1)\r
-                    if len(l) == 1:\r
-                        pb.LibraryClass = LibraryClassObject(l[0], DataType.SUP_MODULE_LIST_STRING)\r
-                    else:\r
-                        pb.LibraryClass = LibraryClassObject(l[0], l[1])\r
+                # LibraryClass of Defines\r
+                for Item in Module.Header.LibraryClass:\r
+                    pb.LibraryClass = LibraryClassObject(Item.LibraryClass, Item.SupModuleList, None)\r
 \r
-                pb.ModuleEntryPointList.extend(infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_ENTRY_POINT])\r
-                pb.ModuleUnloadImageList.extend(infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_UNLOAD_IMAGE])\r
-                pb.ConstructorList.extend(infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_CONSTRUCTOR])\r
-                pb.DestructorList.extend(infObj.Defines.DefinesDictionary[TAB_INF_DEFINES_DESTRUCTOR])\r
-\r
-                #Binaries\r
-                for index in range(len(infObj.Contents[key].Binaries)):\r
-                    BinaryFile = infObj.Contents[key].Binaries[index].split(DataType.TAB_VALUE_SPLIT)\r
-                    BinaryFile.append('')\r
-                    FileType = BinaryFile[0].strip()\r
-                    Target = BinaryFile[1].strip()\r
-                    FileName = NormPath(BinaryFile[2].strip())\r
-                    PcdFeatureFlag = BinaryFile[3].strip()\r
-                    pb.Binaries.append(ModuleBinaryFilesClassObject(FileName, FileType, Target, PcdFeatureFlag))\r
-                    \r
+                # Module image and library of Defines\r
+                for Item in Module.ExternImages:\r
+                    if Item.ModuleEntryPoint != '':\r
+                        pb.ModuleEntryPointList.append(Item.ModuleEntryPoint)\r
+                    if Item.ModuleUnloadImage != '':\r
+                        pb.ModuleUnloadImageList.append(Item.ModuleUnloadImage)\r
+                for Item in Module.ExternLibraries:\r
+                    if Item.Constructor != '':\r
+                        pb.ConstructorList.append(Item.Constructor)\r
+                    if Item.Destructor != '':\r
+                        pb.DestructorList.append(Item.Destructor)\r
+                \r
+                # Binaries\r
+                for Item in Module.Binaries:\r
+                    if Arch in Item.SupArchList:\r
+                        FileName = NormPath(Item.BinaryFile)\r
+                        FileType = Item.FileType\r
+                        Target = Item.Target\r
+                        FeatureFlag = Item.FeatureFlag\r
+                        pb.Binaries.append(ModuleBinaryFileClass(FileName, FileType, Target, FeatureFlag))\r
+                \r
                 #Sources\r
-                for index in range(len(infObj.Contents[key].Sources)):\r
-                    SourceFile = infObj.Contents[key].Sources[index].split(DataType.TAB_VALUE_SPLIT)\r
-                    if len(SourceFile) == 6:\r
-                        FileName = NormPath(SourceFile[0].strip())\r
-                        PcdFeatureFlag = SourceFile[1].strip()\r
-                        TagName = SourceFile[3].strip()\r
-                        ToolCode = SourceFile[4].strip()\r
-                        ToolChainFamily = SourceFile[2].strip()\r
-                        String = SourceFile[5].strip()\r
-                        pb.Sources.append(ModuleSourceFilesClassObject(FileName, PcdFeatureFlag, TagName, ToolCode, ToolChainFamily, String))\r
-                    elif len(SourceFile) == 1:\r
-                        pb.Sources.append(ModuleSourceFilesClassObject(NormPath(infObj.Contents[key].Sources[index])))\r
-                    else:\r
-                        raise ParseError("Inconsistent '|' value defined in SourceFiles." + key + " section in file " + inf)\r
-\r
-                #Protocols\r
-                for index in range(len(infObj.Contents[key].Protocols)):\r
-                    pb.Protocols.append(infObj.Contents[key].Protocols[index])\r
-            \r
-                #Ppis\r
-                for index in range(len(infObj.Contents[key].Ppis)):\r
-                    pb.Ppis.append(infObj.Contents[key].Ppis[index])\r
-                                \r
-                #Guids\r
-                for index in range(len(infObj.Contents[key].Guids)):\r
-                    pb.Guids.append(infObj.Contents[key].Guids[index])\r
-            \r
-                #Includes\r
-                for index in range(len(infObj.Contents[key].Includes)):\r
-                    pb.Includes.append(NormPath(infObj.Contents[key].Includes[index]))\r
-            \r
-                #Packages\r
-                for index in range(len(infObj.Contents[key].Packages)):\r
-                    pb.Packages.append(NormPath(infObj.Contents[key].Packages[index]))\r
-                    \r
-                #BuildOptions\r
-                for index in range(len(infObj.Contents[key].BuildOptions)):\r
-                    b = infObj.Contents[key].BuildOptions[index].split(DataType.TAB_EQUAL_SPLIT, 1)\r
-                    Family = ''\r
-                    ToolChain = ''\r
-                    Flag = ''\r
-                    if b[0].find(':') > -1:\r
-                        Family = CleanString(b[0][ : b[0].find(':')])\r
-                        ToolChain = CleanString(b[0][b[0].find(':') + 1 : ])\r
-                    else:\r
-                        ToolChain = CleanString(b[0])\r
-                    Flag = CleanString(b[1])\r
-                    pb.BuildOptions[(Family, ToolChain)] = Flag\r
-                self.FindBuildOptions(key, inf, pb.BuildOptions)\r
+                for Item in Module.Sources:\r
+                    if Arch in Item.SupArchList:\r
+                        SourceFile = NormPath(Item.SourceFile)\r
+                        TagName = Item.TagName\r
+                        ToolCode = Item.ToolCode\r
+                        ToolChainFamily = Item.ToolChainFamily\r
+                        FeatureFlag = Item.FeatureFlag\r
+                        pb.Sources.append(ModuleSourceFileClass(SourceFile, TagName, ToolCode, ToolChainFamily, FeatureFlag))\r
                 \r
-                #Depex\r
-                pb.Depex = ' '.join(infObj.Contents[key].Depex)\r
+                # Protocols\r
+                for Item in Module.Protocols:\r
+                    if Arch in Item.SupArchList:\r
+                        pb.Protocols.append(Item.CName)\r
+                        \r
+                # Ppis\r
+                for Item in Module.Ppis:\r
+                    if Arch in Item.SupArchList:\r
+                        pb.Ppis.append(Item.CName)\r
                 \r
-                #LibraryClasses\r
-                for index in range(len(infObj.Contents[key].LibraryClasses)):\r
-                    #Get LibraryClass name and default instance if existing\r
-                    list = infObj.Contents[key].LibraryClasses[index][0].split(DataType.TAB_VALUE_SPLIT)\r
-                    if len(list) < 2:\r
-                        v = ''\r
-                    else:\r
-                        v = list[1]\r
-                    \r
-                    if pb.LibraryClass != None:\r
-                        #For Library\r
-                        for type in pb.LibraryClass.SupModList:\r
-                            instance = self.FindLibraryClassInstanceOfLibrary(CleanString(list[0]), key, type)\r
-                            if instance != None:\r
-                                v = instance\r
-                                pb.LibraryClasses[(CleanString(list[0]), type)] = NormPath(CleanString(v))\r
-                    else:\r
-                        #For Module                        \r
-                        instance = self.FindLibraryClassInstanceOfModule(CleanString(list[0]), key, pb.ModuleType, inf) \r
-                        if instance != None:\r
-                            v = instance\r
-                            pb.LibraryClasses[(CleanString(list[0]), pb.ModuleType)] = NormPath(CleanString(v))\r
+                # Guids\r
+                for Item in Module.Guids:\r
+                    if Arch in Item.SupArchList:\r
+                        pb.Ppis.append(Item.CName)\r
+                \r
+                # Includes\r
+                for Item in Module.Includes:\r
+                    if Arch in Item.SupArchList:\r
+                        pb.Includes.append(NormPath(Item.FilePath))                \r
+                \r
+                # Packages\r
+                for Item in Module.PackageDependencies:\r
+                    if Arch in Item.SupArchList:\r
+                        pb.Packages.append(NormPath(Item.FilePath))                        \r
 \r
-                #Pcds\r
-                for index in range(len(infObj.Contents[key].PcdsFixedAtBuild)):\r
-                    pcd = infObj.Contents[key].PcdsFixedAtBuild[index].split(DataType.TAB_VALUE_SPLIT)\r
-                    pb.Pcds[(pcd[0], pcd[1])] = self.FindPcd(key, pcd[0], pcd[1], DataType.TAB_PCDS_FIXED_AT_BUILD)\r
-                for index in range(len(infObj.Contents[key].PcdsPatchableInModule)):\r
-                    pcd = infObj.Contents[key].PcdsPatchableInModule[index].split(DataType.TAB_VALUE_SPLIT)\r
-                    pb.Pcds[(pcd[0], pcd[1])] = self.FindPcd(key, pcd[0], pcd[1], DataType.TAB_PCDS_PATCHABLE_IN_MODULE)\r
-                    #pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_PATCHABLE_IN_MODULE, None, None, None, None)                    \r
-                for index in range(len(infObj.Contents[key].PcdsFeatureFlag)):\r
-                    pcd = infObj.Contents[key].PcdsFeatureFlag[index].split(DataType.TAB_VALUE_SPLIT)\r
-                    pb.Pcds[(pcd[0], pcd[1])] = self.FindPcd(key, pcd[0], pcd[1], DataType.TAB_PCDS_FEATURE_FLAG)\r
-                    #pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_FEATURE_FLAG, None, None, None, None)                    \r
-                for index in range(len(infObj.Contents[key].PcdsDynamic)):\r
-                    pcd = infObj.Contents[key].PcdsDynamic[index].split(DataType.TAB_VALUE_SPLIT)\r
-                    pb.Pcds[(pcd[0], pcd[1])] = self.FindPcd(key, pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC)\r
-                    #pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC, None, None, None, None)\r
-                for index in range(len(infObj.Contents[key].PcdsDynamicEx)):\r
-                    pcd = infObj.Contents[key].PcdsDynamicEx[index].split(DataType.TAB_VALUE_SPLIT)\r
-                    pb.Pcds[(pcd[0], pcd[1])] = self.FindPcd(key, pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_EX)\r
-                    #pb.Pcds[(pcd[0], pcd[1])] = PcdClassObject(pcd[0], pcd[1], DataType.TAB_PCDS_DYNAMIC_EX, None, None, None, None)\r
-                                        \r
-                #Add to database\r
-                self.Build[key].ModuleDatabase[inf] = pb\r
-                pb = None    \r
-            #End of Arch List Go Through\r
-        \r
-        #End of Inf Go Through\r
+                # BuildOptions\r
+                for Item in Module.BuildOptions:\r
+                    if Arch in Item.SupArchList:\r
+                        pb.BuildOptions[(Item.ToolChainFamily, Item.ToolChain)] = Item.Option\r
+                self.FindBuildOptions(Arch, Inf, pb.BuildOptions)\r
+                \r
+                # Depex\r
+                for Item in Module.Depex:\r
+                    if Arch in Item.SupArchList:\r
+                        pb.Depex = pb.Depex + Item.Depex + ' '\r
+                pb.Depex = pb.Depex.strip()\r
+                \r
+                # LibraryClasses\r
+                for Item in Module.LibraryClasses:\r
+                    if Arch in Item.SupArchList:\r
+                        Lib = Item.LibraryClass\r
+                        RecommendedInstance = Item.RecommendedInstance\r
+                        if pb.LibraryClass != None:\r
+                            # For Library\r
+                            for Type in pb.LibraryClass.SupModList:\r
+                                Instance = self.FindLibraryClassInstanceOfLibrary(Lib, Arch, Type)\r
+                                if Instance == None:\r
+                                    Instance = RecommendedInstance\r
+                                    pb.LibraryClasses[(Lib, Type)] = NormPath(Instance)\r
+                        else:\r
+                            # For Module\r
+                            Instance = self.FindLibraryClassInstanceOfModule(Lib, Arch, pb.ModuleType, Inf) \r
+                            if Instance == None:\r
+                                Instance = RecommendedInstance\r
+                            pb.LibraryClasses[(Lib, pb.ModuleType)] = NormPath(Instance)\r
+                \r
+                # Pcds\r
+                for Item in Module.PcdCodes:\r
+                    if Arch in Item.SupArchList:\r
+                        Name = Item.CName\r
+                        Guid = Item.TokenSpaceGuidCName\r
+                        Type = Item.ItemType\r
+                        pb.Pcds[(Name, Guid)] = self.FindPcd(Arch, Inf, Name, Guid, Type, PcdsSet)\r
+                \r
+                # Add to database\r
+                self.Build[Arch].ModuleDatabase[Inf] = pb\r
+                pb = None\r
+    \r
+    #\r
+    # Generate build database for all arches\r
+    #\r
+    def GenBuildDatabase(self, PcdsSet = {}):\r
+        self.GenPlatformDatabase()\r
+        self.GenPackageDatabase()\r
+        self.GenModuleDatabase(PcdsSet)\r
         \r
-        #End of build ModuleDatabase\r
+    #\r
+    # Return a full path with workspace dir\r
+    #\r
+    def WorkspaceFile(self, Filename):\r
+        return os.path.join(os.path.normpath(self.WorkspaceDir), os.path.normpath(Filename))\r
     \r
+    #\r
+    # If a module of a platform has its own override libraryclass but the libraryclass not defined in the module\r
+    # Add this libraryclass to the module\r
+    #\r
     def UpdateLibraryClassOfModule(self, InfFileName, LibraryClass, Arch):\r
         LibList = self.InfDatabase[NormPath(InfFileName)].Module.LibraryClasses\r
         NotFound = True\r
@@ -687,201 +523,234 @@ class WorkspaceBuild(object):
             Lib = LibraryClassClass()\r
             Lib.LibraryClass = LibraryClass\r
             Lib.SupArchList = [Arch]\r
-                \r
-    \r
-#    def UpdateInfDatabase(self, InfFileName, LibraryClass, Arch):\r
-#        InfFileName = NormPath(InfFileName)\r
-#        LibList = self.InfDatabase[InfFileName].Contents[Arch].LibraryClasses\r
-#        LibList = self.InfDatabase[InfFileName].Module.LibraryClasses\r
-#        NotFound = True\r
-#        for Lib in LibList:\r
-#            if Lib.LibraryClass == LibraryClass and Arch in Lib.SupArchList:\r
-#                return\r
-#        \r
-#        if NotFound:\r
-#            self.InfDatabase[infFileName].Module.Contents[Arch].LibraryClasses.extend([LibraryClass])\r
-    \r
+            self.InfDatabase[NormPath(InfFileName)].Module.LibraryClasses.append(Lib)\r
+            \r
+    #\r
+    # Create a Inf instance for input inf file and add it to InfDatabase\r
+    #\r
     def AddToInfDatabase(self, InfFileName):\r
         InfFileName = NormPath(InfFileName)\r
         File = self.WorkspaceFile(InfFileName)\r
         if os.path.exists(File) and os.path.isfile(File):\r
             if InfFileName not in self.InfDatabase:\r
                 self.InfDatabase[InfFileName] = Inf(File, True, True)\r
-                \r
+        else:\r
+            raise ParserError(FILE_NOT_FOUND, name = File)\r
+    \r
+    #\r
+    # Create a Dec instance for input dec file and add it to DecDatabase\r
+    #                \r
     def AddToDecDatabase(self, DecFileName):\r
         DecFileName = NormPath(DecFileName)\r
         File = self.WorkspaceFile(DecFileName)\r
         if os.path.exists(File) and os.path.isfile(File):\r
             if DecFileName not in self.DecDatabase:\r
                 self.DecDatabase[DecFileName] = Dec(File, True, True)\r
+        else:\r
+            raise ParserError(FILE_NOT_FOUND, name = File)\r
                 \r
-    def FindLibraryClassInstanceOfModule(self, lib, arch, moduleType, moduleName):\r
-        for dsc in self.DscDatabase.keys():\r
-            #First find if exist in <LibraryClass> of <Components> from dsc file            \r
-            dscObj = self.DscDatabase[dsc]\r
-            for index in range(len(dscObj.Contents[arch].Components)):\r
-                if NormPath(dscObj.Contents[arch].Components[index][0]) == moduleName and len(dscObj.Contents[arch].Components[index][1]) > 0:\r
-                    #Search each library class\r
-                    LibList = dscObj.Contents[arch].Components[index][1]\r
-                    for indexOfLib in range(len(LibList)):\r
-                        if LibList[indexOfLib].split(DataType.TAB_VALUE_SPLIT)[0].strip() == lib:\r
-                            return LibList[indexOfLib].split(DataType.TAB_VALUE_SPLIT)[1].strip()\r
-            \r
-            #Second find if exist in <LibraryClass> of <LibraryClasses> from dsc file            \r
-            if (lib, moduleType) in self.Build[arch].PlatformDatabase[dsc].LibraryClasses:\r
-                return self.Build[arch].PlatformDatabase[dsc].LibraryClasses[(lib, moduleType)]\r
-            elif (lib, None) in self.Build[arch].PlatformDatabase[dsc].LibraryClasses:\r
-                return self.Build[arch].PlatformDatabase[dsc].LibraryClasses[(lib, None)]\r
+    #\r
+    # Search PlatformBuildDatabase to find LibraryClass Instance for Module\r
+    # Return the instance if found\r
+    #\r
+    def FindLibraryClassInstanceOfModule(self, Lib, Arch, ModuleType, ModuleName):\r
+        #\r
+        # First find if exist in <LibraryClass> of <Components> from dsc file\r
+        #\r
+        for Dsc in self.DscDatabase.keys():\r
+            Platform = self.DscDatabase[Dsc].Platform\r
+            for Module in Platform.Modules.ModuleList:\r
+                if Arch in Module.SupArchList:\r
+                    if NormPath(Module.FilePath) == ModuleName:\r
+                        for LibraryClass in Module.LibraryClasses.LibraryList:\r
+                            if LibraryClass.Name == Lib:\r
+                                return NormPath(LibraryClass.FilePath)\r
+        #\r
+        #Second find if exist in <LibraryClass> of <LibraryClasses> from dsc file            \r
+        #\r
+        return self.FindLibraryClassInstanceOfLibrary(Lib, Arch, ModuleType)\r
             \r
-    def FindLibraryClassInstanceOfLibrary(self, lib, arch, type):\r
-        for dsc in self.DscDatabase.keys():\r
-            dscObj = self.DscDatabase[dsc]\r
-            if (lib, type) in self.Build[arch].PlatformDatabase[dsc].LibraryClasses:\r
-                return self.Build[arch].PlatformDatabase[dsc].LibraryClasses[(lib, type)]\r
-            elif (lib, None) in self.Build[arch].PlatformDatabase[dsc].LibraryClasses:\r
-                return self.Build[arch].PlatformDatabase[dsc].LibraryClasses[(lib, None)]\r
+    #\r
+    # Search PlatformBuildDatabase to find LibraryClass Instance for Library\r
+    # Return the instance if found\r
+    #\r
+    def FindLibraryClassInstanceOfLibrary(self, Lib, Arch, Type):\r
+        for Dsc in self.DscDatabase.keys():\r
+            Platform  = self.DscDatabase[Dsc].Platform\r
+            if (Lib, Type) in self.Build[Arch].PlatformDatabase[Dsc].LibraryClasses:\r
+                return self.Build[Arch].PlatformDatabase[Dsc].LibraryClasses[(Lib, Type)]\r
+            elif (Lib, '') in self.Build[Arch].PlatformDatabase[Dsc].LibraryClasses:\r
+                return self.Build[Arch].PlatformDatabase[Dsc].LibraryClasses[(Lib, '')]\r
+        return None\r
             \r
-    def FindBuildOptions(self, arch, moduleName, BuildOptions):\r
-        for dsc in self.DscDatabase.keys():\r
-            #First find if exist in <BuildOptions> of <Components> from dsc file\r
-            dscObj = self.DscDatabase[dsc]\r
-            for index in range(len(dscObj.Contents[arch].Components)):\r
-                if NormPath(dscObj.Contents[arch].Components[index][0]) == moduleName and len(dscObj.Contents[arch].Components[index][2]) > 0:\r
-                    list = dscObj.Contents[arch].Components[index][2]\r
-                    for l in list:\r
-                        b = l.split(DataType.TAB_EQUAL_SPLIT, 1)\r
-                        Family = ''\r
-                        ToolChain = ''\r
-                        Flag = ''\r
-                        if b[0].find(':') > -1:\r
-                            Family = CleanString(b[0][ : b[0].find(':')])\r
-                            ToolChain = CleanString(b[0][b[0].find(':') + 1 : ])\r
-                        else:\r
-                            ToolChain = CleanString(b[0])\r
-                        Flag = CleanString(b[1])\r
-                        BuildOptions[(Family, ToolChain)] = Flag\r
+    #\r
+    # Search DscDatabase to find component definition of ModuleName\r
+    # Override BuildOption if it is defined in component\r
+    #\r
+    def FindBuildOptions(self, Arch, ModuleName, BuildOptions):\r
+        for Dsc in self.DscDatabase.keys():\r
+            #\r
+            # First find if exist in <BuildOptions> of <Components> from dsc file\r
+            # if find, use that override the one defined in inf file\r
+            #\r
+            Platform = self.DscDatabase[Dsc].Platform\r
+            for Module in Platform.Modules.ModuleList:\r
+                if Arch in Module.SupArchList:\r
+                    if NormPath(Module.FilePath) == ModuleName:\r
+                        for BuildOption in Module.ModuleSaBuildOption.BuildOptionList:\r
+                            BuildOptions[(BuildOption.ToolChainFamily, BuildOption.ToolChain)] = BuildOption.Option\r
                         \r
-    def FindPcd(self, arch, CName, GuidCName, Type):\r
+    #\r
+    # Search platform database, package database, module database and PcdsSet from Fdf\r
+    # Return found Pcd\r
+    #\r
+    def FindPcd(self, Arch, ModuleName, Name, Guid, Type, PcdsSet):\r
         DatumType = ''\r
-        DefaultValue = ''\r
-        TokenValue = ''\r
+        Value = ''\r
+        Token = ''\r
         MaxDatumSize = ''\r
-        SkuInfoList = None\r
-        for dsc in self.Build[arch].PlatformDatabase.keys():\r
-            platform = self.Build[arch].PlatformDatabase[dsc]\r
-            pcds = platform.Pcds\r
-            if (CName, GuidCName) in pcds:\r
-                Type = pcds[(CName, GuidCName)].Type\r
-                DatumType = pcds[(CName, GuidCName)].DatumType\r
-                DefaultValue = pcds[(CName, GuidCName)].DefaultValue\r
-                TokenValue = pcds[(CName, GuidCName)].TokenValue\r
-                MaxDatumSize = pcds[(CName, GuidCName)].MaxDatumSize\r
-                SkuInfoList =  pcds[(CName, GuidCName)].SkuInfoList\r
+        SkuInfoList = {}\r
+        #\r
+        # First get information from platform database\r
+        #\r
+        for Dsc in self.Build[Arch].PlatformDatabase.keys():\r
+            Pcds = self.Build[Arch].PlatformDatabase[Dsc].Pcds\r
+            if (Name, Guid) in Pcds:\r
+                Type = Pcds[(Name, Guid)].Type\r
+                DatumType = Pcds[(Name, Guid)].DatumType\r
+                Value = Pcds[(Name, Guid)].DefaultValue\r
+                Token = Pcds[(Name, Guid)].TokenValue\r
+                MaxDatumSize = Pcds[(Name, Guid)].MaxDatumSize\r
+                SkuInfoList =  Pcds[(Name, Guid)].SkuInfoList\r
                 break\r
 \r
-        for dec in self.Build[arch].PackageDatabase.keys():\r
-            package = self.Build[arch].PackageDatabase[dec]\r
-            pcds = package.Pcds\r
-            if (CName, GuidCName) in pcds:\r
-                DatumType = pcds[(CName, GuidCName)].DatumType\r
-                #DefaultValue = pcds[(CName, GuidCName)].DefaultValue\r
-                TokenValue = pcds[(CName, GuidCName)].TokenValue\r
-                #MaxDatumSize = pcds[(CName, GuidCName)].MaxDatumSize\r
+        #\r
+        # Second get information from package database\r
+        #\r
+        for Dec in self.Build[Arch].PackageDatabase.keys():\r
+            Pcds = self.Build[Arch].PackageDatabase[Dec].Pcds\r
+            if (Name, Guid) in Pcds:\r
+                DatumType = Pcds[(Name, Guid)].DatumType\r
+                Token = Pcds[(Name, Guid)].TokenValue\r
                 break\r
         \r
-        return PcdClassObject(CName, GuidCName, Type, DatumType, DefaultValue, TokenValue, MaxDatumSize, SkuInfoList)\r
-    \r
-    def ReloadPcd(self, FvDict):\r
-        pass\r
-                \r
+        #\r
+        # Third get information from <Pcd> of <Compontents> from module database\r
+        #\r
+        for Dsc in self.DscDatabase.keys():\r
+            for Module in self.DscDatabase[Dsc].Platform.Modules.ModuleList:\r
+                if Arch in Module.SupArchList:\r
+                    if NormPath(Module.FilePath) == ModuleName:\r
+                        for Pcd in Module.PcdBuildDefinitions:\r
+                            if (Name, Guid) == (Pcd.CName, Pcd.TokenSpaceGuidCName):\r
+                                if Pcd.DefaultValue != '':\r
+                                    Value = Pcd.DefaultValue\r
+                                if Pcd.MaxDatumSize != '':\r
+                                    MaxDatumSize = Pcd.MaxDatumSize\r
+        \r
+        #\r
+        # Last get information from PcdsSet defined by FDF\r
+        #\r
+        if Guid in PcdsSet.keys():\r
+            Value = PcdsSet[Guid]\r
+        \r
+        return PcdClassObject(Name, Guid, Type, DatumType, Value, Token, MaxDatumSize, SkuInfoList)   \r
+\r
+    #\r
+    # Show all content of the workspacebuild\r
+    #\r
+    def ShowWorkspaceBuild(self):\r
+        #print ewb.DscDatabase\r
+        #print ewb.InfDatabase\r
+        #print ewb.DecDatabase\r
+        print 'SupArchList', ewb.SupArchList\r
+        print 'BuildTarget', ewb.BuildTarget\r
+        print 'SkuId', ewb.SkuId\r
+        \r
+        for arch in ewb.SupArchList:\r
+            print arch\r
+            print 'Platform'\r
+            for platform in ewb.Build[arch].PlatformDatabase.keys():\r
+                p = ewb.Build[arch].PlatformDatabase[platform]\r
+                print 'DescFilePath = ', p.DescFilePath     \r
+                print 'PlatformName = ', p.PlatformName     \r
+                print 'Guid = ', p.Guid                     \r
+                print 'Version = ', p.Version\r
+                print 'OutputDirectory = ', p.OutputDirectory                \r
+                print 'FlashDefinition = ', p.FlashDefinition\r
+                print 'SkuIds = ', p.SkuIds\r
+                print 'Modules = ', p.Modules\r
+                print 'LibraryClasses = ', p.LibraryClasses \r
+                print 'Pcds = ', p.Pcds\r
+                for item in p.Pcds.keys():\r
+                    print p.Pcds[item]\r
+                print 'BuildOptions = ', p.BuildOptions\r
+                print ''   \r
+            # End of Platform\r
+        \r
+            print 'package'\r
+            for package in ewb.Build[arch].PackageDatabase.keys():\r
+                p = ewb.Build[arch].PackageDatabase[package]\r
+                print 'DescFilePath = ', p.DescFilePath    \r
+                print 'PackageName = ', p.PackageName     \r
+                print 'Guid = ', p.Guid                    \r
+                print 'Version = ', p.Version             \r
+                print 'Protocols = ', p.Protocols         \r
+                print 'Ppis = ', p.Ppis                    \r
+                print 'Guids = ', p.Guids                 \r
+                print 'Includes = ', p.Includes            \r
+                print 'LibraryClasses = ', p.LibraryClasses\r
+                print 'Pcds = ', p.Pcds\r
+                for item in p.Pcds.keys():\r
+                    print p.Pcds[item]\r
+                print ''                    \r
+            # End of Package\r
+            \r
+            print 'module'\r
+            for module in ewb.Build[arch].ModuleDatabase.keys():\r
+                p = ewb.Build[arch].ModuleDatabase[module]\r
+                print 'DescFilePath = ', p.DescFilePath                    \r
+                print 'BaseName = ', p.BaseName                         \r
+                print 'ModuleType = ', p.ModuleType                     \r
+                print 'Guid = ', p.Guid                                 \r
+                print 'Version = ', p.Version\r
+                print 'CustomMakefile = ', p.CustomMakefile\r
+                print 'Specification = ', p.Specification\r
+                print 'PcdIsDriver = ', p.PcdIsDriver\r
+                if p.LibraryClass != None:\r
+                    print 'LibraryClass = ', p.LibraryClass.LibraryClass, 'SupModList = ', p.LibraryClass.SupModList\r
+                print 'ModuleEntryPointList = ', p.ModuleEntryPointList \r
+                print 'ModuleUnloadImageList = ', p.ModuleUnloadImageList\r
+                print 'ConstructorList = ', p.ConstructorList            \r
+                print 'DestructorList = ', p.DestructorList             \r
+                                                                         \r
+                print 'Binaries = '\r
+                for item in p.Binaries:\r
+                    print item.BinaryFile, item.FeatureFlag\r
+                print 'Sources = '\r
+                for item in p.Sources:\r
+                    print item.SourceFile\r
+                print 'LibraryClasses = ', p.LibraryClasses             \r
+                print 'Protocols = ', p.Protocols                        \r
+                print 'Ppis = ', p.Ppis                                 \r
+                print 'Guids = ', p.Guids                                \r
+                print 'Includes = ', p.Includes                         \r
+                print 'Packages = ', p.Packages                         \r
+                print 'Pcds = ', p.Pcds\r
+                for item in p.Pcds.keys():\r
+                    print p.Pcds[item]\r
+                print 'BuildOptions = ', p.BuildOptions\r
+                print 'Depex = ', p.Depex\r
+                print ''\r
+            # End of Module    \r
+\r
+#\r
 # This acts like the main() function for the script, unless it is 'import'ed into another\r
 # script.\r
+#\r
 if __name__ == '__main__':\r
-\r
     # Nothing to do here. Could do some unit tests.\r
     w = os.getenv('WORKSPACE')\r
     ewb = WorkspaceBuild('Nt32Pkg/Nt32Pkg.dsc', w)\r
-    ewb.GenBuildDatabase()\r
-    #print ewb.DscDatabase\r
-    #print ewb.InfDatabase\r
-    #print ewb.DecDatabase\r
-    print 'SupArchList', ewb.SupArchList\r
-    print 'BuildTarget', ewb.BuildTarget\r
-    print 'SkuId', ewb.SkuId\r
-    \r
-    #\r
-    for arch in DataType.ARCH_LIST:\r
-        print arch\r
-        print 'Platform'\r
-        for platform in ewb.Build[arch].PlatformDatabase.keys():\r
-            p = ewb.Build[arch].PlatformDatabase[platform]\r
-            print 'DescFilePath = ', p.DescFilePath     \r
-            print 'PlatformName = ', p.PlatformName     \r
-            print 'Guid = ', p.Guid                     \r
-            print 'Version = ', p.Version\r
-            print 'OutputDirectory = ', p.OutputDirectory                \r
-            print 'FlashDefinition = ', p.FlashDefinition\r
-            print 'SkuIds = ', p.SkuIds\r
-            print 'Modules = ', p.Modules\r
-            print 'LibraryClasses = ', p.LibraryClasses \r
-            print 'Pcds = ', p.Pcds\r
-            for item in p.Pcds.keys():\r
-                print p.Pcds[item]\r
-            print 'BuildOptions = ', p.BuildOptions\r
-            print ''   \r
-        #End of Platform\r
-    \r
-        print 'package'\r
-        for package in ewb.Build[arch].PackageDatabase.keys():\r
-            p = ewb.Build[arch].PackageDatabase[package]\r
-            print 'DescFilePath = ', p.DescFilePath    \r
-            print 'PackageName = ', p.PackageName     \r
-            print 'Guid = ', p.Guid                    \r
-            print 'Version = ', p.Version             \r
-            print 'Protocols = ', p.Protocols         \r
-            print 'Ppis = ', p.Ppis                    \r
-            print 'Guids = ', p.Guids                 \r
-            print 'Includes = ', p.Includes            \r
-            print 'LibraryClasses = ', p.LibraryClasses\r
-            print 'Pcds = ', p.Pcds\r
-            print ''                    \r
-        #End of Package\r
-        \r
-        print 'module'\r
-        for module in ewb.Build[arch].ModuleDatabase.keys():\r
-            p = ewb.Build[arch].ModuleDatabase[module]\r
-            print 'DescFilePath = ', p.DescFilePath                    \r
-            print 'BaseName = ', p.BaseName                         \r
-            print 'ModuleType = ', p.ModuleType                     \r
-            print 'Guid = ', p.Guid                                 \r
-            print 'Version = ', p.Version\r
-            print 'CustomMakefile = ', p.CustomMakefile\r
-            print 'Specification = ', p.Specification\r
-            print 'PcdIsDriver = ', p.PcdIsDriver\r
-            if p.LibraryClass != None:\r
-                print 'LibraryClass = ', p.LibraryClass.LibraryClass\r
-                print 'SupModList = ', p.LibraryClass.SupModList\r
-            print 'ModuleEntryPointList = ', p.ModuleEntryPointList \r
-            print 'ModuleUnloadImageList = ', p.ModuleUnloadImageList\r
-            print 'ConstructorList = ', p.ConstructorList            \r
-            print 'DestructorList = ', p.DestructorList             \r
-                                                                     \r
-            print 'Binaries = '\r
-            for item in p.Binaries:\r
-                print str(item)\r
-            print 'Sources = '\r
-            for item in p.Sources:\r
-                print str(item)\r
-            print 'LibraryClasses = ', p.LibraryClasses             \r
-            print 'Protocols = ', p.Protocols                        \r
-            print 'Ppis = ', p.Ppis                                 \r
-            print 'Guids = ', p.Guids                                \r
-            print 'Includes = ', p.Includes                         \r
-            print 'Packages = ', p.Packages                         \r
-            print 'Pcds = ', p.Pcds\r
-            print 'BuildOptions = ', p.BuildOptions\r
-            print 'Depex = ', p.Depex\r
-            print ''\r
-        #End of Module    \r
-            \r
-    #End of Arch List\r
+    ewb.GenBuildDatabase({'gEfiMdeModulePkgTokenSpaceGuid' : 'KKKKKKKKKKKKKKKKKKKKK'})\r
+    ewb.ShowWorkspaceBuild()\r
index 3d0abb5..eac95d9 100644 (file)
@@ -147,10 +147,13 @@ class Inf(InfObject):
         #LibraryClass of Define\r
         if self.Defines.DefinesDictionary[TAB_INF_DEFINES_LIBRARY_CLASS][0] != '':\r
             for Item in self.Defines.DefinesDictionary[TAB_INF_DEFINES_LIBRARY_CLASS]:\r
-                List = Item.split(DataType.TAB_VALUE_SPLIT, 1)\r
+                List = GetSplitValueList(Item, DataType.TAB_VALUE_SPLIT, 1)\r
                 Lib = LibraryClassClass()\r
                 Lib.LibraryClass = CleanString(List[0])\r
-                Lib.SupModuleList = GetSplitValueList(CleanString(List[1]))\r
+                if len(List) == 1:\r
+                    Lib.SupModuleList = DataType.SUP_MODULE_LIST\r
+                elif len(List) == 2:\r
+                    Lib.SupModuleList = GetSplitValueList(CleanString(List[1]))\r
                 self.Module.Header.LibraryClass.append(Lib)\r
         \r
         #Custom makefile\r
@@ -342,7 +345,7 @@ class Inf(InfObject):
                 MergeArches(Pcds, (List[0], List[1], List[2], TAB_PCDS_DYNAMIC), Arch)\r
         for Key in Pcds.keys():\r
             Pcd = PcdClass()\r
-            Pcd.Token = Key[0]\r
+            Pcd.CName = Key[0]\r
             Pcd.TokenSpaceGuidCName = Key[1]\r
             Pcd.DefaultValue = Key[2]\r
             Pcd.ItemType = Key[3]\r
@@ -357,13 +360,7 @@ class Inf(InfObject):
                 List = GetSplitValueList(Item)\r
                 MergeArches(Sources, (List[0], List[1], List[2], List[3], List[4]), Arch)\r
         for Key in Sources.keys():\r
-            Source = ModuleSourceFileClass()\r
-            Source.SourceFile = Key[0]\r
-            Source.ToolChainFamily = Key[1]\r
-            Source.FeatureFlag = Key[2]\r
-            Source.TagName = Key[3]\r
-            Source.ToolCode = Key[4]\r
-            Source.SupArchList = Sources[Key]\r
+            Source = ModuleSourceFileClass(Key[0], Key[3], Key[4], Key[1], Key[2], Sources[Key])\r
             self.Module.Sources.append(Source)\r
         \r
         #UserExtensions\r
@@ -443,17 +440,12 @@ class Inf(InfObject):
                 Item = Item + DataType.TAB_VALUE_SPLIT\r
                 List = GetSplitValueList(Item)\r
                 if len(List) < 4:\r
-                    ErrorMsg = "Wrong DEFINE statement '%s' found in section Binaries in file '%s', correct format is '<FileType>|<Target>|<FileName>[|<PcdFeatureFlag>]'" % (Item[0:-1], self.Module.Header.FullPath) \r
+                    ErrorMsg = "Wrong statement '%s' found in section Binaries in file '%s', correct format is '<FileType>|<Target>|<FileName>[|<PcdFeatureFlag>]'" % (Item[0:-1], self.Module.Header.FullPath) \r
                     raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
                 else:\r
                     MergeArches(Binaries, (List[0], List[1], List[2], List[3]), Arch)\r
         for Key in Binaries.keys():\r
-            Binary = ModuleBinaryFileClass()\r
-            Binary.FileType = Key[0]\r
-            Binary.Target = Key[1]\r
-            Binary.BinaryFile = Key[2]\r
-            Binary.FeatureFlag = Key[3]\r
-            Binary.SupArchList = Binaries[Key]\r
+            Binary = ModuleBinaryFileClass(Key[2], Key[0], Key[1], Key[3], Binaries[Key])\r
             self.Module.Binaries.append(Binary)\r
         \r
     def LoadInfFile(self, Filename):     \r
@@ -468,14 +460,6 @@ class Inf(InfObject):
             tab = (sect.split(TAB_SECTION_END, 1)[0]).upper()\r
             if tab == TAB_INF_DEFINES.upper():\r
                 GetSingleValueOfKeyFromLines(sect, self.Defines.DefinesDictionary, TAB_COMMENT_SPLIT, TAB_EQUAL_SPLIT, False, None)\r
-#                if self.Defines.DefinesDictionary[TAB_INF_DEFINES_ENTRY_POINT][0] == '':\r
-#                    self.Defines.DefinesDictionary[TAB_INF_DEFINES_ENTRY_POINT] = []\r
-#                if self.Defines.DefinesDictionary[TAB_INF_DEFINES_UNLOAD_IMAGE][0] == '':\r
-#                    self.Defines.DefinesDictionary[TAB_INF_DEFINES_UNLOAD_IMAGE] = []\r
-#                if self.Defines.DefinesDictionary[TAB_INF_DEFINES_CONSTRUCTOR][0] == '':\r
-#                    self.Defines.DefinesDictionary[TAB_INF_DEFINES_CONSTRUCTOR] = []\r
-#                if self.Defines.DefinesDictionary[TAB_INF_DEFINES_DESTRUCTOR][0] == '':\r
-#                    self.Defines.DefinesDictionary[TAB_INF_DEFINES_DESTRUCTOR] = []\r
                 continue\r
             if tab.find(DataType.TAB_USER_EXTENSIONS.upper()) > -1:\r
                 self.UserExtensions = sect\r
@@ -560,7 +544,7 @@ class Inf(InfObject):
             print Item.Name, Item.Value, Item.SupArchList\r
         print '\nPcds =', m.PcdCodes\r
         for Item in m.PcdCodes:\r
-            print Item.Token, Item.TokenSpaceGuidCName, Item.DefaultValue, Item.ItemType, Item.SupArchList\r
+            print Item.CName, Item.TokenSpaceGuidCName, Item.DefaultValue, Item.ItemType, Item.SupArchList\r
         print '\nSources =', m.Sources\r
         for Source in m.Sources:\r
             print Source.SourceFile, Source.ToolChainFamily, Source.FeatureFlag, Source.TagName, Source.ToolCode, Source.SupArchList\r
index 3d55e45..63b572f 100644 (file)
 #\r
 \r
 class CommonClass(object):\r
-    def __init__(self, SupArchList = []):\r
-        self.Usage = []                                   #ALWAYS_CONSUMED | SOMETIMES_CONSUMED | ALWAYS_PRODUCED | SOMETIMES_PRODUCED | TO_START | BY_START | PRIVATE\r
-        self.FeatureFlag = ''\r
+    def __init__(self, Usage = [], FeatureFlag = '', SupArchList = [], HelpText = ''):\r
+        self.Usage = Usage                                   #ALWAYS_CONSUMED | SOMETIMES_CONSUMED | ALWAYS_PRODUCED | SOMETIMES_PRODUCED | TO_START | BY_START | PRIVATE\r
+        self.FeatureFlag = FeatureFlag\r
         self.SupArchList = SupArchList                    #EBC | IA32 | X64 | IPF | ARM | PPC\r
-        self.HelpText = ''\r
+        self.HelpText = HelpText\r
         \r
 class CommonHeaderClass(object):\r
     def __init__(self):\r
@@ -101,7 +101,8 @@ class SkuInfoClass(object):
         self.DefaultValue = DefaultValue\r
         \r
     def __str__(self):\r
-        rtn = rtn = str(self.SkuId) + "," + \\r
+        rtn = rtn = 'SkuInfo = ' + str(self.SkuId) + "," + \\r
+                    str(self.SkuIdName) + "," + \\r
                     str(self.VariableName) + "," + \\r
                     str(self.VariableGuid) + "," + \\r
                     str(self.VariableOffset) + "," + \\r
index fb334c7..13bcc8a 100644 (file)
@@ -39,19 +39,19 @@ class ModuleHeaderClass(IdentificationClass, CommonHeaderClass, DefineClass):
         self.CustomMakefile = {}                    #{ Family : Filename, ... }\r
         \r
 class ModuleSourceFileClass(CommonClass):\r
-    def __init__(self):\r
-        self.SourceFile = ''\r
-        self.TagName = ''\r
-        self.ToolCode = ''\r
-        self.ToolChainFamily = ''\r
-        CommonClass.__init__(self)\r
+    def __init__(self, SourceFile = '', TagName = '', ToolCode = '', ToolChainFamily = '', FeatureFlag = '', SupArchList = []):\r
+        self.SourceFile = SourceFile\r
+        self.TagName = TagName\r
+        self.ToolCode = ToolCode\r
+        self.ToolChainFamily = ToolChainFamily\r
+        CommonClass.__init__(self, FeatureFlag = FeatureFlag, SupArchList = SupArchList)\r
 \r
 class ModuleBinaryFileClass(CommonClass):\r
-    def __init__(self):\r
-        self.BinaryFile = ''\r
-        self.FileType = ''                          #FW | GUID | PREEFORM | UEFI_APP | UNI_UI | UNI_VER | LIB | PE32 | PIC | PEI_DEPEX | DXE_DEPEX | TE | VER | UI | BIN | FV\r
-        self.Target = ''\r
-        CommonClass.__init__(self)\r
+    def __init__(self, BinaryFile = '', FileType = '', Target = '', FeatureFlag = '', SupArchList = []):\r
+        self.BinaryFile = BinaryFile\r
+        self.FileType = FileType                          #FW | GUID | PREEFORM | UEFI_APP | UNI_UI | UNI_VER | LIB | PE32 | PIC | PEI_DEPEX | DXE_DEPEX | TE | VER | UI | BIN | FV\r
+        self.Target = Target\r
+        CommonClass.__init__(self, FeatureFlag = FeatureFlag, SupArchList = SupArchList)\r
         \r
 class ModulePackageDependencyClass(CommonClass, DefineClass):\r
     def __init__(self):\r