git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@412 7335b...
authorhche10x <hche10x@7335b38e-4728-0410-8992-fb3ffe349368>
Thu, 26 Jul 2007 06:25:53 +0000 (06:25 +0000)
committerhche10x <hche10x@7335b38e-4728-0410-8992-fb3ffe349368>
Thu, 26 Jul 2007 06:25:53 +0000 (06:25 +0000)
Source/Python/Common/DataType.py
Source/Python/Common/DscClassObject.py
Source/Python/Common/InfClassObject.py
Source/Python/Common/String.py
Source/Python/CommonDataClass/CommonClass.py
Source/Python/CommonDataClass/PlatformClass.py

index 6d97fe2..cdce703 100644 (file)
@@ -227,6 +227,7 @@ TAB_BUILD_OPTIONS = 'BuildOptions'
 TAB_DEFINE = 'DEFINE'\r
 TAB_NMAKE = 'Nmake'\r
 TAB_USER_EXTENSIONS = 'UserExtensions'\r
+TAB_INCLUDE = '!include'\r
 \r
 #Common Define\r
 TAB_COMMON_DEFINES = 'Defines'\r
index d0364a4..674a2f8 100644 (file)
@@ -17,6 +17,7 @@ from DataType import *
 from Identification import *\r
 from Dictionary import *\r
 from CommonDataClass.PlatformClass import *\r
+from CommonDataClass.CommonClass import SkuInfoClass\r
 from BuildToolError import *\r
 \r
 class DscObject(object):\r
@@ -63,7 +64,7 @@ class DscContents(DscObject):
 \r
 class Dsc(DscObject):\r
     def __init__(self, filename = None, isMergeAllArches = False, isToPlatform = False):\r
-        self.identification = Identification()\r
+        self.Identification = Identification()\r
         self.Defines = DscDefines()\r
         self.Contents = {}\r
         self.UserExtensions = ''\r
@@ -77,7 +78,7 @@ class Dsc(DscObject):
             TAB_PCDS_PATCHABLE_IN_MODULE_NULL, TAB_PCDS_FEATURE_FLAG_NULL, \\r
             TAB_PCDS_DYNAMIC_DEFAULT_NULL, TAB_PCDS_DYNAMIC_HII_NULL, TAB_PCDS_DYNAMIC_VPD_NULL, \\r
             TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL, TAB_PCDS_DYNAMIC_EX_HII_NULL, TAB_PCDS_DYNAMIC_EX_VPD_NULL, \\r
-            TAB_COMPONENTS, TAB_BUILD_OPTIONS\r
+            TAB_COMPONENTS\r
         ]\r
         \r
         if filename != None:\r
@@ -106,10 +107,14 @@ class Dsc(DscObject):
                 Command = "self.Contents[arch]." + key + ".extend(" + "self.Contents['" + DataType.TAB_ARCH_COMMON + "']." + key + ")"\r
                 eval(Command)\r
             \r
-    def LoadDscFile(self, filename):\r
-        EdkLogger.verbose('Open Dsc File:' + filename)\r
-        f = open(filename, 'r').read()\r
-        sects = f.split('[')\r
+    def LoadDscFile(self, Filename):\r
+        (Filepath, Name) = os.path.split(Filename)\r
+        self.Identification.FileName = Name\r
+        self.Identification.FileFullPath = Filename\r
+        self.Identification.FileRelativePath = Filepath\r
+        \r
+        F = open(Filename, 'r').read()\r
+        sects = F.split('[')\r
         for sect in sects:\r
             tab = (sect.split(TAB_SECTION_END, 1)[0]).upper()\r
             if tab == TAB_INF_DEFINES.upper():\r
@@ -135,15 +140,303 @@ class Dsc(DscObject):
         #\r
         # Get value for Header\r
         #\r
