]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/PcdTools/org/tianocore/pcd/action/PlatformPcdPreprocessAction.java
Fix track EDKT179.
[mirror_edk2.git] / Tools / Source / PcdTools / org / tianocore / pcd / action / PlatformPcdPreprocessAction.java
index f2d52475ae0f60b04a4756317f4218ee34d7cfa0..9343c1689d09365a4ab0205d48ecae4b17d056ee 100644 (file)
@@ -159,9 +159,9 @@ public abstract class PlatformPcdPreprocessAction {
 \r
     public void putError(String error) {\r
         if (errorString == null) {\r
-            errorString = "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n\r\n";\r
+            errorString = "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n";\r
         } else {\r
-            errorString += "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n\r\n";\r
+            errorString += "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n";\r
         }\r
 \r
         errorCount++;\r
@@ -199,7 +199,7 @@ public abstract class PlatformPcdPreprocessAction {
 \r
         if (modules == null) {\r
             throw new PlatformPcdPreprocessException(\r
-                "No modules in FPD file, Please check whether there are elements in <FrameworkModules> in FPD file!");\r
+                "No modules found in the FPD file.\nPlease check whether there are elements in <FrameworkModules> in the FPD file!");\r
         }\r
 \r
         //\r
@@ -230,8 +230,8 @@ public abstract class PlatformPcdPreprocessAction {
                 tokenSpaceStrRet = getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
 \r
                 if (tokenSpaceStrRet == null) {\r
-                    putError("Fail to get Token space guid for token" + pcdBuildData.getCName() +\r
-                             " from all SPD files. You must have an <GuidDeclaration> for this token space Guid");\r
+                    putError("Failed to get Token Space Guid for token " + pcdBuildData.getCName() +\r
+                             " from any SPD file. You must have an <GuidDeclaration> for this Token Space Guid!");\r
                     //\r
                     // Do not break preprocess, continues to analysis.\r
                     // All errors will be summary to be shown.\r
@@ -252,8 +252,8 @@ public abstract class PlatformPcdPreprocessAction {
 \r
                 if ((pcdType    == Token.PCD_TYPE.FEATURE_FLAG) &&\r
                     (datumType  != Token.DATUM_TYPE.BOOLEAN)){\r
-                    exceptionString = String.format("In FPD file, for PCD %s in module %s, the PCD type is FEATRUE_FLAG but "+\r
-                                                    "datum type of this PCD entry is not BOOLEAN!",\r
+                    exceptionString = String.format("In FPD file, for PCD %s in module %s, the PCD type is FEATURE_FLAG but "+\r
+                                                    "datum type for this PCD entry is not BOOLEAN!",\r
                                                     pcdBuildData.getCName(),\r
                                                     moduleName);\r
                     putError(exceptionString);\r
@@ -274,7 +274,7 @@ public abstract class PlatformPcdPreprocessAction {
                      // Value is required.\r
                      //\r
                      if (datum == null) {\r
-                         exceptionString = String.format("In FPD file, there is no value for PCD entry %s in module %s!",\r
+                         exceptionString = String.format("In the FPD file, there is no value for PCD entry %s in module %s!",\r
                                                          pcdBuildData.getCName(),\r
                                                          moduleName);\r
                          putError(exceptionString);\r
@@ -319,7 +319,7 @@ public abstract class PlatformPcdPreprocessAction {
                     // modules.\r
                     //\r
                     if (token.datumType != datumType) {\r
-                        exceptionString = String.format("In FPD file, the datum type of PCD entry %s is %s, which is different with  %s defined in before!",\r
+                        exceptionString = String.format("In the FPD file, the datum type of the PCD entry %s is %s, which is different from %s which was previously defined!",\r
                                                         pcdBuildData.getCName(),\r
                                                         pcdBuildData.getDatumType().toString(),\r
                                                         Token.getStringOfdatumType(token.datumType));\r
@@ -335,7 +335,7 @@ public abstract class PlatformPcdPreprocessAction {
                     // Check token number is valid\r
                     //\r
                     if (tokenNumber != token.tokenNumber) {\r
-                        exceptionString = String.format("In FPD file, the token number of PCD entry %s in module %s is different with same PCD entry in other modules!",\r
+                        exceptionString = String.format("In the FPD file, the token number of PCD entry %s in module %s is different from the same PCD entry in other modules!",\r
                                                         pcdBuildData.getCName(),\r
                                                         moduleName);\r
                         putError(exceptionString);\r
@@ -350,8 +350,8 @@ public abstract class PlatformPcdPreprocessAction {
                     // For same PCD used in different modules, the PCD type should all be dynamic or non-dynamic.\r
                     //\r
                     if (token.isDynamicPCD != Token.isDynamic(pcdType)) {\r
-                        exceptionString = String.format("In FPD file, for PCD entry %s in module %s, you define dynamic or non-dynamic PCD type which"+\r
-                                                        " is different with others module's",\r
+                        exceptionString = String.format("In the FPD file, for PCD entry %s in module %s, you defined dynamic or non-dynamic PCD type which"+\r
+                                                        " is different from other module's definition.",\r
                                                         token.cName,\r
                                                         moduleName);\r
                         putError(exceptionString);\r
@@ -363,33 +363,10 @@ public abstract class PlatformPcdPreprocessAction {
                     }\r
 \r
                     if (token.isDynamicPCD) {\r
-                        //\r
-                        // Check datum is equal the datum in dynamic information.\r
-                        // For dynamic PCD, you can do not write <Value> in sperated every <PcdBuildDefinition> in different <ModuleSA>,\r
-                        // But if you write, the <Value> must be same as the value in <DynamicPcdBuildDefinitions>.\r
-                        //\r
-                        if (!token.isSkuEnable() &&\r
-                            (token.getDefaultSku().type == DynamicTokenValue.VALUE_TYPE.DEFAULT_TYPE) &&\r
-                            (datum != null)) {\r
-                            if (!datum.equalsIgnoreCase(token.getDefaultSku().value)) {\r
-                                exceptionString = String.format("In FPD file, for dynamic PCD %s in module %s, the datum in <ModuleSA> is "+\r
-                                                                "not equal to the datum in <DynamicPcdBuildDefinitions>, it is "+\r
-                                                                "illega! You could no set <Value> in <ModuleSA> for a dynamic PCD!",\r
-                                                                token.cName,\r
-                                                                moduleName);\r
-                                putError(exceptionString);\r
-                                //\r
-                                // Do not break preprocess, continues to analysis.\r
-                                // All errors will be summary to be shown.\r
-                                // \r
-                                continue;\r
-                            }\r
-                        }\r
-\r
                         if ((maxDatumSize != 0) &&\r
                             (maxDatumSize != token.datumSize)){\r
-                            exceptionString = String.format("In FPD file, for dynamic PCD %s in module %s, the max datum size is %d which "+\r
-                                                            "is different with <MaxDatumSize> %d defined in <DynamicPcdBuildDefinitions>!",\r
+                            exceptionString = String.format("In the FPD file, for dynamic PCD %s in module %s, the max datum size is %d which "+\r
+                                                            "is different than <MaxDatumSize> %d defined in <DynamicPcdBuildDefinitions>!",\r
                                                             token.cName,\r
                                                             moduleName,\r
                                                             maxDatumSize,\r
@@ -411,8 +388,8 @@ public abstract class PlatformPcdPreprocessAction {
                     tokenSpaceStrRet = getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
 \r
                     if (tokenSpaceStrRet == null) {\r
-                        putError("Fail to get Token space guid for token" + token.cName +\r
-                                 " from all SPD files. You must have an <GuidDeclaration> for this token space Guid");\r
+                        putError("Failed to get the Token Space Guid for token" + token.cName +\r
+                                 " from any SPD file. You must have a <GuidDeclaration> for this Token Space Guid!");\r
                         //\r
                         // Do not break preprocess, continues to analysis.\r
                         // All errors will be summary to be shown.\r
@@ -461,8 +438,8 @@ public abstract class PlatformPcdPreprocessAction {
                                                   datum,\r
                                                   maxDatumSize);\r
                 if (!token.addUsageInstance(usageInstance)) {\r
-                    putError(String.format("PCD %s for module %s(%s) has already exist in database, Please check all PCD build entries "+\r
-                                           "in modules %s in <ModuleSA> to make sure no duplicated definitions in FPD file!",\r
+                    putError(String.format("PCD %s for module %s(%s) already exists in the database.\nPlease check all PCD build entries "+\r
+                                           "in the %s module's <ModuleSA> section to make sure there are no duplicated definitions in the FPD file!",\r
                                            token.cName,\r
                                            modules.get(index).usageId.moduleGuid,\r
                                            moduleName,\r
@@ -519,9 +496,9 @@ public abstract class PlatformPcdPreprocessAction {
 \r
         dynamicInfo = getDynamicInfoFromFpd(token, moduleName);\r
         if (dynamicInfo == null) {\r
-            exceptionString = String.format("In FPD file, for Dynamic PCD %s used by module %s, "+\r
-                                            "there is no dynamic information in <DynamicPcdBuildDefinitions> "+\r
-                                            "in FPD file, but it is required!",\r
+            exceptionString = String.format("In the FPD file, the Dynamic PCD %s is used by module %s.\n" +\r
+                                            "However, there is no dynamic information in the <DynamicPcdBuildDefinitions> " +\r
+                                            "section of the FPD file.  This section is required!",\r
                                             token.cName,\r
                                             moduleName);\r
             putError(exceptionString);\r
@@ -541,8 +518,8 @@ public abstract class PlatformPcdPreprocessAction {
 \r
         if ((maxDatumSize != 0) &&\r
             (maxDatumSize != token.datumSize)) {\r
-            exceptionString = String.format("In FPD file, for dynamic PCD %s, the datum size in module %s is %d, but "+\r
-                                            "the datum size in <DynamicPcdBuildDefinitions> is %d, they are not match!",\r
+            exceptionString = String.format("In the FPD file, for dynamic PCD %s, the datum size in module %s is %d, but "+\r
+                                            "the datum size in <DynamicPcdBuildDefinitions> is %d, they do not match!",\r
                                             token.cName,\r
                                             moduleName,\r
                                             maxDatumSize,\r
@@ -552,8 +529,8 @@ public abstract class PlatformPcdPreprocessAction {
         }\r
         tokenNumber = Long.decode(dynamicInfo.getToken().toString());\r
         if (tokenNumber != token.tokenNumber) {\r
-            exceptionString = String.format("In FPD file, for dynamic PCD %s, the token number in module %s is 0x%x, but"+\r
-                                            "in <DynamicPcdBuildDefinictions>, the token number is 0x%x, they are not match!",\r
+            exceptionString = String.format("In the FPD file, for dynamic PCD %s, the token number in module %s is 0x%x, but "+\r
+                                            "in the <DynamicPcdBuildDefinictions> section, the token number is 0x%x, they do not match!",\r
                                             token.cName,\r
                                             moduleName,\r
                                             token.tokenNumber,\r
@@ -595,20 +572,6 @@ public abstract class PlatformPcdPreprocessAction {
 \r
                 token.skuData.add(skuInstance);\r
 \r
-                //\r
-                // Judege wether is same of datum between module's information\r
-                // and dynamic information.\r
-                //\r
-                if (datum != null) {\r
-                    if ((skuInstance.id == 0)                                   &&\r
-                        !datum.toString().equalsIgnoreCase(skuInfoList.get(index).getValue().toString())) {\r
-                        exceptionString = "In FPD file, for dynamic PCD " + token.cName + ", the value in module " + moduleName + " is " + datum.toString() + " but the "+\r
-                                          "value of sku 0 data in <DynamicPcdBuildDefinition> is " + skuInstance.value.value + ". They are must be same!"+\r
-                                          " or you could not define value for a dynamic PCD in every <ModuleSA>!";\r
-                        putError(exceptionString);\r
-                        return null;\r
-                    }\r
-                }\r
                 continue;\r
             }\r
 \r
@@ -618,8 +581,8 @@ public abstract class PlatformPcdPreprocessAction {
             if (skuInfoList.get(index).getVariableName() != null) {\r
                 exceptionString = null;\r
                 if (skuInfoList.get(index).getVariableGuid() == null) {\r
-                    exceptionString = String.format("In FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
-                                                    "file, who use HII, but there is no <VariableGuid> defined for Sku %d data!",\r
+                    exceptionString = String.format("In the FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
+                                                    "file, use of HII was defined, but there is no <VariableGuid> defined for SKU %d data!",\r
                                                     token.cName,\r
                                                     index);\r
                     putError(exceptionString);\r
@@ -627,8 +590,8 @@ public abstract class PlatformPcdPreprocessAction {
                 }\r
 \r
                 if (skuInfoList.get(index).getVariableOffset() == null) {\r
-                    exceptionString = String.format("In FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
-                                                    "file, who use HII, but there is no <VariableOffset> defined for Sku %d data!",\r
+                    exceptionString = String.format("In the FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
+                                                    "file, use of HII was defined, but there is no <VariableOffset> defined for SKU %d data!",\r
                                                     token.cName,\r
                                                     index);\r
                     putError(exceptionString);\r
@@ -636,8 +599,8 @@ public abstract class PlatformPcdPreprocessAction {
                 }\r
 \r
                 if (skuInfoList.get(index).getHiiDefaultValue() == null) {\r
-                    exceptionString = String.format("In FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
-                                                    "file, who use HII, but there is no <HiiDefaultValue> defined for Sku %d data!",\r
+                    exceptionString = String.format("In the FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
+                                                    "file, use of HII was defined, but there is no <HiiDefaultValue> defined for SKU %d data!",\r
                                                     token.cName,\r
                                                     index);\r
                     putError(exceptionString);\r
@@ -660,8 +623,8 @@ public abstract class PlatformPcdPreprocessAction {
 \r
                 offset = Integer.decode(skuInfoList.get(index).getVariableOffset());\r
                 if (offset > 0xFFFF) {\r
-                    putError(String.format("In FPD file, for dynamic PCD %s ,  the variable offset defined in sku %d data "+\r
-                                           "exceed 64K, it is not allowed!",\r
+                    putError(String.format("In the FPD file, for dynamic PCD %s, the variable offset defined in SKU %d data "+\r
+                                           "exceeds 64K, which is not allowed!",\r
                                            token.cName,\r
                                            index));\r
                     return null;\r
@@ -672,7 +635,7 @@ public abstract class PlatformPcdPreprocessAction {
                 //\r
                 variableGuidString = getGuidInfoFromSpd(skuInfoList.get(index).getVariableGuid().toString());\r
                 if (variableGuidString == null) {\r
-                    putError(String.format("In FPD file, for dynamic PCD %s,  the variable guid %s can be found in all SPD file!",\r
+                    putError(String.format("In the FPD file, for dynamic PCD %s, the variable guid: %s cannot be found in any SPD file!",\r
                                            token.cName,\r
                                            skuInfoList.get(index).getVariableGuid().toString()));\r
                     return null;\r
@@ -700,16 +663,16 @@ public abstract class PlatformPcdPreprocessAction {
                 continue;\r
             }\r
 \r
-            exceptionString = String.format("In FPD file, for dynamic PCD %s, the dynamic info must "+\r
-                                            "be one of 'DefaultGroup', 'HIIGroup', 'VpdGroup'.",\r
+            exceptionString = String.format("In the FPD file, for dynamic PCD %s, the dynamic info must "+\r
+                                            "be one of: 'DefaultGroup', 'HIIGroup', 'VpdGroup'.",\r
                                             token.cName);\r
             putError(exceptionString);\r
             return null;\r
         }\r
 \r
         if (!hasSkuId0) {\r
-            exceptionString = String.format("In FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions>, there are "+\r
-                                            "no sku id = 0 data, which is required for every dynamic PCD",\r
+            exceptionString = String.format("In the FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions>, there is "+\r
+                                            "no SKU ID = 0 data, which is required for every dynamic PCD",\r
                                             token.cName);\r
             putError(exceptionString);\r
             return null;\r
@@ -751,7 +714,7 @@ public abstract class PlatformPcdPreprocessAction {
             tokenSpaceStrRet = getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
 \r
             if (tokenSpaceStrRet == null) {\r
-                putError("Fail to get Token space guid for token" + pcdBuildData.getCName());\r
+                putError("Failed to get the Token Space Guid for token" + pcdBuildData.getCName());\r
                 continue;\r
             }\r
 \r
@@ -764,7 +727,7 @@ public abstract class PlatformPcdPreprocessAction {
 \r
             pcdType = Token.getPcdTypeFromString(pcdBuildData.getItemType().toString());\r
             if (pcdType != Token.PCD_TYPE.DYNAMIC_EX) {\r
-                putError(String.format("In FPD file, it not allowed for DYNAMIC PCD %s who is no used by any module",\r
+                putError(String.format("In the FPD file, it not allowed to define DYNAMIC PCD %s that is not used by any module",\r
                                        pcdBuildData.getCName()));\r
                 continue;\r
             }\r
@@ -832,8 +795,8 @@ public abstract class PlatformPcdPreprocessAction {
                 if (skuInfoList.get(index).getVariableName() != null) {\r
                     exceptionString = null;\r
                     if (skuInfoList.get(index).getVariableGuid() == null) {\r
-                        exceptionString = String.format("In FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
-                                                        "file, who use HII, but there is no <VariableGuid> defined for Sku %d data!",\r
+                        exceptionString = String.format("In the FPD file, for dynamic PCD %s in the <DynamicPcdBuildDefinitions> section of the FPD "+\r
+                                                        "file, use of HII is defined, but there is no <VariableGuid> defined for SKU %d data!",\r
                                                         token.cName,\r
                                                         index);\r
                         putError(exceptionString);\r
@@ -841,8 +804,8 @@ public abstract class PlatformPcdPreprocessAction {
                     }\r
 \r
                     if (skuInfoList.get(index).getVariableOffset() == null) {\r
-                        exceptionString = String.format("In FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
-                                                        "file, who use HII, but there is no <VariableOffset> defined for Sku %d data!",\r
+                        exceptionString = String.format("In the FPD file, for dynamic PCD %s in the <DynamicPcdBuildDefinitions> section of the FPD "+\r
+                                                        "file, use of HII is defined, but there is no <VariableOffset> defined for SKU %d data!",\r
                                                         token.cName,\r
                                                         index);\r
                         putError(exceptionString);\r
@@ -850,8 +813,8 @@ public abstract class PlatformPcdPreprocessAction {
                     }\r
 \r
                     if (skuInfoList.get(index).getHiiDefaultValue() == null) {\r
-                        exceptionString = String.format("In FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
-                                                        "file, who use HII, but there is no <HiiDefaultValue> defined for Sku %d data!",\r
+                        exceptionString = String.format("In the FPD file, for dynamic PCD %s in the <DynamicPcdBuildDefinitions> section of the FPD "+\r
+                                                        "file, use of HII is defined, but there is no <HiiDefaultValue> defined for SKU %d data!",\r
                                                         token.cName,\r
                                                         index);\r
                         putError(exceptionString);\r
@@ -875,8 +838,8 @@ public abstract class PlatformPcdPreprocessAction {
 \r
                     offset = Integer.decode(skuInfoList.get(index).getVariableOffset());\r
                     if (offset > 0xFFFF) {\r
-                        exceptionString = String.format("In FPD file, for dynamic PCD %s ,  the variable offset defined in sku %d data "+\r
-                                          "exceed 64K, it is not allowed!",\r
+                        exceptionString = String.format("In the FPD file, for dynamic PCD %s, the variable offset defined in SKU %d data "+\r
+                                          "exceeds 64K, which is not allowed!",\r
                                           token.cName,\r
                                           index);\r
                         putError(exceptionString);\r
@@ -888,7 +851,7 @@ public abstract class PlatformPcdPreprocessAction {
                     //\r
                     variableGuidString = getGuidInfoFromSpd(skuInfoList.get(index).getVariableGuid().toString());\r
                     if (variableGuidString == null) {\r
-                        exceptionString = String.format("In FPD file, for dynamic PCD %s,  the variable guid %s can be found in all SPD file!",\r
+                        exceptionString = String.format("In the FPD file, for dynamic PCD %s, the variable guid %s cannot be found in any SPD file!",\r
                                                         token.cName,\r
                                                         skuInfoList.get(index).getVariableGuid().toString());\r
                         putError(exceptionString);\r
@@ -917,15 +880,15 @@ public abstract class PlatformPcdPreprocessAction {
                     continue;\r
                 }\r
 \r
-                exceptionString = String.format("In FPD file, for dynamic PCD %s, the dynamic info must "+\r
+                exceptionString = String.format("In the FPD file, for dynamic PCD %s, the dynamic info must "+\r
                                                 "be one of 'DefaultGroup', 'HIIGroup', 'VpdGroup'.",\r
                                                 token.cName);\r
                 putError(exceptionString);\r
             }\r
 \r
             if (!hasSkuId0) {\r
-                exceptionString = String.format("In FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions>, there are "+\r
-                                                "no sku id = 0 data, which is required for every dynamic PCD",\r
+                exceptionString = String.format("In the FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions>, there is "+\r
+                                                "no SKU ID = 0 data, which is required for every dynamic PCD",\r
                                                 token.cName);\r
                 putError(exceptionString);\r
                 continue;\r
@@ -984,7 +947,7 @@ public abstract class PlatformPcdPreprocessAction {
         if ((uuidString.charAt(0) == '0') && ((uuidString.charAt(1) == 'x') || (uuidString.charAt(1) == 'X'))) {\r
             splitStringArray = uuidString.split("," );\r
             if (splitStringArray.length != 11) {\r
-                throw new PlatformPcdPreprocessException ("Wrong format for UUID string: " + uuidString);\r
+                throw new PlatformPcdPreprocessException ("Wrong format for GUID string: " + uuidString);\r
             }\r
 \r
             //\r