]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/VfrCompilerTask.java
Fixed the issue caused by introducing INCLUDE_PATH property;
[mirror_edk2.git] / Tools / Source / FrameworkTasks / org / tianocore / framework / tasks / VfrCompilerTask.java
index 8d3a22dd17009547f8e56efe6671f008a50d873e..d99f2399dc082ac5f2e15943a8b9ce4417e0e95f 100644 (file)
@@ -38,12 +38,13 @@ 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 vfrFileName = "";\r
 \r
-    private List<Object> includepathList = new ArrayList<Object>();\r
+    private List<IncludePath> includepathList = new ArrayList<IncludePath>();\r
 \r
     /**\r
      get class member of createList file\r
@@ -79,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
@@ -166,21 +170,11 @@ public class VfrCompilerTask extends Task implements EfiDefine {
         List<Object> includePath = new ArrayList<Object>();     \r
         String incPath = "";        \r
 \r
-        int  count = includepathList.size();    \r
-        IncludePath path;\r
-        for (int i = 0; i < count; i++) {\r
-            path = (IncludePath) includepathList.get(i);\r
-            if (path.getFile() != null) {\r
-                FileParser.loadFile( project,includePath,path.getFile(), "-I");             \r
-            }\r
-        }\r
+        int count = includepathList.size();    \r
         for (int i = 0; i < count; i++) {\r
-            incPath = incPath + " " + includepathList.get(i);\r
-        }\r
-        count =  includePath.size();\r
-        for (int i = 0; i < count; i++) {\r
-            incPath = incPath + " " + includePath.get(i);\r
+            incPath += includepathList.get(i).toString();\r
         }\r
+\r
         String argument = this.createIfrBinFile +\r
                           this.processerArg + \r
                           incPath +\r
@@ -204,19 +198,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
             log(Commandline.toString(commandLine.getCommandline()), Project.MSG_VERBOSE);\r
             log(vfrFileName);\r
             int returnVal = runner.execute();\r
             if (EFI_SUCCESS == returnVal) {\r
-                log("VfrCompiler succeeded!", Project.MSG_VERBOSE);\r
+                log("VfrCompile succeeded!", Project.MSG_VERBOSE);\r
             } else {\r
                 log("ERROR = " + Integer.toHexString(returnVal));\r
-                throw new BuildException("VfrCompiler failed!");\r
+                throw new BuildException("VfrCompile failed!");\r
             }\r
         } catch (IOException e) {\r
             throw new BuildException(e.getMessage());\r
         }\r
     }\r
-}
\ No newline at end of file
+}\r