-        self.Module.Header.Name = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_PLATFORM_NAME][0]\r
-        self.Module.Header.Guid = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_PLATFORM_GUID][0]\r
-        self.Module.Header.Version = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_PLATFORM_VERSION][0]\r
-        self.Module.Header.FileName = self.Identification.FileName\r
-        self.Module.Header.FullPath = self.Identification.FileFullPath\r
-        self.Module.Header.InfVersion = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_DSC_SPECIFICATION][0]\r
+        self.Platform.Header.Name = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_PLATFORM_NAME][0]\r
+        self.Platform.Header.Guid = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_PLATFORM_GUID][0]\r
+        self.Platform.Header.Version = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_PLATFORM_VERSION][0]\r
+        self.Platform.Header.FileName = self.Identification.FileName\r
+        self.Platform.Header.FullPath = self.Identification.FileFullPath\r
+        self.Platform.Header.DscSpecification = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_DSC_SPECIFICATION][0]\r
+        \r
+        self.Platform.Header.SkuIdName = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_SKUID_IDENTIFIER]\r
+        self.Platform.Header.SupArchList = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES]\r
+        self.Platform.Header.BuildTargets = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_BUILD_TARGETS]\r
+        self.Platform.Header.OutputDirectory = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_OUTPUT_DIRECTORY][0]\r
+        self.Platform.Header.BuildNumber = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_BUILD_NUMBER][0]\r
+        self.Platform.Header.MakefileName = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_MAKEFILE_NAME][0]\r
+        \r
+        Fdf = PlatformFlashDefinitionFileClass()\r
+        Fdf.FilePath = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_FLASH_DEFINITION][0]\r
+        self.Platform.FlashDefinitionFile = Fdf\r
+        \r
+        #BuildOptions\r
+        BuildOptions = {}\r
+        IncludeFiles = {}\r
+        for Arch in DataType.ARCH_LIST:\r
+            for Item in self.Contents[Arch].BuildOptions:\r
+                if GenInclude(Item, IncludeFiles, Arch):\r
+                    continue\r
+                MergeArches(BuildOptions, GetBuildOption(Item), Arch)\r
+        self.Platform.BuildOptions.IncludeFiles = IncludeFiles\r
+        for Key in BuildOptions.keys():\r
+            BuildOption = BuildOptionClass(Key[0], Key[1], Key[2])\r
+            BuildOption.SupArchList = BuildOptions[Key]\r
+            self.Platform.BuildOptions.BuildOptionList.append(BuildOption)\r
+        \r
+        #SkuIds\r
+        IncludeFiles = {}\r
+        self.Platform.SkuInfos.SkuInfoList['DEFAULT'] = '0'\r
+        for Arch in DataType.ARCH_LIST:\r
+            for Item in self.Contents[Arch].SkuIds:\r
+                if GenInclude(Item, IncludeFiles, Arch):\r
+                    continue\r
+                List = GetSplitValueList(Item)\r
+                if len(List) != 2:\r
+                    ErrorMsg = "Wrong statement '%s' found in section SkuIds in file '%s', correct format is '<Integer>|<UiName>'" % (Item, self.Platform.Header.FullPath)\r
+                    raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                else:\r
+                    self.Platform.SkuInfos.SkuInfoList[List[1]] = List[0]\r
+        self.Platform.SkuInfos.IncludeFiles = IncludeFiles\r
+        \r
+        #Libraries\r
+        Libraries = {}\r
+        IncludeFiles = {}\r
+        Defines = {}\r
+        for Arch in DataType.ARCH_LIST:\r
+            for Item in self.Contents[Arch].Libraries:\r
+                if GenInclude(Item, IncludeFiles, Arch):\r
+                    continue\r
+                Status = GenDefines(Item, Arch, Defines)\r
+                if Status == 0:       # Find DEFINE statement\r
+                    pass\r
+                elif Status == -1:    # Find DEFINE statement but in wrong format\r
+                    ErrorMsg = "Wrong DEFINE statement '%s' found in section Libraries in file '%s', correct format is 'DEFINE <VarName> = <PATH>'" % (Item, self.Platform.Header.FullPath) \r
+                    raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                elif Status == 1:     # Not find DEFINE statement\r
+                    MergeArches(Libraries, Item, Arch)\r
+        self.Platform.Libraries.IncludeFiles = IncludeFiles\r
+        for Key in Libraries.keys():\r
+            Library = PlatformLibraryClass()\r
+            Library.FilePath = Key\r
+            Library.Define = Defines\r
+            Library.SupArchList = Libraries[Key]\r
+            self.Platform.Libraries.LibraryList.append(Library)\r
+        \r
+        #LibraryClasses\r
+        LibraryClasses = {}\r
+        IncludeFiles = {}\r
+        Defines = {}\r
+        for Arch in DataType.ARCH_LIST:\r
+            for Item in self.Contents[Arch].LibraryClasses:\r
+                if GenInclude(Item[0], IncludeFiles, Arch):\r
+                    continue\r
+                Status = GenDefines(Item[0], Arch, Defines)\r
+                if Status == 0:       # Find DEFINE statement\r
+                    pass\r
+                elif Status == -1:    # Find DEFINE statement but in wrong format\r
+                    ErrorMsg = "Wrong DEFINE statement '%s' found in section LibraryClasses in file '%s', correct format is 'DEFINE <VarName> = <PATH>'" % (Item, self.Platform.Header.FullPath) \r
+                    raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                elif Status == 1:     # Not find DEFINE statement\r
+                    List = GetSplitValueList(Item[0])\r
+                    if len(List) != 2:\r
+                        ErrorMsg = "Wrong statement '%s' found in section LibraryClasses in file '%s', correct format is '<LibraryClassKeyWord>|<LibraryInstance>'" % (Item, self.Platform.Header.FullPath) \r
+                        raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                    else:\r
+                        MergeArches(LibraryClasses, (List[0], List[1]) + tuple(Item[1]), Arch)\r
+        self.Platform.LibraryClasses.IncludeFiles = IncludeFiles\r
+        for Key in LibraryClasses.keys():\r
+            Library = PlatformLibraryClass()\r
+            Library.Name = Key[0]\r
+            Library.FilePath = Key[1]\r
+            Library.ModuleType = list(Key[2:])\r
+            Library.Define = Defines\r
+            Library.SupArchList = LibraryClasses[Key]\r
+            self.Platform.LibraryClasses.LibraryList.append(Library)\r
+        \r
+        #Pcds\r
+        self.GenPcds(DataType.TAB_PCDS_FIXED_AT_BUILD)\r
+        self.GenPcds(DataType.TAB_PCDS_PATCHABLE_IN_MODULE)\r
+        self.GenPcds(DataType.TAB_PCDS_FEATURE_FLAG)\r
+        self.GenDynamicDefaultPcds(DataType.TAB_PCDS_DYNAMIC_DEFAULT)\r
+        self.GenDynamicDefaultPcds(DataType.TAB_PCDS_DYNAMIC_EX_DEFAULT)\r
+        self.GenDynamicHiiPcds(DataType.TAB_PCDS_DYNAMIC_HII)\r
+        self.GenDynamicHiiPcds(DataType.TAB_PCDS_DYNAMIC_EX_HII)\r
+        self.GenDynamicVpdPcds(DataType.TAB_PCDS_DYNAMIC_VPD)\r
+        self.GenDynamicVpdPcds(DataType.TAB_PCDS_DYNAMIC_EX_VPD)\r
+        \r
+        #Components\r
+        Components = {}\r
+        IncludeFiles = {}\r
+        Defines = {}\r
+        for Arch in DataType.ARCH_LIST:\r
+            for Item in self.Contents[Arch].Components:\r
+                (InfFilename, ExecFilename) = GetExec(Item[0])\r
+                LibraryClasses = Item[1]\r
+                BuildOptions = Item[2]\r
+                Pcds = Item[3]\r
+                Component = PlatformModuleClass()\r
+                Component.FilePath = InfFilename\r
+                Component.ExecFilePath = ExecFilename\r
+                for Lib in LibraryClasses:\r
+                    List = GetSplitValueList(Lib)\r
+                    if len(List) != 2:\r
+                        ErrorMsg = "Wrong LibraryClass statement '%s' found in section Components in file '%s', correct format is '<ClassName>|<InfFilename>'" % (Lib, self.Platform.Header.FullPath) \r
+                        raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                    Component.LibraryClasses.LibraryList.append(PlatformLibraryClass(List[0], List[1]))\r
+                for BuildOption in BuildOptions:\r
+                    Key = GetBuildOption(BuildOption)\r
+                    Component.ModuleSaBuildOption.BuildOptionList.append(BuildOptionClass(Key[0], Key[1], Key[2]))\r
+                for Pcd in Pcds:\r
+                    Type = Pcd[0]\r
+                    List = GetSplitValueList(Pcd[1])\r
+                    if Type == DataType.TAB_PCDS_FEATURE_FLAG:\r
+                        if len(List) != 3:\r
+                            ErrorMsg = "Wrong Pcds%s statement '%s' found in section Components in file '%s', correct format is '<Cname>|<TokenSpaceGuidCName>|<TrueFalse>'" % (Type, Pcd[1], self.Platform.Header.FullPath) \r
+                            raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                        else:\r
+                            Component.PcdBuildDefinitions.append(PcdClass(List[0], '', List[1], '', '', List[2], Type, [], {}, []))\r
+                    if Type == DataType.TAB_PCDS_FIXED_AT_BUILD or Type == DataType.TAB_PCDS_PATCHABLE_IN_MODULE:\r
+                        if len(List.append('')) < 4:\r
+                            ErrorMsg = "Wrong Pcds%s statement '%s' found in section Components in file '%s', correct format is '<Cname>|<TokenSpaceGuidCName>|<Value>[|<MaxDatumSize>]'" % (Type, Pcd[1], self.Platform.Header.FullPath) \r
+                            raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                        else:\r
+                            Component.PcdBuildDefinitions.append(PcdClass(List[0], '', List[1], '', List[3], List[2], Type, [], {}, []))\r
+                    if Type == DataType.TAB_PCDS_DYNAMIC or Type == DataType.TAB_PCDS_DYNAMIC_EX:\r
+                        if len(List) != 2:\r
+                            ErrorMsg = "Wrong Pcds%s statement '%s' found in section Components in file '%s', correct format is '<Cname>|<TokenSpaceGuidCName>|<Value>[|<MaxDatumSize>]'" % (Type, Pcd[1], self.Platform.Header.FullPath) \r
+                            raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                        else:\r
+                            Component.PcdBuildDefinitions.append(PcdClass(List[0], '', List[1], '', List[3], List[2], Type, [], {}, []))                        \r
+                    \r
+                if GenInclude(Item[0], IncludeFiles, Arch):\r
+                    continue\r
+                Status = GenDefines(Item[0], Arch, Defines)\r
+                if Status == 0:       # Find DEFINE statement\r
+                    pass\r
+                elif Status == -1:    # Find DEFINE statement but in wrong format\r
+                    ErrorMsg = "Wrong DEFINE statement '%s' found in section LibraryClasses in file '%s', correct format is 'DEFINE <VarName> = <PATH>'" % (Item, self.Platform.Header.FullPath) \r
+                    raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                elif Status == 1:     # Not find DEFINE statement\r
+                    MergeArches(Components, Component, Arch)\r
+        self.Platform.Modules.IncludeFiles = IncludeFiles\r
+        for Key in Components.keys():\r
+            Key.Define = Defines\r
+            Key.SupArchList = Components[Key]\r
+            self.Platform.Modules.ModuleList.append(Key)\r
         \r
