\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