CreateMtFileTask is used to call CreateMtFile.exe to create MT file.\r
**/\r
public class CreateMtFileTask extends Task implements EfiDefine {\r
- ///\r
- /// Tool name\r
- ///\r
- private String toolName="CreateMtFile";\r
- ///\r
- /// file size\r
- ///\r
- private String fileSize = "";\r
-\r
- ///\r
- /// output file\r
- ///\r
- private String outputFile = "";\r
-\r
- ///\r
- /// output directory, this variable is added by jave wrap\r
- ///\r
- private String outputDir = "";\r
+ //\r
+ // Tool name\r
+ //\r
+ private String toolName = "CreateMtFile";\r
+ //\r
+ // file size\r
+ //\r
+ private ToolArg fileSize = new ToolArg();\r
+\r
+ //\r
+ // output file\r
+ //\r
+ private FileArg outputFile = new FileArg();\r
+\r
+ //\r
+ // output directory, this variable is added by jave wrap\r
+ //\r
+ private String outputDir = ".";\r
\r
/**\r
- * execute\r
- *\r
- * StripTask execute function is to assemble tool command line & execute\r
- * tool command line\r
- *\r
- * @throws BuidException\r
- */\r
+ execute\r
+ \r
+ StripTask execute function is to assemble tool command line & execute\r
+ tool command line\r
+ \r
+ @throws BuidException\r
+ **/\r
public void execute() throws BuildException {\r
\r
Project project = this.getOwningTarget().getProject();\r
if (path == null) {\r
command = toolName;\r
} else {\r
- command = path + File.separatorChar + toolName;\r
+ command = path + File.separator + toolName;\r
}\r
//\r
// argument of tools\r
//\r
- File file = new File(outputFile);\r
- if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
- argument = outputDir + File.separatorChar + outputFile + " " + this.fileSize;\r
-\r
- } else {\r
- argument = outputFile + " " + this.fileSize;\r
- }\r
+ argument = "" + outputFile + fileSize;\r
//\r
// return value of fwimage execution\r
//\r
\r
runner.setAntRun(project);\r
runner.setCommandline(cmdline.getCommandline());\r
+ runner.setWorkingDirectory(new File(outputDir));\r
+\r
//\r
// Set debug log information.\r
//\r
EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
- EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.outputFile)).getName());\r
- revl = runner.execute();\r
+ EdkLog.log(this, EdkLog.EDK_INFO, this.outputFile.toFileList());\r
\r
+ revl = runner.execute();\r
if (EFI_SUCCESS == revl) {\r
//\r
// command execution success\r
//\r
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "CreateMtFile succeeded!");\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
} else {\r
//\r
// command execution fail\r
//\r
EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));\r
- throw new BuildException("CreateMtFile failed!");\r
+ throw new BuildException(toolName + " failed!");\r
}\r
} catch (Exception e) {\r
throw new BuildException(e.getMessage());\r
}\r
\r
/**\r
- * getFileSize\r
- *\r
- * This function is to get class member "fileSize".\r
- *\r
- * @return fileSize string of file size.\r
- */\r
+ getFileSize\r
+ \r
+ This function is to get class member "fileSize".\r
+ \r
+ @return fileSize string of file size.\r
+ **/\r
public String getFileSize() {\r
- return this.fileSize;\r
+ return this.fileSize.getValue();\r
}\r
\r
/**\r
- * setFileSize\r
- *\r
- * This function is to set class member "fileSize".\r
- *\r
- * @param fileSize\r
- * string of file size value.\r
- */\r
+ setFileSize\r
+ \r
+ This function is to set class member "fileSize".\r
+ \r
+ @param fileSize\r
+ string of file size value.\r
+ **/\r
public void setFileSize(String fileSize) {\r
- this.fileSize = fileSize;\r
+ this.fileSize.setArg(" ", fileSize);\r
}\r
\r
/**\r
- * getOutputFile\r
- *\r
- * This function is to get class member "outputFile"\r
- *\r
- * @return outputFile string of output file name.\r
- */\r
+ getOutputFile\r
+ \r
+ This function is to get class member "outputFile"\r
+ \r
+ @return outputFile string of output file name.\r
+ **/\r
public String getOutputFile() {\r
- return outputFile;\r
+ return outputFile.getValue();\r
}\r
\r
/**\r
- * setOutputFile\r
- *\r
- * This function is to set class member "outputFile"\r
- *\r
- * @param outputFile\r
- * string of output file name.\r
- */\r
+ setOutputFile\r
+ \r
+ This function is to set class member "outputFile"\r
+ \r
+ @param outputFile\r
+ string of output file name.\r
+ **/\r
public void setOutputFile(String outputFile) {\r
- this.outputFile = outputFile;\r
+ this.outputFile.setArg(" ", outputFile);\r
}\r
\r
/**\r
- * getOutputDir\r
- *\r
- * This function is to get class member "outputDir"\r
- *\r
- * @return outputDir string of output directory.\r
- */\r
+ getOutputDir\r
+ \r
+ This function is to get class member "outputDir"\r
+ \r
+ @return outputDir string of output directory.\r
+ **/\r
public String getOutputDir() {\r
return outputDir;\r
}\r
\r
/**\r
- * setOutputDir\r
- *\r
- * This function is to set class member "outputDir"\r
- *\r
- * @param outputDir\r
- * string of output directory.\r
- */\r
+ setOutputDir\r
+ \r
+ This function is to set class member "outputDir"\r
+ \r
+ @param outputDir\r
+ string of output directory.\r
+ **/\r
public void setOutputDir(String outputDir) {\r
this.outputDir = outputDir;\r
}\r
EfiCompressTask is used to call EfiCompress.exe to strip input file.\r
**/\r
public class EfiCompressTask extends Task implements EfiDefine {\r
- // /\r
- // / input file\r
- // /\r
- private String inputFile = "";\r
-\r
- // /\r
- // / output file\r
- // /\r
- private String outputFile = "";\r
-\r
- // /\r
- // / output directory, this variable is added by jave wrap\r
- // /\r
- private String outputDir = "";\r
+ //\r
+ // \r
+ // \r
+ private final static String toolName = "EfiCompress";\r
+ //\r
+ // input file\r
+ //\r
+ private FileArg inputFile = new FileArg();\r
+\r
+ //\r
+ // output file\r
+ //\r
+ private FileArg outputFile = new FileArg();\r
+\r
+ //\r
+ // output directory, this variable is added by jave wrap\r
+ //\r
+ private String outputDir = ".";\r
\r
/**\r
- * execute\r
- *\r
- * EfiCompressTask execute function is to assemble tool command line & execute\r
- * tool command line\r
- *\r
- * @throws BuidException\r
- */\r
+ execute\r
+ \r
+ EfiCompressTask execute function is to assemble tool command line & execute\r
+ tool command line\r
+ \r
+ @throws BuidException\r
+ **/\r
public void execute() throws BuildException {\r
\r
Project project = this.getOwningTarget().getProject();\r
String command;\r
String argument;\r
if (path == null) {\r
- command = "EfiCompress";\r
+ command = toolName;\r
} else {\r
- command = path + File.separatorChar + "EfiCompress";\r
+ command = path + File.separator + toolName;\r
}\r
//\r
// argument of tools\r
//\r
- File file = new File(outputFile);\r
- if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
- argument = inputFile + " " + outputDir + File.separatorChar\r
- + outputFile;\r
- } else {\r
- argument = inputFile + " " + outputFile;\r
- }\r
+ argument = "" + inputFile + outputFile;\r
//\r
// return value of fwimage execution\r
//\r
\r
runner.setAntRun(project);\r
runner.setCommandline(cmdline.getCommandline());\r
+ runner.setWorkingDirectory(new File(outputDir));\r
+\r
//\r
// Set debug log information.\r
//\r
EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
- EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.inputFile)).getName());\r
+ EdkLog.log(this, EdkLog.EDK_INFO, this.inputFile.toFileList() + " => "\r
+ + this.outputFile.toFileList());\r
\r
revl = runner.execute();\r
-\r
if (EFI_SUCCESS == revl) {\r
//\r
// command execution success\r
//\r
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "EfiCompress succeeded!");\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
} else {\r
//\r
// command execution fail\r
//\r
EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));\r
- throw new BuildException("EfiCompress failed!");\r
+ throw new BuildException(toolName + " failed!");\r
\r
}\r
} catch (Exception e) {\r
}\r
\r
/**\r
- * getInputFile\r
- *\r
- * This function is to get class member "inputFile".\r
- *\r
- * @return string of input file name.\r
- */\r
+ getInputFile\r
+ \r
+ This function is to get class member "inputFile".\r
+ \r
+ @return string of input file name.\r
+ **/\r
public String getInputFile() {\r
- return inputFile;\r
+ return inputFile.getValue();\r
}\r
\r
/**\r
- * setComponentType\r
- *\r
- * This function is to set class member "inputFile".\r
- *\r
- * @param inputFile\r
- * string of input file name.\r
- */\r
+ setComponentType\r
+ \r
+ This function is to set class member "inputFile".\r
+ \r
+ @param inputFile\r
+ string of input file name.\r
+ **/\r
public void setInputFile(String inputFile) {\r
- this.inputFile = inputFile;\r
+ this.inputFile.setArg(" ", inputFile);\r
}\r
\r
/**\r
- * getOutputFile\r
- *\r
- * This function is to get class member "outputFile"\r
- *\r
- * @return outputFile string of output file name.\r
- */\r
+ getOutputFile\r
+ \r
+ This function is to get class member "outputFile"\r
+ \r
+ @return outputFile string of output file name.\r
+ **/\r
public String getOutputFile() {\r
- return outputFile;\r
+ return outputFile.getValue();\r
}\r
\r
/**\r
- * setOutputFile\r
- *\r
- * This function is to set class member "outputFile"\r
- *\r
- * @param outputFile\r
- * string of output file name.\r
- */\r
+ setOutputFile\r
+ \r
+ This function is to set class member "outputFile"\r
+ \r
+ @param outputFile\r
+ string of output file name.\r
+ **/\r
public void setOutputFile(String outputFile) {\r
- this.outputFile = outputFile;\r
+ this.outputFile.setArg(" ", outputFile);\r
}\r
\r
/**\r
- * getOutputDir\r
- *\r
- * This function is to get class member "outputDir"\r
- *\r
- * @return outputDir string of output directory.\r
- */\r
+ getOutputDir\r
+ \r
+ This function is to get class member "outputDir"\r
+ \r
+ @return outputDir string of output directory.\r
+ **/\r
public String getOutputDir() {\r
return outputDir;\r
}\r
\r
/**\r
- * setOutputDir\r
- *\r
- * This function is to set class member "outputDir"\r
- *\r
- * @param outputDir\r
- * string of output directory.\r
- */\r
+ setOutputDir\r
+ \r
+ This function is to set class member "outputDir"\r
+ \r
+ @param outputDir\r
+ string of output directory.\r
+ **/\r
public void setOutputDir(String outputDir) {\r
this.outputDir = outputDir;\r
}\r
import java.util.LinkedList;\r
import java.util.List;\r
\r
-import org.apache.tools.ant.Task;\r
-import org.apache.tools.ant.Project;\r
import org.apache.tools.ant.BuildException;\r
-\r
+import org.apache.tools.ant.Project;\r
+import org.apache.tools.ant.Task;\r
import org.tianocore.common.logger.EdkLog;\r
+import org.apache.tools.ant.taskdefs.Execute;\r
+import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
+import org.apache.tools.ant.types.Commandline;\r
+\r
+import com.sun.org.apache.bcel.internal.generic.NEW;\r
\r
/**\r
- * SecFixupTask class.\r
- *\r
- * SecFixupTask is used to call SecFixup.exe to fix up sec image.\r
- */\r
+ SecFixupTask class.\r
+ \r
+ SecFixupTask is used to call SecFixup.exe to fix up sec image.\r
+ **/\r
public class EfiRomTask extends Task implements EfiDefine {\r
- ///\r
- /// tool name\r
- ///\r
- private final String toolName = "EfiRom";\r
-\r
- ///\r
- /// Flash default file\r
- ///\r
- private String verbose = "";\r
-\r
- ///\r
- /// Flash device\r
- ///\r
- private String venderId = "";\r
-\r
- ///\r
- /// Flash device Image\r
- ///\r
- private String deviceId = "";\r
-\r
- ///\r
- /// MCI file\r
- ///\r
- private String outputFile = "";\r
-\r
- ///\r
- /// MCO file\r
- ///\r
- private List<Input> binaryFileList = new ArrayList<Input>();\r
-\r
- ///\r
- /// Efi PE32 image file\r
- ///\r
- private List<Input> pe32FileList = new ArrayList<Input>();\r
-\r
- ///\r
- /// Compress efi PE32 image file\r
- ///\r
- private List<Input> pe32ComprFileList = new ArrayList<Input>();\r
-\r
- ///\r
- /// Hex class code in the PCI data strutor header\r
- ///\r
- private String classCode = "";\r
-\r
- ///\r
- /// Hex revision in the PCI data header.\r
- ///\r
- private String revision = "";\r
-\r
- ///\r
- /// Dump the headers of an existing option rom image.\r
- ///\r
- private String dump = "";\r
-\r
-\r
- ///\r
- /// output directory\r
- ///\r
+ //\r
+ // tool name\r
+ //\r
+ private final static String toolName = "EfiRom";\r
+\r
+ //\r
+ // Flash default file\r
+ //\r
+ private ToolArg verbose = new ToolArg();\r
+\r
+ //\r
+ // Flash device\r
+ //\r
+ private ToolArg venderId = new ToolArg();\r
+\r
+ //\r
+ // Flash device Image\r
+ //\r
+ private ToolArg deviceId = new ToolArg();\r
+\r
+ //\r
+ // output file\r
+ //\r
+ private FileArg outputFile = new FileArg();\r
+\r
+ //\r
+ // binary file\r
+ //\r
+ private Input binaryFileList = new Input();\r
+\r
+ //\r
+ // Efi PE32 image file\r
+ //\r
+ private Input pe32FileList = new Input();\r
+\r
+ //\r
+ // Compress efi PE32 image file\r
+ //\r
+ private Input pe32ComprFileList = new Input();\r
+\r
+ //\r
+ // Hex class code in the PCI data strutor header\r
+ //\r
+ private ToolArg classCode = new ToolArg();\r
+\r
+ //\r
+ // Hex revision in the PCI data header.\r
+ //\r
+ private ToolArg revision = new ToolArg();\r
+\r
+ //\r
+ // Dump the headers of an existing option rom image.\r
+ //\r
+ private ToolArg dump = new ToolArg();\r
+\r
+ //\r
+ // output directory\r
+ //\r
private String outputDir = ".";\r
\r
-\r
- ///\r
- /// command and argument list\r
- ///\r
+ //\r
+ // command and argument list\r
+ //\r
LinkedList<String> argList = new LinkedList<String>();\r
+\r
/**\r
- * execute\r
- *\r
- * EfiRomTask execute function is to assemble tool command line & execute\r
- * tool command line\r
- *\r
- * @throws BuidException\r
- */\r
+ execute\r
+ \r
+ EfiRomTask execute function is to assemble tool command line & execute\r
+ tool command line\r
+ \r
+ @throws BuidException\r
+ **/\r
public void execute() throws BuildException {\r
\r
Project project = this.getOwningTarget().getProject();\r
if (path == null) {\r
command = toolName;\r
} else {\r
- command = path + File.separatorChar + toolName;\r
+ command = path + File.separator + toolName;\r
}\r
- argList.addFirst(command);\r
\r
- //\r
- // add microcode binary files\r
- //\r
- if (this.binaryFileList.size() > 0){\r
- argList.add("-b");\r
- Iterator binList = this.binaryFileList.iterator();\r
- while (binList.hasNext()){\r
- argList.addAll(((Input)binList.next()).getNameList());\r
- }\r
- }\r
+ String argument = "" + verbose + venderId + deviceId + dump + revision + classCode \r
+ + binaryFileList.toStringWithSinglepPrefix(" -b ")\r
+ + pe32FileList.toStringWithSinglepPrefix(" -e ")\r
+ + pe32ComprFileList.toStringWithSinglepPrefix(" -ec ")\r
+ + outputFile;\r
\r
- //\r
- // add pe32 file\r
- //\r
- if (this.pe32FileList.size() > 0){\r
- argList.add("-e");\r
- Iterator pe32List = this.pe32FileList.iterator();\r
- while (pe32List.hasNext()){\r
- argList.addAll(((Input)pe32List.next()).getNameList());\r
- }\r
- }\r
+ try {\r
+ Commandline cmdline = new Commandline();\r
+ cmdline.setExecutable(command);\r
+ cmdline.createArgument().setLine(argument);\r
\r
- //\r
- // add compressed pe32 file\r
- //\r
- if (this.pe32ComprFileList.size() > 0){\r
- argList.add("-ec");\r
- Iterator pe32ComprList = this.pe32ComprFileList.iterator();\r
- while (pe32ComprList.hasNext()){\r
- argList.addAll(((Input)pe32ComprList.next()).getNameList());\r
- }\r
- }\r
+ LogStreamHandler streamHandler = new LogStreamHandler(this,\r
+ Project.MSG_INFO, Project.MSG_WARN);\r
+ Execute runner = new Execute(streamHandler, null);\r
\r
- EdkLog.log(this, EdkLog.EDK_VERBOSE, argList.toString().replaceAll(",",""));\r
- EdkLog.log(this, EdkLog.EDK_INFO, " ");\r
+ runner.setAntRun(project);\r
+ runner.setCommandline(cmdline.getCommandline());\r
+ runner.setWorkingDirectory(new File(outputDir));\r
\r
- //\r
- // lauch the program\r
- //\r
- ProcessBuilder pb = new ProcessBuilder(argList);\r
- pb.directory(new File(outputDir));\r
- int exitCode = 0;\r
- try {\r
- Process cmdProc = pb.start();\r
- InputStreamReader cmdOut = new InputStreamReader(cmdProc.getInputStream());\r
- char[] buf = new char[1024];\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
+ EdkLog.log(this, EdkLog.EDK_INFO, binaryFileList.toFileList() \r
+ + pe32FileList.toFileList() + pe32ComprFileList.toFileList()\r
+ + " => " + outputFile.toFileList());\r
\r
- exitCode = cmdProc.waitFor();\r
+ int exitCode = runner.execute();\r
if (exitCode != 0) {\r
- int len = cmdOut.read(buf, 0, 1024);\r
- EdkLog.log(EdkLog.EDK_INFO, new String(buf, 0, len));\r
+ //\r
+ // command execution fail\r
+ //\r
+ EdkLog.log(this, "ERROR = " + Integer.toHexString(exitCode));\r
+ throw new BuildException(toolName + " failed!");\r
} else {\r
- EdkLog.log(EdkLog.EDK_VERBOSE, "EfiRom succeeded!");\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
}\r
} catch (Exception e) {\r
throw new BuildException(e.getMessage());\r
- } finally {\r
- if (exitCode != 0) {\r
- throw new BuildException("EfiRom failed!");\r
- }\r
}\r
}\r
\r
/**\r
- * getVerbose\r
- *\r
- * This function is to get class member "verbose"\r
- *\r
- * @return verbose for verbose output.\r
- */\r
+ getVerbose\r
+ \r
+ This function is to get class member "verbose"\r
+ \r
+ @return verbose for verbose output.\r
+ **/\r
public String getVerbose() {\r
- return verbose;\r
+ return verbose.getValue();\r
}\r
\r
/**\r
- * setVerbose\r
- *\r
- * This function is to set class member "verbose"\r
- *\r
- * @param verbose for verbose output.\r
- */\r
+ setVerbose\r
+ \r
+ This function is to set class member "verbose"\r
+ \r
+ @param verbose for verbose output.\r
+ **/\r
public void setVerbose(boolean verbose) {\r
if (verbose){\r
- this.verbose = "-p";\r
- argList.add(this.verbose);\r
+ this.verbose.setArg(" -", "p");\r
}\r
}\r
\r
/**\r
- * getVenderId\r
- *\r
- * This function is to get class member "venderId"\r
- *\r
- * @return venderId String of venderId.\r
- */\r
+ getVenderId\r
+ \r
+ This function is to get class member "venderId"\r
+ \r
+ @return venderId String of venderId.\r
+ **/\r
public String getVenderId() {\r
- return venderId;\r
+ return venderId.getValue();\r
}\r
\r
/**\r
- * setVenderId\r
- *\r
- * This function is to set class member "venderId"\r
- *\r
- * @param venderId String of venderId.\r
- */\r
- public void setVenderId(String VenderId) {\r
- this.venderId = VenderId;\r
- argList.add("-v");\r
- argList.add(this.venderId);\r
+ setVenderId\r
+ \r
+ This function is to set class member "venderId"\r
+ \r
+ @param venderId String of venderId.\r
+ **/\r
+ public void setVenderId(String venderId) {\r
+ this.venderId.setArg(" -v ", venderId);\r
}\r
\r
/**\r
- * getDeviceId\r
- *\r
- * This function is to get class member "deviceId"\r
- *\r
- * @return deviceId String of device ID.\r
- */\r
+ getDeviceId\r
+ \r
+ This function is to get class member "deviceId"\r
+ \r
+ @return deviceId String of device ID.\r
+ **/\r
public String getDeviceId() {\r
- return this.deviceId;\r
+ return this.deviceId.getValue();\r
}\r
\r
/**\r
- * setDeviceId\r
- *\r
- * This function is to set class member "deviceId"\r
- *\r
- * @param deviceId String of device ID.\r
- */\r
+ setDeviceId\r
+ \r
+ This function is to set class member "deviceId"\r
+ \r
+ @param deviceId String of device ID.\r
+ **/\r
public void setDeviceId(String deviceId) {\r
- this.deviceId = deviceId;\r
- argList.add("-d");\r
- argList.add(this.deviceId);\r
+ this.deviceId.setArg(" -d ", deviceId);\r
}\r
\r
\r
/**\r
- * getOutputFile\r
- *\r
- * This function is to get class member "outputFile"\r
- *\r
- * @return outputFile name of output directory.\r
- */\r
+ getOutputFile\r
+ \r
+ This function is to get class member "outputFile"\r
+ \r
+ @return outputFile name of output directory.\r
+ **/\r
public String getOutputFile() {\r
- return outputFile;\r
+ return outputFile.getValue();\r
}\r
\r
/**\r
- * setOutputFile\r
- *\r
- * This function is to set class member "dscFile"\r
- *\r
- * @param outputFile name of DSC file\r
- */\r
+ setOutputFile\r
+ \r
+ This function is to set class member "dscFile"\r
+ \r
+ @param outputFile name of DSC file\r
+ **/\r
public void setOutputFile(String outputFile) {\r
- this.outputFile = outputFile;\r
-\r
+ this.outputFile.setArg(" -o ", outputFile);\r
}\r
\r
/**\r
- * getClassCode\r
- *\r
- * This function is to get class member "classCode"\r
- *\r
- * @return fdImage name of class code file.\r
- */\r
+ getClassCode\r
+ \r
+ This function is to get class member "classCode"\r
+ \r
+ @return fdImage name of class code file.\r
+ **/\r
public String getClassCode() {\r
- return classCode;\r
+ return classCode.getValue();\r
}\r
\r
/**\r
- * setclassCode\r
- *\r
- * This function is to set class member "classCode"\r
- *\r
- * @param fdImage name of class code file.\r
- */\r
+ setclassCode\r
+ \r
+ This function is to set class member "classCode"\r
+ \r
+ @param fdImage name of class code file.\r
+ **/\r
public void setclassCode(String classCode) {\r
- this.classCode = classCode;\r
- argList.add("-cc");\r
- argList.add(this.classCode);\r
+ this.classCode.setArg(" -cc ", classCode);\r
}\r
\r
/**\r
- * getRevision\r
- *\r
- * This function is to get class member "revision".\r
- *\r
- * @return revision hex revision in the PDI data header.\r
- */\r
+ getRevision\r
+ \r
+ This function is to get class member "revision".\r
+ \r
+ @return revision hex revision in the PDI data header.\r
+ **/\r
public String getRevision() {\r
- return revision;\r
+ return revision.getValue();\r
}\r
\r
/**\r
- * setRevision\r
- *\r
- * This function is to set class member "revision"\r
- *\r
- * @param revision hex revision in the PDI data header.\r
- */\r
+ setRevision\r
+ \r
+ This function is to set class member "revision"\r
+ \r
+ @param revision hex revision in the PDI data header.\r
+ **/\r
public void setRevision(String revision) {\r
- this.revision = revision;\r
- argList.add("-rev");\r
- argList.add(this.revision);\r
+ this.revision.setArg(" -rev ", revision);\r
}\r
\r
/**\r
- * getFlashDeviceImage\r
- *\r
- * This function is to get class member "dump"\r
- *\r
- * @return flashDeviceImage name of flash device image\r
- */\r
+ getFlashDeviceImage\r
+ \r
+ This function is to get class member "dump"\r
+ \r
+ @return flashDeviceImage name of flash device image\r
+ **/\r
public String getDump() {\r
- return dump;\r
+ return dump.getValue();\r
}\r
\r
/**\r
- * setFlashDeviceImage\r
- *\r
- * This function is to set class member "dump"\r
- *\r
- * @param flashDeviceImage name of flash device image\r
- */\r
+ setFlashDeviceImage\r
+ \r
+ This function is to set class member "dump"\r
+ \r
+ @param flashDeviceImage name of flash device image\r
+ **/\r
public void setDump(boolean dump) {\r
- if (dump){\r
- this.dump = "-dump";\r
- argList.add(this.dump);\r
+ if (dump) {\r
+ this.dump.setArg(" -", "dump");\r
}\r
}\r
\r
/**\r
- * getOutputDir\r
- *\r
- * This function is to get class member "outputDir"\r
- *\r
- * @return outputDir string of output directory\r
- */\r
+ getOutputDir\r
+ \r
+ This function is to get class member "outputDir"\r
+ \r
+ @return outputDir string of output directory\r
+ **/\r
public String getOutputDir() {\r
return outputDir;\r
}\r
\r
/**\r
- * setOutputDir\r
- *\r
- * This function is to set class member "outputDir"\r
- *\r
- * @param outputDir string of output directory\r
- */\r
+ setOutputDir\r
+ \r
+ This function is to set class member "outputDir"\r
+ \r
+ @param outputDir string of output directory\r
+ **/\r
public void setOutputDir(String outputDir) {\r
this.outputDir = outputDir;\r
}\r
+\r
/**\r
- * addBinaryFile\r
- *\r
- * This function is to add binary file to binaryFile list.\r
- *\r
- * @param binaryFile name of binary file.\r
- */\r
- public void addBinaryFile(Input binaryFile){\r
- this.binaryFileList.add(binaryFile);\r
+ addBinaryFile\r
+ \r
+ This function is to add binary file to binaryFile list.\r
+ \r
+ @param binaryFile name of binary file.\r
+ **/\r
+ public void addConfiguredBinaryFile(Input binaryFile){\r
+ this.binaryFileList.insert(binaryFile);\r
}\r
\r
/**\r
- * addPe32File\r
- *\r
- * This function is to add pe32 file to pe32File list.\r
- *\r
- * @param pe32File name of pe32 file.\r
- */\r
- public void addPe32File(Input pe32File){\r
- this.pe32FileList.add(pe32File);\r
+ addPe32File\r
+ \r
+ This function is to add pe32 file to pe32File list.\r
+ \r
+ @param pe32File name of pe32 file.\r
+ **/\r
+ public void addConfiguredPe32File(Input pe32File){\r
+ this.pe32FileList.insert(pe32File);\r
}\r
\r
/**\r
- * addPe32ComprFile\r
- *\r
- * This function os to add compressed pe32 file to pe32ComprFile list.\r
- *\r
- * @param pe32ComprFile name of compressed pe32 file.\r
- */\r
- public void addPe32ComprFile(Input pe32ComprFile){\r
- this.pe32ComprFileList.add(pe32ComprFile);\r
+ addPe32ComprFile\r
+ \r
+ This function os to add compressed pe32 file to pe32ComprFile list.\r
+ \r
+ @param pe32ComprFile name of compressed pe32 file.\r
+ **/\r
+ public void addConfiguredPe32ComprFile(Input pe32ComprFile){\r
+ this.pe32ComprFileList.insert(pe32ComprFile);\r
}\r
}\r
+++ /dev/null
-/** @file\r
- FileParser class.\r
-\r
- FileParser class is to parse file which contains the list of file name and \r
- add those files to list.\r
- \r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
- **/\r
-package org.tianocore.framework.tasks;\r
-import java.io.*;\r
-import java.util.List;\r
-\r
-import org.apache.tools.ant.BuildException;\r
-import org.apache.tools.ant.Project;\r
-\r
-/**\r
- FileParser class.\r
-\r
- FileParser class is to parse file which contains the list of file name and \r
- add those files to list.\r
-**/\r
-public class FileParser {\r
- /**\r
- loadFile\r
- \r
- This function is to add files to array from input file which contains the \r
- files list.\r
- @param project The current project.\r
- @param list File array.\r
- @param file File which contains the file list.\r
- @param tag Target of architecture.\r
- @throws BuildException\r
- **/\r
- public static synchronized void loadFile(Project project, List<Object> list, File file, String tag) throws BuildException{\r
- FileReader fileReader;\r
- BufferedReader in;\r
- String str;\r
- \r
- if (!file.exists()) {\r
- throw new BuildException("The file, " + file + " does not exist!"); \r
- } \r
- try {\r
- fileReader = new FileReader(file);\r
- in = new BufferedReader(fileReader);\r
- while((str=in.readLine())!= null){\r
- if (str.trim()==""){\r
- continue;\r
- }\r
- str = project.replaceProperties(str);\r
- if (str.trim().substring(0,2).equalsIgnoreCase(tag)) {\r
- list.add(str.trim());\r
- } else {\r
- list.add(tag + " " + str.trim());\r
- }\r
- \r
- }\r
- } catch (Exception e){\r
- System.out.println(e.getMessage());\r
- \r
- }\r
- }\r
- \r
-}\r
**/\r
package org.tianocore.framework.tasks;\r
\r
+import java.io.File;\r
+\r
import org.apache.tools.ant.BuildException;\r
import org.apache.tools.ant.Project;\r
import org.apache.tools.ant.Task;\r
//\r
private ToolArg componentType = new ToolArg();\r
\r
- /**\r
- * assemble tool command line & execute tool command line\r
- *\r
- * @throws BuildException\r
- */\r
/**\r
execute\r
\r
if (path == null) {\r
command = toolName;\r
} else {\r
- command = path + "/" + toolName;\r
+ command = path + File.separator + toolName;\r
}\r
//\r
// argument of tools\r
GenAcpiTable is used to call GenAcpiTable.exe to generate ACPI Table image .\r
**/\r
public class GenAcpiTableTask extends Task implements EfiDefine {\r
- // /\r
- // / input file\r
- // /\r
- private String inputFile = "";\r
-\r
- // /\r
- // / output file\r
- // /\r
- private String outputFile = "";\r
-\r
- // /\r
- // / output directory, this variable is added by jave wrap\r
- // /\r
- private String outputDir = "";\r
+ //\r
+ // Tool name\r
+ // \r
+ private static String toolName = "GenAcpiTable";\r
+\r
+ //\r
+ // input file\r
+ //\r
+ private FileArg inputFile = new FileArg();\r
+\r
+ //\r
+ // output file\r
+ //\r
+ private FileArg outputFile = new FileArg();\r
+\r
+ //\r
+ // output directory, this variable is added by jave wrap\r
+ //\r
+ private String outputDir = ".";\r
\r
/**\r
- * execute\r
- *\r
- * StripTask execute function is to assemble tool command line & execute\r
- * tool command line\r
- *\r
- * @throws BuidException\r
- */\r
+ execute\r
+ \r
+ StripTask execute function is to assemble tool command line & execute\r
+ tool command line\r
+ \r
+ @throws BuidException\r
+ **/\r
public void execute() throws BuildException {\r
\r
Project project = this.getOwningTarget().getProject();\r
String command;\r
String argument;\r
if (path == null) {\r
- command = "GenAcpiTable";\r
+ command = toolName;\r
} else {\r
- command = path + File.separatorChar + "GenAcpiTable";\r
+ command = path + File.separator + toolName;\r
}\r
//\r
// argument of tools\r
//\r
- File file = new File(outputFile);\r
- if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
- argument = inputFile + " " + outputDir + File.separatorChar\r
- + outputFile;\r
- } else {\r
- argument = inputFile + " " + outputFile;\r
- }\r
+ argument = "" + inputFile + outputFile;\r
+\r
//\r
// return value of fwimage execution\r
//\r
\r
runner.setAntRun(project);\r
runner.setCommandline(cmdline.getCommandline());\r
+ runner.setWorkingDirectory(new File(outputDir));\r
+\r
//\r
// Set debug log information.\r
//\r
EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
- EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.inputFile)).getName());\r
- revl = runner.execute();\r
+ EdkLog.log(this, EdkLog.EDK_INFO, this.inputFile.toFileList() + " => " \r
+ + this.outputFile.toFileList());\r
\r
+ revl = runner.execute();\r
if (EFI_SUCCESS == revl) {\r
//\r
// command execution success\r
//\r
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "GenAcpiTable succeeded!");\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
} else {\r
//\r
// command execution fail\r
//\r
EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));\r
- throw new BuildException("GenAcpiTable failed!");\r
+ throw new BuildException(toolName + " failed!");\r
}\r
} catch (Exception e) {\r
throw new BuildException(e.getMessage());\r
}\r
\r
/**\r
- * getInputFile\r
- *\r
- * This function is to get class member "inputFile".\r
- *\r
- * @return string of input file name.\r
- */\r
+ getInputFile\r
+ \r
+ This function is to get class member "inputFile".\r
+ \r
+ @return string of input file name.\r
+ **/\r
public String getInputFile() {\r
- return inputFile;\r
+ return inputFile.getValue();\r
}\r
\r
/**\r
- * setComponentType\r
- *\r
- * This function is to set class member "inputFile".\r
- *\r
- * @param inputFile\r
- * string of input file name.\r
- */\r
+ setComponentType\r
+ \r
+ This function is to set class member "inputFile".\r
+ \r
+ @param inputFile\r
+ string of input file name.\r
+ **/\r
public void setInputFile(String inputFile) {\r
- this.inputFile = inputFile;\r
+ this.inputFile.setArg(" ", inputFile);\r
}\r
\r
/**\r
- * getOutputFile\r
- *\r
- * This function is to get class member "outputFile"\r
- *\r
- * @return outputFile string of output file name.\r
- */\r
+ getOutputFile\r
+ \r
+ This function is to get class member "outputFile"\r
+ \r
+ @return outputFile string of output file name.\r
+ **/\r
public String getOutputFile() {\r
- return outputFile;\r
+ return outputFile.getValue();\r
}\r
\r
/**\r
- * setOutputFile\r
- *\r
- * This function is to set class member "outputFile"\r
- *\r
- * @param outputFile\r
- * string of output file name.\r
- */\r
+ setOutputFile\r
+ \r
+ This function is to set class member "outputFile"\r
+ \r
+ @param outputFile\r
+ string of output file name.\r
+ **/\r
public void setOutputFile(String outputFile) {\r
- this.outputFile = outputFile;\r
+ this.outputFile.setArg(" ", outputFile);\r
}\r
\r
/**\r
- * getOutputDir\r
- *\r
- * This function is to get class member "outputDir"\r
- *\r
- * @return outputDir string of output directory.\r
- */\r
+ getOutputDir\r
+ \r
+ This function is to get class member "outputDir"\r
+ \r
+ @return outputDir string of output directory.\r
+ **/\r
public String getOutputDir() {\r
return outputDir;\r
}\r
\r
/**\r
- * setOutputDir\r
- *\r
- * This function is to set class member "outputDir"\r
- *\r
- * @param outputDir\r
- * string of output directory.\r
- */\r
+ setOutputDir\r
+ \r
+ This function is to set class member "outputDir"\r
+ \r
+ @param outputDir\r
+ string of output directory.\r
+ **/\r
public void setOutputDir(String outputDir) {\r
this.outputDir = outputDir;\r
}\r
\r
package org.tianocore.framework.tasks;\r
\r
-import java.util.*;\r
+import java.io.File;\r
+\r
+import org.apache.tools.ant.BuildException;\r
import org.apache.tools.ant.Project;\r
import org.apache.tools.ant.Task;\r
-import org.apache.tools.ant.BuildException;\r
import org.apache.tools.ant.taskdefs.Execute;\r
import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
import org.apache.tools.ant.types.Commandline;\r
\r
+import org.tianocore.common.logger.EdkLog;\r
+\r
/**\r
GenCRC32SectionTask\r
\r
\r
**/\r
public class GenCRC32SectionTask extends Task implements EfiDefine {\r
- ///\r
- /// output file\r
- ///\r
- private String outputFile;\r
- ///\r
- /// inputFile list\r
- ///\r
- private List<NestElement> inputFileList = new ArrayList<NestElement>();\r
+ //\r
+ // Tool name\r
+ //\r
+ private static String toolName = "GenCRC32Section";\r
+ //\r
+ // output file\r
+ //\r
+ private FileArg outputFile = new FileArg();\r
+ //\r
+ // inputFile list\r
+ //\r
+ private InputFile inputFileList = new InputFile();\r
\r
- ///\r
- /// Project\r
- ///\r
+ //\r
+ // Project\r
+ //\r
static private Project project;\r
\r
/**\r
String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH"); \r
String command;\r
if (path == null) {\r
- command = "GenCRC32Section";\r
+ command = toolName;\r
} else {\r
- command = path + "/" + "GenCRC32Section" ;\r
- }\r
- // \r
- // string line of input files \r
- // \r
- String inputFiles = " -i "; \r
- for (int i = 0; i < inputFileList.size(); ++i) {\r
- inputFiles += inputFileList.get(i).toString(" ");\r
+ command = path + File.separator + toolName ;\r
}\r
-\r
// \r
// assemble argument \r
//\r
- String argument = inputFiles + outputFile; \r
+ String argument = "" + inputFileList.toStringWithSinglepPrefix(" -i ") + outputFile; \r
// \r
// return value of fwimage execution \r
//\r
\r
runner.setAntRun(project);\r
runner.setCommandline(cmdline.getCommandline());\r
- log(Commandline.toString(cmdline.getCommandline()), Project.MSG_VERBOSE);\r
- log(" ");\r
+\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
+ EdkLog.log(this, inputFileList.toFileList() + " => " + outputFile.toFileList());\r
+\r
revl = runner.execute();\r
if (EFI_SUCCESS == revl){\r
//\r
// command execution success \r
//\r
- log("GenCRC32Section succeeded!", Project.MSG_VERBOSE);\r
+ EdkLog.log(this, toolName + " succeeded!");\r
} else {\r
// \r
// command execution fail\r
//\r
- log("ERROR = " + Integer.toHexString(revl));\r
+ EdkLog.log(this, "ERROR = " + Integer.toHexString(revl));\r
// LAH Added This Line\r
- throw new BuildException("GenCRC32Section failed!");\r
+ throw new BuildException(toolName + " failed!");\r
}\r
} catch (Exception e) {\r
throw new BuildException(e.getMessage());\r
This function is to add a inputFile element into list\r
@param inputFile : inputFile element\r
**/\r
- public void addInputfile(InputFile inputFile) {\r
- inputFileList.add(inputFile);\r
+ public void addConfiguredInputfile(InputFile inputFile) {\r
+ inputFileList.insert(inputFile);\r
}\r
\r
/**\r
- get class member "outputFile"\r
- * @return name of output file\r
- */\r
+ get class member "outputFile"\r
+ @return name of output file\r
+ **/\r
public String getOutputFile() {\r
- return this.outputFile;\r
+ return this.outputFile.getValue();\r
}\r
/**\r
- * set class member "outputFile"\r
- * @param outputFile : outputFile parameter \r
- */\r
+ set class member "outputFile"\r
+ @param outputFile : outputFile parameter \r
+ **/\r
public void setOutputFile(String outputFile) {\r
- this.outputFile = " -o " + outputFile;\r
+ this.outputFile.setArg(" -o ", outputFile);\r
}\r
}\r
GenCapsuleHdrTask is used to call GenCapsuleHdr.exe to generate capsule.\r
**/\r
public class GenCapsuleHdrTask extends Task implements EfiDefine {\r
- ///\r
- /// tool name\r
- ///\r
+ //\r
+ // tool name\r
+ //\r
private String toolName = "GenCapsuleHdr";\r
\r
- ///\r
- /// script file\r
- ///\r
- private String scriptFile = "";\r
+ //\r
+ // script file\r
+ //\r
+ private FileArg scriptFile = new FileArg();\r
\r
- ///\r
- /// output file\r
- ///\r
- private String outputFile = "";\r
+ //\r
+ // output file\r
+ //\r
+ private FileArg outputFile = new FileArg();\r
\r
- ///\r
- /// output directory, this variable is added by jave wrap\r
- ///\r
- private String outputDir = "";\r
+ //\r
+ // output directory, this variable is added by jave wrap\r
+ //\r
+ private String outputDir = ".";\r
\r
- ///\r
- /// Verbose flag\r
- ///\r
- private String verbose = "";\r
+ //\r
+ // Verbose flag\r
+ //\r
+ private ToolArg verbose = new ToolArg();\r
\r
- ///\r
- /// Dump flag\r
- ///\r
- private String dump = "";\r
+ //\r
+ // Dump flag\r
+ //\r
+ private ToolArg dump = new ToolArg();\r
\r
- ///\r
- /// Split size\r
- ///\r
- private String size = "";\r
+ //\r
+ // Split size\r
+ //\r
+ private ToolArg size = new ToolArg();\r
\r
- ///\r
- /// capsule into one image flag\r
- ///\r
- private String joinFlag = "";\r
+ //\r
+ // capsule into one image flag\r
+ //\r
+ private ToolArg joinFlag = new ToolArg();\r
\r
- ///\r
- /// capsule file\r
- ///\r
- private String capsuleFile = "";\r
+ //\r
+ // capsule file\r
+ //\r
+ private FileArg capsuleFile = new FileArg();\r
\r
\r
/**\r
- * execute\r
- *\r
- * GenCapsuleHdrTask execute function is to assemble tool command line & execute\r
- * tool command line\r
- *\r
- * @throws BuidException\r
- */\r
+ execute\r
+ \r
+ GenCapsuleHdrTask execute function is to assemble tool command line & execute\r
+ tool command line\r
+ \r
+ @throws BuidException\r
+ **/\r
public void execute() throws BuildException {\r
\r
Project project = this.getOwningTarget().getProject();\r
if (path == null) {\r
command = toolName;\r
} else {\r
- command = path + File.separatorChar + toolName;\r
+ command = path + File.separator + toolName;\r
}\r
//\r
// argument of tools\r
//\r
- File file = new File(outputFile);\r
- if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
- argument = this.verbose + this.dump + "-o " +this.outputDir\r
- + File.separatorChar + this.outputFile + " "\r
- + this.scriptFile + " " + this.size + " " + this.joinFlag + this.capsuleFile;\r
- } else {\r
- argument = this.verbose + this.dump + "-o " + this.outputFile\r
- + " " + this.scriptFile + " " + this.size + " " + this.joinFlag + this.capsuleFile;\r
- }\r
+ argument = "" + this.verbose + this.dump + this.outputFile\r
+ + this.scriptFile + this.size + this.joinFlag + this.capsuleFile;\r
+\r
//\r
// return value of fwimage execution\r
//\r
\r
runner.setAntRun(project);\r
runner.setCommandline(cmdline.getCommandline());\r
+ runner.setWorkingDirectory(new File(outputDir));\r
+\r
//\r
// Set debug log information.\r
//\r
EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
- EdkLog.log(this, EdkLog.EDK_INFO, (new File(scriptFile)).getName());\r
- revl = runner.execute();\r
+ EdkLog.log(this, EdkLog.EDK_INFO, scriptFile.toFileList() + " => " +\r
+ outputFile.toFileList() + capsuleFile.toFileList());\r
\r
+ revl = runner.execute();\r
if (EFI_SUCCESS == revl) {\r
//\r
// command execution success\r
//\r
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "GenCapsuleHdr succeeded!");\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
} else {\r
//\r
// command execution fail\r
//\r
EdkLog.log(this, EdkLog.EDK_ERROR, "ERROR = " + Integer.toHexString(revl));\r
- throw new BuildException("GenCapsuleHdr failed!");\r
+ throw new BuildException(toolName + " failed!");\r
}\r
} catch (Exception e) {\r
throw new BuildException(e.getMessage());\r
}\r
\r
/**\r
- * getInputFile\r
- *\r
- * This function is to get class member "scriptFile".\r
- *\r
- * @return string of input file name.\r
- */\r
+ getInputFile\r
+ \r
+ This function is to get class member "scriptFile".\r
+ \r
+ @return string of input file name.\r
+ **/\r
public String getScriptFile() {\r
- return this.scriptFile;\r
+ return this.scriptFile.getValue();\r
}\r
\r
/**\r
- * setComponentType\r
- *\r
- * This function is to set class member "inputFile".\r
- *\r
- * @param inputFile\r
- * string of input file name.\r
- */\r
+ setComponentType\r
+ \r
+ This function is to set class member "inputFile".\r
+ \r
+ @param inputFile\r
+ string of input file name.\r
+ **/\r
public void setScriptFile(String scriptFile) {\r
- this.scriptFile = "-script " + scriptFile;\r
+ this.scriptFile.setArg(" -script ", scriptFile);\r
}\r
\r
/**\r
- * getOutputFile\r
- *\r
- * This function is to get class member "outputFile"\r
- *\r
- * @return outputFile string of output file name.\r
- */\r
+ getOutputFile\r
+ \r
+ This function is to get class member "outputFile"\r
+ \r
+ @return outputFile string of output file name.\r
+ **/\r
public String getOutputFile() {\r
- return outputFile;\r
+ return outputFile.getValue();\r
}\r
\r
/**\r
- * setOutputFile\r
- *\r
- * This function is to set class member "outputFile"\r
- *\r
- * @param outputFile\r
- * string of output file name.\r
- */\r
+ setOutputFile\r
+ \r
+ This function is to set class member "outputFile"\r
+ \r
+ @param outputFile\r
+ string of output file name.\r
+ **/\r
public void setOutputFile(String outputFile) {\r
- this.outputFile = outputFile + " ";\r
+ this.outputFile.setArg(" -o ", outputFile);\r
}\r
\r
/**\r
- * getOutputDir\r
- *\r
- * This function is to get class member "outputDir"\r
- *\r
- * @return outputDir string of output directory.\r
- */\r
+ getOutputDir\r
+ \r
+ This function is to get class member "outputDir"\r
+ \r
+ @return outputDir string of output directory.\r
+ **/\r
public String getOutputDir() {\r
return outputDir;\r
}\r
\r
/**\r
- * setOutputDir\r
- *\r
- * This function is to set class member "outputDir"\r
- *\r
- * @param outputDir\r
- * string of output directory.\r
- */\r
+ setOutputDir\r
+ \r
+ This function is to set class member "outputDir"\r
+ \r
+ @param outputDir\r
+ string of output directory.\r
+ **/\r
public void setOutputDir(String outputDir) {\r
this.outputDir = outputDir;\r
}\r
\r
/**\r
- * getVerbose\r
- *\r
- * This function is to get class member "verbose"\r
- *\r
- * @return verbose the flag of verbose.\r
- */\r
+ getVerbose\r
+ \r
+ This function is to get class member "verbose"\r
+ \r
+ @return verbose the flag of verbose.\r
+ **/\r
public String getVerbose() {\r
- return this.verbose;\r
+ return this.verbose.getValue();\r
}\r
\r
/**\r
- * setVerbose\r
- *\r
- * This function is to set class member "verbose"\r
- *\r
- * @param verbose\r
- * True or False.\r
- */\r
+ setVerbose\r
+ \r
+ This function is to set class member "verbose"\r
+ \r
+ @param verbose\r
+ True or False.\r
+ **/\r
public void setVerbose(boolean verbose) {\r
if (verbose) {\r
- this.verbose = "-v ";\r
+ this.verbose.setArg(" -", "v");\r
}\r
}\r
\r
/**\r
- * getDump\r
- *\r
- * This function is to get class member "dump"\r
- *\r
- * @return verbose the flag of dump.\r
- */\r
+ getDump\r
+ \r
+ This function is to get class member "dump"\r
+ \r
+ @return verbose the flag of dump.\r
+ **/\r
public String getDump() {\r
- return dump;\r
+ return dump.getValue();\r
}\r
\r
/**\r
- * setDump\r
- *\r
- * This function is to set class member "dump".\r
- *\r
- * @param dump\r
- * True or False.\r
- */\r
+ setDump\r
+ \r
+ This function is to set class member "dump".\r
+ \r
+ @param dump\r
+ True or False.\r
+ **/\r
public void setDump(boolean dump) {\r
if (dump) {\r
- this.dump = "-dump ";\r
+ this.dump.setArg(" -", "dump");\r
}\r
}\r
\r
/**\r
- * getSize\r
- *\r
- * This function is to set class member "size".\r
- *\r
- * @return size string of size value\r
- */\r
+ getSize\r
+ \r
+ This function is to set class member "size".\r
+ \r
+ @return size string of size value\r
+ **/\r
public String getSize() {\r
- return size;\r
+ return size.getValue();\r
}\r
\r
/**\r
- * setSize\r
- *\r
- * This function is to set class member "size".\r
- *\r
- * @param size string of size value.\r
- */\r
+ setSize\r
+ \r
+ This function is to set class member "size".\r
+ \r
+ @param size string of size value.\r
+ **/\r
public void setSize(String size) {\r
- this.size = "-split " + size;\r
+ this.size.setArg(" -split ", size);\r
}\r
\r
/**\r
- * getCapsuleFile\r
- *\r
- * This function is to get class member "capsuleFile"\r
- *\r
- * @return capsuleFile capsule file name\r
- */\r
+ getCapsuleFile\r
+ \r
+ This function is to get class member "capsuleFile"\r
+ \r
+ @return capsuleFile capsule file name\r
+ **/\r
public String getCapsuleFile() {\r
- return capsuleFile;\r
+ return capsuleFile.getValue();\r
}\r
\r
/**\r
- * setCapsuleFile\r
- *\r
- * This function is to set class member "capsuleFile"\r
- *\r
- * @param capsuleFile capsule file name\r
- */\r
+ setCapsuleFile\r
+ \r
+ This function is to set class member "capsuleFile"\r
+ \r
+ @param capsuleFile capsule file name\r
+ **/\r
public void setCapsuleFile(String capsuleFile) {\r
- this.capsuleFile = capsuleFile;\r
+ this.capsuleFile.setArg(" ", capsuleFile);\r
}\r
\r
/**\r
- * isJoinFlag\r
- *\r
- * This function is to get class member "joinFlag"\r
- *\r
- * @return joinFlag flag of if need to join split capsule images into\r
- * a single image.\r
- */\r
+ isJoinFlag\r
+ \r
+ This function is to get class member "joinFlag"\r
+ \r
+ @return joinFlag flag of if need to join split capsule images into\r
+ a single image.\r
+ **/\r
public String getJoinFlag() {\r
- return joinFlag;\r
+ return joinFlag.getValue();\r
}\r
\r
/**\r
- * setJoinFlag\r
- *\r
- * This function is to set class member "joinFlag"\r
- *\r
- * @param joinFlag flag of if need to join split capsule images into\r
- * a single image.\r
- */\r
+ setJoinFlag\r
+ \r
+ This function is to set class member "joinFlag"\r
+ \r
+ @param joinFlag flag of if need to join split capsule images into\r
+ a single image.\r
+ **/\r
public void setJoinFlag(boolean joinFlag) {\r
if (joinFlag){\r
- this.joinFlag = "-j ";\r
+ this.joinFlag.setArg(" -", "j");\r
}\r
-\r
}\r
}\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
- **/\r
+**/\r
\r
package org.tianocore.framework.tasks;\r
\r
import java.io.ByteArrayOutputStream;\r
import java.io.DataOutputStream;\r
+import java.io.File;\r
+import java.io.file;\r
import java.util.ArrayList;\r
import java.util.Iterator;\r
import java.util.List;\r
import org.apache.tools.ant.types.Commandline;\r
import org.tianocore.common.logger.EdkLog;\r
\r
-public class GenSectionTask extends Task implements EfiDefine, Section,\r
- FfsTypes {\r
+public class GenSectionTask extends Task implements EfiDefine, Section, FfsTypes {\r
+ //\r
+ // Tool name\r
+ // \r
+ private final static String toolName = "GenSection";\r
//\r
// inputfile name\r
//\r
private boolean haveTool = false;\r
\r
/**\r
- * execute\r
- * \r
- * GenSectionTaks execute is to assemble tool command line & execute tool\r
- * command line.\r
- * \r
- * @throws BuildException\r
- */\r
+ execute\r
+ \r
+ GenSectionTaks execute is to assemble tool command line & execute tool\r
+ command line.\r
+ \r
+ @throws BuildException\r
+ **/\r
public void execute() throws BuildException {\r
String command;\r
Project project = this.getOwningTarget().getProject();\r
//\r
String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
if (path == null) {\r
- command = "GenSection";\r
+ command = toolName;\r
} else {\r
- command = path + "/" + "GenSection";\r
+ command = path + File.separator + toolName;\r
}\r
//\r
// argument of tools\r
//\r
- String argument = "" + inputFile + outputFile + sectionType\r
- + versionNum + interfaceString;\r
+ String argument = "" + inputFile + outputFile + sectionType + versionNum + interfaceString;\r
//\r
// return value of gensection execution\r
//\r
runner.setAntRun(project);\r
runner.setCommandline(cmdline.getCommandline());\r
\r
- EdkLog.log(this, inputFile.toFileList() + " => "\r
- + outputFile.toFileList());\r
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline\r
- .getCommandline()));\r
+ EdkLog.log(this, inputFile.toFileList() + versionNum.getValue() \r
+ + interfaceString.getValue() + " => " + outputFile.toFileList());\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
\r
revl = runner.execute();\r
if (EFI_SUCCESS == revl) {\r
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "GenSection succeeded!");\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
} else {\r
//\r
// command execution fail\r
//\r
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = "\r
- + Integer.toHexString(revl));\r
- throw new BuildException("GenSection failed!");\r
+ EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));\r
+ throw new BuildException(toolName + " failed!");\r
}\r
} catch (Exception e) {\r
throw new BuildException(e.getMessage());\r
}\r
\r
/**\r
- * getInputFile\r
- * \r
- * This function is to get class member "inputFile".\r
- * \r
- * @return name of input file\r
- */\r
+ getInputFile\r
+ \r
+ This function is to get class member "inputFile".\r
+ \r
+ @return name of input file\r
+ **/\r
public String getInputFile() {\r
return this.inputFile.getValue();\r
}\r
\r
/**\r
- * setInputFile\r
- * \r
- * This function is to set class member "inputFile".\r
- * \r
- * @param inputFile\r
- * name of input file\r
- */\r
+ setInputFile\r
+ \r
+ This function is to set class member "inputFile".\r
+ \r
+ @param inputFile name of input file\r
+ **/\r
public void setInputFile(String inputFile) {\r
this.inputFile.setArg(" -i ", inputFile);\r
}\r
\r
/**\r
- * getOutputFile\r
- * \r
- * This function is to get class member "outputFile".\r
- * \r
- * @return name of output file\r
- */\r
+ getOutputFile\r
+ \r
+ This function is to get class member "outputFile".\r
+ \r
+ @return name of output file\r
+ **/\r
public String getOutputFile() {\r
return this.outputFile.getValue();\r
}\r
\r
/**\r
- * setOutputfile\r
- * \r
- * This function is to set class member "outputFile".\r
- * \r
- * @param outputFile\r
- * name of output file\r
- */\r
+ setOutputfile\r
+ \r
+ This function is to set class member "outputFile".\r
+ @param outputFile name of output file\r
+ **/\r
public void setOutputfile(String outputFile) {\r
this.outputFile.setArg(" -o ", outputFile);\r
}\r
\r
/**\r
- * getSectionType\r
- * \r
- * This function is to get class member "sectionType".\r
- * \r
- * @return sectoin type\r
- */\r
+ getSectionType\r
+ \r
+ This function is to get class member "sectionType".\r
+ \r
+ @return sectoin type\r
+ **/\r
public String getSectionType() {\r
return this.sectionType.getValue();\r
}\r
\r
/**\r
- * setSectionType\r
- * \r
- * This function is to set class member "sectionType".\r
- * \r
- * @param sectionType\r
- * section type\r
- */\r
+ setSectionType\r
+ \r
+ This function is to set class member "sectionType".\r
+ \r
+ @param sectionType section type\r
+ **/\r
public void setSectionType(String sectionType) {\r
this.sectionType.setArg(" -s ", sectionType);\r
}\r
\r
/**\r
- * getVersionNum\r
- * \r
- * This function is to get class member "versionNum".\r
- * \r
- * @return version number\r
- */\r
+ getVersionNum\r
+ \r
+ This function is to get class member "versionNum".\r
+ @return version number\r
+ **/\r
public String getVersionNum() {\r
return this.versionNum.getValue();\r
}\r
\r
/**\r
- * setVersionNume\r
- * \r
- * This function is to set class member "versionNum".\r
- * \r
- * @param versionNum\r
- * version number\r
- */\r
+ setVersionNume\r
+ \r
+ This function is to set class member "versionNum".\r
+ @param versionNum version number\r
+ **/\r
public void setVersionNum(String versionNum) {\r
this.versionNum.setArg(" -v ", versionNum);\r
}\r
\r
/**\r
- * getInterfaceString\r
- * \r
- * This function is to get class member "interfaceString".\r
- * \r
- * @return interface string\r
- */\r
+ getInterfaceString\r
+ \r
+ This function is to get class member "interfaceString".\r
+ @return interface string\r
+ **/\r
public String getInterfaceString() {\r
return this.interfaceString.getValue();\r
}\r
\r
/**\r
- * setInterfaceString\r
- * \r
- * This funcion is to set class member "interfaceString".\r
- * \r
- * @param interfaceString\r
- * interface string\r
- */\r
+ setInterfaceString\r
+ \r
+ This funcion is to set class member "interfaceString".\r
+ @param interfaceString interface string\r
+ **/\r
public void setInterfaceString(String interfaceString) {\r
this.interfaceString.setArg(" -a ", "\"" + interfaceString + "\"");\r
}\r
-\r
+ \r
/**\r
- * addSectFile\r
- * \r
- * This function is to add sectFile to list.\r
- * \r
- * @param sectFile\r
- * instance of sectFile.\r
- */\r
- public void addSectFile(SectFile sectFile) {\r
+ addSectFile\r
+ \r
+ This function is to add sectFile to list.\r
+ \r
+ @param sectFile instance of sectFile.\r
+ **/\r
+ public void addSectFile(SectFile sectFile){\r
this.sectFileList.add(sectFile);\r
}\r
\r
/**\r
- * setTool\r
- * \r
- * This function is to set the class member "Tool";\r
- * \r
- * @param tool\r
- */\r
+ setTool\r
+ \r
+ This function is to set the class member "Tool";\r
+ \r
+ @param tool \r
+ **/\r
public void addTool(Tool tool) {\r
this.sectFileList.add(tool);\r
this.haveTool = true;\r
}\r
-\r
+ \r
/**\r
- * addGenSection\r
- * \r
- * This function is to add GenSectin element to list\r
- * \r
- * @param task\r
- * Instance of genSection\r
- */\r
- public void addGenSection(GenSectionTask task) {\r
+ addGenSection\r
+ \r
+ This function is to add GenSectin element to list\r
+ @param task Instance of genSection\r
+ **/\r
+ public void addGenSection(GenSectionTask task){\r
this.sectFileList.add(task);\r
}\r
-\r
- public void toBuffer(DataOutputStream buffer) {\r
+ \r
+ public void toBuffer(DataOutputStream buffer){\r
//\r
// Search SectionList find earch section and call it's\r
// ToBuffer function.\r
* GenTeImageTask is used to call GenAcpiTable.exe to generate ACPI Table image .\r
*/\r
public class GenTeImageTask extends Task implements EfiDefine {\r
- ///\r
- /// tool name\r
- ///\r
+ //\r
+ // tool name\r
+ //\r
private String toolName = "GenTeImage";\r
- ///\r
- /// input file\r
- ///\r
- private String inputFile = "";\r
-\r
- ///\r
- /// output file\r
- ///\r
- private String outputFile = "";\r
-\r
- ///\r
- /// output directory, this variable is added by jave wrap\r
- ///\r
+ //\r
+ // input file\r
+ //\r
+ private FileArg inputFile = new FileArg();\r
+\r
+ //\r
+ // output file\r
+ //\r
+ private FileArg outputFile = new FileArg();\r
+\r
+ //\r
+ // output directory, this variable is added by jave wrap\r
+ //\r
private String outputDir = "";\r
\r
- ///\r
- /// Verbose flag\r
- ///\r
- private String verbose = "";\r
+ //\r
+ // Verbose flag\r
+ //\r
+ private ToolArg verbose = new ToolArg();\r
\r
- ///\r
- /// Dump flag\r
- ///\r
- private String dump = "";\r
+ //\r
+ // Dump flag\r
+ //\r
+ private ToolArg dump = new ToolArg();\r
\r
/**\r
- * assemble tool command line & execute tool command line\r
- *\r
- * @throws BuildException\r
- */\r
- /**\r
- * execute\r
- *\r
- * GenTeImgaeTask execute function is to assemble tool command line & execute\r
- * tool command line\r
- *\r
- * @throws BuidException\r
- */\r
+ execute\r
+ \r
+ GenTeImgaeTask execute function is to assemble tool command line & execute\r
+ tool command line\r
+ \r
+ @throws BuidException\r
+ **/\r
public void execute() throws BuildException {\r
\r
Project project = this.getOwningTarget().getProject();\r
if (path == null) {\r
command = toolName;\r
} else {\r
- command = path + File.separatorChar + toolName;\r
+ command = path + File.separator + toolName;\r
}\r
//\r
// argument of tools\r
//\r
- File file = new File(outputFile);\r
- if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
- argument = this.verbose + this.dump + "-o " +this.outputDir\r
- + File.separatorChar + this.outputFile + " "\r
- + this.inputFile;\r
- } else {\r
- argument = this.verbose + this.dump + "-o " + this.outputFile\r
- + " " + this.inputFile;\r
- }\r
+ argument = "" + this.verbose + this.dump + this.outputFile + this.inputFile;\r
//\r
// return value of fwimage execution\r
//\r
\r
runner.setAntRun(project);\r
runner.setCommandline(cmdline.getCommandline());\r
+ runner.setWorkingDirectory(new File(outputDir));\r
+\r
//\r
// Set debug log information.\r
//\r
EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
- EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.inputFile)).getName());\r
+ EdkLog.log(this, EdkLog.EDK_INFO, this.inputFile.toFileList()\r
+ + " => " + this.outputFile.toFileList());\r
\r
revl = runner.execute();\r
\r
//\r
// command execution success\r
//\r
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "GenTeImage succeeded!");\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
} else {\r
//\r
// command execution fail\r
//\r
EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = "+ Integer.toHexString(revl));\r
- throw new BuildException("GenTeImage failed!");\r
+ throw new BuildException(toolName + " failed!");\r
}\r
} catch (Exception e) {\r
throw new BuildException(e.getMessage());\r
}\r
\r
/**\r
- * getInputFile\r
- *\r
- * This function is to get class member "inputFile".\r
- *\r
- * @return string of input file name.\r
- */\r
+ getInputFile\r
+ \r
+ This function is to get class member "inputFile".\r
+ \r
+ @return string of input file name.\r
+ **/\r
public String getInputFile() {\r
- return inputFile;\r
+ return inputFile.getValue();\r
}\r
\r
/**\r
- * setComponentType\r
- *\r
- * This function is to set class member "inputFile".\r
- *\r
- * @param inputFile\r
- * string of input file name.\r
- */\r
+ setComponentType\r
+ \r
+ This function is to set class member "inputFile".\r
+ \r
+ @param inputFile\r
+ string of input file name.\r
+ **/\r
public void setInputFile(String inputFile) {\r
- this.inputFile = inputFile;\r
+ this.inputFile.setArg(" ", inputFile);\r
}\r
\r
/**\r
- * getOutputFile\r
- *\r
- * This function is to get class member "outputFile"\r
- *\r
- * @return outputFile string of output file name.\r
- */\r
+ getOutputFile\r
+ \r
+ This function is to get class member "outputFile"\r
+ \r
+ @return outputFile string of output file name.\r
+ **/\r
public String getOutputFile() {\r
- return outputFile;\r
+ return outputFile.getValue();\r
}\r
\r
/**\r
- * setOutputFile\r
- *\r
- * This function is to set class member "outputFile"\r
- *\r
- * @param outputFile\r
- * string of output file name.\r
- */\r
+ setOutputFile\r
+ \r
+ This function is to set class member "outputFile"\r
+ \r
+ @param outputFile\r
+ string of output file name.\r
+ **/\r
public void setOutputFile(String outputFile) {\r
- this.outputFile = outputFile + " ";\r
+ this.outputFile.setArg(" -o ", outputFile);\r
}\r
\r
/**\r
- * getOutputDir\r
- *\r
- * This function is to get class member "outputDir"\r
- *\r
- * @return outputDir string of output directory.\r
- */\r
+ getOutputDir\r
+ \r
+ This function is to get class member "outputDir"\r
+ \r
+ @return outputDir string of output directory.\r
+ **/\r
public String getOutputDir() {\r
return outputDir;\r
}\r
\r
/**\r
- * setOutputDir\r
- *\r
- * This function is to set class member "outputDir"\r
- *\r
- * @param outputDir\r
- * string of output directory.\r
- */\r
+ setOutputDir\r
+ \r
+ This function is to set class member "outputDir"\r
+ \r
+ @param outputDir\r
+ string of output directory.\r
+ **/\r
public void setOutputDir(String outputDir) {\r
this.outputDir = outputDir;\r
}\r
\r
/**\r
- * getVerbose\r
- *\r
- * This function is to get class member "verbose"\r
- *\r
- * @return verbose the flag of verbose.\r
- */\r
+ getVerbose\r
+ \r
+ This function is to get class member "verbose"\r
+ \r
+ @return verbose the flag of verbose.\r
+ **/\r
public String getVerbose() {\r
- return this.verbose;\r
+ return this.verbose.getValue();\r
}\r
\r
/**\r
- * setVerbose\r
- *\r
- * This function is to set class member "verbose"\r
- *\r
- * @param verbose\r
- * True or False.\r
- */\r
+ setVerbose\r
+ \r
+ This function is to set class member "verbose"\r
+ \r
+ @param verbose\r
+ True or False.\r
+ **/\r
public void setVerbose(boolean verbose) {\r
if (verbose) {\r
- this.verbose = "-v ";\r
+ this.verbose.setArg(" -", "v");\r
}\r
}\r
\r
/**\r
- * getDump\r
- *\r
- * This function is to get class member "dump"\r
- *\r
- * @return verbose the flag of dump.\r
- */\r
+ getDump\r
+ \r
+ This function is to get class member "dump"\r
+ \r
+ @return verbose the flag of dump.\r
+ **/\r
public String getDump() {\r
- return dump;\r
+ return dump.getValue();\r
}\r
\r
/**\r
- * setDump\r
- *\r
- * This function is to set class member "dump"\r
- *\r
- * @param dump\r
- * True or False.\r
- */\r
+ setDump\r
+ \r
+ This function is to set class member "dump"\r
+ \r
+ @param dump\r
+ True or False.\r
+ **/\r
public void setDump(boolean dump) {\r
if (dump) {\r
- this.dump = "-dump ";\r
+ this.dump.setArg(" -", "dump");\r
}\r
}\r
}\r
import org.apache.tools.ant.Project;\r
import org.apache.tools.ant.Task;\r
\r
+import org.tianocore.common.logger.EdkLog;\r
+\r
/**\r
GuidChkTask\r
\r
* -fos : out put redirect to this file \r
* \r
*/\r
- ///\r
- /// Directory name of exclusion searching \r
- ///\r
- private String exDir = "";\r
- ///\r
- /// File name of exclusion searching.\r
- ///\r
- private String exFile = "";\r
- ///\r
- /// Extension name of exclusion searching.\r
- ///\r
- private String exExt = "";\r
- ///\r
- /// Extesnion name of sub dir which excluded searching.\r
- ///\r
- private String exSubDir = "";\r
- ///\r
- /// Out put file wrote internal GUID+basename list\r
- ///\r
- private String outFile = "";\r
- ///\r
- /// Check for duplicate guids.\r
- ///\r
- private String chkGui = "";\r
- ///\r
- /// Check for duplicate signatures\r
- ///\r
- private String chkSign = "";\r
- ///\r
- /// If set will print guid+defined symbol name\r
- ///\r
- private String printGuiDef = "";\r
- ///\r
- /// If set will print all GUIDS found\r
- ///\r
- private String printAllGuid = "";\r
- ///\r
- /// redirection file name.\r
- ///\r
+ //\r
+ // Tool name\r
+ // \r
+ private static String toolName = "GuidChk";\r
+ //\r
+ // Directory name of exclusion searching \r
+ //\r
+ private FileArg exDir = new FileArg();\r
+ //\r
+ // File name of exclusion searching.\r
+ //\r
+ private FileArg exFile = new FileArg();\r
+ //\r
+ // Extension name of exclusion searching.\r
+ //\r
+ private FileArg exExt = new FileArg();\r
+ //\r
+ // Extesnion name of sub dir which excluded searching.\r
+ //\r
+ private FileArg exSubDir = new FileArg();\r
+ //\r
+ // Out put file wrote internal GUID+basename list\r
+ //\r
+ private FileArg outFile = new FileArg();\r
+ //\r
+ // Check for duplicate guids.\r
+ //\r
+ private ToolArg chkGui = new ToolArg();\r
+ //\r
+ // Check for duplicate signatures\r
+ //\r
+ private ToolArg chkSign = new ToolArg();\r
+ //\r
+ // If set will print guid+defined symbol name\r
+ //\r
+ private ToolArg printGuiDef = new ToolArg();\r
+ //\r
+ // If set will print all GUIDS found\r
+ //\r
+ private ToolArg printAllGuid = new ToolArg();\r
+ //\r
+ // redirection file name.\r
+ //\r
private String outPut = "";\r
- ///\r
- /// out put redirect to this file.\r
- ///\r
+ //\r
+ // out put redirect to this file.\r
+ //\r
protected PrintWriter fos = null;\r
\r
//\r
String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
String command;\r
if (path == null) {\r
- command = "GuidChk";\r
+ command = toolName;\r
} else {\r
- command = path + File.separatorChar + "GuidChk";\r
+ command = path + File.separatorChar + toolName;\r
}\r
- String argument = exDir +\r
- exFile +\r
- exExt +\r
- exSubDir +\r
- outFile +\r
- chkGui +\r
- chkSign +\r
- printGuiDef + \r
- printAllGuid; \r
+ String argument = "" + exDir +\r
+ exFile +\r
+ exExt +\r
+ exSubDir +\r
+ outFile +\r
+ chkGui +\r
+ chkSign +\r
+ printGuiDef + \r
+ printAllGuid; \r
try {\r
- log(command + " " + argument, Project.MSG_VERBOSE);\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, command + " " + argument);\r
//\r
// execute command line \r
//\r
- Process proc = Runtime.getRuntime().exec(command + "" + argument);\r
+ Process proc = Runtime.getRuntime().exec(command + " " + argument);\r
//\r
// if set output, redirect out put to output file, else print output to screen\r
// \r
BufferedReader bin = new BufferedReader(new InputStreamReader(proc.getInputStream()));\r
String line = bin.readLine();\r
while (line != null ){ \r
- fos.println(line);\r
- line = bin.readLine();\r
+ fos.println(line);\r
+ line = bin.readLine();\r
}\r
fos.close();\r
}\r
line = bin.readLine();\r
} \r
} \r
- log("GuidChkTask Succeeded!", Project.MSG_VERBOSE);\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " Succeeded!");\r
} catch (Exception e) {\r
- throw new BuildException("GuidChkTask failed!");\r
+ throw new BuildException(toolName + " failed!");\r
}\r
}\r
/**\r
@return string of flag of ChkGui\r
**/\r
public String getChkGui() {\r
- return chkGui;\r
+ return chkGui.getValue();\r
}\r
\r
/**\r
\r
@param chkGui set class member of chkGui\r
**/\r
- public void setChkGui(String chkGui) {\r
- if (chkGui.equals("on")||(chkGui.equals("ON"))){\r
- this.chkGui = " -g ";\r
- }\r
- \r
+ public void setChkGui(boolean chkGui) {\r
+ if (chkGui) {\r
+ this.chkGui.setArg(" -", "g");\r
+ } \r
}\r
\r
/**\r
@return chkSign\r
**/\r
public String getChkSign() {\r
- return chkSign;\r
+ return chkSign.getValue();\r
}\r
\r
/**\r
This function is to set class member of chkSign\r
* @param chkSign\r
*/\r
- public void setChkSign(String chkSign) {\r
- if (chkSign.equals("on")|| chkSign.equals("ON")){\r
- this.chkSign = " -s ";\r
+ public void setChkSign(boolean chkSign) {\r
+ if (chkSign){\r
+ this.chkSign.setArg(" -", "s");\r
} \r
}\r
/**\r
@return exDir\r
**/\r
public String getExDir() {\r
- return exDir;\r
+ return exDir.getValue();\r
}\r
\r
/**\r
@param exDir\r
**/\r
public void setExDir(String exDir) {\r
- this.exDir = " -d " + exDir;\r
+ this.exDir.setArg(" -d ", exDir);\r
}\r
\r
/**\r
@return exExt\r
**/\r
public String getExExt() {\r
- return exExt;\r
+ return exExt.getValue();\r
}\r
\r
/**\r
@param exExt\r
**/\r
public void setExExt(String exExt) {\r
- this.exExt = " -e " + exExt;\r
+ this.exExt.setArg(" -e ", exExt);\r
}\r
\r
/**\r
@return exFile\r
**/\r
public String getExFile() {\r
- return exFile;\r
+ return exFile.getValue();\r
}\r
\r
/**\r
@param exFile\r
**/\r
public void setExFile(String exFile) {\r
- this.exFile = " -f " + exFile;\r
+ this.exFile.setArg(" -f ", exFile);\r
}\r
\r
/**\r
@return exSubDir\r
**/\r
public String getExSubDir() {\r
- return exSubDir;\r
+ return exSubDir.getValue();\r
}\r
\r
/**\r
@param exSubDir\r
**/\r
public void setExSubDir(String exSubDir) {\r
- this.exSubDir = " -u " + exSubDir;\r
+ this.exSubDir.setArg(" -u ", exSubDir);\r
}\r
\r
/**\r
@return outFile\r
**/\r
public String getOutFile() {\r
- return outFile;\r
+ return outFile.getValue();\r
}\r
/**\r
* set class member of outFile\r
* @param outFile\r
*/\r
public void setOutFile(String outFile) {\r
- this.outFile = " -b " + outFile;\r
+ this.outFile.setArg(" -b ", outFile);\r
}\r
/**\r
getPrintGuidDef\r
@return flage of printing (guid+defined symbol name)\r
**/\r
public String getPrintGuiDef() {\r
- return printGuiDef;\r
+ return printGuiDef.getValue();\r
}\r
\r
\r
This function is to set class member of printGuiDef.\r
@param printGuiDef\r
**/\r
- public void setPrintGuiDef(String printGuiDef) {\r
- if (printGuiDef.equals("on")|| printGuiDef.equals("ON")){\r
- this.printGuiDef = " -x ";\r
+ public void setPrintGuiDef(boolean printGuiDef) {\r
+ if (printGuiDef){\r
+ this.printGuiDef.setArg(" -", "x");\r
}\r
\r
}\r
@return printAllGuid\r
**/\r
public String getPrintAllGuid() {\r
- return printAllGuid;\r
+ return printAllGuid.getValue();\r
}\r
\r
/**\r
This function is to set class member of printAllGuid.\r
@param printAllGuid\r
**/\r
- public void setPrintAllGuid(String printAllGuid) {\r
- if (printAllGuid.equals("on")||printAllGuid.equals("ON")) {\r
- this.printAllGuid = " -p ";\r
+ public void setPrintAllGuid(boolean printAllGuid) {\r
+ if (printAllGuid) {\r
+ this.printAllGuid.setArg(" -", "p");\r
} \r
}\r
}\r
//\r
// private members, use set/get to access them\r
//\r
- private static final String cmdName = "MakeDeps";\r
- private String depsFile = null;\r
- private String subDir = null;\r
- private boolean quietMode = true;\r
- private boolean ignoreError = true;\r
- private String extraDeps = "";\r
- private List<IncludePath> includePathList = new ArrayList<IncludePath>();\r
- private List<Input> inputFileList = new ArrayList<Input>();\r
+ private static final String toolName = "MakeDeps";\r
+ private FileArg depsFile = new FileArg();\r
+ private ToolArg subDir = new ToolArg();\r
+ private ToolArg quietMode = new ToolArg(" -", "q");\r
+ private ToolArg ignoreError = new ToolArg(" -", "ignorenotfound");\r
+ private IncludePath includePathList = new IncludePath();\r
+ private Input inputFileList = new Input();\r
+ private ToolArg target = new FileArg(" -target ", "dummy");\r
\r
public MakeDeps() {\r
\r
/// compose full tool path\r
///\r
if (toolPath == null || toolPath.length() == 0) {\r
- toolPath = cmdName;\r
+ toolPath = toolName;\r
} else {\r
if (toolPath.endsWith("/") || toolPath.endsWith("\\")) {\r
- toolPath = toolPath + cmdName;\r
+ toolPath = toolPath + toolName;\r
} else {\r
- toolPath = toolPath + File.separator + cmdName;\r
+ toolPath = toolPath + File.separator + toolName;\r
}\r
}\r
\r
///\r
/// compose tool arguments\r
///\r
- StringBuffer args = new StringBuffer(4096);\r
- if (ignoreError) {\r
- args.append(" -ignorenotfound ");\r
- }\r
- if (quietMode) {\r
- args.append(" -q ");\r
- }\r
- if (subDir != null && subDir.length() > 0) {\r
- args.append(" -s ");\r
- args.append(subDir);\r
- }\r
-\r
- ///\r
- /// if there's no source files, we can do nothing about dependency\r
- ///\r
- if (inputFileList.size() == 0) {\r
- throw new BuildException("No source files specified to scan");\r
- }\r
-\r
- ///\r
- /// compose source file arguments\r
- ///\r
- for (int i = 0, listLength = inputFileList.size(); i < listLength; ++i) {\r
- args.append(inputFileList.get(i).toString());\r
- }\r
-\r
- for (int i = 0, listLength = includePathList.size(); i < listLength; ++i) {\r
- args.append(includePathList.get(i).toString());\r
- }\r
-\r
- ///\r
- /// We don't need a real target. So just a "dummy" is given\r
- ///\r
- args.append(" -target dummy");\r
- args.append(" -o ");\r
- args.append(depsFile);\r
+ String argument = "" + inputFileList + includePathList + subDir\r
+ + quietMode + ignoreError + target + depsFile;\r
\r
///\r
/// prepare to execute the tool\r
///\r
Commandline cmd = new Commandline();\r
cmd.setExecutable(toolPath);\r
- cmd.createArgument().setLine(args.toString());\r
+ cmd.createArgument().setLine(argument);\r
\r
LogStreamHandler streamHandler = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN);\r
Execute runner = new Execute(streamHandler, null);\r
}\r
\r
if (result != 0) {\r
- EdkLog.log(this, EdkLog.EDK_INFO, "MakeDeps failed!");\r
- throw new BuildException("MakeDeps: failed to generate dependency file!");\r
+ EdkLog.log(this, EdkLog.EDK_INFO, toolName + " failed!");\r
+ throw new BuildException(toolName + ": failed to generate dependency file!");\r
+ } else {\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
}\r
}\r
\r
- ///\r
- /// Remove any duplicated path separator or inconsistent path separator\r
- ///\r
- private String cleanupPathName(String path) {\r
- String separator = "\\" + File.separator;\r
- String duplicateSeparator = separator + "{2}";\r
- path = Path.translateFile(path);\r
- path = path.replaceAll(duplicateSeparator, separator);\r
- return path;\r
- }\r
-\r
/**\r
Set method for "DepsFile" attribute\r
\r
@param name The name of dependency list file\r
**/\r
public void setDepsFile(String name) {\r
- depsFile = cleanupPathName(name);\r
+ depsFile.setArg(" -o ", name);\r
}\r
\r
/**\r
@returns The name of dependency list file\r
**/\r
public String getDepsFile() {\r
- return depsFile;\r
+ return depsFile.getValue();\r
}\r
\r
/**\r
@param ignore flag to control error handling (true/false)\r
**/\r
public void setIgnoreError(boolean ignore) {\r
- ignoreError = ignore;\r
+ if (!ignore) {\r
+ ignoreError.setArg(" ", " ");\r
+ }\r
}\r
\r
/**\r
@returns The value of current IgnoreError flag\r
**/\r
public boolean getIgnoreError() {\r
- return ignoreError;\r
+ return ignoreError.getValue().length() > 0;\r
}\r
\r
/**\r
@param quiet flag to control the output information (true/false)\r
**/\r
public void setQuietMode(boolean quiet) {\r
- quietMode = quiet;\r
+ if (!quiet) {\r
+ quietMode.setArg(" ", " ");\r
+ }\r
}\r
\r
/**\r
@returns value of current QuietMode flag\r
**/\r
public boolean getQuietMode() {\r
- return quietMode;\r
+ return quietMode.getValue().length() > 0;\r
}\r
\r
/**\r
@param dir The name of sub-directory in which source files will be scanned\r
**/\r
public void setSubDir(String dir) {\r
- subDir = cleanupPathName(dir);\r
+ subDir.setArg(" -s ", dir);\r
}\r
\r
/**\r
@returns The name of sub-directory\r
**/\r
public String getSubDir() {\r
- return subDir;\r
- }\r
-\r
- /**\r
- Set method for "ExtraDeps" attribute\r
-\r
- @param deps The name of dependency file specified separately\r
- **/\r
- public void setExtraDeps(String deps) {\r
- extraDeps = cleanupPathName(deps);\r
- }\r
-\r
- /**\r
- Get method for "ExtraDeps" attribute\r
-\r
- @returns The name of dependency file specified separately\r
- **/\r
- public String getExtraDeps () {\r
- return extraDeps;\r
+ return subDir.getValue();\r
}\r
\r
/**\r
\r
@param path The IncludePath object from nested IncludePath type of element\r
**/\r
- public void addIncludepath(IncludePath path) {\r
- includePathList.add(path);\r
+ public void addConfiguredIncludepath(IncludePath path) {\r
+ includePathList.insert(path);\r
}\r
\r
/**\r
\r
@param input The Input object from nested Input type of element\r
**/\r
- public void addInput(Input inputFile) {\r
- inputFileList.add(inputFile);\r
+ public void addConfiguredInput(Input inputFile) {\r
+ inputFileList.insert(inputFile);\r
}\r
\r
/**\r
@returns false The dependency list file is outofdate. Re-generation is needed.\r
**/\r
private boolean isUptodate() {\r
- File df = new File(depsFile);\r
+ String dfName = depsFile.getValue();\r
+ File df = new File(dfName);\r
if (!df.exists()) {\r
- EdkLog.log(this, EdkLog.EDK_VERBOSE, depsFile + " doesn't exist!");\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, dfName + " doesn't exist!");\r
return false;\r
}\r
\r
// re-generate the dependency list file\r
//\r
long depsFileTimeStamp = df.lastModified();\r
- Iterator<Input> iterator = (Iterator<Input>)inputFileList.iterator();\r
- while (iterator.hasNext()) {\r
- Input inputFile = iterator.next();\r
- List<String> fileList = inputFile.getNameList();\r
- for (int i = 0, length = fileList.size(); i < length; ++i) {\r
- File sf = new File(fileList.get(i));\r
- if (sf.lastModified() > depsFileTimeStamp) {\r
- EdkLog.log(this, EdkLog.EDK_VERBOSE, sf.getPath() + " has been changed since last build!");\r
- return false;\r
- }\r
+ List<String> fileList = inputFileList.getNameList();\r
+ for (int i = 0, length = fileList.size(); i < length; ++i) {\r
+ File sf = new File(fileList.get(i));\r
+ if (sf.lastModified() > depsFileTimeStamp) {\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, sf.getPath() + " has been changed since last build!");\r
+ return false;\r
}\r
}\r
\r
// check if the .dep file is empty\r
// \r
if (lines == 0) {\r
- EdkLog.log(this, EdkLog.EDK_VERBOSE, depsFile + " is empty!");\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, dfName + " is empty!");\r
ret = false;\r
}\r
\r
ModifyInfTask is used to call Modify.exe to generate inf file.\r
**/\r
public class ModifyInfTask extends Task implements EfiDefine {\r
- ///\r
- /// tool name\r
- ///\r
+ //\r
+ // tool name\r
+ //\r
private String toolName = "ModifyInf";\r
\r
- ///\r
- /// input FV inf file\r
- ///\r
- private String inputFVInfFile = "";\r
+ //\r
+ // input FV inf file\r
+ //\r
+ private FileArg inputFVInfFile = new FileArg();\r
\r
- ///\r
- /// output FV inf file\r
- ///\r
- private String outputFVInfFile = "";\r
+ //\r
+ // output FV inf file\r
+ //\r
+ private FileArg outputFVInfFile = new FileArg();\r
\r
- ///\r
- /// pattern string\r
- ///\r
- private String patternStr = "";\r
+ //\r
+ // pattern string\r
+ //\r
+ private ToolArg patternStr = new ToolArg();\r
\r
- ///\r
- /// Output dir\r
- ///\r
- private String outputDir = "";\r
+ //\r
+ // Output dir\r
+ //\r
+ private String outputDir = ".";\r
\r
/**\r
- * execute\r
- *\r
- * ModifyInfTask execute function is to assemble tool command line & execute\r
- * tool command line\r
- *\r
- * @throws BuidException\r
- */\r
+ execute\r
+ \r
+ ModifyInfTask execute function is to assemble tool command line & execute\r
+ tool command line\r
+ \r
+ @throws BuidException\r
+ **/\r
public void execute() throws BuildException {\r
\r
Project project = this.getOwningTarget().getProject();\r
//\r
// argument of tools\r
//\r
- File file = new File(outputFVInfFile);\r
- if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
- argument = this.inputFVInfFile +\r
- this.outputDir +\r
- File.separatorChar +\r
- this.outputFVInfFile +\r
- this.patternStr;\r
- } else {\r
- argument = this.inputFVInfFile +\r
- this.outputFVInfFile +\r
- this.patternStr;\r
- }\r
+ argument = "" + this.inputFVInfFile + this.outputFVInfFile + this.patternStr;\r
//\r
// return value of fwimage execution\r
//\r
\r
runner.setAntRun(project);\r
runner.setCommandline(cmdline.getCommandline());\r
+ runner.setWorkingDirectory(new File(outputDir));\r
+\r
//\r
// Set debug log information.\r
//\r
EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
- EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.inputFVInfFile)).getName());\r
- revl = runner.execute();\r
+ EdkLog.log(this, EdkLog.EDK_INFO, this.inputFVInfFile.toFileList()\r
+ + " => " + this.inputFVInfFile.toFileList());\r
\r
+ revl = runner.execute();\r
if (EFI_SUCCESS == revl) {\r
//\r
// command execution success\r
//\r
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "ModifyInfTask succeeded!");\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
} else {\r
//\r
// command execution fail\r
//\r
EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));\r
- throw new BuildException("ModifyInfTask failed!");\r
+ throw new BuildException(toolName + " failed!");\r
}\r
} catch (Exception e) {\r
throw new BuildException(e.getMessage());\r
}\r
\r
/**\r
- * getinputFVInfFile\r
- *\r
- * This function is to get class member "inputFVInfFile".\r
- *\r
- * @return string of input inf file name.\r
- */\r
+ getinputFVInfFile\r
+ \r
+ This function is to get class member "inputFVInfFile".\r
+ \r
+ @return string of input inf file name.\r
+ **/\r
public String getinputFVInfFile() {\r
- return this.inputFVInfFile;\r
+ return this.inputFVInfFile.getValue();\r
}\r
\r
/**\r
- * setinputFVInfFile\r
- *\r
- * This function is to set class member "inputFVInfFile".\r
- *\r
- * @param inputFile\r
- * string of input inf file name.\r
- */\r
+ setinputFVInfFile\r
+ \r
+ This function is to set class member "inputFVInfFile".\r
+ \r
+ @param inputFile\r
+ string of input inf file name.\r
+ **/\r
public void setinputFVInfFile(String inputFVInfFileName) {\r
- this.inputFVInfFile= inputFVInfFileName + " ";\r
+ this.inputFVInfFile.setArg(" ", inputFVInfFileName);\r
}\r
\r
/**\r
- * getoutputFVInfFile\r
- *\r
- * This function is to get class member "outputFVInfFile"\r
- *\r
- * @return outputFVInfFile string of output inf file name.\r
- */\r
+ getoutputFVInfFile\r
+ \r
+ This function is to get class member "outputFVInfFile"\r
+ \r
+ @return outputFVInfFile string of output inf file name.\r
+ **/\r
public String getoutputFVInfFile() {\r
- return this.outputFVInfFile;\r
+ return this.outputFVInfFile.getValue();\r
}\r
\r
/**\r
- * setoutputFVInfFile\r
- *\r
- * This function is to set class member "outputFVInfFile"\r
- *\r
- * @param outputFVInfFile\r
- * string of output inf file name.\r
- */\r
+ setoutputFVInfFile\r
+ \r
+ This function is to set class member "outputFVInfFile"\r
+ \r
+ @param outputFVInfFile\r
+ string of output inf file name.\r
+ **/\r
public void setoutputFVInfFile(String outputFVInfFileName) {\r
- this.outputFVInfFile = outputFVInfFileName + " ";\r
+ this.outputFVInfFile.setArg(" ", outputFVInfFileName);\r
}\r
\r
/**\r
- * getpatternStr\r
- *\r
- * This function is to get class member "patternStr"\r
- *\r
- * @return patternStr string of pattern.\r
- */\r
+ getpatternStr\r
+ \r
+ This function is to get class member "patternStr"\r
+ \r
+ @return patternStr string of pattern.\r
+ **/\r
public String getpatternStr() {\r
- return this.patternStr;\r
+ return this.patternStr.getValue();\r
}\r
\r
/**\r
- * setpatternStr\r
- *\r
- * This function is to set class member "patternStr"\r
- *\r
- * @param patternStr\r
- * string of patternStr.\r
- */\r
+ setpatternStr\r
+ \r
+ This function is to set class member "patternStr"\r
+ \r
+ @param patternStr\r
+ string of patternStr.\r
+ **/\r
public void setpatternStr(String patternStr) {\r
- this.patternStr = patternStr;\r
+ this.patternStr.setArg(" ", patternStr);\r
}\r
\r
/**\r
- * getoutputDir\r
- *\r
- * This function is to get class member "outputDir"\r
- *\r
- * @return outputDir string of output directory.\r
- */\r
+ getoutputDir\r
+ \r
+ This function is to get class member "outputDir"\r
+ \r
+ @return outputDir string of output directory.\r
+ **/\r
public String getoutputDir() {\r
return this.outputDir;\r
}\r
\r
/**\r
- * setoutputDir\r
- *\r
- * This function is to set class member "outputDir"\r
- *\r
- * @param patternStr\r
- * string of output directory.\r
- */\r
+ setoutputDir\r
+ \r
+ This function is to set class member "outputDir"\r
+ \r
+ @param patternStr\r
+ string of output directory.\r
+ **/\r
public void setoutputDir(String outputDir) {\r
this.outputDir = outputDir;\r
}\r
Ap reset vector.\r
**/\r
public class SecApResetVectorFixupTask extends Task implements EfiDefine {\r
- ///\r
- /// tool name\r
- ///\r
+ //\r
+ // tool name\r
+ //\r
private String toolName = "SecApResetVectorFixup";\r
- // /\r
- // / input FV recovery file\r
- // /\r
- private String fvInputFile = "";\r
+ //\r
+ // input FV recovery file\r
+ //\r
+ private FileArg fvInputFile = new FileArg();\r
\r
- // /\r
- // / output file\r
- // /\r
- private String fvOutputFile = "";\r
+ //\r
+ // output file\r
+ //\r
+ private FileArg fvOutputFile = new FileArg();\r
\r
- // /\r
- // / output directory, this variable is added by jave wrap\r
- // /\r
- private String outputDir = "";\r
+ //\r
+ // output directory, this variable is added by jave wrap\r
+ //\r
+ private String outputDir = ".";\r
\r
\r
/**\r
- * execute\r
- *\r
- * SecApResetVectorFixupTask execute function is to assemble tool command line & execute\r
- * tool command line\r
- *\r
- * @throws BuidException\r
- */\r
+ execute\r
+ \r
+ SecApResetVectorFixupTask execute function is to assemble tool command line & execute\r
+ tool command line\r
+ \r
+ @throws BuidException\r
+ **/\r
public void execute() throws BuildException {\r
\r
Project project = this.getOwningTarget().getProject();\r
if (path == null) {\r
command = toolName;\r
} else {\r
- command = path + File.separatorChar + toolName;\r
+ command = path + File.separator + toolName;\r
}\r
//\r
// argument of tools\r
//\r
- File file = new File(this.fvOutputFile);\r
- if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
- argument = this.fvInputFile + " " + outputDir + File.separatorChar\r
- + this.fvOutputFile;\r
- } else {\r
- argument = this.fvInputFile + " " + this.fvOutputFile;\r
- }\r
+ argument = "" + this.fvInputFile + this.fvOutputFile;\r
//\r
// return value of fwimage execution\r
//\r
\r
runner.setAntRun(project);\r
runner.setCommandline(cmdline.getCommandline());\r
+ runner.setWorkingDirectory(new File(outputDir));\r
+\r
//\r
// Set debug log information.\r
//\r
EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
- EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.fvInputFile)).getName());\r
+ EdkLog.log(this, EdkLog.EDK_INFO, this.fvInputFile.toFileList() \r
+ + " => " + this.fvOutputFile.toFileList());\r
\r
revl = runner.execute();\r
\r
//\r
// command execution success\r
//\r
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "SecApResetVectorFixup succeeded!");\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
} else {\r
//\r
// command execution fail\r
//\r
EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));\r
- throw new BuildException("SecApResetVectorFixup failed!");\r
+ throw new BuildException(toolName + " failed!");\r
}\r
} catch (Exception e) {\r
throw new BuildException(e.getMessage());\r
}\r
\r
/**\r
- * getInputFile\r
- *\r
- * This function is to get class member "fvInputFile".\r
- *\r
- * @return string of input file name.\r
- */\r
+ getInputFile\r
+ \r
+ This function is to get class member "fvInputFile".\r
+ \r
+ @return string of input file name.\r
+ **/\r
public String getfvInputFile() {\r
- return this.fvInputFile;\r
+ return this.fvInputFile.getValue();\r
}\r
\r
/**\r
- * setComponentType\r
- *\r
- * This function is to set class member "fvInputFile".\r
- *\r
- * @param inputFile\r
- * string of input file name.\r
- */\r
+ setComponentType\r
+ \r
+ This function is to set class member "fvInputFile".\r
+ \r
+ @param inputFile\r
+ string of input file name.\r
+ **/\r
public void setFvInputFile(String inputFile) {\r
- this.fvInputFile = inputFile;\r
+ this.fvInputFile.setArg(" ", inputFile);\r
}\r
\r
/**\r
- * getOutputFile\r
- *\r
- * This function is to get class member "fvOutputFile"\r
- *\r
- * @return outputFile string of output file name.\r
- */\r
+ getOutputFile\r
+ \r
+ This function is to get class member "fvOutputFile"\r
+ \r
+ @return outputFile string of output file name.\r
+ **/\r
public String getOutputFile() {\r
- return this.fvOutputFile;\r
+ return this.fvOutputFile.getValue();\r
}\r
\r
/**\r
- * setOutputFile\r
- *\r
- * This function is to set class member "fvOutputFile"\r
- *\r
- * @param outputFile\r
- * string of output file name.\r
- */\r
+ setOutputFile\r
+ \r
+ This function is to set class member "fvOutputFile"\r
+ \r
+ @param outputFile\r
+ string of output file name.\r
+ **/\r
public void setFvOutputFile(String outputFile) {\r
- this.fvOutputFile = outputFile;\r
+ this.fvOutputFile.setArg(" ", outputFile);\r
}\r
\r
/**\r
- * getOutputDir\r
- *\r
- * This function is to get class member "outputDir"\r
- *\r
- * @return outputDir string of output directory.\r
- */\r
+ getOutputDir\r
+ \r
+ This function is to get class member "outputDir"\r
+ \r
+ @return outputDir string of output directory.\r
+ **/\r
public String getOutputDir() {\r
return outputDir;\r
}\r
\r
/**\r
- * setOutputDir\r
- *\r
- * This function is to set class member "outputDir"\r
- *\r
- * @param outputDir\r
- * string of output directory.\r
- */\r
+ setOutputDir\r
+ \r
+ This function is to set class member "outputDir"\r
+ \r
+ @param outputDir\r
+ string of output directory.\r
+ **/\r
public void setOutputDir(String outputDir) {\r
this.outputDir = outputDir;\r
}\r
* SecFixupTask is used to call SecFixup.exe to fix up sec image.\r
*/\r
public class SecFixupTask extends Task implements EfiDefine {\r
- // /\r
- // / tool name\r
- // /\r
+ //\r
+ // tool name\r
+ //\r
private String toolName = "SecFixup";\r
\r
- // /\r
- // / input file\r
- // /\r
- private String secExeFile = "";\r
+ //\r
+ // input file\r
+ //\r
+ private FileArg secExeFile = new FileArg();\r
\r
- // /\r
- // / output file\r
- // /\r
- private String resetVectorDataFile = "";\r
+ //\r
+ // output file\r
+ //\r
+ private FileArg resetVectorDataFile = new FileArg();\r
\r
- // /\r
- // / output directory, this variable is added by jave wrap\r
- // /\r
- private String outputFile = "";\r
+ //\r
+ // output file\r
+ //\r
+ private FileArg outputFile = new FileArg();\r
\r
- // /\r
- // / output directory\r
- // /\r
- private String outputDir = "";\r
+ //\r
+ // output directory, this variable is added by jave wrap\r
+ //\r
+ private String outputDir = ".";\r
\r
/**\r
- * execute\r
- *\r
- * SecFixupTask execute function is to assemble tool command line & execute\r
- * tool command line\r
- *\r
- * @throws BuidException\r
- */\r
+ execute\r
+ \r
+ SecFixupTask execute function is to assemble tool command line & execute\r
+ tool command line\r
+ \r
+ @throws BuidException\r
+ **/\r
public void execute() throws BuildException {\r
\r
Project project = this.getOwningTarget().getProject();\r
//\r
// argument of tools\r
//\r
- if (!this.outputDir.equalsIgnoreCase("")) {\r
- argument = this.secExeFile + " " + this.resetVectorDataFile + " "\r
- + this.outputDir + File.separatorChar + this.outputFile;\r
- } else {\r
- argument = this.secExeFile + " " + this.resetVectorDataFile + " "\r
- + this.outputFile;\r
- }\r
+ argument = "" + secExeFile + resetVectorDataFile + outputFile;\r
\r
//\r
// return value of fwimage execution\r
\r
runner.setAntRun(project);\r
runner.setCommandline(cmdline.getCommandline());\r
+ runner.setWorkingDirectory(new File(outputDir));\r
+\r
//\r
// Set debug log information.\r
//\r
EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
+ EdkLog.log(this, EdkLog.EDK_INFO, secExeFile.toFileList() \r
+ + resetVectorDataFile.toFileList() + " => " + outputFile.toFileList());\r
\r
revl = runner.execute();\r
\r
//\r
// command execution success\r
//\r
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "SecFixup succeeded!");\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
} else {\r
//\r
// command execution fail\r
//\r
EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = "+ Integer.toHexString(revl));\r
- throw new BuildException("SecFixup failed!");\r
+ throw new BuildException(toolName + " failed!");\r
}\r
} catch (Exception e) {\r
throw new BuildException(e.getMessage());\r
}\r
\r
/**\r
- * getSecExeFile\r
- *\r
- * This function is to get class member "secExeFile".\r
- *\r
- * @return string of sectExe file name.\r
- */\r
+ getSecExeFile\r
+ \r
+ This function is to get class member "secExeFile".\r
+ \r
+ @return string of sectExe file name.\r
+ **/\r
public String getSecExeFile() {\r
- return this.secExeFile;\r
+ return this.secExeFile.getValue();\r
}\r
\r
/**\r
- * setSecExeFile\r
- *\r
- * This function is to set class member "secExeFile".\r
- *\r
- * @param secExeFile\r
- * string of secExe file name.\r
- */\r
+ setSecExeFile\r
+ \r
+ This function is to set class member "secExeFile".\r
+ \r
+ @param secExeFile\r
+ string of secExe file name.\r
+ **/\r
public void setSecExeFile(String secExeFile) {\r
- this.secExeFile = secExeFile;\r
+ this.secExeFile.setArg(" ", secExeFile);\r
}\r
\r
/**\r
- * getResetVectorDataFile\r
- *\r
- * This function is to get class member "resetVectorDataFile"\r
- *\r
- * @return resetVectorDataFile string of resetVectorData file name.\r
- */\r
+ getResetVectorDataFile\r
+ \r
+ This function is to get class member "resetVectorDataFile"\r
+ \r
+ @return resetVectorDataFile string of resetVectorData file name.\r
+ **/\r
public String getResetVectorDataFile() {\r
- return this.resetVectorDataFile;\r
+ return this.resetVectorDataFile.getValue();\r
}\r
\r
/**\r
- * setResetVectorDataFile\r
- *\r
- * This function is to set class member "resetVectorDataFile"\r
- *\r
- * @param resetVectorDataFile\r
- * string of resetVectorData file name.\r
- */\r
+ setResetVectorDataFile\r
+ \r
+ This function is to set class member "resetVectorDataFile"\r
+ \r
+ @param resetVectorDataFile\r
+ string of resetVectorData file name.\r
+ **/\r
public void setResetVectorDataFile(String resetVectorDataFile) {\r
- this.resetVectorDataFile = resetVectorDataFile;\r
+ this.resetVectorDataFile.setArg(" ", resetVectorDataFile);\r
}\r
\r
/**\r
- * getOutputFile\r
- *\r
- * This function is to get class member "outputFile"\r
- *\r
- * @return outputFile string of output file name.\r
- */\r
+ getOutputFile\r
+ \r
+ This function is to get class member "outputFile"\r
+ \r
+ @return outputFile string of output file name.\r
+ **/\r
public String getOutputFile() {\r
- return outputFile;\r
+ return this.outputFile.getValue();\r
}\r
\r
/**\r
- * setOutputFile\r
- *\r
- * This function is to set class member "outputFile"\r
- *\r
- * @param outputFile\r
- * string of output file name.\r
- */\r
+ setOutputFile\r
+ \r
+ This function is to set class member "outputFile"\r
+ \r
+ @param outputFile\r
+ string of output file name.\r
+ **/\r
public void setOutputFile(String outputFile) {\r
- this.outputFile = outputFile;\r
+ this.outputFile.setArg(" ", outputFile);\r
}\r
\r
/**\r
- * getOutputDir\r
- *\r
- * This function is to get class member "outputDir"\r
- *\r
- * @return outputDir name of output directory\r
- */\r
+ getOutputDir\r
+ \r
+ This function is to get class member "outputDir"\r
+ \r
+ @return outputDir name of output directory\r
+ **/\r
public String getOutputDir() {\r
return outputDir;\r
}\r
\r
/**\r
- * setOutputDir\r
- *\r
- * This function is to set class member "outputDir"\r
- *\r
- * @param outputDir\r
- * name of output directory\r
- */\r
+ setOutputDir\r
+ \r
+ This function is to set class member "outputDir"\r
+ \r
+ @param outputDir\r
+ name of output directory\r
+ **/\r
public void setOutputDir(String outputDir) {\r
this.outputDir = outputDir;\r
}\r
import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
import org.apache.tools.ant.types.Commandline;\r
\r
+import org.tianocore.common.logger.EdkLog;\r
+\r
/**\r
Class SetStampTask is a wrap class for setstamp.exe.\r
**/\r
-peFile : file of PE\r
-timeFile: Txt file of time\r
**/ \r
- \r
- private String peFile = "";\r
\r
- private String timeFile = "";\r
+ private static String toolName = "SetStamp";\r
+\r
+ private FileArg peFile = new FileArg();\r
+\r
+ private FileArg timeFile = new FileArg();\r
+\r
+ private String outputDir = ".";\r
\r
/**\r
assemble tool command line & execute tool command line\r
String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
String command;\r
if (path == null) {\r
- command = "SetStamp";\r
+ command = toolName;\r
} else {\r
- command = path + "/" + "SetStamp";\r
+ command = path + File.separator + toolName;\r
}\r
///\r
/// argument of SetStamp tool\r
///\r
- String argument = peFile + timeFile;\r
+ String argument = "" + peFile + timeFile;\r
///\r
/// reture value of SetStamp execution\r
///\r
Execute runner = new Execute(streamHandler, null);\r
runner.setAntRun(project);\r
runner.setCommandline(commandLine.getCommandline());\r
+ runner.setWorkingDirectory(new File(outputDir));\r
\r
- log(Commandline.toString(commandLine.getCommandline()), Project.MSG_VERBOSE);\r
- log((new File(this.peFile)).getName());\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(commandLine.getCommandline()));\r
+ EdkLog.log(this, peFile.toFileList() + " < " + timeFile.toFileList());\r
\r
returnVal = runner.execute();\r
if (EFI_SUCCESS == returnVal) {\r
- log("SetStamp succeeded!", Project.MSG_VERBOSE);\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
} else {\r
///\r
/// command execution fail\r
///\r
- log("ERROR = " + Integer.toHexString(returnVal));\r
- throw new BuildException("SetStamp failed!");\r
+ EdkLog.log(this, "ERROR = " + Integer.toHexString(returnVal));\r
+ throw new BuildException(toolName + " failed!");\r
}\r
} catch (Exception e) {\r
throw new BuildException(e.getMessage());\r
@param peFile name of PE File\r
**/\r
public void setPeFile(String peFile) {\r
- this.peFile = " " + peFile;\r
+ this.peFile.setArg(" ", peFile);\r
}\r
\r
/**\r
@return peFile name of PE file\r
**/\r
public String getPeFile() {\r
- return this.peFile;\r
+ return this.peFile.getValue();\r
}\r
\r
/**\r
@param timeFile name of time file\r
**/\r
public void setTimeFile(String timeFile) {\r
- this.timeFile = " " + timeFile;\r
+ this.timeFile.setArg(" ", timeFile);\r
}\r
\r
/**\r
@returns name of time file\r
**/\r
public String getTimeFile() {\r
- return this.timeFile;\r
+ return this.timeFile.getValue();\r
}\r
\r
+ /**\r
+ getOutputDir\r
+ \r
+ This function is to get class member "outputDir"\r
+ \r
+ @return outputDir string of output directory.\r
+ **/\r
+ public String getOutputDir() {\r
+ return outputDir;\r
+ }\r
+\r
+ /**\r
+ setOutputDir\r
+ \r
+ This function is to set class member "outputDir"\r
+ \r
+ @param outputDir\r
+ string of output directory.\r
+ **/\r
+ public void setOutputDir(String outputDir) {\r
+ this.outputDir = outputDir;\r
+ }\r
}\r
file.\r
**/\r
public class SplitfileTask extends Task implements EfiDefine {\r
- ///\r
- /// input file\r
- ///\r
- private String inputFile = "";\r
-\r
- ///\r
- /// offset value\r
- ///\r
- private String offset = "";\r
-\r
+ //\r
+ // Tool name\r
+ // \r
+ private static String toolName = "SplitFile";\r
+\r
+ //\r
+ // input file\r
+ //\r
+ private FileArg inputFile = new FileArg();\r
+\r
+ //\r
+ // offset value\r
+ //\r
+ private ToolArg offset = new ToolArg();\r
+\r
+ //\r
+ // Output directory\r
+ // \r
+ private String outputDir = ".";\r
\r
/**\r
- * execute\r
- *\r
- * SplitfleTask execute function is to assemble tool command line & execute\r
- * tool command line\r
- *\r
- * @throws BuidException\r
- */\r
+ execute\r
+ \r
+ SplitfleTask execute function is to assemble tool command line & execute\r
+ tool command line\r
+ \r
+ @throws BuidException\r
+ **/\r
public void execute() throws BuildException {\r
\r
Project project = this.getOwningTarget().getProject();\r
String command;\r
String argument;\r
if (path == null) {\r
- command = "SplitFile";\r
+ command = toolName;\r
} else {\r
- command = path + File.separatorChar + "SplitFile";\r
+ command = path + File.separator + toolName;\r
}\r
\r
//\r
// argument of tools\r
//\r
- argument = inputFile + " " + offset;\r
+ argument = "" + inputFile + offset;\r
\r
//\r
// return value of fwimage execution\r
\r
runner.setAntRun(project);\r
runner.setCommandline(cmdline.getCommandline());\r
+ runner.setWorkingDirectory(new File(outputDir));\r
\r
EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
- EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.inputFile)).getName());\r
+ String fileName = inputFile.toFileList();\r
+ EdkLog.log(this, EdkLog.EDK_INFO, fileName + " => " + fileName + "1 " + fileName + "2");\r
+\r
revl = runner.execute();\r
if (EFI_SUCCESS == revl) {\r
//\r
// command execution success\r
//\r
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "SplitFile succeeded!");\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
} else {\r
//\r
// command execution fail\r
//\r
EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));\r
- throw new BuildException("SplitFile failed!");\r
+ throw new BuildException(toolName + " failed!");\r
}\r
} catch (Exception e) {\r
throw new BuildException(e.getMessage());\r
}\r
\r
/**\r
- * getInputFile\r
- *\r
- * This function is to get class member "inputFile".\r
- *\r
- * @return string of input file name.\r
- */\r
+ getInputFile\r
+ \r
+ This function is to get class member "inputFile".\r
+ \r
+ @return string of input file name.\r
+ **/\r
public String getInputFile() {\r
- return inputFile;\r
+ return inputFile.getValue();\r
}\r
\r
/**\r
- * setComponentType\r
- *\r
- * This function is to set class member "inputFile".\r
- *\r
- * @param inputFile\r
- * string of input file name.\r
- */\r
+ setComponentType\r
+ \r
+ This function is to set class member "inputFile".\r
+ \r
+ @param inputFile\r
+ string of input file name.\r
+ **/\r
public void setInputFile(String inputFile) {\r
- this.inputFile = inputFile;\r
+ this.inputFile.setArg(" ", inputFile);\r
}\r
\r
/**\r
@return offset value of string.\r
**/\r
public String getOffset() {\r
- return offset;\r
+ return offset.getValue();\r
}\r
\r
/**\r
string of offset value.\r
**/\r
public void setOffset(String offset) {\r
- this.offset = offset;\r
+ this.offset.setArg(" ", offset);\r
+ }\r
+\r
+ /**\r
+ getOutputDir\r
+ \r
+ This function is to get class member "outputDir"\r
+ \r
+ @return outputDir string of output directory.\r
+ **/\r
+ public String getOutputDir() {\r
+ return outputDir;\r
}\r
\r
+ /**\r
+ setOutputDir\r
+ \r
+ This function is to set class member "outputDir"\r
+ \r
+ @param outputDir\r
+ string of output directory.\r
+ **/\r
+ public void setOutputDir(String outputDir) {\r
+ this.outputDir = outputDir;\r
+ }\r
}\r
-outputHpk : create an HII export pack of the strings\r
**/\r
public class StrGatherTask extends Task implements EfiDefine {\r
- ///\r
- /// common options\r
- ///\r
+ //\r
+ // Tool name\r
+ // \r
+ private static String toolName = "StrGather";\r
+\r
+ //\r
+ // common options\r
+ //\r
private ToolArg commandType = new ToolArg();\r
\r
private ToolArg baseName = new ToolArg();\r
\r
- ///\r
- /// "all/read/write"\r
- ///\r
+ //\r
+ // "all/read/write"\r
+ //\r
private ToolArg verbose = new ToolArg();\r
\r
private FileArg outputDatabase = new FileArg();\r
\r
private InputFile inputFileList = new InputFile();\r
\r
- ///\r
- /// parse options newDatabase -- "ture/false" unquoteString -- "ture/false"\r
- ///\r
+ //\r
+ // parse options newDatabase -- "ture/false" unquoteString -- "ture/false"\r
+ //\r
private ToolArg newDatabase = new ToolArg();\r
\r
private ToolArg unquotedString = new ToolArg();\r
\r
private IncludePath includePathList = new IncludePath();\r
\r
- ///\r
- /// scan options ignoreNotFound -- "ture/false"\r
- ///\r
+ //\r
+ // scan options ignoreNotFound -- "ture/false"\r
+ //\r
private ToolArg ignoreNotFound = new ToolArg();\r
\r
private SkipExt skipExtList = new SkipExt();\r
\r
- ///\r
- /// dump options\r
- ///\r
+ //\r
+ // dump options\r
+ //\r
private ToolArg outputString = new ToolArg();\r
\r
private ToolArg outputDefines = new ToolArg();\r
\r
private FileArg outputHpk = new FileArg();\r
\r
- ///\r
- /// global variable\r
- ///\r
+ //\r
+ // global variable\r
+ //\r
static private Project project;\r
\r
/**\r
String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH"); \r
String command;\r
if (path == null) {\r
- command = "StrGather";\r
+ command = toolName;\r
} else {\r
- command = path + File.separator + "StrGather";\r
+ command = path + File.separator + toolName;\r
}\r
\r
///\r
\r
revl = runner.execute();\r
if (EFI_SUCCESS == revl) {\r
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "StrGather succeeded!");\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
} else {\r
///\r
/// command execution fail\r
///\r
EdkLog.log(this, "ERROR = " + Integer.toHexString(revl));\r
- throw new BuildException("StrGather failed!");\r
+ throw new BuildException(toolName + " failed!");\r
}\r
} catch (Exception e) {\r
throw new BuildException(e.getMessage());\r
StripTask is used to call Strip.exe to strip input file.\r
*/\r
public class StripTask extends Task implements EfiDefine {\r
- // /\r
- // / input file\r
- // /\r
- private String inputFile = "";\r
-\r
- // /\r
- // / output file\r
- // /\r
- private String outputFile = "";\r
-\r
- // /\r
- // / output directory, this variable is added by jave wrap\r
- // /\r
- private String outputDir = "";\r
+ //\r
+ // \r
+ // \r
+ private static String toolName = "Strip";\r
+ //\r
+ // input file\r
+ //\r
+ private FileArg inputFile = new FileArg();\r
+\r
+ //\r
+ // output file\r
+ //\r
+ private FileArg outputFile = new FileArg();\r
+\r
+ //\r
+ // output directory, this variable is added by jave wrap\r
+ //\r
+ private String outputDir = ".";\r
\r
\r
/**\r
- * execute\r
- *\r
- * StripTask execute function is to assemble tool command line & execute\r
- * tool command line\r
- *\r
- * @throws BuidException\r
- */\r
+ execute\r
+ \r
+ StripTask execute function is to assemble tool command line & execute\r
+ tool command line\r
+ \r
+ @throws BuidException\r
+ **/\r
public void execute() throws BuildException {\r
\r
Project project = this.getOwningTarget().getProject();\r
String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
String command;\r
String argument;\r
+\r
if (path == null) {\r
- command = "Strip";\r
+ command = toolName;\r
} else {\r
- command = path + File.separatorChar + "Strip";\r
+ command = path + File.separator + toolName;\r
}\r
+\r
//\r
// argument of tools\r
//\r
- File file = new File(outputFile);\r
- if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
- argument = inputFile + " " + outputDir + File.separatorChar\r
- + outputFile;\r
- } else {\r
- argument = inputFile + " " + outputFile;\r
- }\r
+ argument = "" + inputFile + outputFile;\r
+\r
//\r
// return value of fwimage execution\r
//\r
\r
runner.setAntRun(project);\r
runner.setCommandline(cmdline.getCommandline());\r
+ runner.setWorkingDirectory(new File(outputDir));\r
+\r
//\r
// Set debug log information.\r
//\r
EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
- EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.inputFile)).getName());\r
+ EdkLog.log(this, EdkLog.EDK_INFO, inputFile.toFileList() + " => " + outputFile.toFileList());\r
\r
revl = runner.execute();\r
\r
//\r
// command execution success\r
//\r
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "Strip succeeded!");\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
} else {\r
//\r
// command execution fail\r
//\r
EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));\r
- throw new BuildException("Strip failed!");\r
+ throw new BuildException(toolName + " failed!");\r
}\r
} catch (Exception e) {\r
throw new BuildException(e.getMessage());\r
}\r
\r
/**\r
- * getInputFile\r
- *\r
- * This function is to get class member "inputFile".\r
- *\r
- * @return string of input file name.\r
- */\r
+ getInputFile\r
+ \r
+ This function is to get class member "inputFile".\r
+ \r
+ @return string of input file name.\r
+ **/\r
public String getInputFile() {\r
- return inputFile;\r
+ return inputFile.getValue();\r
}\r
\r
/**\r
- * setComponentType\r
- *\r
- * This function is to set class member "inputFile".\r
- *\r
- * @param inputFile\r
- * string of input file name.\r
- */\r
+ setComponentType\r
+ \r
+ This function is to set class member "inputFile".\r
+ \r
+ @param inputFile\r
+ string of input file name.\r
+ **/\r
public void setInputFile(String inputFile) {\r
- this.inputFile = inputFile;\r
+ this.inputFile.setArg(" ", inputFile);\r
}\r
\r
/**\r
- * getOutputFile\r
- *\r
- * This function is to get class member "outputFile"\r
- *\r
- * @return outputFile string of output file name.\r
- */\r
+ getOutputFile\r
+ \r
+ This function is to get class member "outputFile"\r
+ \r
+ @return outputFile string of output file name.\r
+ **/\r
public String getOutputFile() {\r
- return outputFile;\r
+ return outputFile.getValue();\r
}\r
\r
/**\r
- * setOutputFile\r
- *\r
- * This function is to set class member "outputFile"\r
- *\r
- * @param outputFile\r
- * string of output file name.\r
- */\r
+ setOutputFile\r
+ \r
+ This function is to set class member "outputFile"\r
+ \r
+ @param outputFile\r
+ string of output file name.\r
+ **/\r
public void setOutputFile(String outputFile) {\r
- this.outputFile = outputFile;\r
+ this.outputFile.setArg(" ", outputFile);\r
}\r
\r
/**\r
- * getOutputDir\r
- *\r
- * This function is to get class member "outputDir"\r
- *\r
- * @return outputDir string of output directory.\r
- */\r
+ getOutputDir\r
+ \r
+ This function is to get class member "outputDir"\r
+ \r
+ @return outputDir string of output directory.\r
+ **/\r
public String getOutputDir() {\r
return outputDir;\r
}\r
\r
/**\r
- * setOutputDir\r
- *\r
- * This function is to set class member "outputDir"\r
- *\r
- * @param outputDir\r
- * string of output directory.\r
- */\r
+ setOutputDir\r
+ \r
+ This function is to set class member "outputDir"\r
+ \r
+ @param outputDir\r
+ string of output directory.\r
+ **/\r
public void setOutputDir(String outputDir) {\r
this.outputDir = outputDir;\r
}\r
try {\r
executeTool ();\r
} catch (Exception e) {\r
- throw new BuildException("Call to executeTool failed!\n");\r
+ throw new BuildException("Call to executeTool failed!\n" + e.getMessage());\r
}\r
\r
///\r
buffer.writeByte(0);\r
}\r
} catch (Exception e) {\r
- System.out.print(e.getMessage());\r
+ EdkLog.log(e.getMessage());\r
throw new BuildException("Tool call, toBuffer failed!\n");\r
} finally {\r
try {\r
fs.close();\r
}\r
} catch (Exception e) {\r
- System.out.println("WARNING: Cannot close " + outputFile.getPath());\r
+ EdkLog.log("WARNING: Cannot close " + outputFile.getPath());\r
}\r
}\r
}\r
sect.toBuffer(Do);\r
}\r
catch (BuildException e) {\r
- System.out.print(e.getMessage());\r
+ EdkLog.log(e.getMessage());\r
throw new BuildException ("GenSection failed at Tool!");\r
} \r
Do.close();\r
Process process = Runtime.getRuntime().exec(command + " " + argument);\r
process.waitFor();\r
} catch (Exception e) {\r
- System.out.print (e.getMessage());\r
+ EdkLog.log(e.getMessage());\r
throw new BuildException("Execution of externalTool task failed!\n");\r
}\r
}\r
ZeroDebugDataTask is used to call ZeroDebugData.exe to remove debug data.\r
**/\r
public class ZeroDebugDataTask extends Task implements EfiDefine {\r
- // /\r
- // / input PE file\r
- // /\r
- private String peFile = "";\r
-\r
- // /\r
- // / output file\r
- // /\r
- private String outputFile = "DebugData.dat";\r
-\r
- // /\r
- // / output directory, this variable is added by jave wrap\r
- // /\r
- private String outputDir = "";\r
+ //\r
+ // Tool name\r
+ // \r
+ private static String toolName = "ZeroDebugData";\r
+ //\r
+ // input PE file\r
+ //\r
+ private FileArg peFile = new FileArg();\r
+\r
+ //\r
+ // output file\r
+ //\r
+ private FileArg outputFile = new FileArg(" ", "DebugData.dat");\r
+\r
+ //\r
+ // output directory, this variable is added by jave wrap\r
+ //\r
+ private String outputDir = ".";\r
\r
\r
/**\r
- * execute\r
- *\r
- * ZeroDebugDataTask execute function is to assemble tool command line & execute\r
- * tool command line\r
- *\r
- * @throws BuidException\r
- */\r
+ execute\r
+ \r
+ ZeroDebugDataTask execute function is to assemble tool command line & execute\r
+ tool command line\r
+ \r
+ @throws BuidException\r
+ **/\r
public void execute() throws BuildException {\r
\r
Project project = this.getOwningTarget().getProject();\r
String command;\r
String argument;\r
if (path == null) {\r
- command = "ZeroDebugData";\r
+ command = toolName;\r
} else {\r
- command = path + File.separatorChar + "ZeroDebugData";\r
+ command = path + File.separatorChar + toolName;\r
}\r
+\r
//\r
// argument of tools\r
//\r
- File file = new File(outputFile);\r
- if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
- argument = this.peFile + " " + outputDir + File.separatorChar\r
- + outputFile;\r
- } else {\r
- argument = this.peFile + " " + outputFile;\r
- }\r
+ argument = "" + peFile + outputFile;\r
+\r
//\r
// return value of fwimage execution\r
//\r
\r
runner.setAntRun(project);\r
runner.setCommandline(cmdline.getCommandline());\r
+ runner.setWorkingDirectory(new File(outputDir)); \r
//\r
// Set debug log information.\r
//\r
EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
- EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.peFile)).getName());\r
+ EdkLog.log(this, EdkLog.EDK_INFO, peFile.toFileList() + " => " + outputFile.toFileList());\r
\r
revl = runner.execute();\r
\r
//\r
EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));\r
throw new BuildException("ZeroDebugData failed!");\r
-\r
}\r
} catch (Exception e) {\r
throw new BuildException(e.getMessage());\r
}\r
\r
/**\r
- * getPeFile\r
- *\r
- * This function is to get class member "inputFile".\r
- *\r
- * @return string of input file name.\r
- */\r
+ getPeFile\r
+ \r
+ This function is to get class member "inputFile".\r
+ \r
+ @return string of input file name.\r
+ **/\r
public String getPeFile() {\r
- return this.peFile;\r
+ return this.peFile.getValue();\r
}\r
\r
/**\r
- * setPeFile\r
- *\r
- * This function is to set class member "peFile".\r
- *\r
- * @param peFile\r
- * string of input file name.\r
- */\r
+ setPeFile\r
+ \r
+ This function is to set class member "peFile".\r
+ \r
+ @param peFile\r
+ string of input file name.\r
+ **/\r
public void setPeFile(String peFile) {\r
- this.peFile = peFile;\r
+ this.peFile.setArg(" ", peFile);\r
}\r
\r
/**\r
- * getOutputFile\r
- *\r
- * This function is to get class member "outputFile"\r
- *\r
- * @return outputFile string of output file name.\r
- */\r
+ getOutputFile\r
+ \r
+ This function is to get class member "outputFile"\r
+ \r
+ @return outputFile string of output file name.\r
+ **/\r
public String getOutputFile() {\r
- return outputFile;\r
+ return this.outputFile.getValue();\r
}\r
\r
/**\r
- * setOutputFile\r
- *\r
- * This function is to set class member "outputFile"\r
- *\r
- * @param outputFile\r
- * string of output file name.\r
- */\r
+ setOutputFile\r
+ \r
+ This function is to set class member "outputFile"\r
+ \r
+ @param outputFile\r
+ string of output file name.\r
+ **/\r
public void setOutputFile(String outputFile) {\r
- this.outputFile = outputFile;\r
+ this.outputFile.setArg(" ", outputFile);\r
}\r
\r
/**\r
- * getOutputDir\r
- *\r
- * This function is to get class member "outputDir"\r
- *\r
- * @return outputDir string of output directory.\r
- */\r
+ getOutputDir\r
+ \r
+ This function is to get class member "outputDir"\r
+ \r
+ @return outputDir string of output directory.\r
+ **/\r
public String getOutputDir() {\r
return outputDir;\r
}\r
\r
/**\r
- * setOutputDir\r
- *\r
- * This function is to set class member "outputDir"\r
- *\r
- * @param outputDir\r
- * string of output directory.\r
- */\r
+ setOutputDir\r
+ \r
+ This function is to set class member "outputDir"\r
+ \r
+ @param outputDir\r
+ string of output directory.\r
+ **/\r
public void setOutputDir(String outputDir) {\r
this.outputDir = outputDir;\r
}\r
\r
import org.apache.tools.ant.types.DataType;\r
import org.apache.tools.ant.types.Path;\r
+import org.apache.tools.ant.BuildException;\r
\r
import java.io.File;\r
import java.io.FileReader;\r
lineReader.close();\r
fileReader.close();\r
} catch (IOException e) {\r
- System.out.println (e.getMessage());\r
+ throw new BuildException(e.getMessage());\r
}\r
}\r
\r
\r
@return String[][] The variables defined in the config file\r
\r
- @throws EdkException\r
+ @throws GenBuildException\r
Config file's format is not valid\r
**/\r
public static synchronized String[][] parse(File configFile) throws GenBuildException {\r
// \r
int index;\r
if ((index = str.indexOf('=')) <= 0) {\r
- throw new GenBuildException("ERROR Processing file [" + configFile.getAbsolutePath() \r
+ throw new GenBuildException("ERROR Processing file [" \r
+ + configFile.getAbsolutePath() \r
+ "] (line " + lines + ").\n");\r
}\r
\r
keyList.add(str.substring(0, index).trim());\r
valueList.add(str.substring(index + 1).trim());\r
}\r
- } catch (Exception e) {\r
- throw new GenBuildException("ERROR Processing file [" + configFile.getAbsolutePath() \r
- + "] (line " + lines + ").\n" + e.getMessage());\r
+ } catch (Exception ex) {\r
+ GenBuildException e = new GenBuildException("ERROR Processing file [" \r
+ + configFile.getAbsolutePath() \r
+ + "] (line " + lines + ").\n" + ex.getMessage());\r
+ e.setStackTrace(ex.getStackTrace());\r
+ throw e;\r
}\r
\r
String[][] definitions = new String[2][keyList.size()];\r