]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/GenBuild/org/tianocore/build/pcd/action/PlatformPcdPreprocessActionForBuilding.java
In preprocess for getting platform PCD information, if meet error, put error into...
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / pcd / action / PlatformPcdPreprocessActionForBuilding.java
index fd1ae56eb646bcfd71281f3ce6fa30a753e0a5b4..7dd90886b9dbaae33c89c9d68fcf5ceed9b0a121 100644 (file)
@@ -28,18 +28,19 @@ import java.util.Map;
 import org.apache.xmlbeans.XmlException;\r
 import org.apache.xmlbeans.XmlObject;\r
 import org.tianocore.DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions;\r
+import org.tianocore.PcdBuildDefinitionDocument;\r
 import org.tianocore.PlatformSurfaceAreaDocument;\r
+import org.tianocore.build.exception.PlatformPcdPreprocessBuildException;\r
 import org.tianocore.build.fpd.FpdParserTask;\r
 import org.tianocore.build.global.GlobalData;\r
 import org.tianocore.build.id.FpdModuleIdentification;\r
 import org.tianocore.pcd.action.ActionMessage;\r
-import org.tianocore.pcd.entity.ModulePcdInfoFromFpd;\r
+import org.tianocore.pcd.action.PlatformPcdPreprocessAction;\r
 import org.tianocore.pcd.entity.MemoryDatabaseManager;\r
+import org.tianocore.pcd.entity.ModulePcdInfoFromFpd;\r
 import org.tianocore.pcd.entity.Token;\r
 import org.tianocore.pcd.entity.UsageIdentification;\r
 import org.tianocore.pcd.exception.EntityException;\r
-import org.tianocore.pcd.action.PlatformPcdPreprocessAction;\r
-import org.tianocore.build.exception.PlatformPcdPreprocessBuildException;\r
 import org.tianocore.pcd.exception.PlatformPcdPreprocessException;\r
 \r
 /**\r
@@ -120,7 +121,9 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
 \r
     **/\r
     public void execute() throws PlatformPcdPreprocessBuildException {\r
-        String errorMessageHeader = "Fail to initialize Pcd memory database for building. Because:";\r
+        String errorMessageHeader   = "Fail to initialize Pcd memory database for building. Because:";\r
+        String errorsForPreprocess  = null;\r
+\r
         //\r
         // Get memoryDatabaseManager instance from GlobalData.\r
         // The memoryDatabaseManager should be initialized as static variable\r
@@ -138,6 +141,10 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
         } catch (PlatformPcdPreprocessException exp) {\r
             throw new PlatformPcdPreprocessBuildException(errorMessageHeader + exp.getMessage());\r
         }\r
+        errorsForPreprocess = this.getErrorString();\r
+        if (errorsForPreprocess != null) {\r
+            throw new PlatformPcdPreprocessBuildException(errorMessageHeader + "\r\n" + errorsForPreprocess);\r
+        }\r
 \r
         //\r
         // Generate for PEI, DXE PCD DATABASE's definition and initialization.\r
@@ -228,7 +235,10 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
                                                                  id.getArch(),\r
                                                                  id.getModule().getVersion(),\r
                                                                  id.getModule().getModuleType());\r
-            allModules.add(new ModulePcdInfoFromFpd(usageId, pcdBuildDefinitions.get(id)));\r
+            allModules.add(\r
+                new ModulePcdInfoFromFpd(\r
+                    usageId, \r
+                    ((PcdBuildDefinitionDocument)pcdBuildDefinitions.get(id)).getPcdBuildDefinition()));\r
         }\r
         return allModules;\r
     }\r
@@ -542,7 +552,7 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
                     return exceptionString;\r
                 }\r
             } else {\r
-                exceptionString = String.format("[FPD file error] The datum type of PCD %s in %s is VOID*. For VOID* type, you have three format choise:\n "+\r
+                exceptionString = String.format("[FPD file error] The datum type of PCD %s in %s is VOID*. For VOID* type, you have three format choise:\n"+\r
                                                 "1) UNICODE string: like L\"xxxx\";\r\n"+\r
                                                 "2) ANSIC string: like \"xxx\";\r\n"+\r
                                                 "3) Byte array: like {0x2, 0x45, 0x23}\r\n"+\r
@@ -602,19 +612,18 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
                                             "PCD entry %s in module %s!",\r
                                             token.cName,\r
                                             moduleName);\r
-            throw new PlatformPcdPreprocessException(exceptionString);\r
+            putError(exceptionString);\r
+            return null;\r
         }\r
 \r
         dynamicPcdBuildDataArray = dynamicPcdBuildDefinitions.getPcdBuildDataList();\r
         for (index = 0; index < dynamicPcdBuildDataArray.size(); index ++) {\r
-            try {\r
-                tokenSpaceStrRet = GlobalData.getGuidInfoFromCname(dynamicPcdBuildDataArray.get(index).getTokenSpaceGuidCName());\r
-            } catch (Exception e) {\r
-                throw new PlatformPcdPreprocessException ("Fail to get token space guid for token " + dynamicPcdBuildDataArray.get(index).getCName());\r
-            }\r
+            tokenSpaceStrRet = this.getGuidInfoFromSpd(dynamicPcdBuildDataArray.get(index).getTokenSpaceGuidCName());\r
 \r
             if (tokenSpaceStrRet == null) {\r
-                throw new PlatformPcdPreprocessException ("Fail to get token space guid for token " + dynamicPcdBuildDataArray.get(index).getCName());\r
+                exceptionString = "Fail to get token space guid for token " + dynamicPcdBuildDataArray.get(index).getCName();\r
+                putError(exceptionString);\r
+                continue;\r
             }\r
 \r
             dynamicPrimaryKey = Token.getPrimaryKeyString(dynamicPcdBuildDataArray.get(index).getCName(),\r
@@ -655,6 +664,7 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
 \r
         dynamicPcdBuildDefinitions = fpdDocInstance.getPlatformSurfaceArea().getDynamicPcdBuildDefinitions();\r
         if (dynamicPcdBuildDefinitions == null) {\r
+            putError("There is no <DynamicPcdBuildDefinitions> in FPD file!");\r
             return null;\r
         }\r
 \r