+    #End of DscToPlatform\r
+    \r
+    def GenPcds(self, Type = ''):\r
+        Pcds = {}\r
+        Items = []\r
+        for Arch in DataType.ARCH_LIST:\r
+            if Type == DataType.TAB_PCDS_FIXED_AT_BUILD:\r
+                Items = self.Contents[Arch].PcdsFixedAtBuild\r
+            elif Type == DataType.TAB_PCDS_PATCHABLE_IN_MODULE:\r
+                Items = self.Contents[Arch].PcdsPatchableInModule\r
+            elif Type == DataType.TAB_PCDS_FEATURE_FLAG:\r
+                Items = self.Contents[Arch].PcdsFeatureFlag\r
+            else:\r
+                pass\r
+            \r
+            for Item in Items:\r
+                List = GetSplitValueList(Item + DataType.TAB_VALUE_SPLIT)\r
+                if len(List) < 4:\r
+                    ErrorMsg = "Wrong statement '%s' found in section %s in file '%s', correct format is '<PcdTokenName>|<PcdTokenSpaceGuidCName>|<Value>[|<MaximumDatumSize>]'" % (Item, Type, self.Platform.Header.FullPath) \r
+                    raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                else:\r
+                    MergeArches(Pcds, (List[0], List[1], List[2], List[3], Type), Arch)\r
+        for Key in Pcds:\r
+            Pcd = PcdClass(Key[0], '', Key[1], '', Key[3], Key[2], Key[4], [], {}, [])\r
+            Pcd.SupArchList = Pcds[Key]\r
+            self.Platform.DynamicPcdBuildDefinitions.append(Pcd)\r
+    \r
+    def GenSkuInfoList(self, SkuNameList, SkuInfo, VariableName = '', VariableGuid = '', VariableOffset = '', HiiDefaultValue = '', VpdOffset = '', DefaultValue = ''):\r
+        if SkuNameList == None or SkuNameList == [] or SkuNameList == ['']:\r
+                SkuNameList = ['DEFAULT']\r
+        SkuInfoList = {}\r
+        for Item in SkuNameList:\r
+            if Item not in SkuInfo:\r
+                return False, Item\r
+            Sku = SkuInfoClass(Item, SkuInfo[Item], VariableName, VariableGuid, VariableOffset, HiiDefaultValue, VpdOffset, DefaultValue)\r
+            SkuInfoList[Item] = Sku\r
         \r
