a) Fixed a bug which will cause failure in accessing platform object
authorjwang36 <jwang36@7335b38e-4728-0410-8992-fb3ffe349368>
Mon, 21 Jan 2008 09:37:48 +0000 (09:37 +0000)
committerjwang36 <jwang36@7335b38e-4728-0410-8992-fb3ffe349368>
Mon, 21 Jan 2008 09:37:48 +0000 (09:37 +0000)
b) Added support module type check for library instances used by a module
c) Let enforced library instances (NULL library class) to support all module types

git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@961 7335b38e-4728-0410-8992-fb3ffe349368

Source/Python/Common/EdkIIWorkspaceBuild.py

index 7949033..c21d56a 100755 (executable)
@@ -521,7 +521,6 @@ class WorkspaceBuild(object):
     def GenPlatformDatabase(self, PcdsSet={}):\r
         for Dsc in self.DscDatabase.keys():\r
             Platform = self.DscDatabase[Dsc].Platform\r
-\r
             for Arch in self.SupArchList:\r
                 Pb = PlatformBuildClassObject()\r
 \r
@@ -570,9 +569,9 @@ class WorkspaceBuild(object):
                 # Libraries\r
                 # \r
                 for Item in Platform.Libraries.LibraryList:\r
-                    for Arch in Item.SupArchList:\r
+                    for ItemArch in Item.SupArchList:\r
                         Library = self.InfDatabase[Item.FilePath]\r
-                        Pb.Libraries[Library.Module.Header[Arch].Name] = Item.FilePath\r
+                        Pb.Libraries[Library.Module.Header[ItemArch].Name] = Item.FilePath\r
                 \r
                 #\r
                 # Pcds\r
@@ -916,9 +915,9 @@ class WorkspaceBuild(object):
                 M = LibraryConsumerList.pop()\r
                 for LibraryName in M.Libraries:\r
                     if LibraryName not in Platform.Libraries:\r
-                        EdkLogger.error("AutoGen", AUTOGEN_ERROR,\r
-                                        "Library instance for library class [%s] is not found" % LibraryName,\r
+                        EdkLogger.warn("AutoGen", "Library [%s] is not found" % LibraryName,\r
                                         ExtraData="\t%s [%s]" % (str(Module), Arch))\r
+                        continue\r
     \r
                     LibraryFile = Platform.Libraries[LibraryName]\r
                     if (LibraryName, ModuleType) not in Module.LibraryClasses:\r
@@ -986,6 +985,11 @@ class WorkspaceBuild(object):
             # check if there're duplicate library classes\r
             #\r
             for Lc in M.LibraryClass:\r
+                if Lc.SupModList != None and ModuleType not in Lc.SupModList:\r
+                    EdkLogger.error("AutoGen", AUTOGEN_ERROR,\r
+                                    "Module type [%s] is not supported by library instance [%s]" % (ModuleType, str(M)),\r
+                                    ExtraData="\t%s" % str(Module))\r
+\r
                 if Lc.LibraryClass in LibraryInstance and str(M) != str(LibraryInstance[Lc.LibraryClass]):\r
                     EdkLogger.error("AutoGen", AUTOGEN_ERROR,\r
                                     "More than one library instance found for library class [%s] in module [%s]" % (Lc.LibraryClass, Module),\r
@@ -1186,7 +1190,7 @@ class WorkspaceBuild(object):
         if NotFound:\r
             NewLib = LibraryClassClass()\r
             NewLib.LibraryClass = LibraryClass\r
-            NewLib.SupModuleList = LibraryModule.Header[Arch].ModuleType.split()\r
+            NewLib.SupModuleList = DataType.SUP_MODULE_LIST # LibraryModule.Header[Arch].ModuleType.split()\r
             LibraryModule.Header[Arch].LibraryClass.append(NewLib)\r
 \r
         #\r