\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.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
GenDepexTask\r
\r
\r
**/\r
public class GenDepexTask extends Task implements EfiDefine {\r
- ///\r
- /// output binary dependency files name\r
- ///\r
- private String outputFile = "";\r
- ///\r
- /// input pre-processed dependency text files name\r
- ///\r
- private String inputFile = "";\r
- private String inputFileName = "";\r
- ///\r
- /// padding integer value\r
- ///\r
- private String padding = "";\r
+ private static String toolName = "GenDepex";\r
+ //\r
+ // output binary dependency files name\r
+ //\r
+ private FileArg outputFile = new FileArg();\r
+ //\r
+ // input pre-processed dependency text files name\r
+ //\r
+ private FileArg inputFile = new FileArg();\r
+ //\r
+ // padding integer value\r
+ //\r
+ private ToolArg padding = new FileArg();\r
/**\r
execute\r
\r
String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
String command;\r
if (path == null) {\r
- command = "GenDepex";\r
+ command = toolName;\r
} else {\r
- command = path + "/" + "GenDepex";\r
+ command = path + File.separator + toolName;\r
}\r
//\r
// argument of GenDepex tool\r
//\r
- String argument = inputFile + outputFile + padding;\r
+ String argument = "" + inputFile + outputFile + padding;\r
//\r
// reture value of GenDepex execution\r
//\r
runner.setAntRun(project);\r
runner.setCommandline(commandLine.getCommandline());\r
\r
- log(Commandline.toString(commandLine.getCommandline()), Project.MSG_VERBOSE);\r
- log(inputFileName);\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(commandLine.getCommandline()));\r
+ EdkLog.log(this, inputFile.toFileList() + " => " + outputFile.toFileList());\r
+\r
returnVal = runner.execute();\r
if (EFI_SUCCESS == returnVal) {\r
- log("GenDepex succeeded!", Project.MSG_VERBOSE);\r
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, "GenDepex succeeded!");\r
} else {\r
//\r
// command execution fail\r
//\r
- log("ERROR = " + Integer.toHexString(returnVal));\r
+ EdkLog.log(this, "ERROR = " + Integer.toHexString(returnVal));\r
throw new BuildException("GenDepex failed!");\r
}\r
} catch (Exception e) {\r
@param outputFileName name of output file\r
**/\r
public void setOutputFile(String outputFileName) {\r
- this.outputFile = " -O " + outputFileName;\r
+ this.outputFile.setArg(" -O ", outputFileName);\r
}\r
\r
/**\r
@return name of ouput file\r
**/\r
public String getOutputFile() {\r
- return this.outputFile;\r
+ return this.outputFile.getValue();\r
}\r
\r
/**\r
@param inputFileName name of inputFile\r
**/\r
public void setInputFile(String inputFileName) {\r
- this.inputFileName = (new File(inputFileName)).getName();\r
- this.inputFile = " -I " + inputFileName;\r
+ this.inputFile.setArg(" -I ", inputFileName);\r
}\r
\r
/**\r
@return name of input file\r
**/\r
public String getInputFile() {\r
- return this.inputFile;\r
+ return this.inputFile.getValue();\r
}\r
\r
/**\r
@param paddingNum padding value\r
**/\r
public void setPadding(String paddingNum) {\r
- this.padding = " -P " + paddingNum;\r
+ this.padding.setArg(" -P ", paddingNum);\r
}\r
\r
/**\r
@return value of padding\r
**/\r
public String getPadding() {\r
- return this.padding;\r
+ return this.padding.getValue();\r
}\r
}\r