-    def showDsc(self):\r
+        return True, SkuInfoList\r
+            \r
+    def GenDynamicDefaultPcds(self, Type = ''):\r
+        Pcds = {}\r
+        Items = []\r
+        SkuInfoList = {}\r
+        for Arch in DataType.ARCH_LIST:\r
+            if Type == DataType.TAB_PCDS_DYNAMIC_DEFAULT:\r
+                Items = self.Contents[Arch].PcdsDynamicDefault\r
+            elif Type == DataType.TAB_PCDS_DYNAMIC_EX_DEFAULT:\r
+                Items = self.Contents[Arch].PcdsDynamicExDefault\r
+            else:\r
+                pass\r
+            \r
+            for Item in Items:\r
+                List = GetSplitValueList(Item[0] + DataType.TAB_VALUE_SPLIT)\r
+                if len(List) < 4:\r
+                    ErrorMsg = "Wrong statement '%s' found in section %s in file '%s', correct format is '<PcdTokenName>|<PcdTokenSpaceGuidCName>|<Value>[|<MaximumDatumSize>]'" % (Item, Type, self.Platform.Header.FullPath) \r
+                    raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                else:\r
+                    MergeArches(Pcds, (List[0], List[1], List[2], List[3], Type), Arch)\r
+        for Key in Pcds:\r
+            (Status, SkuInfoList) = self.GenSkuInfoList(Item[1], self.Platform.SkuInfos.SkuInfoList, '', '', '', '', '', Key[2])\r
+            if Status == False:\r
+                ErrorMsg = "SKUID '%s' of '%s' not defined in file '%s'" % (SkuInfoList, Type, self.Platform.Header.FullPath) \r
+                raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+            Pcd = PcdClass(Key[0], '', Key[1], '', Key[3], '', Key[4], [], SkuInfoList, [])\r
+            Pcd.SupArchList = Pcds[Key]\r
+            self.Platform.DynamicPcdBuildDefinitions.append(Pcd)\r
+         \r
+    def GenDynamicHiiPcds(self, Type = ''):\r
+        Pcds = {}\r
+        Items = []\r
+        SkuInfoList = {}\r
+        for Arch in DataType.ARCH_LIST:\r
+            if Type == DataType.TAB_PCDS_DYNAMIC_HII:\r
+                Items = self.Contents[Arch].PcdsDynamicHii\r
+            elif Type == DataType.TAB_PCDS_DYNAMIC_EX_HII:\r
+                Items = self.Contents[Arch].PcdsDynamicExHii\r
+            else:\r
+                pass\r
+            \r
+            for Item in Items:\r
+                List = GetSplitValueList(Item[0] + DataType.TAB_VALUE_SPLIT)\r
+                if len(List) < 7:\r
+                    ErrorMsg = "Wrong statement '%s' found in section %s in file '%s', correct format is '<PcdTokenName>|<PcdTokenSpaceGuidCName>|<String>|<VariableGuidCName>|<VariableOffset>|<DefaultValue>[|<MaximumDatumSize>]'" % (Item, Type, self.Platform.Header.FullPath) \r
+                    raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                else:\r
+                    MergeArches(Pcds, (List[0], List[1], List[2], List[3], List[4], List[5], List[6], Type), Arch)\r
+        for Key in Pcds:\r
+            (Status, SkuInfoList) = self.GenSkuInfoList(Item[1], self.Platform.SkuInfos.SkuInfoList, List[3], List[4], List[5], List[6], '', '')\r
+            if Status == False:\r
+                ErrorMsg = "SKUID '%s' of '%s' not defined in file '%s'" % (SkuInfoList, Type, self.Platform.Header.FullPath) \r
+                raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+            Pcd = PcdClass(Key[0], '', Key[1], '', Key[3], '', Key[7], [], SkuInfoList, [])\r
+            Pcd.SupArchList = Pcds[Key]\r
+            self.Platform.DynamicPcdBuildDefinitions.append(Pcd)\r
+    \r
+    def GenDynamicVpdPcds(self, Type = ''):\r
+        Pcds = {}\r
+        Items = []\r
+        SkuInfoList = {}\r
+        for Arch in DataType.ARCH_LIST:\r
+            if Type == DataType.TAB_PCDS_DYNAMIC_VPD:\r
+                Items = self.Contents[Arch].PcdsDynamicVpd\r
+            elif Type == DataType.TAB_PCDS_DYNAMIC_EX_VPD:\r
+                Items = self.Contents[Arch].PcdsDynamicExVpd\r
+            else:\r
+                pass\r
+            \r
+            for Item in Items:\r
+                List = GetSplitValueList(Item[0] + DataType.TAB_VALUE_SPLIT)\r
+                if len(List) < 4:\r
+                    ErrorMsg = "Wrong statement '%s' found in section %s in file '%s', correct format is '<PcdTokenName>|<PcdTokenSpaceGuidCName>|<DefaultValue>[|<MaximumDatumSize>]'" % (Item, Type, self.Platform.Header.FullPath) \r
+                    raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                else:\r
+                    MergeArches(Pcds, (List[0], List[1], List[2], List[3], Type), Arch)\r
+        for Key in Pcds:\r
+            (Status, SkuInfoList) = self.GenSkuInfoList(Item[1], self.Platform.SkuInfos.SkuInfoList, '', '', '', '', List[2], '')\r
+            if Status == False:\r
+                ErrorMsg = "SKUID '%s' of '%s' not defined in file '%s'" % (SkuInfoList, Type, self.Platform.Header.FullPath) \r
+                raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+            Pcd = PcdClass(Key[0], '', Key[1], '', Key[3], '', Key[4], [], SkuInfoList, [])\r
+            Pcd.SupArchList = Pcds[Key]\r
+            self.Platform.DynamicPcdBuildDefinitions.append(Pcd)\r
+    \r
+    def ShowDsc(self):\r
         print TAB_SECTION_START + TAB_INF_DEFINES + TAB_SECTION_END\r
         printDict(self.Defines.DefinesDictionary)\r
 \r
@@ -153,7 +446,45 @@ class Dsc(DscObject):
                                     key + DataType.TAB_SPLIT + arch + \\r
                                     "' + TAB_SECTION_END, self.Contents[arch]." + key + ')'\r
                 eval(Command)\r
-        \r
+       \r
+    def ShowPlatform(self):\r
+        m = self.Platform\r
+        print 'Filename =', m.Header.FileName\r
+        print 'FullPath =', m.Header.FullPath\r
+        print 'BaseName =', m.Header.Name\r
+        print 'Guid =', m.Header.Guid\r
+        print 'Version =', m.Header.Version\r
+        print 'DscSpecification =', m.Header.DscSpecification\r
+        print 'SkuId =', m.Header.SkuIdName\r
+        print 'SupArchList =', m.Header.SupArchList\r
+        print 'BuildTargets =', m.Header.BuildTargets\r
+        print 'OutputDirectory =', m.Header.OutputDirectory\r
+        print 'BuildNumber =', m.Header.BuildNumber\r
+        print 'MakefileName =', m.Header.MakefileName\r
+        print 'Fdf =', m.FlashDefinitionFile.FilePath\r
+        print '\nBuildOptions =', m.BuildOptions, m.BuildOptions.IncludeFiles\r
+        for Item in m.BuildOptions.BuildOptionList:\r
+            print Item.ToolChainFamily, Item.ToolChain, Item.Option, Item.SupArchList\r
+        print '\nSkuIds =', m.SkuInfos.SkuInfoList, m.SkuInfos.IncludeFiles\r
+        print '\nLibraries =', m.Libraries, m.Libraries.IncludeFiles\r
+        for Item in m.Libraries.LibraryList:\r
+            print Item.FilePath, Item.SupArchList, Item.Define\r
+        print '\nLibraryClasses =', m.LibraryClasses, m.LibraryClasses.IncludeFiles\r
+        for Item in m.LibraryClasses.LibraryList:\r
+            print Item.Name, Item.FilePath, Item.ModuleType, Item.SupArchList, Item.Define\r
+        print '\nPcds =', m.DynamicPcdBuildDefinitions\r
+        for Item in m.DynamicPcdBuildDefinitions:\r
+            print Item.CName, Item.TokenSpaceGuidCName, Item.DefaultValue, Item.Token, Item.ItemType, Item.MaxDatumSize, Item.SupArchList, Item.SkuInfoList\r
+        print '\nComponents =', m.Modules.ModuleList, m.Modules.IncludeFiles\r
+        for Item in m.Modules.ModuleList:\r
+            print Item.FilePath, Item.ExecFilePath, Item.SupArchList\r
+            for Lib in Item.LibraryClasses.LibraryList:\r
+                print Lib.Name, Lib.FilePath\r
+            for Bo in Item.ModuleSaBuildOption.BuildOptionList:\r
+                print Bo.ToolChainFamily, Bo.ToolChain, Bo.Option\r
+            for Pcd in Item.PcdBuildDefinitions:\r
+                print Pcd.CName, Pcd.TokenSpaceGuidCName, Pcd.MaxDatumSize, Pcd.DefaultValue, Pcd.ItemType\r
+    \r
 if __name__ == '__main__':\r
     p = Dsc()\r
     directory = 'C:\MyWorkspace\\EdkModulePkg'\r
