]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java
It is legal that same base name exist in one FPD file. In future, we should use ...
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / pcd / action / CollectPCDAction.java
index 055563df1b29a2f2c51181cca20e3014b3017078..71a30b67abb74a0768fef0bcb1ec73f6c0c885af 100644 (file)
@@ -373,15 +373,13 @@ public class CollectPCDAction {
 \r
         if(Token.PCD_USAGE.UNKNOWN != token.isUsageInstanceExist(moduleName)) {\r
             //\r
-            // BUGBUG: It should *not* throw exception here. Becaues in MdePkg.fpd, \r
-            // more than on BaseLib exist. But why? need confirmation.\r
+            // BUGBUG: It is legal that same base name exist in one FPD file. In furture\r
+            //         we should use "Guid, Version, Package" and "Arch" to differ a module.\r
+            //         So currently, warning should be disabled.\r
             //\r
-            //throw new EntityException(\r
-            //  "In module " + moduleName + " exist more than one PCD token " + token.cName\r
-            //  );\r
-            ActionMessage.warning(this,\r
-                                  "In module " + moduleName + " exist more than one PCD token " + token.cName\r
-                                  );\r
+            //ActionMessage.warning(this,\r
+            //                      "In module " + moduleName + " exist more than one PCD token " + token.cName\r
+            //                      );\r
             return null;\r
         }\r
 \r
@@ -501,7 +499,8 @@ public class CollectPCDAction {
             token.skuDataArrayEnabled  = pcdBuildData.getSkuDataArrayEnable();\r
             token.assignedtokenNumber  = Integer.decode(pcdBuildData.getToken().getStringValue());\r
             skuDataArray               = pcdBuildData.getSkuDataArray1();\r
-           \r
+            token.datumType    = Token.getdatumTypeFromString(pcdBuildData.getDatumType().toString());\r
+\r
             if(skuDataArray != null) {\r
                 for(skuIndex = 0; skuIndex < skuDataArray.size(); skuIndex ++) {\r
                     //\r
@@ -550,11 +549,12 @@ public class CollectPCDAction {
     private void updateTokenBySPD(UsageInstance  usageInstance,\r
                                   String         packageFullPath) \r
         throws EntityException {\r
-        PackageSurfaceAreaDocument  pkgDoc          = null;\r
-        List<PcdDefinitions.PcdEntry> pcdEntryArray = new ArrayList<PcdDefinitions.PcdEntry>();\r
-        int                         index;\r
-        boolean                     isFoundInSpd  = false;\r
-        Token.DATUM_TYPE            datumType     = Token.DATUM_TYPE.UNKNOWN;\r
+        PackageSurfaceAreaDocument      pkgDoc          = null;\r
+        PcdDefinitions                  pcdDefinitions  = null;\r
+        List<PcdDefinitions.PcdEntry>   pcdEntryArray   = new ArrayList<PcdDefinitions.PcdEntry>();\r
+        int                             index           = 0;\r
+        boolean                         isFoundInSpd    = false;\r
+        Token.DATUM_TYPE                datumType       = Token.DATUM_TYPE.UNKNOWN;\r
 \r
         try {\r
             pkgDoc =(PackageSurfaceAreaDocument)XmlObject.Factory.parse(new File(packageFullPath));\r
@@ -563,8 +563,18 @@ public class CollectPCDAction {
         } catch(XmlException xmlE) {\r
             throw new EntityException("Can't parse the FPD xml fle:" + packageFullPath);\r
         }\r
+        pcdDefinitions = pkgDoc.getPackageSurfaceArea().getPcdDefinitions();\r
+        //\r
+        // It is illege for SPD file does not contains any PCD information.\r
+        //\r
+        if (pcdDefinitions == null) {\r
+            return;\r
+        }\r
 \r
-        pcdEntryArray = pkgDoc.getPackageSurfaceArea().getPcdDefinitions().getPcdEntryList();\r
+        pcdEntryArray = pcdDefinitions.getPcdEntryList();\r
+        if (pcdEntryArray == null) {\r
+            return;\r
+        }\r
         for(index = 0; index < pcdEntryArray.size(); index ++) {\r
             if(pcdEntryArray.get(index).getCName().equalsIgnoreCase(\r
                 usageInstance.parentToken.cName)) {\r
@@ -616,12 +626,6 @@ public class CollectPCDAction {
                 }\r
             }\r
         }\r
-\r
-        if(!isFoundInSpd ) {\r
-            ActionMessage.warning(this, \r
-                                  "Can *not* find the PCD token " + usageInstance.parentToken.cName + \r
-                                  " in SPD file!");\r
-        }\r
     }\r
 \r
     /**\r