\r
import java.io.File;\r
import java.io.IOException;\r
-import java.math.BigInteger;\r
import java.util.ArrayList;\r
import java.util.Iterator;\r
import java.util.List;\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
**/\r
public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreprocessAction {\r
///\r
- /// FPD file is the root file.\r
+ /// FPD file path.\r
///\r
private String fpdFilePath;\r
\r
/**\r
Common function interface for outer.\r
\r
- @param fpdFilePath The fpd file path of current build or analysis.\r
+ @param fpdFilePath The fpd file path of current build or processing.\r
@param messageLevel The message level for this Action.\r
\r
@throws PlatformPreprocessBuildException \r
**/\r
public void perform(String fpdFilePath, int messageLevel) \r
throws PlatformPcdPreprocessBuildException {\r
- setFPDFilePath(fpdFilePath);\r
+ this.fpdFilePath = fpdFilePath;\r
setActionMessageLevel(messageLevel);\r
checkParameter();\r
execute();\r
\r
**/\r
public void execute() throws PlatformPcdPreprocessBuildException {\r
- String errorMessageHeader = "Fail to initialize Pcd memory database for building. Because:";\r
+ String errorMessageHeader = "Failed to initialize the Pcd memory database because: ";\r
String errorsForPreprocess = null;\r
\r
//\r
try {\r
genPcdDatabaseSourceCode ();\r
} catch (EntityException exp) {\r
- throw new PlatformPcdPreprocessBuildException(errorMessageHeader + exp.getMessage());\r
+ throw new PlatformPcdPreprocessBuildException(errorMessageHeader + "\r\n" + exp.getMessage());\r
}\r
}\r
\r
try {\r
tokenSpaceStrRet = GlobalData.getGuidInfoFromCname(guidCName);\r
} catch ( Exception e ) {\r
- throw new PlatformPcdPreprocessException ("Failed get Guid CName " + guidCName + "from SPD file!");\r
+ throw new PlatformPcdPreprocessException ("Failed to get Guid CName " + guidCName + " from the SPD file!");\r
}\r
return tokenSpaceStrRet;\r
}\r
\r
dynamicPcdBuildDefinitions = fpdDocInstance.getPlatformSurfaceArea().getDynamicPcdBuildDefinitions();\r
if (dynamicPcdBuildDefinitions == null) {\r
- exceptionString = String.format("[FPD file error] There are no <PcdDynamicBuildDescriptions> in FPD file but contains Dynamic type "+\r
- "PCD entry %s in module %s!",\r
+ exceptionString = String.format("[FPD file error] There are no <PcdDynamicBuildDescriptions> elements in FPD file but there are Dynamic type "+\r
+ "PCD entries %s in module %s!",\r
token.cName,\r
moduleName);\r
putError(exceptionString);\r
\r
dynamicPrimaryKey = Token.getPrimaryKeyString(dynamicPcdBuildDataArray.get(index).getCName(),\r
tokenSpaceStrRet);\r
- if (dynamicPrimaryKey.equalsIgnoreCase(token.getPrimaryKeyString())) {\r
+ if (dynamicPrimaryKey.equals(token.getPrimaryKeyString())) {\r
return dynamicPcdBuildDataArray.get(index);\r
}\r
}\r
File file = null;\r
\r
if (fpdFilePath == null) {\r
- throw new PlatformPcdPreprocessBuildException("WorkspacePath and FPDFileName should be blank for CollectPCDAtion!");\r
+ throw new PlatformPcdPreprocessBuildException("FPDFileName should be empty for CollectPCDAtion!");\r
}\r
\r
if (fpdFilePath.length() == 0) {\r
- throw new PlatformPcdPreprocessBuildException("WorkspacePath and FPDFileName should be blank for CollectPCDAtion!");\r
+ throw new PlatformPcdPreprocessBuildException("FPDFileName should be empty for CollectPCDAtion!");\r
}\r
\r
file = new File(fpdFilePath);\r
throw new PlatformPcdPreprocessBuildException("FPD File " + fpdFilePath + " does not exist!");\r
}\r
}\r
-\r
- /**\r
- Test case function\r
-\r
- @param argv parameter from command line\r
- **/\r
- public static void main(String argv[]) throws PlatformPcdPreprocessBuildException {\r
- PlatformPcdPreprocessActionForBuilding ca = new PlatformPcdPreprocessActionForBuilding();\r
- String projectDir = "x:/edk2";\r
- ca.setFPDFilePath(projectDir + "/EdkNt32Pkg/Nt32.fpd");\r
- ca.setActionMessageLevel(ActionMessage.MAX_MESSAGE_LEVEL);\r
- GlobalData.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db",\r
- projectDir,\r
- "tools_def.txt");\r
- System.out.println("After initInfo!");\r
- FpdParserTask fpt = new FpdParserTask();\r
- fpt.parseFpdFile(new File(projectDir + "/EdkNt32Pkg/Nt32.fpd"));\r
- ca.execute();\r
- }\r
}\r