]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/VfrCompilerTask.java
Fix cleanall can't clean all genereated files. Now .i files generated by VfrCompile...
[mirror_edk2.git] / Tools / Source / FrameworkTasks / org / tianocore / framework / tasks / VfrCompilerTask.java
index cf2fe1e476218eb85e0bae4a07f5b9da9cecb7dd..3d940cb29762e313b03c23149b03a3f1e69a060e 100644 (file)
@@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\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
@@ -37,9 +38,11 @@ import org.apache.tools.ant.types.Commandline;
 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
@@ -77,6 +80,9 @@ public class VfrCompilerTask extends Task implements EfiDefine {
      @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
@@ -116,6 +122,7 @@ public class VfrCompilerTask extends Task implements EfiDefine {
      @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
@@ -201,21 +208,24 @@ public class VfrCompilerTask extends Task implements EfiDefine {
 \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