///\r
private MemoryDatabaseManager pcdDbManager;\r
\r
+ ///\r
+ /// Errors string when perform preprocess \r
+ /// \r
+ private String errorString;\r
+\r
+ ///\r
+ /// the count of errors when perform preprocess\r
+ /// \r
+ private int errorCount;\r
+\r
+ /**\r
+ Default contructor function \r
+ **/\r
+ public PlatformPcdPreprocessAction() {\r
+ pcdDbManager = null;\r
+ errorString = null;\r
+ }\r
+\r
/**\r
Set parameter pcdDbManager\r
\r
\r
@param guidCName the CName of GUID\r
\r
- @return String[] Guid information from SPD file.\r
+ @return String Guid information from SPD file.\r
@throws PlatformPcdPreprocessException\r
Fail to get Guid information from SPD file.\r
**/\r
- public abstract String[] getGuidInfoFromSpd(String guidCName)\r
+ public abstract String getGuidInfoFromSpd(String guidCName)\r
throws PlatformPcdPreprocessException;\r
\r
/**\r
getAllDynamicPcdInfoFromFpd()\r
throws PlatformPcdPreprocessException;\r
\r
+ /**\r
+ Return the error string after preprocess \r
+\r
+ @return String error string\r
+ **/\r
+ public String getErrorString() {\r
+ return errorString;\r
+ }\r
+\r
+ public void putError(String error) {\r
+ if (errorString == null) {\r
+ errorString = "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n";\r
+ } else {\r
+ errorString += "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n";\r
+ }\r
+\r
+ errorCount++;\r
+ }\r
+\r
/**\r
Collect all PCD information from FPD file into PCD memory database.\r
\r
String moduleName = null;\r
String datum = null;\r
int maxDatumSize = 0;\r
- String[] tokenSpaceStrRet = null;\r
+ String tokenSpaceStrRet = null;\r
\r
//\r
// ----------------------------------------------\r
tokenSpaceStrRet = getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
\r
if (tokenSpaceStrRet == null) {\r
- throw new PlatformPcdPreprocessException(\r
- "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("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
+ //\r
+ // Do not break preprocess, continues to analysis.\r
+ // All errors will be summary to be shown.\r
+ // \r
+ continue;\r
}\r
\r
- primaryKey = Token.getPrimaryKeyString(pcdBuildData.getCName(), tokenSpaceStrRet[1]);\r
+ primaryKey = Token.getPrimaryKeyString(pcdBuildData.getCName(), tokenSpaceStrRet);\r
pcdType = Token.getPcdTypeFromString(pcdBuildData.getItemType().toString());\r
datumType = Token.getdatumTypeFromString(pcdBuildData.getDatumType().toString());\r
tokenNumber = Long.decode(pcdBuildData.getToken().toString());\r
"datum type of this PCD entry is not BOOLEAN!",\r
pcdBuildData.getCName(),\r
moduleName);\r
- throw new PlatformPcdPreprocessException(exceptionString);\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
exceptionString = String.format("In FPD file, there is no value for PCD entry %s in module %s!",\r
pcdBuildData.getCName(),\r
moduleName);\r
- throw new PlatformPcdPreprocessException(exceptionString);\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
datum,\r
datumType,\r
maxDatumSize)) != null) {\r
- throw new PlatformPcdPreprocessException(exceptionString);\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
pcdBuildData.getCName(),\r
pcdBuildData.getDatumType().toString(),\r
Token.getStringOfdatumType(token.datumType));\r
- throw new PlatformPcdPreprocessException(exceptionString);\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
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
pcdBuildData.getCName(),\r
moduleName);\r
- throw new PlatformPcdPreprocessException(exceptionString);\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
" is different with others module's",\r
token.cName,\r
moduleName);\r
- throw new PlatformPcdPreprocessException(exceptionString);\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
if (token.isDynamicPCD) {\r
"illega! You could no set <Value> in <ModuleSA> for a dynamic PCD!",\r
token.cName,\r
moduleName);\r
- throw new PlatformPcdPreprocessException(exceptionString);\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
moduleName,\r
maxDatumSize,\r
token.datumSize);\r
- throw new PlatformPcdPreprocessException(exceptionString);\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 the token is not in database, create a new token instance and add\r
// a usage instance into this token in database.\r
//\r
- tokenSpaceStrRet = this.getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
+ tokenSpaceStrRet = getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
\r
if (tokenSpaceStrRet == null) {\r
- throw new PlatformPcdPreprocessException(\r
- "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
-\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
+ //\r
+ // Do not break preprocess, continues to analysis.\r
+ // All errors will be summary to be shown.\r
+ // \r
+ continue;\r
}\r
\r
- token = new Token(pcdBuildData.getCName(), tokenSpaceStrRet[1]);\r
+ token = new Token(pcdBuildData.getCName(), tokenSpaceStrRet);\r
\r
token.datumType = datumType;\r
token.tokenNumber = tokenNumber;\r
// For Dynamic and Dynamic Ex type, need find the dynamic information\r
// in <DynamicPcdBuildDefinition> section in FPD file.\r
//\r
- updateDynamicInformation(moduleName,\r
- token,\r
- datum,\r
- maxDatumSize);\r
+ if (null == updateDynamicInformation(moduleName,\r
+ token,\r
+ datum,\r
+ maxDatumSize)) {\r
+ continue;\r
+ }\r
}\r
\r
pcdDbManager.addTokenToDatabase(primaryKey, token);\r
datum,\r
maxDatumSize);\r
if (!token.addUsageInstance(usageInstance)) {\r
- throw new PlatformPcdPreprocessException(\r
- String.format("PCD %s for module %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
- token.cName,\r
- moduleName,\r
- moduleName));\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
+ token.cName,\r
+ modules.get(index).usageId.moduleGuid,\r
+ moduleName,\r
+ moduleName));\r
+ continue;\r
}\r
}\r
}\r
boolean hasSkuId0 = false;\r
long tokenNumber = 0;\r
String hiiDefaultValue = null;\r
- String[] variableGuidString = null;\r
+ String variableGuidString = null;\r
\r
List<DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo> skuInfoList = null;\r
DynamicPcdBuildDefinitions.PcdBuildData dynamicInfo = null;\r
"in FPD file, but it is required!",\r
token.cName,\r
moduleName);\r
- throw new PlatformPcdPreprocessException(exceptionString);\r
+ putError(exceptionString);\r
+ return null;\r
}\r
\r
token.datumSize = dynamicInfo.getMaxDatumSize();\r
moduleName,\r
maxDatumSize,\r
dynamicInfo.getMaxDatumSize());\r
- throw new PlatformPcdPreprocessException(exceptionString);\r
+ putError(exceptionString);\r
+ return null;\r
}\r
tokenNumber = Long.decode(dynamicInfo.getToken().toString());\r
if (tokenNumber != token.tokenNumber) {\r
moduleName,\r
token.tokenNumber,\r
tokenNumber);\r
- throw new PlatformPcdPreprocessException(exceptionString);\r
+ putError(exceptionString);\r
+ return null;\r
}\r
\r
token.dynamicExTokenNumber = tokenNumber;\r
skuInfoList.get(index).getValue().toString(),\r
token.datumType,\r
token.datumSize)) != null) {\r
- throw new PlatformPcdPreprocessException(exceptionString);\r
+ putError(exceptionString);\r
+ return null;\r
}\r
\r
token.skuData.add(skuInstance);\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
- throw new PlatformPcdPreprocessException(exceptionString);\r
+ putError(exceptionString);\r
+ return null;\r
}\r
}\r
continue;\r
"file, who use HII, but there is no <VariableGuid> defined for Sku %d data!",\r
token.cName,\r
index);\r
- if (exceptionString != null) {\r
- throw new PlatformPcdPreprocessException(exceptionString);\r
- }\r
+ putError(exceptionString);\r
+ return null;\r
}\r
\r
if (skuInfoList.get(index).getVariableOffset() == null) {\r
"file, who use HII, but there is no <VariableOffset> defined for Sku %d data!",\r
token.cName,\r
index);\r
- if (exceptionString != null) {\r
- throw new PlatformPcdPreprocessException(exceptionString);\r
- }\r
+ putError(exceptionString);\r
+ return null;\r
}\r
\r
if (skuInfoList.get(index).getHiiDefaultValue() == null) {\r
"file, who use HII, but there is no <HiiDefaultValue> defined for Sku %d data!",\r
token.cName,\r
index);\r
- if (exceptionString != null) {\r
- throw new PlatformPcdPreprocessException(exceptionString);\r
- }\r
+ putError(exceptionString);\r
+ return null;\r
}\r
\r
if (skuInfoList.get(index).getHiiDefaultValue() != null) {\r
\r
offset = Integer.decode(skuInfoList.get(index).getVariableOffset());\r
if (offset > 0xFFFF) {\r
- throw new PlatformPcdPreprocessException(\r
- 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
- token.cName,\r
- index));\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
+ token.cName,\r
+ index));\r
+ return null;\r
}\r
\r
//\r
//\r
variableGuidString = getGuidInfoFromSpd(skuInfoList.get(index).getVariableGuid().toString());\r
if (variableGuidString == null) {\r
- throw new PlatformPcdPreprocessException(\r
- String.format("In FPD file, for dynamic PCD %s, the variable guid %s can be found in all SPD file!",\r
- token.cName,\r
- skuInfoList.get(index).getVariableGuid().toString()));\r
+ putError(String.format("In FPD file, for dynamic PCD %s, the variable guid %s can be found in all SPD file!",\r
+ token.cName,\r
+ skuInfoList.get(index).getVariableGuid().toString()));\r
+ return null;\r
}\r
String variableStr = skuInfoList.get(index).getVariableName();\r
Pattern pattern = Pattern.compile("0x([a-fA-F0-9]){4}");\r
}\r
\r
skuInstance.value.setHiiData(varNameList,\r
- translateSchemaStringToUUID(variableGuidString[1]),\r
+ translateSchemaStringToUUID(variableGuidString),\r
skuInfoList.get(index).getVariableOffset(),\r
skuInfoList.get(index).getHiiDefaultValue().toString());\r
token.skuData.add(skuInstance);\r
exceptionString = String.format("In FPD file, for dynamic PCD %s, the dynamic info must "+\r
"be one of 'DefaultGroup', 'HIIGroup', 'VpdGroup'.",\r
token.cName);\r
- throw new PlatformPcdPreprocessException(exceptionString);\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
token.cName);\r
- throw new PlatformPcdPreprocessException(exceptionString);\r
+ putError(exceptionString);\r
+ return null;\r
}\r
\r
return token;\r
String temp;\r
String exceptionString;\r
String hiiDefaultValue;\r
- String tokenSpaceStrRet[];\r
- String variableGuidString[];\r
+ String tokenSpaceStrRet;\r
+ String variableGuidString;\r
\r
dynamicPcdBuildDataArray = getAllDynamicPcdInfoFromFpd();\r
if (dynamicPcdBuildDataArray == null) {\r
\r
for (index2 = 0; index2 < dynamicPcdBuildDataArray.size(); index2++) {\r
pcdBuildData = dynamicPcdBuildDataArray.get(index2);\r
- tokenSpaceStrRet = this.getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
+ tokenSpaceStrRet = getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
\r
if (tokenSpaceStrRet == null) {\r
- throw new PlatformPcdPreprocessException("Fail to get Token space guid for token" + pcdBuildData.getCName());\r
+ putError("Fail to get Token space guid for token" + pcdBuildData.getCName());\r
+ continue;\r
}\r
\r
primaryKey = Token.getPrimaryKeyString(pcdBuildData.getCName(),\r
- tokenSpaceStrRet[1]);\r
+ tokenSpaceStrRet);\r
\r
if (pcdDbManager.isTokenInDatabase(primaryKey)) {\r
continue;\r
\r
pcdType = Token.getPcdTypeFromString(pcdBuildData.getItemType().toString());\r
if (pcdType != Token.PCD_TYPE.DYNAMIC_EX) {\r
- throw new PlatformPcdPreprocessException(\r
- String.format("In FPD file, it not allowed for DYNAMIC PCD %s who is no used by any module",\r
- pcdBuildData.getCName()));\r
+ putError(String.format("In FPD file, it not allowed for DYNAMIC PCD %s who is no used by any module",\r
+ pcdBuildData.getCName()));\r
+ continue;\r
}\r
\r
//\r
// Create new token for unreference dynamic PCD token\r
//\r
- token = new Token(pcdBuildData.getCName(), tokenSpaceStrRet[1]);\r
+ token = new Token(pcdBuildData.getCName(), tokenSpaceStrRet);\r
token.datumSize = pcdBuildData.getMaxDatumSize();\r
\r
\r
token.datumType,\r
token.datumSize);\r
if (exceptionString != null) {\r
- throw new PlatformPcdPreprocessException(exceptionString);\r
+ putError(exceptionString);\r
+ continue;\r
}\r
\r
skuInfoList = pcdBuildData.getSkuInfoList();\r
skuInfoList.get(index).getValue().toString(),\r
token.datumType,\r
token.datumSize)) != null) {\r
- throw new PlatformPcdPreprocessException(exceptionString);\r
+ putError(exceptionString);\r
+ continue;\r
}\r
\r
token.skuData.add(skuInstance);\r
"file, who use HII, but there is no <VariableGuid> defined for Sku %d data!",\r
token.cName,\r
index);\r
- if (exceptionString != null) {\r
- throw new PlatformPcdPreprocessException(exceptionString);\r
- }\r
+ putError(exceptionString);\r
+ continue;\r
}\r
\r
if (skuInfoList.get(index).getVariableOffset() == null) {\r
"file, who use HII, but there is no <VariableOffset> defined for Sku %d data!",\r
token.cName,\r
index);\r
- if (exceptionString != null) {\r
- throw new PlatformPcdPreprocessException(exceptionString);\r
- }\r
+ putError(exceptionString);\r
+ continue;\r
}\r
\r
if (skuInfoList.get(index).getHiiDefaultValue() == null) {\r
"file, who use HII, but there is no <HiiDefaultValue> defined for Sku %d data!",\r
token.cName,\r
index);\r
- if (exceptionString != null) {\r
- throw new PlatformPcdPreprocessException(exceptionString);\r
- }\r
+ putError(exceptionString);\r
+ continue;\r
}\r
\r
if (skuInfoList.get(index).getHiiDefaultValue() != null) {\r
hiiDefaultValue,\r
token.datumType,\r
token.datumSize)) != null) {\r
- throw new PlatformPcdPreprocessException(exceptionString);\r
+ putError(exceptionString);\r
+ continue;\r
}\r
\r
offset = Integer.decode(skuInfoList.get(index).getVariableOffset());\r
if (offset > 0xFFFF) {\r
- throw new PlatformPcdPreprocessException(\r
- String.format("In FPD file, for dynamic PCD %s , the variable offset defined in sku %d data "+\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
token.cName,\r
- index));\r
+ index);\r
+ putError(exceptionString);\r
+ continue;\r
}\r
\r
//\r
// Get variable guid string according to the name of guid which will be mapped into a GUID in SPD file.\r
//\r
- variableGuidString = this.getGuidInfoFromSpd(skuInfoList.get(index).getVariableGuid().toString());\r
+ variableGuidString = getGuidInfoFromSpd(skuInfoList.get(index).getVariableGuid().toString());\r
if (variableGuidString == null) {\r
- throw new PlatformPcdPreprocessException(\r
- String.format("In FPD file, for dynamic PCD %s, the variable guid %s can be found in all SPD file!",\r
- token.cName,\r
- skuInfoList.get(index).getVariableGuid().toString()));\r
+ exceptionString = String.format("In FPD file, for dynamic PCD %s, the variable guid %s can be found in all SPD file!",\r
+ token.cName,\r
+ skuInfoList.get(index).getVariableGuid().toString());\r
+ putError(exceptionString);\r
+ continue;\r
}\r
String variableStr = skuInfoList.get(index).getVariableName();\r
Pattern pattern = Pattern.compile("0x([a-fA-F0-9]){4}");\r
}\r
\r
skuInstance.value.setHiiData(varNameList,\r
- translateSchemaStringToUUID(variableGuidString[1]),\r
+ translateSchemaStringToUUID(variableGuidString),\r
skuInfoList.get(index).getVariableOffset(),\r
skuInfoList.get(index).getHiiDefaultValue().toString());\r
token.skuData.add(skuInstance);\r
exceptionString = String.format("In FPD file, for dynamic PCD %s, the dynamic info must "+\r
"be one of 'DefaultGroup', 'HIIGroup', 'VpdGroup'.",\r
token.cName);\r
- throw new PlatformPcdPreprocessException(exceptionString);\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
token.cName);\r
- throw new PlatformPcdPreprocessException(exceptionString);\r
+ putError(exceptionString);\r
+ continue;\r
}\r
\r
tokenArray.add(token);\r