]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SecApResetVectorFixupTask.java
1) Applied ToolArg and FileArg class to represent tool arguments
[mirror_edk2.git] / Tools / Source / FrameworkTasks / org / tianocore / framework / tasks / SecApResetVectorFixupTask.java
index 1bcfacf2f0d5c73fd6e20047de10d5b0b3c4a301..310cb6a81449178b526c311268e16301193783c4 100644 (file)
@@ -35,34 +35,34 @@ import org.tianocore.common.logger.EdkLog;
   Ap reset vector.\r
 **/\r
 public class SecApResetVectorFixupTask extends Task implements EfiDefine {\r
-    ///\r
-    /// tool name\r
-    ///\r
+    //\r
+    // tool name\r
+    //\r
     private String toolName = "SecApResetVectorFixup";\r
-    // /\r
-    // input FV recovery file\r
-    // /\r
-    private String fvInputFile = "";\r
+    //\r
+    // input FV recovery file\r
+    //\r
+    private FileArg fvInputFile = new FileArg();\r
 \r
-    // /\r
-    // output file\r
-    // /\r
-    private String fvOutputFile = "";\r
+    //\r
+    // output file\r
+    //\r
+    private FileArg fvOutputFile = new FileArg();\r
 \r
-    // /\r
-    // output directory, this variable is added by jave wrap\r
-    // /\r
-    private String outputDir = "";\r
+    //\r
+    // output directory, this variable is added by jave wrap\r
+    //\r
+    private String outputDir = ".";\r
 \r
 \r
     /**\r
-     * execute\r
-     *\r
-     * SecApResetVectorFixupTask execute function is to assemble tool command line & execute\r
-     * tool command line\r
-     *\r
-     * @throws BuidException\r
-     */\r
+      execute\r
+     \r
+      SecApResetVectorFixupTask execute function is to assemble tool command line & execute\r
+      tool command line\r
+     \r
+      @throws BuidException\r
+     **/\r
     public void execute() throws BuildException {\r
 \r
         Project project = this.getOwningTarget().getProject();\r
@@ -75,18 +75,12 @@ public class SecApResetVectorFixupTask extends Task implements EfiDefine {
         if (path == null) {\r
             command = toolName;\r
         } else {\r
-            command = path + File.separatorChar + toolName;\r
+            command = path + File.separator + toolName;\r
         }\r
         //\r
         // argument of tools\r
         //\r
-        File file = new File(this.fvOutputFile);\r
-        if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
-            argument = this.fvInputFile + " " + outputDir + File.separatorChar\r
-                    + this.fvOutputFile;\r
-        } else {\r
-            argument = this.fvInputFile + " " + this.fvOutputFile;\r
-        }\r
+        argument = "" + this.fvInputFile + this.fvOutputFile;\r
         //\r
         // return value of fwimage execution\r
         //\r
@@ -103,11 +97,14 @@ public class SecApResetVectorFixupTask extends Task implements EfiDefine {
 \r
             runner.setAntRun(project);\r
             runner.setCommandline(cmdline.getCommandline());\r
+            runner.setWorkingDirectory(new File(outputDir));\r
+\r
             //\r
             // Set debug log information.\r
             //\r
             EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
-            EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.fvInputFile)).getName());\r
+            EdkLog.log(this, EdkLog.EDK_INFO, this.fvInputFile.toFileList() \r
+                + " => " + this.fvOutputFile.toFileList());\r
 \r
             revl = runner.execute();\r
 \r
@@ -115,13 +112,13 @@ public class SecApResetVectorFixupTask extends Task implements EfiDefine {
                 //\r
                 // command execution success\r
                 //\r
-                EdkLog.log(this, EdkLog.EDK_VERBOSE, "SecApResetVectorFixup succeeded!");\r
+                EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
             } else {\r
                 //\r
                 // command execution fail\r
                 //\r
                 EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));\r
-                throw new BuildException("SecApResetVectorFixup failed!");\r
+                throw new BuildException(toolName + " failed!");\r
             }\r
         } catch (Exception e) {\r
             throw new BuildException(e.getMessage());\r
@@ -129,70 +126,70 @@ public class SecApResetVectorFixupTask extends Task implements EfiDefine {
     }\r
 \r
     /**\r
-     * getInputFile\r
-     *\r
-     * This function is to get class member "fvInputFile".\r
-     *\r
-     * @return string of input file name.\r
-     */\r
+      getInputFile\r
+     \r
+      This function is to get class member "fvInputFile".\r
+     \r
+      @return string of input file name.\r
+     **/\r
     public String getfvInputFile() {\r
-        return this.fvInputFile;\r
+        return this.fvInputFile.getValue();\r
     }\r
 \r
     /**\r
-     * setComponentType\r
-     *\r
-     * This function is to set class member "fvInputFile".\r
-     *\r
-     * @param inputFile\r
-     *            string of input file name.\r
-     */\r
+      setComponentType\r
+     \r
+      This function is to set class member "fvInputFile".\r
+     \r
+      @param inputFile\r
+                 string of input file name.\r
+     **/\r
     public void setFvInputFile(String inputFile) {\r
-        this.fvInputFile = inputFile;\r
+        this.fvInputFile.setArg(" ", inputFile);\r
     }\r
 \r
     /**\r
-     * getOutputFile\r
-     *\r
-     * This function is to get class member "fvOutputFile"\r
-     *\r
-     * @return outputFile string of output file name.\r
-     */\r
+      getOutputFile\r
+     \r
+      This function is to get class member "fvOutputFile"\r
+     \r
+      @return outputFile string of output file name.\r
+     **/\r
     public String getOutputFile() {\r
-        return this.fvOutputFile;\r
+        return this.fvOutputFile.getValue();\r
     }\r
 \r
     /**\r
-     * setOutputFile\r
-     *\r
-     * This function is to set class member "fvOutputFile"\r
-     *\r
-     * @param outputFile\r
-     *            string of output file name.\r
-     */\r
+      setOutputFile\r
+     \r
+      This function is to set class member "fvOutputFile"\r
+     \r
+      @param outputFile\r
+                 string of output file name.\r
+     **/\r
     public void setFvOutputFile(String outputFile) {\r
-        this.fvOutputFile = outputFile;\r
+        this.fvOutputFile.setArg(" ", outputFile);\r
     }\r
 \r
     /**\r
-     * getOutputDir\r
-     *\r
-     * This function is to get class member "outputDir"\r
-     *\r
-     * @return outputDir string of output directory.\r
-     */\r
+      getOutputDir\r
+     \r
+      This function is to get class member "outputDir"\r
+     \r
+      @return outputDir string of output directory.\r
+     **/\r
     public String getOutputDir() {\r
         return outputDir;\r
     }\r
 \r
     /**\r
-     * setOutputDir\r
-     *\r
-     * This function is to set class member "outputDir"\r
-     *\r
-     * @param outputDir\r
-     *            string of output directory.\r
-     */\r
+      setOutputDir\r
+     \r
+      This function is to set class member "outputDir"\r
+     \r
+      @param outputDir\r
+                 string of output directory.\r
+     **/\r
     public void setOutputDir(String outputDir) {\r
         this.outputDir = outputDir;\r
     }\r