@@ -163,6 +494,6 @@ if __name__ == '__main__':
             fileList.append(os.path.join(directory, os.path.normcase(f)))\r
             \r
     for f in fileList:\r
-        p.LoadDscFile(f)\r
-        p.MergeAllArches()\r
-        p.showDsc()\r
+        p = Dsc(f, True, True)\r
+        #p.ShowDsc()\r
+        p.ShowPlatform()\r
index 02f1b78..755ee17 100644 (file)
@@ -211,22 +211,9 @@ class Inf(InfObject):
         BuildOptions = {}\r
         for Arch in DataType.ARCH_LIST:\r
             for Item in self.Contents[Arch].BuildOptions:\r
-                ToolChainFamily = ''\r
-                Statement = ''\r
-                Option = ''\r
-                List = Item.split(DataType.TAB_EQUAL_SPLIT, 1)\r
-                if List[0].find(':') > -1:\r
-                    ToolChainFamily = CleanString(List[0][ : List[0].find(':')])\r
-                    Statement = CleanString(List[0][List[0].find(':') + 1 : ])\r
-                else:\r
-                    Statement = CleanString(List[0])                    \r
-                Option = CleanString(List[1])\r
-                MergeArches(BuildOptions, (ToolChainFamily, Statement, Option), Arch)\r
+                MergeArches(BuildOptions, GetBuildOption(Item), Arch)\r
         for Key in BuildOptions.keys():\r
-            BuildOption = BuildOptionClass()\r
-            BuildOption.ToolChainFamily = Key[0]\r
-            BuildOption.Statement = Key[1]\r
-            BuildOption.Option = Key[2]\r
+            BuildOption = BuildOptionClass(Key[0], Key[1], Key[2])\r
             BuildOption.SupArchList = BuildOptions[Key]\r
             self.Module.BuildOptions.append(BuildOption)    \r
         \r
@@ -555,7 +542,7 @@ class Inf(InfObject):
         print 'Specification =', m.Header.Specification\r
         print '\nBuildOptions =', m.BuildOptions\r
         for Item in m.BuildOptions:\r
-            print Item.ToolChainFamily, Item.Statement, Item.Option, Item.SupArchList\r
+            print Item.ToolChainFamily, Item.ToolChain, Item.Option, Item.SupArchList\r
         print '\nIncludes =', m.Includes\r
         for Item in m.Includes:\r
             print Item.FilePath, Item.SupArchList\r
index ab00c1e..8f033c4 100644 (file)
@@ -49,89 +49,62 @@ def GenDefines(String, Arch, Defines):
     \r
     return 1\r
 \r
-def MergeModulePcds(pcds, pcdsFixedAtBuild, pcdsPatchableInModule, pcdsFeatureFlag, pcdsDynamic):\r
-    #[ ['PcdName|PcdGuid|PcdType', 'IA32|X64|IPF|EBC'], ...]\r
-    \r
-    Item = pcdsFixedAtBuild\r
-    for index in range(len(Item)):\r
-        pcds.append([(Item[index][0].split(DataType.TAB_VALUE_SPLIT))[1] + DataType.TAB_VALUE_SPLIT + DataType.TAB_PCDS_FIXED_AT_BUILD, Item[index][1]])\r
-\r
-    Item = pcdsPatchableInModule\r
-    for index in range(len(Item)):\r
-        pcds.append([(Item[index][0].split(DataType.TAB_VALUE_SPLIT))[1] + DataType.TAB_VALUE_SPLIT + DataType.TAB_PCDS_PATCHABLE_IN_MODULE, Item[index][1]])\r
-                                 \r
-    Item = pcdsFeatureFlag\r
-    for index in range(len(Item)):\r
-        pcds.append([(Item[index][0].split(DataType.TAB_VALUE_SPLIT))[1] + DataType.TAB_VALUE_SPLIT + DataType.TAB_PCDS_FEATURE_FLAG, Item[index][1]])\r
-                                 \r
-    Item = pcdsDynamic\r
-    for index in range(len(Item)):\r
-        pcds.append([(Item[index][0].split(DataType.TAB_VALUE_SPLIT))[1] + DataType.TAB_VALUE_SPLIT + DataType.TAB_PCDS_DYNAMIC, Item[index][1]])\r
-\r
-def MergeAllArch(list1, listCommon, listIa32, listX64, listIpf, listEbc):\r
-    isFound = False\r
-    for j in range(len(list1)):\r
-        list1[j] = [list1[j], '']\r
-    \r
-    for i in listCommon:\r
-        if i not in list1:\r
-            list1.append([i, ''])\r
-    for i in listIa32:\r
-        for j in range(len(list1)):\r
-            if i == list1[j][0]:\r
-                isFound = True\r
-                list1[j] = [list1[j][0], 'IA32|']\r
-                break\r
-        if not isFound:\r
-            list1.append([i, 'IA32|'])\r
-        isFound = False\r
+#\r
+# Parse a string with format "!include <Filename>"\r
+# Return the file path\r
+# Return False if invalid format or NOT FOUND\r
+#\r
+def GenInclude(String, IncludeFiles, Arch):\r
+    if String.upper().find(DataType.TAB_INCLUDE.upper() + ' ') > -1:\r
+        IncludeFile = CleanString(String[String.upper().find(DataType.TAB_INCLUDE.upper() + ' ') + len(DataType.TAB_INCLUDE + ' ') : ])\r
+        MergeArches(IncludeFiles, IncludeFile, Arch)\r
+        return True\r
+    else:\r
+        return False\r
     \r
