git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@300 7335b...
authorhche10x <hche10x@7335b38e-4728-0410-8992-fb3ffe349368>
Wed, 11 Jul 2007 03:00:24 +0000 (03:00 +0000)
committerhche10x <hche10x@7335b38e-4728-0410-8992-fb3ffe349368>
Wed, 11 Jul 2007 03:00:24 +0000 (03:00 +0000)
Source/Python/EdkIIWorkspaceBuild.py

index a969ded..7fa455a 100644 (file)
@@ -25,7 +25,9 @@ from DecClassObject import *
 from DscClassObject import *\r
 from String import *\r
 from ClassObjects.CommonClassObject import *\r
+from FdfParser import *\r
 from BuildToolError import *\r
+from Region import *\r
 \r
 class ModuleSourceFilesClassObject(object):\r
     def __init__(self, SourceFile = '', PcdFeatureFlag = '', TagName = '', ToolCode = '', ToolChainFamily = '', String = ''):\r
@@ -242,13 +244,14 @@ class WorkspaceBuild(object):
                 for index in range(len(dscObj.Contents[key].LibraryClasses)):\r
                     self.AddToInfDatabase(dscObj.Contents[key].LibraryClasses[index][0].split(DataType.TAB_VALUE_SPLIT, 1)[1])\r
                 for index in range(len(dscObj.Contents[key].Components)):\r
-                    self.AddToInfDatabase(dscObj.Contents[key].Components[index][0])\r
-                    if len(dscObj.Contents[key].Components[index][1]) > 0:\r
-                        LibList = dscObj.Contents[key].Components[index][1]\r
-                        for indexOfLib in range(len(LibList)):\r
-                            Lib = LibList[indexOfLib]\r
-                            if len(Lib.split(DataType.TAB_VALUE_SPLIT)) == 2:\r
-                                self.AddToInfDatabase(CleanString(Lib.split(DataType.TAB_VALUE_SPLIT)[1]))\r
+                    Module = dscObj.Contents[key].Components[index][0]\r
+                    LibList = dscObj.Contents[key].Components[index][1]\r
+                    self.AddToInfDatabase(Module)\r
+                    for indexOfLib in range(len(LibList)):\r
+                        Lib = LibList[indexOfLib]\r
+                        if len(Lib.split(DataType.TAB_VALUE_SPLIT)) == 2:\r
+                            self.AddToInfDatabase(CleanString(Lib.split(DataType.TAB_VALUE_SPLIT)[1]))\r
+                            self.UpdateInfDatabase(Module, CleanString(Lib.split(DataType.TAB_VALUE_SPLIT)[0]), key)\r
         #End For of Dsc\r
         \r
         #parse module to get package\r
@@ -657,6 +660,18 @@ class WorkspaceBuild(object):
     \r
     #End of self.Init\r
     \r
+    def UpdateInfDatabase(self, infFileName, LibraryClass, Arch):\r
+        infFileName = NormPath(infFileName)\r
+        LibList = self.InfDatabase[infFileName].Contents[Arch].LibraryClasses\r
+        NotFound = True\r
+        for Item in LibList:\r
+            LibName = Item.split(DataType.TAB_VALUE_SPLIT)[0].strip()\r
+            if LibName == LibraryClass:\r
+                return\r
+        \r
+        if NotFound:\r
+            self.InfDatabase[infFileName].Contents[Arch].LibraryClasses.extend([LibraryClass])\r
+    \r
     def AddToInfDatabase(self, infFileName):\r
         infFileName = NormPath(infFileName)\r
         file = self.Workspace.WorkspaceFile(infFileName)\r
@@ -680,8 +695,8 @@ class WorkspaceBuild(object):
                     #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] == lib:\r
-                            return LibList[indexOfLib].split(DataType.TAB_VALUE_SPLIT)[1]\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
@@ -746,7 +761,9 @@ class WorkspaceBuild(object):
                 break\r
         \r
         return PcdClassObject(CName, GuidCName, Type, DatumType, DefaultValue, TokenValue, MaxDatumSize, SkuInfoList)\r
-                \r
+    \r
+    def ReloadPcd(self, FvDict):\r
+        pass\r
                 \r
 # This acts like the main() function for the script, unless it is 'import'ed into another\r
 # script.\r