Fix two bugs for current PCD workflow:
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 28 Apr 2006 13:52:29 +0000 (13:52 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 28 Apr 2006 13:52:29 +0000 (13:52 +0000)
1) Switch build message on for PCD action.
2) If SPD file does *not* contains PCD information, it is illegal.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@76 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java
Tools/Source/GenBuild/org/tianocore/build/pcd/action/BuildAction.java
Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java

index 99b7242..1de29ea 100644 (file)
@@ -799,7 +799,7 @@ public class FpdParserTask extends Task {
         collectAction.perform (\r
           getProject().getProperty("WORKSPACE_DIR"),\r
           fpdFilename.getPath(),\r
-          ActionMessage.NULL_MESSAGE_LEVEL\r
+          ActionMessage.MAX_MESSAGE_LEVEL\r
           );\r
       } catch (Exception exp) {\r
         throw new BuildException (exp.getMessage());\r
index c8b0d9d..270b393 100644 (file)
@@ -17,6 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 package org.tianocore.build.pcd.action;\r
 \r
 import org.apache.tools.ant.Task;\r
+import org.apache.tools.ant.Project;\r
 import org.tianocore.build.pcd.exception.BuildActionException;\r
 \r
 /** BuildAction is the parent class for all action related to ant Task. This class will\r
@@ -68,9 +69,7 @@ abstract class BuildAction extends Task {
         //\r
         // Comment following code because in console debug environment, we can't \r
         // get Project instance.\r
-        //((Task) action).log(errorText, Project.MSG_INFO);\r
-        //\r
-        System.out.println(logStr);\r
+        ((Task) action).log(logStr, Project.MSG_INFO);\r
     }\r
 \r
     /**\r
@@ -87,9 +86,7 @@ abstract class BuildAction extends Task {
         //\r
         // Comment following code because in console debug environment, we can't \r
         // get Project instance.\r
-        //((Task) action).log(warningText, Project.MSG_WARN);\r
-        //\r
-        System.out.println(warningStr);\r
+        ((Task) action).log(warningStr, Project.MSG_WARN);\r
     }\r
 \r
     /**\r
index 055563d..9929005 100644 (file)
@@ -501,7 +501,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 +551,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 +565,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 +628,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