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