-    for i in listX64:\r
-        for j in range(len(list1)):\r
-            if i == list1[j][0]:\r
-                isFound = True\r
-                list1[j] = [list1[j][0], list1[j][1] + 'X64|']\r
-                break\r
-        if not isFound:\r
-            list1.append([i, 'X64|'])\r
-        isFound = False\r
+#\r
+# Parse a string with format "InfFilename [EXEC = ExecFilename]"\r
+# Return (InfFilename, ExecFilename)\r
+#\r
+def GetExec(String):\r
+    InfFilename = ''\r
+    ExecFilename = '' \r
+    if String.find('EXEC') > -1:\r
+        InfFilename = String[ : String.find('EXEC')].strip()\r
+        ExecFilename = String[String.find('EXEC') + len('EXEC') : ].strip()\r
+    else:\r
+        InfFilename = String.strip()\r
     \r
-    for i in listIpf:\r
-        for j in range(len(list1)):\r
-            if i == list1[j][0]:\r
-                isFound = True\r
-                list1[j] = [list1[j][0], list1[j][1] + 'Ipf|']\r
-                break\r
-        if not isFound:\r
-            list1.append([i, 'Ipf|'])\r
-        isFound = False\r
-        \r
-    for i in listEbc:\r
-        for j in range(len(list1)):\r
-            if i == list1[j][0]:\r
-                isFound = True\r
-                list1[j] = [list1[j][0], list1[j][1] + 'Ebc|']\r
-                break\r
-        if not isFound:\r
-            list1.append([i, 'Ebc|'])\r
-        isFound = False\r
-        \r
-    #Remove DataType.TAB_VALUE_SPLIT\r
-    for i in range(len(list1)):\r
-        if list1[i][1].endswith(DataType.TAB_VALUE_SPLIT):\r
-            list1[i][1] = list1[i][1].rsplit(DataType.TAB_VALUE_SPLIT, 1)[0]\r
+    return (InfFilename, ExecFilename)\r
 \r
-    #print list1\r
+#\r
+# Parse a string with format "[<Family>:]<ToolFlag>=Flag"\r
+# Return (Family, ToolFlag, Flag)\r
+#\r
+def GetBuildOption(String):\r
+    (Family, ToolChain, Flag) = ('', '', '')\r
+    List = GetSplitValueList(String, DataType.TAB_EQUAL_SPLIT, MaxSplit = 1)\r
+    if List[0].find(':') > -1:\r
+        Family = CleanString(List[0][ : List[0].find(':')])\r
+        ToolChain = CleanString(List[0][List[0].find(':') + 1 : ])\r
+    else:\r
+        ToolChain = CleanString(List[0])                    \r
+    Flag = CleanString(List[1])\r
+    \r
+    return (Family, ToolChain, Flag)\r
 \r
+#\r
+# Parse block of the components defined in dsc file\r
+# Return KeyValues [ ['component name', [lib1, lib2, lib3], [bo1, bo2, bo3], [pcd1, pcd2, pcd3]], ...]\r
+#\r
 def GetComponents(Lines, Key, KeyValues, CommentCharacter):\r
-    #KeyValues [ ['component name', [lib1, lib2, lib3], [bo1, bo2, bo3]], ...]\r
+    #KeyValues [ ['component name', [lib1, lib2, lib3], [bo1, bo2, bo3], [pcd1, pcd2, pcd3]], ...]\r
     Lines = Lines.split(DataType.TAB_SECTION_END, 1)[1]\r
-    findBlock = False\r
-    findLibraryClass = False\r
-    findBuildOption = False\r
+    (findBlock, findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, False, False, False, False, False, False)\r
     ListItem = None\r
     LibraryClassItem = []\r
     BuildOption = []\r
+    Pcd = []\r
     \r
     LineList = Lines.split('\n')\r
     for Line in LineList:\r
@@ -148,19 +121,40 @@ def GetComponents(Lines, Key, KeyValues, CommentCharacter):
 \r
         if findBlock:    \r
             if Line.find('<LibraryClass>') != -1:\r
