\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
import org.tianocore.pcd.action.PlatformPcdPreprocessAction;\r
import org.tianocore.pcd.entity.MemoryDatabaseManager;\r
import org.tianocore.pcd.entity.ModulePcdInfoFromFpd;\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
private PlatformSurfaceAreaDocument fpdDocInstance;\r
\r
- /**\r
- Set action message level for CollectPcdAction tool.\r
-\r
- The message should be restored when this action exit.\r
-\r
- @param actionMessageLevel parameter for this action\r
- **/\r
- public void setActionMessageLevel(int actionMessageLevel) {\r
- originalMessageLevel = ActionMessage.messageLevel;\r
- ActionMessage.messageLevel = actionMessageLevel;\r
- }\r
-\r
/**\r
Set FPDFileName parameter for this action class.\r
\r
/**\r
Common function interface for outer.\r
\r
- @param fpdFilePath The fpd file path of current build or analysis.\r
- @param messageLevel The message level for this Action.\r
+ @param fpdFilePath The fpd file path of current build or processing.\r
\r
@throws PlatformPreprocessBuildException \r
The exception of this function. Because it can *not* be predict\r
where the action class will be used. So only Exception can be throw.\r
\r
**/\r
- public void perform(String fpdFilePath, int messageLevel) \r
+ public void perform(String fpdFilePath) \r
throws PlatformPcdPreprocessBuildException {\r
- setFPDFilePath(fpdFilePath);\r
- setActionMessageLevel(messageLevel);\r
+ this.fpdFilePath = fpdFilePath;\r
checkParameter();\r
execute();\r
- ActionMessage.messageLevel = originalMessageLevel;\r
}\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
\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 empty 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 empty 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