**/\r
package org.tianocore.framework.tasks;\r
\r
+import java.io.File;\r
import java.io.IOException;\r
import java.util.ArrayList;\r
import java.util.List;\r
public class VfrCompilerTask extends Task implements EfiDefine {\r
private String createListFile = "";\r
private String outPutDir = "";\r
+ private File outPutFile;\r
private String createIfrBinFile = "";\r
private String processerArg ="";\r
- private String vfrFile;\r
+ private String vfrFile = "";\r
+ private String vfrFileName = "";\r
\r
private List<Object> includepathList = new ArrayList<Object>();\r
\r
@param outPutDir The directory name for ouput file\r
**/\r
public void setOutPutDir(String outPutDir) {\r
+ if (outPutDir != null) {\r
+ outPutFile = new File(outPutDir);\r
+ }\r
this.outPutDir = " -od " + outPutDir;\r
}\r
\r
@param vfrFile The name of VFR file\r
**/\r
public void setVfrFile(String vfrFile) {\r
+ this.vfrFileName = (new File(vfrFile)).getName();\r
this.vfrFile = " " + vfrFile;\r
}\r
\r
**/\r
public void execute() throws BuildException {\r
Project project = this.getProject();\r
- String toolPath= project.getProperty("env.Framework_Tools_Path");\r
+ String toolPath= project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
String command;\r
if (toolPath == null) {\r
command = "VfrCompile";\r
\r
Execute runner = new Execute(streamHandler,null);\r
runner.setAntRun(project);\r
+ \r
runner.setCommandline(commandLine.getCommandline());\r
+ \r
+ if (outPutFile != null && outPutFile.exists()) {\r
+ runner.setWorkingDirectory(outPutFile); \r
+ }\r
\r
- System.out.println(Commandline.toString(commandLine.getCommandline())); \r
+ log(Commandline.toString(commandLine.getCommandline()), Project.MSG_VERBOSE);\r
+ log(vfrFileName);\r
int returnVal = runner.execute();\r
if (EFI_SUCCESS == returnVal) {\r
- System.out.println("VfrCompiler execution succeeded!");\r
+ log("VfrCompile succeeded!", Project.MSG_VERBOSE);\r
} else {\r
- System.out.println("VfrCompiler failed. (error=" + \r
- Integer.toHexString(returnVal) + ")"); \r
- throw new BuildException("VfrCompiler failed. (error=" + \r
- Integer.toHexString(returnVal) + ")");\r
+ log("ERROR = " + Integer.toHexString(returnVal));\r
+ throw new BuildException("VfrCompile failed!");\r
}\r
-\r
} catch (IOException e) {\r
throw new BuildException(e.getMessage());\r
}\r
}\r
-}
\ No newline at end of file
+}\r