-                findLibraryClass = True\r
+                (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (True, False, False, False, False, False, False)\r
                 continue\r
             if Line.find('<BuildOptions>') != -1:\r
-                findBuildOption = True\r
+                (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, True, False, False, False, False, False)\r
+                continue\r
+            if Line.find('<PcdsFeatureFlag>') != -1:\r
+                (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, True, False, False, False, False)\r
+                continue\r
+            if Line.find('<PcdsPatchableInModule>') != -1:\r
+                (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, False, True, False, False, False)\r
+                continue\r
+            if Line.find('<PcdsFixedAtBuild>') != -1:\r
+                (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, False, False, True, False, False)\r
+                continue\r
+            if Line.find('<PcdsDynamic>') != -1:\r
+                (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, False, False, False, True, False)\r
+                continue\r
+            if Line.find('<PcdsDynamicEx>') != -1:\r
+                (findLibraryClass, findBuildOption, findPcdsFeatureFlag, findPcdsPatchableInModule, findPcdsFixedAtBuild, findPcdsDynamic, findPcdsDynamicEx) = (False, False, False, False, False, False, True)\r
                 continue\r
             if Line.endswith('}'):\r
                 #find '}' at line tail\r
-                KeyValues.append([ListItem, LibraryClassItem, BuildOption])\r
+                KeyValues.append([ListItem, LibraryClassItem, BuildOption, Pcd])\r
                 findBlock = False\r
                 findLibraryClass = False\r
                 findBuildOption = False\r
+                findPcdsFeatureFlag = False\r
+                findPcdsPatchableInModule = False\r
+                findPcdsFixedAtBuild = False\r
+                findPcdsDynamic = False\r
+                findPcdsDynamicEx = False\r
                 LibraryClassItem = []\r
                 BuildOption = []\r
+                Pcd = []\r
                 continue\r
 \r
         if findBlock:\r
@@ -168,8 +162,18 @@ def GetComponents(Lines, Key, KeyValues, CommentCharacter):
                 LibraryClassItem.append(Line)\r
             elif findBuildOption:\r
                 BuildOption.append(Line)\r
+            elif findPcdsFeatureFlag:\r
+                Pcd.append((DataType.TAB_PCDS_FEATURE_FLAG, Line))\r
+            elif findPcdsPatchableInModule:\r
+                Pcd.append((DataType.TAB_PCDS_PATCHABLE_IN_MODULE, Line))\r
+            elif findPcdsFixedAtBuild:\r
+                Pcd.append((DataType.TAB_PCDS_FIXED_AT_BUILD, Line))\r
+            elif findPcdsDynamic:\r
+                Pcd.append((DataType.TAB_PCDS_DYNAMIC, Line))\r
+            elif findPcdsDynamicEx:\r
+                Pcd.append((DataType.TAB_PCDS_DYNAMIC_EX, Line))\r
         else:\r
-            KeyValues.append([ListItem, [], []])\r
+            KeyValues.append([ListItem, [], [], []])\r
         \r
     return True\r
 \r
@@ -231,11 +235,11 @@ def CleanString(Line, CommentCharacter = DataType.TAB_COMMENT_SPLIT):
     #remove comments\r
     Line = Line.split(CommentCharacter, 1)[0];\r
     #replace '\\', '\' with '/'\r
-    Line = Line.replace('\\', '/')\r
-    Line = Line.replace('//', '/')\r
+    #Line = Line.replace('\\', '/')\r
+    #Line = Line.replace('//', '/')\r
     #remove ${WORKSPACE}\r
-    Line = Line.replace(DataType.TAB_WORKSPACE1, '')\r
-    Line = Line.replace(DataType.TAB_WORKSPACE2, '')\r
+    #Line = Line.replace(DataType.TAB_WORKSPACE1, '')\r
+    #Line = Line.replace(DataType.TAB_WORKSPACE2, '')\r
     \r
     #remove whitespace again\r
     Line = Line.strip();\r
index fda27ca..3d55e45 100644 (file)
 #\r
 \r
 class CommonClass(object):\r
-    def __init__(self):\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
-        self.SupArchList = []                             #EBC | IA32 | X64 | IPF | ARM | PPC\r
+        self.SupArchList = SupArchList                    #EBC | IA32 | X64 | IPF | ARM | PPC\r
         self.HelpText = ''\r
         \r
 class CommonHeaderClass(object):\r
@@ -47,6 +47,10 @@ class IdentificationClass(object):
         self.FileName = ''\r
         self.FullPath = ''\r
 \r
+class IncludeStatementClass(object):\r
+    def __init__(self):\r
+        self.IncludeFiles = {}                             #{ IncludeFile : [Arch1, Arch2, ...], ...}\r
+\r
 class GuidProtocolPpiCommonClass(CommonClass):\r
     def __init__(self):\r
         self.Name = ''\r
@@ -81,19 +85,20 @@ class PpiClass(GuidProtocolPpiCommonClass):
         GuidProtocolPpiCommonClass.__init__(self)\r
         \r
 class SkuInfoClass(object):\r
-    def __init__(self):\r
-        self.SkuId = ''\r
+    def __init__(self, SkuIdName = '', SkuId = '', VariableName = '', VariableGuid = '', VariableOffset = '', HiiDefaultValue = '', VpdOffset = '', DefaultValue = ''):\r
+        self.SkuIdName = SkuIdName\r
+        self.SkuId = SkuId\r
         #Used by Hii\r
-        self.VariableName = ''\r
-        self.VariableGuid = ''\r
-        self.VariableOffset = ''\r
-        self.HiiDefaultValue = ''\r
+        self.VariableName = VariableName\r
+        self.VariableGuid = VariableGuid\r
+        self.VariableOffset = VariableOffset\r
+        self.HiiDefaultValue = HiiDefaultValue\r
         \r
         #Used by Vpd\r
-        self.VpdOffset = ''\r
+        self.VpdOffset = VpdOffset\r
         \r
         #Used by Default\r
-        self.DefaultValue = ''\r
+        self.DefaultValue = DefaultValue\r
         \r
     def __str__(self):\r
         rtn = rtn = str(self.SkuId) + "," + \\r
@@ -106,25 +111,27 @@ class SkuInfoClass(object):
         return rtn\r
 \r
 class PcdClass(CommonClass):\r
-    def __init__(self):\r
-        self.CName = ''\r
-        self.Token = ''\r
-        self.TokenSpaceGuidCName = ''\r
-        self.DatumType = ''                               #UINT8 | UINT16 | UINT32 | UINT64 | VOID* | BOOLEAN \r
-        self.MaxDatumSize = ''\r
-        self.DefaultValue = ''\r
-        self.ItemType = ''                                #FEATURE_FLAG | FIXED_AT_BUILD | PATCHABLE_IN_MODULE | DYNAMIC | DYNAMIC_EX\r
-        self.ValidUsage = []                              #FEATURE_FLAG | FIXED_AT_BUILD | PATCHABLE_IN_MODULE | DYNAMIC | DYNAMIC_EX\r
-        self.SkuInfoList = {}                             #{ [SkuId] : SkuInfoClass } \r
-        self.SupModuleList = []                           #BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED\r
+    def __init__(self, CName = '', Token = '', TokenSpaceGuidCName = '', DatumType = '', MaxDatumSize = '', DefaultValue = '', ItemType = '', ValidUsage = [], SkuInfoList = {}, SupModuleList = []):\r
+        self.CName = CName\r
+        self.Token = Token\r
+        self.TokenSpaceGuidCName = TokenSpaceGuidCName\r
+        self.DatumType = DatumType                                 #UINT8 | UINT16 | UINT32 | UINT64 | VOID* | BOOLEAN \r
+        self.MaxDatumSize = MaxDatumSize\r
+        self.DefaultValue = DefaultValue\r
+        self.ItemType = ItemType                                   #FEATURE_FLAG | FIXED_AT_BUILD | PATCHABLE_IN_MODULE | DYNAMIC | DYNAMIC_EX\r
+        self.ValidUsage = ValidUsage                               #FEATURE_FLAG | FIXED_AT_BUILD | PATCHABLE_IN_MODULE | DYNAMIC | DYNAMIC_EX\r
+        self.SkuInfoList = SkuInfoList                             #{ [SkuIdName] : SkuInfoClass } \r
+        self.SupModuleList = SupModuleList                         #BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED\r
         CommonClass.__init__(self)\r
 \r
-class BuildOptionClass(object):\r
-    def __init__(self):\r
-        self.Statement = ''                               #Family:Target_TagName_Tarch_Toolcode_FLAGS = String \r
-        self.Option = ''\r
+class BuildOptionClass(IncludeStatementClass):\r
+    def __init__(self, ToolChainFamily = '', ToolChain = '', Option = ''):\r
+        IncludeStatementClass.__init__(self)\r
+        self.Statement = ''                               #Family:Target_TagName_Tarch_ToolCode_FLAGS = String \r
+        self.ToolChainFamily = ToolChainFamily\r
+        self.ToolChain = ToolChain\r
+        self.Option = Option\r
         self.BuildTarget = ''\r
-        self.ToolChainFamily = ''\r
         self.TagName = ''\r
         self.ToolCode = ''\r
         self.SupArchList = []                             #EBC | IA32 | X64 | IPF | ARM | PPC\r
@@ -141,7 +148,3 @@ class UserExtensionsClass(object):
         self.UserID = ''\r
         self.Identifier = 0\r
         self.Content = ''\r
-        \r
-class IncludeStatementClass(object):\r
-    def __init__(self):\r
-        self.IncludeFile = ''\r
index 36125f1..5904dfe 100644 (file)
@@ -29,7 +29,7 @@ class PlatformHeaderClass(IdentificationClass, CommonHeaderClass, DefineClass):
         self.IntermediateDirectories = ''                            #MODULE | UNIFIED\r
         self.OutputDirectory = ''                                                    \r
         self.ForceDebugTarget = ''\r
-        self.SkuId = ''\r
+        self.SkuIdName = []\r
         self.BuildNumber = ''\r
         self.MakefileName = ''\r
         self.ClonedFrom = []                                         #[ ClonedRecordClass, ...]\r
@@ -100,53 +100,68 @@ class PlatformFfsClass(object):
     def __init__(self):\r
         self.Attribute = {}                                          #{ [(Name, PlatformFfsSectionsClass)] : Value}\r
         self.Sections = []                                           #[ PlatformFfsSectionsClass]\r
-\r
+            \r
 class PlatformBuildOptionClass(object):\r
     def __init__(self):\r
         self.UserDefinedAntTasks = {}                                #{ [Id] : PlatformAntTaskClass, ...}\r
         self.Options = []                                            #[ BuildOptionClass, ...]\r
         self.UserExtensions = {}                                     #{ [(UserID, Identifier)] : UserExtensionsClass, ...}\r
         self.FfsKeyList = {}                                         #{ [FfsKey]: PlatformFfsClass, ...} \r
-\r
-class PlatformLibraryInstanceClass(DefineClass):\r
+    \r
+class PlatformBuildOptionClasses(IncludeStatementClass):\r
     def __init__(self):\r
+        IncludeStatementClass.__init__(self)\r
+        self.FvBinding = ''\r
+        self.FfsFileNameGuid = ''\r
+        self.FfsFormatKey = ''\r
+        self.BuildOptionList = []                                    #[ BuildOptionClass, ...]\r
+\r
+class PlatformLibraryClass(CommonClass, DefineClass):\r
+    def __init__(self, Name = '', FilePath = ''):\r
+        CommonClass.__init__(self)\r
         DefineClass.__init__(self)\r
-        self.Name = ''\r
-        self.FilePath = ''\r
+        self.Name = Name\r
+        self.FilePath = FilePath\r
+        self.ModuleType = []\r
         self.ModuleGuid = ''\r
         self.ModuleVersion = ''\r
         self.PackageGuid = ''\r
         self.PackageVersion = ''\r
 \r
-class PlatformModuleSaBuildOptionClass(DefineClass):\r
+class PlatformLibraryClasses(IncludeStatementClass):\r
     def __init__(self):\r
-        self.FvBinding = ''\r
-        self.FfsFileNameGuid = ''\r
-        self.FfsFormatKey = ''\r
-        self.Options = []                                            #[ BuildOptionClass, ...]\r
-                \r
+        IncludeStatementClass.__init__(self)\r
+        self.LibraryList = []                                        #[ PlatformLibraryClass, ...]\r
+        \r
 class PlatformModuleClass(CommonClass, DefineClass, IncludeStatementClass):\r
     def __init__(self):\r
         CommonClass.__init__(self)\r
         DefineClass.__init__(self)\r
-        IncludeStatementClass.__init__(self)\r
         self.Name = ''                                               #Library name or libraryclass name or module name\r
         self.FilePath = ''\r
         self.Type = ''                                               #LIBRARY | LIBRARY_CLASS | MODULE, used by dsc\r
         self.ModuleType = ''\r
-        self.LibraryClasses = []                                     #[ PlatformLibraryInstanceClass, ...]\r
+        self.ExecFilePath = ''\r
+        self.LibraryClasses = PlatformLibraryClasses()\r
         self.PcdBuildDefinitions = []                                #[ PcdClass, ...]\r
-        self.ModuleSaBuildOption = PlatformModuleSaBuildOptionClass()\r
+        self.ModuleSaBuildOption = PlatformBuildOptionClasses()\r
         self.Specifications = []                                     #[ '', '', ...]\r
-    \r
+\r
+class PlatformModuleClasses(IncludeStatementClass):\r
+    def __init__(self):\r
+        IncludeStatementClass.__init__(self)\r
+        self.ModuleList = []                                         #[ PlatformModuleClass, ...]\r
+\r
 class PlatformClass(object):\r
     def __init__(self):\r
         self.Header = PlatformHeaderClass()\r
-        self.SkuInfoList = SkuInfoListClass()\r
-        self.Modules = []                                            #[ PlatformModuleClass, ...]\r
-        self.FlashDefinitionFile = None                              #PlatformFlashDefinitionFileClass()\r
+        self.SkuInfos = SkuInfoListClass()\r
+        self.Libraries = PlatformLibraryClasses()\r
+        self.LibraryClasses = PlatformLibraryClasses()\r
+        self.Modules = PlatformModuleClasses()\r
+        self.FlashDefinitionFile = PlatformFlashDefinitionFileClass()\r
         self.FvImages = []                                           #[ PlatformFvImagesClass, ...]\r
-        self.BuildOptions = []                                       #[ PlatformBuildOptionClass, ...]\r
+        self.BuildOptions = PlatformBuildOptionClasses()\r
         self.DynamicPcdBuildDefinitions = []                         #[ PcdClass, ...] \r
         self.Fdf = []                                                #[ FdfClass, ...]\r
         self.UserExtensions = []                                     #[ UserExtensionsClass, ...]\r