]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1) Applied ToolArg and FileArg class to represent tool arguments
authorjwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 14 Sep 2006 08:35:38 +0000 (08:35 +0000)
committerjwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 14 Sep 2006 08:35:38 +0000 (08:35 +0000)
2) Unified the tool output message and exception handling
3) Cleaned the coding style
4) Removed used code

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1535 6f19259b-4bc3-4df7-8a09-765794883524

23 files changed:
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/CreateMtFileTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiCompressTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiRomTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FileParser.java [deleted file]
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FwImageTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenAcpiTableTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCRC32SectionTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCapsuleHdrTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenSectionTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenTeImageTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GuidChkTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/ModifyInfTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SecApResetVectorFixupTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SecFixupTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SetStampTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SplitfileTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/StrGatherTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/StripTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/ZeroDebugDataTask.java
Tools/Source/GenBuild/org/tianocore/build/global/DpFile.java
Tools/Source/GenBuild/org/tianocore/build/toolchain/ConfigReader.java

index 672e712b3e91d43d1001a9466d6e4f826888f476..bdc492c0dc7d54d92f8cbc7809bfd121752516fc 100644 (file)
@@ -33,33 +33,33 @@ import org.tianocore.common.logger.EdkLog;
   CreateMtFileTask is used to call CreateMtFile.exe to create MT file.\r
 **/\r
 public class CreateMtFileTask extends Task implements EfiDefine {\r
-    ///\r
-    /// Tool name\r
-    ///\r
-    private String toolName="CreateMtFile";\r
-    ///\r
-    /// file size\r
-    ///\r
-    private String fileSize = "";\r
-\r
-    ///\r
-    /// output file\r
-    ///\r
-    private String outputFile = "";\r
-\r
-    ///\r
-    /// output directory, this variable is added by jave wrap\r
-    ///\r
-    private String outputDir = "";\r
+    //\r
+    // Tool name\r
+    //\r
+    private String toolName = "CreateMtFile";\r
+    //\r
+    // file size\r
+    //\r
+    private ToolArg fileSize = new ToolArg();\r
+\r
+    //\r
+    // output file\r
+    //\r
+    private FileArg outputFile = new FileArg();\r
+\r
+    //\r
+    // output directory, this variable is added by jave wrap\r
+    //\r
+    private String outputDir = ".";\r
 \r
     /**\r
-     * execute\r
-     *\r
-     * StripTask execute function is to assemble tool command line & execute\r
-     * tool command line\r
-     *\r
-     * @throws BuidException\r
-     */\r
+      execute\r
+     \r
+      StripTask 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
@@ -73,18 +73,12 @@ public class CreateMtFileTask 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(outputFile);\r
-        if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
-            argument = outputDir + File.separatorChar +  outputFile + " " + this.fileSize;\r
-\r
-        } else {\r
-            argument = outputFile  + " " + this.fileSize;\r
-        }\r
+        argument = "" + outputFile + fileSize;\r
         //\r
         // return value of fwimage execution\r
         //\r
@@ -101,24 +95,26 @@ public class CreateMtFileTask 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.outputFile)).getName());\r
-            revl = runner.execute();\r
+            EdkLog.log(this, EdkLog.EDK_INFO, this.outputFile.toFileList());\r
 \r
+            revl = runner.execute();\r
             if (EFI_SUCCESS == revl) {\r
                 //\r
                 // command execution success\r
                 //\r
-                EdkLog.log(this, EdkLog.EDK_VERBOSE, "CreateMtFile 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("CreateMtFile failed!");\r
+                throw new BuildException(toolName + " failed!");\r
             }\r
         } catch (Exception e) {\r
             throw new BuildException(e.getMessage());\r
@@ -126,70 +122,70 @@ public class CreateMtFileTask extends Task implements EfiDefine {
     }\r
 \r
     /**\r
-     * getFileSize\r
-     *\r
-     * This function is to get class member "fileSize".\r
-     *\r
-     * @return fileSize       string of file size.\r
-     */\r
+      getFileSize\r
+     \r
+      This function is to get class member "fileSize".\r
+     \r
+      @return fileSize       string of file size.\r
+     **/\r
     public String getFileSize() {\r
-        return this.fileSize;\r
+        return this.fileSize.getValue();\r
     }\r
 \r
     /**\r
-     * setFileSize\r
-     *\r
-     * This function is to set class member "fileSize".\r
-     *\r
-     * @param fileSize\r
-     *            string of file size value.\r
-     */\r
+      setFileSize\r
+     \r
+      This function is to set class member "fileSize".\r
+     \r
+      @param fileSize\r
+                 string of file size value.\r
+     **/\r
     public void setFileSize(String fileSize) {\r
-        this.fileSize = fileSize;\r
+        this.fileSize.setArg(" ", fileSize);\r
     }\r
 \r
     /**\r
-     * getOutputFile\r
-     *\r
-     * This function is to get class member "outputFile"\r
-     *\r
-     * @return outputFile string of output file name.\r
-     */\r
+      getOutputFile\r
+     \r
+      This function is to get class member "outputFile"\r
+     \r
+      @return outputFile string of output file name.\r
+     **/\r
     public String getOutputFile() {\r
-        return outputFile;\r
+        return outputFile.getValue();\r
     }\r
 \r
     /**\r
-     * setOutputFile\r
-     *\r
-     * This function is to set class member "outputFile"\r
-     *\r
-     * @param outputFile\r
-     *            string of output file name.\r
-     */\r
+      setOutputFile\r
+     \r
+      This function is to set class member "outputFile"\r
+     \r
+      @param outputFile\r
+                 string of output file name.\r
+     **/\r
     public void setOutputFile(String outputFile) {\r
-        this.outputFile = outputFile;\r
+        this.outputFile.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
index 0f82002bb503a9bbbc9cec73bdfbe9be172b2241..1ffd61f0158303ffa4cb8ecc4a78b4c15d8694ca 100644 (file)
@@ -33,29 +33,33 @@ import org.tianocore.common.logger.EdkLog;
   EfiCompressTask is used to call EfiCompress.exe to strip input file.\r
 **/\r
 public class EfiCompressTask extends Task implements EfiDefine {\r
-    // /\r
-    // / input file\r
-    // /\r
-    private String inputFile = "";\r
-\r
-    // /\r
-    // / output file\r
-    // /\r
-    private String outputFile = "";\r
-\r
-    // /\r
-    // / output directory, this variable is added by jave wrap\r
-    // /\r
-    private String outputDir = "";\r
+    //\r
+    // \r
+    // \r
+    private final static String toolName = "EfiCompress";\r
+    //\r
+    // input file\r
+    //\r
+    private FileArg inputFile = new FileArg();\r
+\r
+    //\r
+    // output file\r
+    //\r
+    private FileArg outputFile = new FileArg();\r
+\r
+    //\r
+    // output directory, this variable is added by jave wrap\r
+    //\r
+    private String outputDir = ".";\r
 \r
     /**\r
-     * execute\r
-     *\r
-     * EfiCompressTask execute function is to assemble tool command line & execute\r
-     * tool command line\r
-     *\r
-     * @throws BuidException\r
-     */\r
+      execute\r
+     \r
+      EfiCompressTask 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
@@ -67,20 +71,14 @@ public class EfiCompressTask extends Task implements EfiDefine {
         String command;\r
         String argument;\r
         if (path == null) {\r
-            command = "EfiCompress";\r
+            command = toolName;\r
         } else {\r
-            command = path + File.separatorChar + "EfiCompress";\r
+            command = path + File.separator + toolName;\r
         }\r
         //\r
         // argument of tools\r
         //\r
-        File file = new File(outputFile);\r
-        if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
-            argument = inputFile + " " + outputDir + File.separatorChar\r
-                    + outputFile;\r
-        } else {\r
-            argument = inputFile + " " + outputFile;\r
-        }\r
+        argument = "" + inputFile + outputFile;\r
         //\r
         // return value of fwimage execution\r
         //\r
@@ -97,25 +95,27 @@ public class EfiCompressTask 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.inputFile)).getName());\r
+            EdkLog.log(this, EdkLog.EDK_INFO, this.inputFile.toFileList() + " => "\r
+                                              + this.outputFile.toFileList());\r
 \r
             revl = runner.execute();\r
-\r
             if (EFI_SUCCESS == revl) {\r
                 //\r
                 // command execution success\r
                 //\r
-                EdkLog.log(this, EdkLog.EDK_VERBOSE, "EfiCompress 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("EfiCompress failed!");\r
+                throw new BuildException(toolName + " failed!");\r
 \r
             }\r
         } catch (Exception e) {\r
@@ -124,70 +124,70 @@ public class EfiCompressTask extends Task implements EfiDefine {
     }\r
 \r
     /**\r
-     * getInputFile\r
-     *\r
-     * This function is to get class member "inputFile".\r
-     *\r
-     * @return string of input file name.\r
-     */\r
+      getInputFile\r
+     \r
+      This function is to get class member "inputFile".\r
+     \r
+      @return string of input file name.\r
+     **/\r
     public String getInputFile() {\r
-        return inputFile;\r
+        return inputFile.getValue();\r
     }\r
 \r
     /**\r
-     * setComponentType\r
-     *\r
-     * This function is to set class member "inputFile".\r
-     *\r
-     * @param inputFile\r
-     *            string of input file name.\r
-     */\r
+      setComponentType\r
+     \r
+      This function is to set class member "inputFile".\r
+     \r
+      @param inputFile\r
+                 string of input file name.\r
+     **/\r
     public void setInputFile(String inputFile) {\r
-        this.inputFile = inputFile;\r
+        this.inputFile.setArg(" ", inputFile);\r
     }\r
 \r
     /**\r
-     * getOutputFile\r
-     *\r
-     * This function is to get class member "outputFile"\r
-     *\r
-     * @return outputFile string of output file name.\r
-     */\r
+      getOutputFile\r
+     \r
+      This function is to get class member "outputFile"\r
+     \r
+      @return outputFile string of output file name.\r
+     **/\r
     public String getOutputFile() {\r
-        return outputFile;\r
+        return outputFile.getValue();\r
     }\r
 \r
     /**\r
-     * setOutputFile\r
-     *\r
-     * This function is to set class member "outputFile"\r
-     *\r
-     * @param outputFile\r
-     *            string of output file name.\r
-     */\r
+      setOutputFile\r
+     \r
+      This function is to set class member "outputFile"\r
+     \r
+      @param outputFile\r
+                 string of output file name.\r
+     **/\r
     public void setOutputFile(String outputFile) {\r
-        this.outputFile = outputFile;\r
+        this.outputFile.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
index 7eb987854a2e4ad2dc8d3639ce2ce9ec9804e55e..caa77477adfc16f6e0286081746a0acb2563a93a 100644 (file)
@@ -23,92 +23,95 @@ import java.util.Iterator;
 import java.util.LinkedList;\r
 import java.util.List;\r
 \r
-import org.apache.tools.ant.Task;\r
-import org.apache.tools.ant.Project;\r
 import org.apache.tools.ant.BuildException;\r
-\r
+import org.apache.tools.ant.Project;\r
+import org.apache.tools.ant.Task;\r
 import org.tianocore.common.logger.EdkLog;\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 com.sun.org.apache.bcel.internal.generic.NEW;\r
 \r
 /**\r
* SecFixupTask class.\r
- *\r
* SecFixupTask is used to call SecFixup.exe to fix up sec image.\r
- */\r
+  SecFixupTask class.\r
\r
+  SecFixupTask is used to call SecFixup.exe to fix up sec image.\r
+ **/\r
 public class EfiRomTask extends Task implements EfiDefine {\r
-    ///\r
-    /// tool name\r
-    ///\r
-    private final String toolName = "EfiRom";\r
-\r
-    ///\r
-    /// Flash default file\r
-    ///\r
-    private String verbose = "";\r
-\r
-    ///\r
-    /// Flash device\r
-    ///\r
-    private String venderId = "";\r
-\r
-    ///\r
-    /// Flash device Image\r
-    ///\r
-    private String deviceId = "";\r
-\r
-    ///\r
-    /// MCI file\r
-    ///\r
-    private String outputFile = "";\r
-\r
-    ///\r
-    /// MCO file\r
-    ///\r
-    private List<Input> binaryFileList = new ArrayList<Input>();\r
-\r
-    ///\r
-    /// Efi PE32 image file\r
-    ///\r
-    private List<Input> pe32FileList = new ArrayList<Input>();\r
-\r
-    ///\r
-    /// Compress efi PE32 image file\r
-    ///\r
-    private List<Input> pe32ComprFileList = new ArrayList<Input>();\r
-\r
-    ///\r
-    /// Hex class code in the PCI data strutor header\r
-    ///\r
-    private String classCode = "";\r
-\r
-    ///\r
-    /// Hex revision in the PCI data header.\r
-    ///\r
-    private String revision = "";\r
-\r
-    ///\r
-    /// Dump the headers of an existing option rom image.\r
-    ///\r
-    private String dump = "";\r
-\r
-\r
-    ///\r
-    /// output directory\r
-    ///\r
+    //\r
+    // tool name\r
+    //\r
+    private final static String toolName = "EfiRom";\r
+\r
+    //\r
+    // Flash default file\r
+    //\r
+    private ToolArg verbose = new ToolArg();\r
+\r
+    //\r
+    // Flash device\r
+    //\r
+    private ToolArg venderId = new ToolArg();\r
+\r
+    //\r
+    // Flash device Image\r
+    //\r
+    private ToolArg deviceId = new ToolArg();\r
+\r
+    //\r
+    // output file\r
+    //\r
+    private FileArg outputFile = new FileArg();\r
+\r
+    //\r
+    // binary file\r
+    //\r
+    private Input binaryFileList = new Input();\r
+\r
+    //\r
+    // Efi PE32 image file\r
+    //\r
+    private Input pe32FileList = new Input();\r
+\r
+    //\r
+    // Compress efi PE32 image file\r
+    //\r
+    private Input pe32ComprFileList = new Input();\r
+\r
+    //\r
+    // Hex class code in the PCI data strutor header\r
+    //\r
+    private ToolArg classCode = new ToolArg();\r
+\r
+    //\r
+    // Hex revision in the PCI data header.\r
+    //\r
+    private ToolArg revision = new ToolArg();\r
+\r
+    //\r
+    // Dump the headers of an existing option rom image.\r
+    //\r
+    private ToolArg dump = new ToolArg();\r
+\r
+    //\r
+    // output directory\r
+    //\r
     private String outputDir = ".";\r
 \r
-\r
-    ///\r
-    /// command and argument list\r
-    ///\r
+    //\r
+    // command and argument list\r
+    //\r
     LinkedList<String> argList = new LinkedList<String>();\r
+\r
     /**\r
-     * execute\r
-     *\r
-     * EfiRomTask execute function is to assemble tool command line & execute\r
-     * tool command line\r
-     *\r
-     * @throws BuidException\r
-     */\r
+      execute\r
+     \r
+      EfiRomTask 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
@@ -121,294 +124,259 @@ public class EfiRomTask 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
-        argList.addFirst(command);\r
 \r
-        //\r
-        // add microcode binary files\r
-        //\r
-        if (this.binaryFileList.size() > 0){\r
-            argList.add("-b");\r
-            Iterator binList = this.binaryFileList.iterator();\r
-            while (binList.hasNext()){\r
-                argList.addAll(((Input)binList.next()).getNameList());\r
-            }\r
-        }\r
+        String argument = "" + verbose + venderId + deviceId + dump + revision + classCode \r
+                             + binaryFileList.toStringWithSinglepPrefix(" -b ")\r
+                             + pe32FileList.toStringWithSinglepPrefix(" -e ")\r
+                             + pe32ComprFileList.toStringWithSinglepPrefix(" -ec ")\r
+                             + outputFile;\r
 \r
-        //\r
-        // add pe32 file\r
-        //\r
-        if (this.pe32FileList.size() > 0){\r
-            argList.add("-e");\r
-            Iterator pe32List = this.pe32FileList.iterator();\r
-            while (pe32List.hasNext()){\r
-                argList.addAll(((Input)pe32List.next()).getNameList());\r
-            }\r
-        }\r
+        try {\r
+            Commandline cmdline = new Commandline();\r
+            cmdline.setExecutable(command);\r
+            cmdline.createArgument().setLine(argument);\r
 \r
-        //\r
-        // add compressed pe32 file\r
-        //\r
-        if (this.pe32ComprFileList.size() > 0){\r
-            argList.add("-ec");\r
-            Iterator pe32ComprList = this.pe32ComprFileList.iterator();\r
-            while (pe32ComprList.hasNext()){\r
-                argList.addAll(((Input)pe32ComprList.next()).getNameList());\r
-            }\r
-        }\r
+            LogStreamHandler streamHandler = new LogStreamHandler(this,\r
+                    Project.MSG_INFO, Project.MSG_WARN);\r
+            Execute runner = new Execute(streamHandler, null);\r
 \r
-        EdkLog.log(this, EdkLog.EDK_VERBOSE, argList.toString().replaceAll(",",""));\r
-        EdkLog.log(this, EdkLog.EDK_INFO, " ");\r
+            runner.setAntRun(project);\r
+            runner.setCommandline(cmdline.getCommandline());\r
+            runner.setWorkingDirectory(new File(outputDir));\r
 \r
-        //\r
-        // lauch the program\r
-        //\r
-        ProcessBuilder pb = new ProcessBuilder(argList);\r
-        pb.directory(new File(outputDir));\r
-        int exitCode = 0;\r
-        try {\r
-            Process cmdProc = pb.start();\r
-            InputStreamReader cmdOut = new InputStreamReader(cmdProc.getInputStream());\r
-            char[] buf = new char[1024];\r
+            EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
+            EdkLog.log(this, EdkLog.EDK_INFO, binaryFileList.toFileList() \r
+                       + pe32FileList.toFileList() + pe32ComprFileList.toFileList()\r
+                       + " => " + outputFile.toFileList());\r
 \r
-            exitCode = cmdProc.waitFor();\r
+            int exitCode = runner.execute();\r
             if (exitCode != 0) {\r
-                int len = cmdOut.read(buf, 0, 1024);\r
-                EdkLog.log(EdkLog.EDK_INFO, new String(buf, 0, len));\r
+                //\r
+                // command execution fail\r
+                //\r
+                EdkLog.log(this, "ERROR = " + Integer.toHexString(exitCode));\r
+                throw new BuildException(toolName + " failed!");\r
             } else {\r
-                EdkLog.log(EdkLog.EDK_VERBOSE, "EfiRom succeeded!");\r
+                EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
             }\r
         } catch (Exception e) {\r
             throw new BuildException(e.getMessage());\r
-        } finally {\r
-            if (exitCode != 0) {\r
-                throw new BuildException("EfiRom failed!");\r
-            }\r
         }\r
     }\r
 \r
     /**\r
-     * getVerbose\r
-     *\r
-     * This function is to get class member "verbose"\r
-     *\r
-     * @return verbose   for verbose output.\r
-     */\r
+      getVerbose\r
+     \r
+      This function is to get class member "verbose"\r
+     \r
+      @return verbose   for verbose output.\r
+     **/\r
     public String getVerbose() {\r
-        return verbose;\r
+        return verbose.getValue();\r
     }\r
 \r
     /**\r
-     * setVerbose\r
-     *\r
-     * This function is to set class member "verbose"\r
-     *\r
-     * @param verbose    for verbose output.\r
-     */\r
+      setVerbose\r
+     \r
+      This function is to set class member "verbose"\r
+     \r
+      @param verbose    for verbose output.\r
+     **/\r
     public void setVerbose(boolean verbose) {\r
         if (verbose){\r
-            this.verbose = "-p";\r
-            argList.add(this.verbose);\r
+            this.verbose.setArg(" -", "p");\r
         }\r
     }\r
 \r
     /**\r
-     * getVenderId\r
-     *\r
-     * This function is to get class member "venderId"\r
-     *\r
-     * @return venderId     String of venderId.\r
-     */\r
+      getVenderId\r
+     \r
+      This function is to get class member "venderId"\r
+     \r
+      @return venderId     String of venderId.\r
+     **/\r
     public String getVenderId() {\r
-        return venderId;\r
+        return venderId.getValue();\r
     }\r
 \r
     /**\r
-     * setVenderId\r
-     *\r
-     * This function is to set class member "venderId"\r
-     *\r
-     * @param venderId      String of venderId.\r
-     */\r
-    public void setVenderId(String VenderId) {\r
-        this.venderId = VenderId;\r
-        argList.add("-v");\r
-        argList.add(this.venderId);\r
+      setVenderId\r
+     \r
+      This function is to set class member "venderId"\r
+     \r
+      @param venderId      String of venderId.\r
+     **/\r
+    public void setVenderId(String venderId) {\r
+        this.venderId.setArg(" -v ", venderId);\r
     }\r
 \r
     /**\r
-     * getDeviceId\r
-     *\r
-     * This function is to get class member "deviceId"\r
-     *\r
-     * @return deviceId   String of device ID.\r
-     */\r
+      getDeviceId\r
+     \r
+      This function is to get class member "deviceId"\r
+     \r
+      @return deviceId   String of device ID.\r
+     **/\r
     public String getDeviceId() {\r
-        return this.deviceId;\r
+        return this.deviceId.getValue();\r
     }\r
 \r
     /**\r
-     * setDeviceId\r
-     *\r
-     * This function is to set class member "deviceId"\r
-     *\r
-     * @param deviceId   String of device ID.\r
-     */\r
+      setDeviceId\r
+     \r
+      This function is to set class member "deviceId"\r
+     \r
+      @param deviceId   String of device ID.\r
+     **/\r
     public void setDeviceId(String deviceId) {\r
-        this.deviceId = deviceId;\r
-        argList.add("-d");\r
-        argList.add(this.deviceId);\r
+        this.deviceId.setArg(" -d ", deviceId);\r
     }\r
 \r
 \r
     /**\r
-     * getOutputFile\r
-     *\r
-     * This function is to get class member "outputFile"\r
-     *\r
-     * @return outputFile     name of output directory.\r
-     */\r
+      getOutputFile\r
+     \r
+      This function is to get class member "outputFile"\r
+     \r
+      @return outputFile     name of output directory.\r
+     **/\r
     public String getOutputFile() {\r
-        return outputFile;\r
+        return outputFile.getValue();\r
     }\r
 \r
     /**\r
-     * setOutputFile\r
-     *\r
-     * This function is to set class member "dscFile"\r
-     *\r
-     * @param outputFile      name of DSC file\r
-     */\r
+      setOutputFile\r
+     \r
+      This function is to set class member "dscFile"\r
+     \r
+      @param outputFile      name of DSC file\r
+     **/\r
     public void setOutputFile(String outputFile) {\r
-        this.outputFile = outputFile;\r
-\r
+        this.outputFile.setArg(" -o ", outputFile);\r
     }\r
 \r
     /**\r
-     * getClassCode\r
-     *\r
-     * This function is to get class member "classCode"\r
-     *\r
-     * @return fdImage       name of class code file.\r
-     */\r
+      getClassCode\r
+     \r
+      This function is to get class member "classCode"\r
+     \r
+      @return fdImage       name of class code file.\r
+     **/\r
     public String getClassCode() {\r
-        return classCode;\r
+        return classCode.getValue();\r
     }\r
 \r
     /**\r
-     * setclassCode\r
-     *\r
-     * This function is to set class member "classCode"\r
-     *\r
-     * @param fdImage        name of class code file.\r
-     */\r
+      setclassCode\r
+     \r
+      This function is to set class member "classCode"\r
+     \r
+      @param fdImage        name of class code file.\r
+     **/\r
     public void setclassCode(String classCode) {\r
-        this.classCode = classCode;\r
-        argList.add("-cc");\r
-        argList.add(this.classCode);\r
+        this.classCode.setArg(" -cc ", classCode);\r
     }\r
 \r
     /**\r
-     * getRevision\r
-     *\r
-     * This function is to get class member "revision".\r
-     *\r
-     * @return revision     hex revision in the PDI data header.\r
-     */\r
+      getRevision\r
+     \r
+      This function is to get class member "revision".\r
+     \r
+      @return revision     hex revision in the PDI data header.\r
+     **/\r
     public String getRevision() {\r
-        return revision;\r
+        return revision.getValue();\r
     }\r
 \r
     /**\r
-     * setRevision\r
-     *\r
-     * This function is to set class member "revision"\r
-     *\r
-     * @param revision     hex revision in the PDI data header.\r
-     */\r
+      setRevision\r
+     \r
+      This function is to set class member "revision"\r
+     \r
+      @param revision     hex revision in the PDI data header.\r
+     **/\r
     public void setRevision(String revision) {\r
-        this.revision = revision;\r
-        argList.add("-rev");\r
-        argList.add(this.revision);\r
+        this.revision.setArg(" -rev ", revision);\r
     }\r
 \r
     /**\r
-     * getFlashDeviceImage\r
-     *\r
-     * This function is to get class member "dump"\r
-     *\r
-     * @return flashDeviceImage      name of flash device image\r
-     */\r
+      getFlashDeviceImage\r
+     \r
+      This function is to get class member "dump"\r
+     \r
+      @return flashDeviceImage      name of flash device image\r
+     **/\r
     public String getDump() {\r
-        return dump;\r
+        return dump.getValue();\r
     }\r
 \r
     /**\r
-     * setFlashDeviceImage\r
-     *\r
-     * This function is to set class member "dump"\r
-     *\r
-     * @param flashDeviceImage        name of flash device image\r
-     */\r
+      setFlashDeviceImage\r
+     \r
+      This function is to set class member "dump"\r
+     \r
+      @param flashDeviceImage        name of flash device image\r
+     **/\r
     public void setDump(boolean dump) {\r
-        if (dump){\r
-            this.dump = "-dump";\r
-            argList.add(this.dump);\r
+        if (dump) {\r
+            this.dump.setArg(" -", "dump");\r
         }\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         string of output directory\r
-     */\r
+      setOutputDir\r
+     \r
+      This function is to set class member "outputDir"\r
+     \r
+      @param outputDir         string of output directory\r
+     **/\r
     public void setOutputDir(String outputDir) {\r
         this.outputDir = outputDir;\r
     }\r
+\r
     /**\r
-     * addBinaryFile\r
-     *\r
-     * This function is to add binary file to binaryFile list.\r
-     *\r
-     * @param binaryFile         name of binary file.\r
-     */\r
-    public void addBinaryFile(Input binaryFile){\r
-        this.binaryFileList.add(binaryFile);\r
+      addBinaryFile\r
+     \r
+      This function is to add binary file to binaryFile list.\r
+     \r
+      @param binaryFile         name of binary file.\r
+     **/\r
+    public void addConfiguredBinaryFile(Input binaryFile){\r
+        this.binaryFileList.insert(binaryFile);\r
     }\r
 \r
     /**\r
-     * addPe32File\r
-     *\r
-     * This function is to add pe32 file to pe32File list.\r
-     *\r
-     * @param pe32File            name of pe32 file.\r
-     */\r
-    public void addPe32File(Input pe32File){\r
-        this.pe32FileList.add(pe32File);\r
+      addPe32File\r
+     \r
+      This function is to add pe32 file to pe32File list.\r
+     \r
+      @param pe32File            name of pe32 file.\r
+     **/\r
+    public void addConfiguredPe32File(Input pe32File){\r
+        this.pe32FileList.insert(pe32File);\r
     }\r
 \r
     /**\r
-     * addPe32ComprFile\r
-     *\r
-     * This function os to add compressed pe32 file to pe32ComprFile list.\r
-     *\r
-     * @param pe32ComprFile        name of compressed pe32 file.\r
-     */\r
-    public void addPe32ComprFile(Input pe32ComprFile){\r
-        this.pe32ComprFileList.add(pe32ComprFile);\r
+      addPe32ComprFile\r
+     \r
+      This function os to add compressed pe32 file to pe32ComprFile list.\r
+     \r
+      @param pe32ComprFile        name of compressed pe32 file.\r
+     **/\r
+    public void addConfiguredPe32ComprFile(Input pe32ComprFile){\r
+        this.pe32ComprFileList.insert(pe32ComprFile);\r
     }\r
 }\r
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FileParser.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FileParser.java
deleted file mode 100644 (file)
index cc48b71..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/** @file\r
- FileParser class.\r
-\r
- FileParser class is to parse file which contains the list of file name and \r
- add those files to list.\r
-  \r
\r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution.  The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
- **/\r
-package org.tianocore.framework.tasks;\r
-import java.io.*;\r
-import java.util.List;\r
-\r
-import org.apache.tools.ant.BuildException;\r
-import org.apache.tools.ant.Project;\r
-\r
-/**\r
-  FileParser class.\r
-\r
-  FileParser class is to parse file which contains the list of file name and \r
-  add those files to list.\r
-**/\r
-public class  FileParser {\r
-    /**\r
-      loadFile\r
-     \r
-      This function is to add files to array from input file which contains the \r
-      files list.\r
-      @param  project  The current project.\r
-      @param  list     File array.\r
-      @param  file     File which contains the file list.\r
-      @param  tag      Target of architecture.\r
-      @throws BuildException\r
-    **/\r
-    public static synchronized void loadFile(Project project, List<Object> list, File file, String tag) throws BuildException{\r
-        FileReader fileReader;\r
-        BufferedReader in;\r
-        String str;\r
-        \r
-        if (!file.exists()) {\r
-            throw new BuildException("The file, " + file + " does not exist!");           \r
-        } \r
-        try {\r
-            fileReader = new FileReader(file);\r
-            in = new BufferedReader(fileReader);\r
-            while((str=in.readLine())!= null){\r
-                if (str.trim()==""){\r
-                    continue;\r
-                }\r
-                str = project.replaceProperties(str);\r
-                if (str.trim().substring(0,2).equalsIgnoreCase(tag)) {\r
-                    list.add(str.trim());\r
-                } else {\r
-                    list.add(tag + " " + str.trim());\r
-                }\r
-                \r
-            }\r
-        } catch (Exception e){\r
-            System.out.println(e.getMessage());\r
-            \r
-        }\r
-    }\r
-    \r
-}\r
index c991aa3f58fc327e6ecb344e8327c5eac285b629..78d9cbeb18a6c5ffe01d911b2eb62cfdfa6a2e14 100644 (file)
@@ -16,6 +16,8 @@
  **/\r
 package org.tianocore.framework.tasks;\r
 \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
@@ -52,11 +54,6 @@ public class FwImageTask extends Task implements EfiDefine {
     //\r
     private ToolArg componentType = new ToolArg();\r
 \r
-    /**\r
-     * assemble tool command line & execute tool command line\r
-     *\r
-     * @throws BuildException\r
-     */\r
     /**\r
       execute\r
 \r
@@ -76,7 +73,7 @@ public class FwImageTask extends Task implements EfiDefine {
         if (path == null) {\r
             command = toolName;\r
         } else {\r
-            command = path + "/" + toolName;\r
+            command = path + File.separator + toolName;\r
         }\r
         //\r
         // argument of tools\r
index d9eafacc37f40981e33c5b252d45eb5f1880ef04..40d38f349f27c4b22be8f8898fff99e17af0ecaa 100644 (file)
@@ -33,29 +33,34 @@ import org.tianocore.common.logger.EdkLog;
   GenAcpiTable is used to call GenAcpiTable.exe to generate ACPI Table image .\r
 **/\r
 public class GenAcpiTableTask extends Task implements EfiDefine {\r
-    // /\r
-    // / input file\r
-    // /\r
-    private String inputFile = "";\r
-\r
-    // /\r
-    // / output file\r
-    // /\r
-    private String outputFile = "";\r
-\r
-    // /\r
-    // / output directory, this variable is added by jave wrap\r
-    // /\r
-    private String outputDir = "";\r
+    //\r
+    // Tool name\r
+    // \r
+    private static String toolName = "GenAcpiTable";\r
+\r
+    //\r
+    // input file\r
+    //\r
+    private FileArg inputFile = new FileArg();\r
+\r
+    //\r
+    // output file\r
+    //\r
+    private FileArg outputFile = new FileArg();\r
+\r
+    //\r
+    // output directory, this variable is added by jave wrap\r
+    //\r
+    private String outputDir = ".";\r
 \r
     /**\r
-     * execute\r
-     *\r
-     * StripTask execute function is to assemble tool command line & execute\r
-     * tool command line\r
-     *\r
-     * @throws BuidException\r
-     */\r
+      execute\r
+     \r
+      StripTask 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
@@ -66,20 +71,15 @@ public class GenAcpiTableTask extends Task implements EfiDefine {
         String command;\r
         String argument;\r
         if (path == null) {\r
-            command = "GenAcpiTable";\r
+            command = toolName;\r
         } else {\r
-            command = path + File.separatorChar + "GenAcpiTable";\r
+            command = path + File.separator + toolName;\r
         }\r
         //\r
         // argument of tools\r
         //\r
-        File file = new File(outputFile);\r
-        if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
-            argument = inputFile + " " + outputDir + File.separatorChar\r
-                    + outputFile;\r
-        } else {\r
-            argument = inputFile + " " + outputFile;\r
-        }\r
+        argument = "" + inputFile + outputFile;\r
+\r
         //\r
         // return value of fwimage execution\r
         //\r
@@ -96,24 +96,27 @@ public class GenAcpiTableTask 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.inputFile)).getName());\r
-            revl = runner.execute();\r
+            EdkLog.log(this, EdkLog.EDK_INFO, this.inputFile.toFileList() + " => " \r
+                + this.outputFile.toFileList());\r
 \r
+            revl = runner.execute();\r
             if (EFI_SUCCESS == revl) {\r
                 //\r
                 // command execution success\r
                 //\r
-                EdkLog.log(this, EdkLog.EDK_VERBOSE, "GenAcpiTable 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("GenAcpiTable failed!");\r
+                throw new BuildException(toolName + " failed!");\r
             }\r
         } catch (Exception e) {\r
             throw new BuildException(e.getMessage());\r
@@ -121,70 +124,70 @@ public class GenAcpiTableTask extends Task implements EfiDefine {
     }\r
 \r
     /**\r
-     * getInputFile\r
-     *\r
-     * This function is to get class member "inputFile".\r
-     *\r
-     * @return string of input file name.\r
-     */\r
+      getInputFile\r
+     \r
+      This function is to get class member "inputFile".\r
+     \r
+      @return string of input file name.\r
+     **/\r
     public String getInputFile() {\r
-        return inputFile;\r
+        return inputFile.getValue();\r
     }\r
 \r
     /**\r
-     * setComponentType\r
-     *\r
-     * This function is to set class member "inputFile".\r
-     *\r
-     * @param inputFile\r
-     *            string of input file name.\r
-     */\r
+      setComponentType\r
+     \r
+      This function is to set class member "inputFile".\r
+     \r
+      @param inputFile\r
+                 string of input file name.\r
+     **/\r
     public void setInputFile(String inputFile) {\r
-        this.inputFile = inputFile;\r
+        this.inputFile.setArg(" ", inputFile);\r
     }\r
 \r
     /**\r
-     * getOutputFile\r
-     *\r
-     * This function is to get class member "outputFile"\r
-     *\r
-     * @return outputFile string of output file name.\r
-     */\r
+      getOutputFile\r
+     \r
+      This function is to get class member "outputFile"\r
+     \r
+      @return outputFile string of output file name.\r
+     **/\r
     public String getOutputFile() {\r
-        return outputFile;\r
+        return outputFile.getValue();\r
     }\r
 \r
     /**\r
-     * setOutputFile\r
-     *\r
-     * This function is to set class member "outputFile"\r
-     *\r
-     * @param outputFile\r
-     *            string of output file name.\r
-     */\r
+      setOutputFile\r
+     \r
+      This function is to set class member "outputFile"\r
+     \r
+      @param outputFile\r
+                 string of output file name.\r
+     **/\r
     public void setOutputFile(String outputFile) {\r
-        this.outputFile = outputFile;\r
+        this.outputFile.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
index d7184cd5d37691a0678dec8d23afe35c6a256c8f..d9273acf7b7f40b23536bbf7a0065d25b7c4e657 100644 (file)
 \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
@@ -31,18 +34,22 @@ import org.apache.tools.ant.types.Commandline;
   \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
@@ -62,22 +69,14 @@ public class GenCRC32SectionTask extends Task implements EfiDefine {
         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
@@ -93,21 +92,23 @@ public class GenCRC32SectionTask extends Task implements EfiDefine {
             \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
@@ -120,22 +121,22 @@ public class GenCRC32SectionTask extends Task implements EfiDefine {
       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
index 12def7c898a93779b5a3176ac0a3a99dd422abe8..c5b74b5d7e088b94d5c04be5b4122b508b18dfef 100644 (file)
@@ -33,60 +33,60 @@ import org.tianocore.common.logger.EdkLog;
   GenCapsuleHdrTask is used to call GenCapsuleHdr.exe to generate capsule.\r
 **/\r
 public class GenCapsuleHdrTask extends Task implements EfiDefine {\r
-    ///\r
-    /// tool name\r
-    ///\r
+    //\r
+    // tool name\r
+    //\r
     private String toolName = "GenCapsuleHdr";\r
 \r
-    ///\r
-    /// script file\r
-    ///\r
-    private String scriptFile = "";\r
+    //\r
+    // script file\r
+    //\r
+    private FileArg scriptFile = new FileArg();\r
 \r
-    ///\r
-    /// output file\r
-    ///\r
-    private String outputFile = "";\r
+    //\r
+    // output file\r
+    //\r
+    private FileArg outputFile = 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
-    /// Verbose flag\r
-    ///\r
-    private String verbose = "";\r
+    //\r
+    // Verbose flag\r
+    //\r
+    private ToolArg verbose = new ToolArg();\r
 \r
-    ///\r
-    /// Dump flag\r
-    ///\r
-    private String dump = "";\r
+    //\r
+    // Dump flag\r
+    //\r
+    private ToolArg dump = new ToolArg();\r
 \r
-    ///\r
-    /// Split size\r
-    ///\r
-    private String size = "";\r
+    //\r
+    // Split size\r
+    //\r
+    private ToolArg size = new ToolArg();\r
 \r
-    ///\r
-    /// capsule into one image flag\r
-    ///\r
-    private String joinFlag = "";\r
+    //\r
+    // capsule into one image flag\r
+    //\r
+    private ToolArg joinFlag = new ToolArg();\r
 \r
-    ///\r
-    /// capsule file\r
-    ///\r
-    private String capsuleFile = "";\r
+    //\r
+    // capsule file\r
+    //\r
+    private FileArg capsuleFile = new FileArg();\r
 \r
 \r
     /**\r
-     * execute\r
-     *\r
-     * GenCapsuleHdrTask execute function is to assemble tool command line & execute\r
-     * tool command line\r
-     *\r
-     * @throws BuidException\r
-     */\r
+      execute\r
+     \r
+      GenCapsuleHdrTask 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
@@ -99,20 +99,14 @@ public class GenCapsuleHdrTask 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(outputFile);\r
-        if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
-            argument = this.verbose + this.dump + "-o " +this.outputDir\r
-                    + File.separatorChar + this.outputFile + " "\r
-                    + this.scriptFile + " " + this.size + " " + this.joinFlag + this.capsuleFile;\r
-        } else {\r
-            argument = this.verbose + this.dump + "-o " + this.outputFile\r
-                    + " " + this.scriptFile + " " + this.size + " " + this.joinFlag + this.capsuleFile;\r
-        }\r
+        argument = "" + this.verbose + this.dump + this.outputFile\r
+                      + this.scriptFile + this.size + this.joinFlag + this.capsuleFile;\r
+\r
         //\r
         // return value of fwimage execution\r
         //\r
@@ -129,24 +123,27 @@ public class GenCapsuleHdrTask 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(scriptFile)).getName());\r
-            revl = runner.execute();\r
+            EdkLog.log(this, EdkLog.EDK_INFO, scriptFile.toFileList() + " => " +\r
+                outputFile.toFileList() + capsuleFile.toFileList());\r
 \r
+            revl = runner.execute();\r
             if (EFI_SUCCESS == revl) {\r
                 //\r
                 // command execution success\r
                 //\r
-                EdkLog.log(this, EdkLog.EDK_VERBOSE, "GenCapsuleHdr succeeded!");\r
+                EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
             } else {\r
                 //\r
                 // command execution fail\r
                 //\r
                 EdkLog.log(this, EdkLog.EDK_ERROR, "ERROR = " + Integer.toHexString(revl));\r
-                throw new BuildException("GenCapsuleHdr failed!");\r
+                throw new BuildException(toolName + " failed!");\r
             }\r
         } catch (Exception e) {\r
             throw new BuildException(e.getMessage());\r
@@ -154,192 +151,191 @@ public class GenCapsuleHdrTask extends Task implements EfiDefine {
     }\r
 \r
     /**\r
-     * getInputFile\r
-     *\r
-     * This function is to get class member "scriptFile".\r
-     *\r
-     * @return string of input file name.\r
-     */\r
+      getInputFile\r
+     \r
+      This function is to get class member "scriptFile".\r
+     \r
+      @return string of input file name.\r
+     **/\r
     public String getScriptFile() {\r
-        return this.scriptFile;\r
+        return this.scriptFile.getValue();\r
     }\r
 \r
     /**\r
-     * setComponentType\r
-     *\r
-     * This function is to set class member "inputFile".\r
-     *\r
-     * @param inputFile\r
-     *            string of input file name.\r
-     */\r
+      setComponentType\r
+     \r
+      This function is to set class member "inputFile".\r
+     \r
+      @param inputFile\r
+                 string of input file name.\r
+     **/\r
     public void setScriptFile(String scriptFile) {\r
-        this.scriptFile = "-script " + scriptFile;\r
+        this.scriptFile.setArg(" -script ", scriptFile);\r
     }\r
 \r
     /**\r
-     * getOutputFile\r
-     *\r
-     * This function is to get class member "outputFile"\r
-     *\r
-     * @return outputFile string of output file name.\r
-     */\r
+      getOutputFile\r
+     \r
+      This function is to get class member "outputFile"\r
+     \r
+      @return outputFile string of output file name.\r
+     **/\r
     public String getOutputFile() {\r
-        return outputFile;\r
+        return outputFile.getValue();\r
     }\r
 \r
     /**\r
-     * setOutputFile\r
-     *\r
-     * This function is to set class member "outputFile"\r
-     *\r
-     * @param outputFile\r
-     *            string of output file name.\r
-     */\r
+      setOutputFile\r
+     \r
+      This function is to set class member "outputFile"\r
+     \r
+      @param outputFile\r
+                 string of output file name.\r
+     **/\r
     public void setOutputFile(String outputFile) {\r
-        this.outputFile = outputFile  + " ";\r
+        this.outputFile.setArg(" -o ", 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
 \r
     /**\r
-     * getVerbose\r
-     *\r
-     * This function is to get class member "verbose"\r
-     *\r
-     * @return verbose the flag of verbose.\r
-     */\r
+      getVerbose\r
+     \r
+      This function is to get class member "verbose"\r
+     \r
+      @return verbose the flag of verbose.\r
+     **/\r
     public String getVerbose() {\r
-        return this.verbose;\r
+        return this.verbose.getValue();\r
     }\r
 \r
     /**\r
-     * setVerbose\r
-     *\r
-     * This function is to set class member "verbose"\r
-     *\r
-     * @param verbose\r
-     *            True or False.\r
-     */\r
+      setVerbose\r
+     \r
+      This function is to set class member "verbose"\r
+     \r
+      @param verbose\r
+                 True or False.\r
+     **/\r
     public void setVerbose(boolean verbose) {\r
         if (verbose) {\r
-            this.verbose = "-v ";\r
+            this.verbose.setArg(" -", "v");\r
         }\r
     }\r
 \r
     /**\r
-     * getDump\r
-     *\r
-     * This function is to get class member "dump"\r
-     *\r
-     * @return verbose the flag of dump.\r
-     */\r
+      getDump\r
+     \r
+      This function is to get class member "dump"\r
+     \r
+      @return verbose the flag of dump.\r
+     **/\r
     public String getDump() {\r
-        return dump;\r
+        return dump.getValue();\r
     }\r
 \r
     /**\r
-     * setDump\r
-     *\r
-     * This function is to set class member "dump".\r
-     *\r
-     * @param dump\r
-     *            True or False.\r
-     */\r
+      setDump\r
+     \r
+      This function is to set class member "dump".\r
+     \r
+      @param dump\r
+                 True or False.\r
+     **/\r
     public void setDump(boolean dump) {\r
         if (dump) {\r
-            this.dump = "-dump ";\r
+            this.dump.setArg(" -", "dump");\r
         }\r
     }\r
 \r
     /**\r
-     * getSize\r
-     *\r
-     * This function is to set class member "size".\r
-     *\r
-     * @return size   string of size value\r
-     */\r
+      getSize\r
+     \r
+      This function is to set class member "size".\r
+     \r
+      @return size   string of size value\r
+     **/\r
     public String getSize() {\r
-        return size;\r
+        return size.getValue();\r
     }\r
 \r
     /**\r
-     * setSize\r
-     *\r
-     * This function is to set class member "size".\r
-     *\r
-     * @param size  string of size value.\r
-     */\r
+      setSize\r
+     \r
+      This function is to set class member "size".\r
+     \r
+      @param size  string of size value.\r
+     **/\r
     public void setSize(String size) {\r
-        this.size = "-split " + size;\r
+        this.size.setArg(" -split ", size);\r
     }\r
 \r
     /**\r
-     * getCapsuleFile\r
-     *\r
-     * This function is to get class member "capsuleFile"\r
-     *\r
-     * @return capsuleFile   capsule file name\r
-     */\r
+      getCapsuleFile\r
+     \r
+      This function is to get class member "capsuleFile"\r
+     \r
+      @return capsuleFile   capsule file name\r
+     **/\r
     public String getCapsuleFile() {\r
-        return capsuleFile;\r
+        return capsuleFile.getValue();\r
     }\r
 \r
     /**\r
-     * setCapsuleFile\r
-     *\r
-     * This function is to set class member "capsuleFile"\r
-     *\r
-     * @param capsuleFile   capsule file name\r
-     */\r
+      setCapsuleFile\r
+     \r
+      This function is to set class member "capsuleFile"\r
+     \r
+      @param capsuleFile   capsule file name\r
+     **/\r
     public void setCapsuleFile(String capsuleFile) {\r
-        this.capsuleFile = capsuleFile;\r
+        this.capsuleFile.setArg(" ", capsuleFile);\r
     }\r
 \r
     /**\r
-     * isJoinFlag\r
-     *\r
-     * This function is to get class member "joinFlag"\r
-     *\r
-     * @return joinFlag    flag of if need to join split capsule  images into\r
-     *                     a single image.\r
-     */\r
+      isJoinFlag\r
+     \r
+      This function is to get class member "joinFlag"\r
+     \r
+      @return joinFlag    flag of if need to join split capsule  images into\r
+                          a single image.\r
+     **/\r
     public String getJoinFlag() {\r
-        return joinFlag;\r
+        return joinFlag.getValue();\r
     }\r
 \r
     /**\r
-     * setJoinFlag\r
-     *\r
-     * This function is to set class member "joinFlag"\r
-     *\r
-     * @param joinFlag     flag of if need to join split capsule  images into\r
-     *                     a single image.\r
-     */\r
+      setJoinFlag\r
+     \r
+      This function is to set class member "joinFlag"\r
+     \r
+      @param joinFlag     flag of if need to join split capsule  images into\r
+                          a single image.\r
+     **/\r
     public void setJoinFlag(boolean joinFlag) {\r
         if (joinFlag){\r
-            this.joinFlag = "-j ";\r
+            this.joinFlag.setArg(" -", "j");\r
         }\r
-\r
     }\r
 }\r
index 8396f707ab3bc2772007b17c9b6e75e0ae4e9f3f..b1bf83c2a786accd6833a641054016aff642c5d7 100644 (file)
  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
  \r
- **/\r
+**/\r
 \r
 package org.tianocore.framework.tasks;\r
 \r
 import java.io.ByteArrayOutputStream;\r
 import java.io.DataOutputStream;\r
+import java.io.File;\r
+import java.io.file;\r
 import java.util.ArrayList;\r
 import java.util.Iterator;\r
 import java.util.List;\r
@@ -30,8 +32,11 @@ import org.apache.tools.ant.taskdefs.LogStreamHandler;
 import org.apache.tools.ant.types.Commandline;\r
 import org.tianocore.common.logger.EdkLog;\r
 \r
-public class GenSectionTask extends Task implements EfiDefine, Section,\r
-        FfsTypes {\r
+public class GenSectionTask extends Task implements EfiDefine, Section, FfsTypes {\r
+    //\r
+    // Tool name\r
+    // \r
+    private final static String toolName = "GenSection";\r
     //\r
     // inputfile name\r
     //\r
@@ -68,13 +73,13 @@ public class GenSectionTask extends Task implements EfiDefine, Section,
     private boolean haveTool = false;\r
 \r
     /**\r
-     * execute\r
-     * \r
-     * GenSectionTaks execute is to assemble tool command line & execute tool\r
-     * command line.\r
-     * \r
-     * @throws BuildException\r
-     */\r
+      execute\r
+      \r
+      GenSectionTaks execute is to assemble tool command line & execute tool\r
+      command line.\r
+      \r
+      @throws BuildException\r
+    **/\r
     public void execute() throws BuildException {\r
         String command;\r
         Project project = this.getOwningTarget().getProject();\r
@@ -83,15 +88,14 @@ public class GenSectionTask extends Task implements EfiDefine, Section,
         //\r
         String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
         if (path == null) {\r
-            command = "GenSection";\r
+            command = toolName;\r
         } else {\r
-            command = path + "/" + "GenSection";\r
+            command = path + File.separator + toolName;\r
         }\r
         //\r
         // argument of tools\r
         //\r
-        String argument = "" + inputFile + outputFile + sectionType\r
-                + versionNum + interfaceString;\r
+        String argument = "" + inputFile + outputFile + sectionType + versionNum + interfaceString;\r
         //\r
         // return value of gensection execution\r
         //\r
@@ -109,21 +113,19 @@ public class GenSectionTask extends Task implements EfiDefine, Section,
             runner.setAntRun(project);\r
             runner.setCommandline(cmdline.getCommandline());\r
 \r
-            EdkLog.log(this, inputFile.toFileList() + " => "\r
-                    + outputFile.toFileList());\r
-            EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline\r
-                    .getCommandline()));\r
+            EdkLog.log(this, inputFile.toFileList() + versionNum.getValue() \r
+                + interfaceString.getValue() + " => " + outputFile.toFileList());\r
+            EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
 \r
             revl = runner.execute();\r
             if (EFI_SUCCESS == revl) {\r
-                EdkLog.log(this, EdkLog.EDK_VERBOSE, "GenSection 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 = "\r
-                        + Integer.toHexString(revl));\r
-                throw new BuildException("GenSection failed!");\r
+                EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));\r
+                throw new BuildException(toolName + " failed!");\r
             }\r
         } catch (Exception e) {\r
             throw new BuildException(e.getMessage());\r
@@ -131,157 +133,144 @@ public class GenSectionTask extends Task implements EfiDefine, Section,
     }\r
 \r
     /**\r
-     * getInputFile\r
-     * \r
-     * This function is to get class member "inputFile".\r
-     * \r
-     * @return name of input file\r
-     */\r
+      getInputFile\r
+      \r
+      This function is to get class member "inputFile".\r
+      \r
+      @return                    name of input file\r
+    **/\r
     public String getInputFile() {\r
         return this.inputFile.getValue();\r
     }\r
 \r
     /**\r
-     * setInputFile\r
-     * \r
-     * This function is to set class member "inputFile".\r
-     * \r
-     * @param inputFile\r
-     *            name of input file\r
-     */\r
+      setInputFile\r
+      \r
+      This function is to set class member "inputFile".\r
+      \r
+      @param inputFile            name of input file\r
+    **/\r
     public void setInputFile(String inputFile) {\r
         this.inputFile.setArg(" -i ", inputFile);\r
     }\r
 \r
     /**\r
-     * getOutputFile\r
-     * \r
-     * This function is to get class member "outputFile".\r
-     * \r
-     * @return name of output file\r
-     */\r
+      getOutputFile\r
+      \r
+      This function is to get class member "outputFile".\r
+      \r
+      @return                      name of output file\r
+    **/\r
     public String getOutputFile() {\r
         return this.outputFile.getValue();\r
     }\r
 \r
     /**\r
-     * setOutputfile\r
-     * \r
-     * This function is to set class member "outputFile".\r
-     * \r
-     * @param outputFile\r
-     *            name of output file\r
-     */\r
+      setOutputfile\r
+      \r
+      This function is to set class member "outputFile".\r
+      @param  outputFile            name of output file\r
+    **/\r
     public void setOutputfile(String outputFile) {\r
         this.outputFile.setArg(" -o ", outputFile);\r
     }\r
 \r
     /**\r
-     * getSectionType\r
-     * \r
-     * This function is to get class member "sectionType".\r
-     * \r
-     * @return sectoin type\r
-     */\r
+      getSectionType\r
+      \r
+      This function is to get class member "sectionType".\r
+      \r
+      @return                        sectoin type\r
+    **/\r
     public String getSectionType() {\r
         return this.sectionType.getValue();\r
     }\r
 \r
     /**\r
-     * setSectionType\r
-     * \r
-     * This function is to set class member "sectionType".\r
-     * \r
-     * @param sectionType\r
-     *            section type\r
-     */\r
+      setSectionType\r
+      \r
+      This function is to set class member "sectionType".\r
+      \r
+      @param sectionType              section type\r
+    **/\r
     public void setSectionType(String sectionType) {\r
         this.sectionType.setArg(" -s ", sectionType);\r
     }\r
 \r
     /**\r
-     * getVersionNum\r
-     * \r
-     * This function is to get class member "versionNum".\r
-     * \r
-     * @return version number\r
-     */\r
+      getVersionNum\r
+      \r
+      This function is to get class member "versionNum".\r
+      @return                         version number\r
+    **/\r
     public String getVersionNum() {\r
         return this.versionNum.getValue();\r
     }\r
 \r
     /**\r
-     * setVersionNume\r
-     * \r
-     * This function is to set class member "versionNum".\r
-     * \r
-     * @param versionNum\r
-     *            version number\r
-     */\r
+      setVersionNume\r
+      \r
+      This function is to set class member "versionNum".\r
+      @param versionNum               version number\r
+    **/\r
     public void setVersionNum(String versionNum) {\r
         this.versionNum.setArg(" -v ", versionNum);\r
     }\r
 \r
     /**\r
-     * getInterfaceString\r
-     * \r
-     * This function is to get class member "interfaceString".\r
-     * \r
-     * @return interface string\r
-     */\r
+      getInterfaceString\r
+      \r
+      This function is to get class member "interfaceString".\r
+      @return                         interface string\r
+    **/\r
     public String getInterfaceString() {\r
         return this.interfaceString.getValue();\r
     }\r
 \r
     /**\r
-     * setInterfaceString\r
-     * \r
-     * This funcion is to set class member "interfaceString".\r
-     * \r
-     * @param interfaceString\r
-     *            interface string\r
-     */\r
+      setInterfaceString\r
+      \r
+      This funcion is to set class member "interfaceString".\r
+      @param interfaceString            interface string\r
+    **/\r
     public void setInterfaceString(String interfaceString) {\r
         this.interfaceString.setArg(" -a ", "\"" + interfaceString + "\"");\r
     }\r
-\r
+    \r
     /**\r
-     * addSectFile\r
-     * \r
-     * This function is to add sectFile to list.\r
-     * \r
-     * @param sectFile\r
-     *            instance of sectFile.\r
-     */\r
-    public void addSectFile(SectFile sectFile) {\r
+      addSectFile\r
+      \r
+      This function is to add sectFile to list.\r
+      \r
+      @param sectFile     instance of sectFile.\r
+    **/\r
+    public void addSectFile(SectFile sectFile){\r
         this.sectFileList.add(sectFile);\r
     }\r
 \r
     /**\r
-     * setTool\r
-     * \r
-     * This function is to set the class member "Tool";\r
-     * \r
-     * @param tool\r
-     */\r
+      setTool\r
+      \r
+      This function is to set the class member "Tool";\r
+      \r
+      @param tool \r
+    **/\r
     public void addTool(Tool tool) {\r
         this.sectFileList.add(tool);\r
         this.haveTool = true;\r
     }\r
-\r
+    \r
     /**\r
-     * addGenSection\r
-     * \r
-     * This function is to add GenSectin element to list\r
-     * \r
-     * @param task\r
-     *            Instance of genSection\r
-     */\r
-    public void addGenSection(GenSectionTask task) {\r
+      addGenSection\r
+      \r
+      This function is to add GenSectin element to list\r
+      @param task         Instance of genSection\r
+    **/\r
+    public void addGenSection(GenSectionTask task){\r
         this.sectFileList.add(task);\r
     }\r
-\r
-    public void toBuffer(DataOutputStream buffer) {\r
+    \r
+    public void toBuffer(DataOutputStream buffer){\r
         //\r
         // Search SectionList find earch section and call it's\r
         // ToBuffer function.\r
index 9f0b743a471e5f5b62c22b5d567bcd069911c02c..34a7987f432f8b7e8d0bd74f0b1a8ddd2c9d4c52 100644 (file)
@@ -33,48 +33,43 @@ import org.tianocore.common.logger.EdkLog;
  * GenTeImageTask is used to call GenAcpiTable.exe to generate ACPI Table image .\r
  */\r
 public class GenTeImageTask extends Task implements EfiDefine {\r
-    ///\r
-    /// tool name\r
-    ///\r
+    //\r
+    // tool name\r
+    //\r
     private String toolName = "GenTeImage";\r
-    ///\r
-    /// input file\r
-    ///\r
-    private String inputFile = "";\r
-\r
-    ///\r
-    /// output file\r
-    ///\r
-    private String outputFile = "";\r
-\r
-    ///\r
-    /// output directory, this variable is added by jave wrap\r
-    ///\r
+    //\r
+    // input file\r
+    //\r
+    private FileArg inputFile = new FileArg();\r
+\r
+    //\r
+    // output file\r
+    //\r
+    private FileArg outputFile = new FileArg();\r
+\r
+    //\r
+    // output directory, this variable is added by jave wrap\r
+    //\r
     private String outputDir = "";\r
 \r
-    ///\r
-    /// Verbose flag\r
-    ///\r
-    private String verbose = "";\r
+    //\r
+    // Verbose flag\r
+    //\r
+    private ToolArg verbose = new ToolArg();\r
 \r
-    ///\r
-    /// Dump flag\r
-    ///\r
-    private String dump = "";\r
+    //\r
+    // Dump flag\r
+    //\r
+    private ToolArg dump = new ToolArg();\r
 \r
     /**\r
-     * assemble tool command line & execute tool command line\r
-     *\r
-     * @throws BuildException\r
-     */\r
-    /**\r
-     * execute\r
-     *\r
-     * GenTeImgaeTask execute function is to assemble tool command line & execute\r
-     * tool command line\r
-     *\r
-     * @throws BuidException\r
-     */\r
+      execute\r
+     \r
+      GenTeImgaeTask 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
@@ -87,20 +82,12 @@ public class GenTeImageTask 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(outputFile);\r
-        if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
-            argument = this.verbose + this.dump + "-o " +this.outputDir\r
-                    + File.separatorChar + this.outputFile + " "\r
-                    + this.inputFile;\r
-        } else {\r
-            argument = this.verbose + this.dump + "-o " + this.outputFile\r
-                    + " " + this.inputFile;\r
-        }\r
+        argument = "" + this.verbose + this.dump + this.outputFile + this.inputFile;\r
         //\r
         // return value of fwimage execution\r
         //\r
@@ -117,11 +104,14 @@ public class GenTeImageTask 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.inputFile)).getName());\r
+            EdkLog.log(this, EdkLog.EDK_INFO, this.inputFile.toFileList()\r
+                + " => " + this.outputFile.toFileList());\r
 \r
             revl = runner.execute();\r
 \r
@@ -129,13 +119,13 @@ public class GenTeImageTask extends Task implements EfiDefine {
                 //\r
                 // command execution success\r
                 //\r
-                EdkLog.log(this, EdkLog.EDK_VERBOSE, "GenTeImage 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("GenTeImage failed!");\r
+                throw new BuildException(toolName + " failed!");\r
             }\r
         } catch (Exception e) {\r
             throw new BuildException(e.getMessage());\r
@@ -143,121 +133,121 @@ public class GenTeImageTask extends Task implements EfiDefine {
     }\r
 \r
     /**\r
-     * getInputFile\r
-     *\r
-     * This function is to get class member "inputFile".\r
-     *\r
-     * @return string of input file name.\r
-     */\r
+      getInputFile\r
+     \r
+      This function is to get class member "inputFile".\r
+     \r
+      @return string of input file name.\r
+     **/\r
     public String getInputFile() {\r
-        return inputFile;\r
+        return inputFile.getValue();\r
     }\r
 \r
     /**\r
-     * setComponentType\r
-     *\r
-     * This function is to set class member "inputFile".\r
-     *\r
-     * @param inputFile\r
-     *            string of input file name.\r
-     */\r
+      setComponentType\r
+     \r
+      This function is to set class member "inputFile".\r
+     \r
+      @param inputFile\r
+                 string of input file name.\r
+     **/\r
     public void setInputFile(String inputFile) {\r
-        this.inputFile = inputFile;\r
+        this.inputFile.setArg(" ", inputFile);\r
     }\r
 \r
     /**\r
-     * getOutputFile\r
-     *\r
-     * This function is to get class member "outputFile"\r
-     *\r
-     * @return outputFile string of output file name.\r
-     */\r
+      getOutputFile\r
+     \r
+      This function is to get class member "outputFile"\r
+     \r
+      @return outputFile string of output file name.\r
+     **/\r
     public String getOutputFile() {\r
-        return outputFile;\r
+        return outputFile.getValue();\r
     }\r
 \r
     /**\r
-     * setOutputFile\r
-     *\r
-     * This function is to set class member "outputFile"\r
-     *\r
-     * @param outputFile\r
-     *            string of output file name.\r
-     */\r
+      setOutputFile\r
+     \r
+      This function is to set class member "outputFile"\r
+     \r
+      @param outputFile\r
+                 string of output file name.\r
+     **/\r
     public void setOutputFile(String outputFile) {\r
-        this.outputFile = outputFile  + " ";\r
+        this.outputFile.setArg(" -o ", 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
 \r
     /**\r
-     * getVerbose\r
-     *\r
-     * This function is to get class member "verbose"\r
-     *\r
-     * @return verbose the flag of verbose.\r
-     */\r
+      getVerbose\r
+     \r
+      This function is to get class member "verbose"\r
+     \r
+      @return verbose the flag of verbose.\r
+     **/\r
     public String getVerbose() {\r
-        return this.verbose;\r
+        return this.verbose.getValue();\r
     }\r
 \r
     /**\r
-     * setVerbose\r
-     *\r
-     * This function is to set class member "verbose"\r
-     *\r
-     * @param verbose\r
-     *            True or False.\r
-     */\r
+      setVerbose\r
+     \r
+      This function is to set class member "verbose"\r
+     \r
+      @param verbose\r
+                 True or False.\r
+     **/\r
     public void setVerbose(boolean verbose) {\r
         if (verbose) {\r
-            this.verbose = "-v ";\r
+            this.verbose.setArg(" -", "v");\r
         }\r
     }\r
 \r
     /**\r
-     * getDump\r
-     *\r
-     * This function is to get class member "dump"\r
-     *\r
-     * @return verbose the flag of dump.\r
-     */\r
+      getDump\r
+     \r
+      This function is to get class member "dump"\r
+     \r
+      @return verbose the flag of dump.\r
+     **/\r
     public String getDump() {\r
-        return dump;\r
+        return dump.getValue();\r
     }\r
 \r
     /**\r
-     * setDump\r
-     *\r
-     * This function is to set class member "dump"\r
-     *\r
-     * @param dump\r
-     *            True or False.\r
-     */\r
+      setDump\r
+     \r
+      This function is to set class member "dump"\r
+     \r
+      @param dump\r
+                 True or False.\r
+     **/\r
     public void setDump(boolean dump) {\r
         if (dump) {\r
-            this.dump = "-dump ";\r
+            this.dump.setArg(" -", "dump");\r
         }\r
     }\r
 }\r
index 8b6943229fd1f9ce89c923e8ef1c3175dc8f310e..2f892a7cd4abfd4fa2dffe6752bc5fd53844d708 100644 (file)
@@ -23,6 +23,8 @@ import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;\r
 import org.apache.tools.ant.Task;\r
 \r
+import org.tianocore.common.logger.EdkLog;\r
+\r
 /**\r
   GuidChkTask\r
   \r
@@ -46,49 +48,53 @@ public class GuidChkTask extends Task implements EfiDefine{
      *    -fos     : out put redirect to this file \r
      *    \r
      */\r
-    ///\r
-    /// Directory name of exclusion searching \r
-    ///\r
-    private String exDir = "";\r
-    ///\r
-    /// File name of exclusion searching.\r
-    ///\r
-    private String exFile = "";\r
-    ///\r
-    /// Extension name of exclusion searching.\r
-    ///\r
-    private String exExt = "";\r
-    ///\r
-    /// Extesnion name of sub dir which excluded searching.\r
-    ///\r
-    private String exSubDir = "";\r
-    ///\r
-    /// Out put file wrote internal GUID+basename list\r
-    ///\r
-    private String outFile = "";\r
-    ///\r
-    /// Check for duplicate guids.\r
-    ///\r
-    private String chkGui = "";\r
-    ///\r
-    /// Check for duplicate signatures\r
-    ///\r
-    private String chkSign = "";\r
-    ///\r
-    /// If set will print guid+defined symbol name\r
-    ///\r
-    private String printGuiDef = "";\r
-    ///\r
-    /// If set will print all GUIDS found\r
-    ///\r
-    private String printAllGuid = "";\r
-    ///\r
-    /// redirection file name.\r
-    ///\r
+    //\r
+    // Tool name\r
+    // \r
+    private static String toolName = "GuidChk";\r
+    //\r
+    // Directory name of exclusion searching \r
+    //\r
+    private FileArg exDir = new FileArg();\r
+    //\r
+    // File name of exclusion searching.\r
+    //\r
+    private FileArg exFile = new FileArg();\r
+    //\r
+    // Extension name of exclusion searching.\r
+    //\r
+    private FileArg exExt = new FileArg();\r
+    //\r
+    // Extesnion name of sub dir which excluded searching.\r
+    //\r
+    private FileArg exSubDir = new FileArg();\r
+    //\r
+    // Out put file wrote internal GUID+basename list\r
+    //\r
+    private FileArg outFile = new FileArg();\r
+    //\r
+    // Check for duplicate guids.\r
+    //\r
+    private ToolArg chkGui = new ToolArg();\r
+    //\r
+    // Check for duplicate signatures\r
+    //\r
+    private ToolArg chkSign = new ToolArg();\r
+    //\r
+    // If set will print guid+defined symbol name\r
+    //\r
+    private ToolArg printGuiDef = new ToolArg();\r
+    //\r
+    // If set will print all GUIDS found\r
+    //\r
+    private ToolArg printAllGuid = new ToolArg();\r
+    //\r
+    // redirection file name.\r
+    //\r
     private String outPut = "";\r
-    ///\r
-    /// out put redirect to this file.\r
-    ///\r
+    //\r
+    // out put redirect to this file.\r
+    //\r
     protected PrintWriter fos = null;\r
     \r
     //\r
@@ -99,25 +105,25 @@ public class GuidChkTask extends Task implements EfiDefine{
         String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
         String command;\r
         if (path == null) {\r
-            command = "GuidChk";\r
+            command = toolName;\r
         } else {\r
-            command = path + File.separatorChar + "GuidChk";\r
+            command = path + File.separatorChar + toolName;\r
         }\r
-        String argument = exDir +\r
-                          exFile +\r
-                          exExt +\r
-                          exSubDir +\r
-                          outFile +\r
-                          chkGui +\r
-                          chkSign +\r
-                          printGuiDef + \r
-                          printAllGuid;     \r
+        String argument = "" + exDir +\r
+                               exFile +\r
+                               exExt +\r
+                               exSubDir +\r
+                               outFile +\r
+                               chkGui +\r
+                               chkSign +\r
+                               printGuiDef + \r
+                               printAllGuid;     \r
         try {\r
-            log(command + " " + argument, Project.MSG_VERBOSE);\r
+            EdkLog.log(this, EdkLog.EDK_VERBOSE, command + " " + argument);\r
             //\r
             // execute command line \r
             //\r
-            Process proc = Runtime.getRuntime().exec(command + "" + argument);\r
+            Process proc = Runtime.getRuntime().exec(command + " " + argument);\r
             //\r
             // if set output, redirect out put to output file, else print output to screen\r
             //         \r
@@ -126,8 +132,8 @@ public class GuidChkTask extends Task implements EfiDefine{
                 BufferedReader bin = new BufferedReader(new InputStreamReader(proc.getInputStream()));\r
                 String line = bin.readLine();\r
                 while (line != null ){                  \r
-                fos.println(line);\r
-                line = bin.readLine();\r
+                    fos.println(line);\r
+                    line = bin.readLine();\r
                 }\r
                 fos.close();\r
             }\r
@@ -138,9 +144,9 @@ public class GuidChkTask extends Task implements EfiDefine{
                     line = bin.readLine();\r
                 }               \r
             }                      \r
-            log("GuidChkTask Succeeded!", Project.MSG_VERBOSE);\r
+            EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " Succeeded!");\r
         } catch (Exception e) {\r
-            throw new BuildException("GuidChkTask failed!");\r
+            throw new BuildException(toolName + " failed!");\r
         }\r
     }\r
     /**\r
@@ -151,7 +157,7 @@ public class GuidChkTask extends Task implements EfiDefine{
       @return                     string of flag of ChkGui\r
     **/\r
     public String getChkGui() {\r
-        return chkGui;\r
+        return chkGui.getValue();\r
     }\r
     \r
     /**\r
@@ -161,11 +167,10 @@ public class GuidChkTask extends Task implements EfiDefine{
       \r
       @param chkGui               set class member of chkGui\r
     **/\r
-    public void setChkGui(String chkGui) {\r
-        if (chkGui.equals("on")||(chkGui.equals("ON"))){\r
-            this.chkGui = " -g ";\r
-        }\r
-        \r
+    public void setChkGui(boolean chkGui) {\r
+        if (chkGui) {\r
+            this.chkGui.setArg(" -", "g");\r
+        }        \r
     }\r
     \r
     /**\r
@@ -176,7 +181,7 @@ public class GuidChkTask extends Task implements EfiDefine{
       @return                  chkSign\r
     **/\r
     public String getChkSign() {\r
-        return chkSign;\r
+        return chkSign.getValue();\r
     }\r
     \r
     /**\r
@@ -185,9 +190,9 @@ public class GuidChkTask extends Task implements EfiDefine{
       This function is to set class member of chkSign\r
      * @param chkSign\r
      */\r
-    public void setChkSign(String chkSign) {\r
-        if (chkSign.equals("on")|| chkSign.equals("ON")){\r
-            this.chkSign = " -s ";\r
+    public void setChkSign(boolean chkSign) {\r
+        if (chkSign){\r
+            this.chkSign.setArg(" -", "s");\r
         }       \r
     }\r
     /**\r
@@ -198,7 +203,7 @@ public class GuidChkTask extends Task implements EfiDefine{
       @return                 exDir\r
     **/\r
     public String getExDir() {\r
-        return exDir;\r
+        return exDir.getValue();\r
     }\r
     \r
     /**\r
@@ -209,7 +214,7 @@ public class GuidChkTask extends Task implements EfiDefine{
       @param                   exDir\r
     **/\r
     public void setExDir(String exDir) {\r
-        this.exDir = " -d " + exDir;\r
+        this.exDir.setArg(" -d ", exDir);\r
     }\r
     \r
     /**\r
@@ -220,7 +225,7 @@ public class GuidChkTask extends Task implements EfiDefine{
       @return                    exExt\r
     **/\r
     public String getExExt() {\r
-        return exExt;\r
+        return exExt.getValue();\r
     }\r
     \r
     /**\r
@@ -230,7 +235,7 @@ public class GuidChkTask extends Task implements EfiDefine{
       @param                      exExt\r
     **/\r
     public void setExExt(String exExt) {\r
-        this.exExt = " -e " + exExt;\r
+        this.exExt.setArg(" -e ", exExt);\r
     }\r
     \r
     /**\r
@@ -240,7 +245,7 @@ public class GuidChkTask extends Task implements EfiDefine{
       @return                    exFile\r
     **/\r
     public String getExFile() {\r
-        return exFile;\r
+        return exFile.getValue();\r
     }\r
     \r
     /**\r
@@ -251,7 +256,7 @@ public class GuidChkTask extends Task implements EfiDefine{
      @param                       exFile\r
     **/\r
     public void setExFile(String exFile) {\r
-        this.exFile = " -f " + exFile;\r
+        this.exFile.setArg(" -f ", exFile);\r
     }\r
     \r
     /**\r
@@ -262,7 +267,7 @@ public class GuidChkTask extends Task implements EfiDefine{
       @return                      exSubDir\r
     **/\r
     public String getExSubDir() {\r
-        return exSubDir;\r
+        return exSubDir.getValue();\r
     }\r
     \r
     /**\r
@@ -272,7 +277,7 @@ public class GuidChkTask extends Task implements EfiDefine{
      @param                         exSubDir\r
     **/\r
     public void setExSubDir(String exSubDir) {\r
-        this.exSubDir = " -u " + exSubDir;\r
+        this.exSubDir.setArg(" -u ", exSubDir);\r
     }\r
     \r
     /**\r
@@ -283,14 +288,14 @@ public class GuidChkTask extends Task implements EfiDefine{
      @return                        outFile\r
     **/\r
     public String getOutFile() {\r
-        return outFile;\r
+        return outFile.getValue();\r
     }\r
     /**\r
      * set class member of outFile\r
      * @param outFile\r
      */\r
     public void setOutFile(String outFile) {\r
-        this.outFile = " -b " + outFile;\r
+        this.outFile.setArg(" -b ", outFile);\r
     }\r
     /**\r
       getPrintGuidDef\r
@@ -300,7 +305,7 @@ public class GuidChkTask extends Task implements EfiDefine{
       @return     flage of printing (guid+defined symbol name)\r
     **/\r
     public String getPrintGuiDef() {\r
-        return printGuiDef;\r
+        return printGuiDef.getValue();\r
     }\r
     \r
     \r
@@ -310,9 +315,9 @@ public class GuidChkTask extends Task implements EfiDefine{
       This function is to set class member of printGuiDef.\r
       @param       printGuiDef\r
     **/\r
-    public void setPrintGuiDef(String printGuiDef) {\r
-        if (printGuiDef.equals("on")|| printGuiDef.equals("ON")){\r
-            this.printGuiDef = " -x ";\r
+    public void setPrintGuiDef(boolean printGuiDef) {\r
+        if (printGuiDef){\r
+            this.printGuiDef.setArg(" -", "x");\r
         }\r
         \r
     }\r
@@ -345,7 +350,7 @@ public class GuidChkTask extends Task implements EfiDefine{
       @return         printAllGuid\r
     **/\r
     public String getPrintAllGuid() {\r
-        return printAllGuid;\r
+        return printAllGuid.getValue();\r
     }\r
     \r
     /**\r
@@ -354,9 +359,9 @@ public class GuidChkTask extends Task implements EfiDefine{
       This function is to set class member of printAllGuid.\r
       @param          printAllGuid\r
     **/\r
-    public void setPrintAllGuid(String printAllGuid) {\r
-        if (printAllGuid.equals("on")||printAllGuid.equals("ON")) {\r
-            this.printAllGuid = " -p ";\r
+    public void setPrintAllGuid(boolean printAllGuid) {\r
+        if (printAllGuid) {\r
+            this.printAllGuid.setArg(" -", "p");\r
         }       \r
     }\r
 }\r
index 997111ae5d661cbee89cfdd4d414e7574d3f5b36..bd305fa0794c6c57a9071ab223f9757206d1d84e 100644 (file)
@@ -40,14 +40,14 @@ public class MakeDeps extends Task {
     //\r
     // private members, use set/get to access them\r
     //\r
-    private static final String cmdName = "MakeDeps";\r
-    private String              depsFile = null;\r
-    private String              subDir = null;\r
-    private boolean             quietMode = true;\r
-    private boolean             ignoreError = true;\r
-    private String              extraDeps = "";\r
-    private List<IncludePath>   includePathList = new ArrayList<IncludePath>();\r
-    private List<Input>         inputFileList = new ArrayList<Input>();\r
+    private static final String toolName = "MakeDeps";\r
+    private FileArg              depsFile = new FileArg();\r
+    private ToolArg              subDir = new ToolArg();\r
+    private ToolArg              quietMode = new ToolArg(" -", "q");\r
+    private ToolArg              ignoreError = new ToolArg(" -", "ignorenotfound");\r
+    private IncludePath          includePathList = new IncludePath();\r
+    private Input                inputFileList = new Input();\r
+    private ToolArg              target = new FileArg(" -target ", "dummy");\r
 \r
     public MakeDeps() {\r
 \r
@@ -76,61 +76,27 @@ public class MakeDeps extends Task {
         /// compose full tool path\r
         ///\r
         if (toolPath == null || toolPath.length() == 0) {\r
-            toolPath = cmdName;\r
+            toolPath = toolName;\r
         } else {\r
             if (toolPath.endsWith("/") || toolPath.endsWith("\\")) {\r
-                toolPath = toolPath + cmdName;\r
+                toolPath = toolPath + toolName;\r
             } else {\r
-                toolPath = toolPath + File.separator + cmdName;\r
+                toolPath = toolPath + File.separator + toolName;\r
             }\r
         }\r
 \r
         ///\r
         /// compose tool arguments\r
         ///\r
-        StringBuffer args = new StringBuffer(4096);\r
-        if (ignoreError) {\r
-            args.append(" -ignorenotfound ");\r
-        }\r
-        if (quietMode) {\r
-            args.append(" -q ");\r
-        }\r
-        if (subDir != null && subDir.length() > 0) {\r
-            args.append(" -s ");\r
-            args.append(subDir);\r
-        }\r
-\r
-        ///\r
-        /// if there's no source files, we can do nothing about dependency\r
-        ///\r
-        if (inputFileList.size() == 0) {\r
-            throw new BuildException("No source files specified to scan");\r
-        }\r
-\r
-        ///\r
-        /// compose source file arguments\r
-        ///\r
-        for (int i = 0, listLength = inputFileList.size(); i < listLength; ++i) {\r
-            args.append(inputFileList.get(i).toString());\r
-        }\r
-\r
-        for (int i = 0, listLength = includePathList.size(); i < listLength; ++i) {\r
-            args.append(includePathList.get(i).toString());\r
-        }\r
-\r
-        ///\r
-        /// We don't need a real target. So just a "dummy" is given\r
-        ///\r
-        args.append(" -target dummy");\r
-        args.append(" -o ");\r
-        args.append(depsFile);\r
+        String argument = "" + inputFileList + includePathList + subDir\r
+                             + quietMode + ignoreError + target + depsFile;\r
 \r
         ///\r
         /// prepare to execute the tool\r
         ///\r
         Commandline cmd = new Commandline();\r
         cmd.setExecutable(toolPath);\r
-        cmd.createArgument().setLine(args.toString());\r
+        cmd.createArgument().setLine(argument);\r
 \r
         LogStreamHandler streamHandler = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN);\r
         Execute runner = new Execute(streamHandler, null);\r
@@ -148,29 +114,20 @@ public class MakeDeps extends Task {
         }\r
 \r
         if (result != 0) {\r
-            EdkLog.log(this, EdkLog.EDK_INFO, "MakeDeps failed!");\r
-            throw new BuildException("MakeDeps: failed to generate dependency file!");\r
+            EdkLog.log(this, EdkLog.EDK_INFO, toolName + " failed!");\r
+            throw new BuildException(toolName + ": failed to generate dependency file!");\r
+        } else {\r
+            EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
         }\r
     }\r
 \r
-    ///\r
-    /// Remove any duplicated path separator or inconsistent path separator\r
-    ///\r
-    private String cleanupPathName(String path) {\r
-        String separator = "\\" + File.separator;\r
-        String duplicateSeparator = separator + "{2}";\r
-        path = Path.translateFile(path);\r
-        path = path.replaceAll(duplicateSeparator, separator);\r
-        return path;\r
-    }\r
-\r
     /**\r
      Set method for "DepsFile" attribute\r
 \r
      @param     name    The name of dependency list file\r
      **/\r
     public void setDepsFile(String name) {\r
-        depsFile = cleanupPathName(name);\r
+        depsFile.setArg(" -o ", name);\r
     }\r
 \r
     /**\r
@@ -179,7 +136,7 @@ public class MakeDeps extends Task {
      @returns   The name of dependency list file\r
      **/\r
     public String getDepsFile() {\r
-        return depsFile;\r
+        return depsFile.getValue();\r
     }\r
 \r
     /**\r
@@ -188,7 +145,9 @@ public class MakeDeps extends Task {
      @param     ignore    flag to control error handling (true/false)\r
      **/\r
     public void setIgnoreError(boolean ignore) {\r
-        ignoreError = ignore;\r
+        if (!ignore) {\r
+            ignoreError.setArg(" ", " ");\r
+        }\r
     }\r
 \r
     /**\r
@@ -197,7 +156,7 @@ public class MakeDeps extends Task {
      @returns   The value of current IgnoreError flag\r
      **/\r
     public boolean getIgnoreError() {\r
-        return ignoreError;\r
+        return ignoreError.getValue().length() > 0;\r
     }\r
 \r
     /**\r
@@ -206,7 +165,9 @@ public class MakeDeps extends Task {
      @param     quiet   flag to control the output information (true/false)\r
      **/\r
     public void setQuietMode(boolean quiet) {\r
-        quietMode = quiet;\r
+        if (!quiet) {\r
+            quietMode.setArg(" ", " ");\r
+        }\r
     }\r
 \r
     /**\r
@@ -215,7 +176,7 @@ public class MakeDeps extends Task {
      @returns   value of current QuietMode flag\r
      **/\r
     public boolean getQuietMode() {\r
-        return quietMode;\r
+        return quietMode.getValue().length() > 0;\r
     }\r
 \r
     /**\r
@@ -224,7 +185,7 @@ public class MakeDeps extends Task {
      @param     dir     The name of sub-directory in which source files will be scanned\r
      **/\r
     public void setSubDir(String dir) {\r
-        subDir = cleanupPathName(dir);\r
+        subDir.setArg(" -s ", dir);\r
     }\r
 \r
     /**\r
@@ -233,25 +194,7 @@ public class MakeDeps extends Task {
      @returns   The name of sub-directory\r
      **/\r
     public String getSubDir() {\r
-        return subDir;\r
-    }\r
-\r
-    /**\r
-     Set method for "ExtraDeps" attribute\r
-\r
-     @param     deps    The name of dependency file specified separately\r
-     **/\r
-    public void setExtraDeps(String deps) {\r
-        extraDeps = cleanupPathName(deps);\r
-    }\r
-\r
-    /**\r
-     Get method for "ExtraDeps" attribute\r
-\r
-     @returns   The name of dependency file specified separately\r
-     **/\r
-    public String getExtraDeps () {\r
-        return extraDeps;\r
+        return subDir.getValue();\r
     }\r
 \r
     /**\r
@@ -259,8 +202,8 @@ public class MakeDeps extends Task {
 \r
      @param     path    The IncludePath object from nested IncludePath type of element\r
      **/\r
-    public void addIncludepath(IncludePath path) {\r
-        includePathList.add(path);\r
+    public void addConfiguredIncludepath(IncludePath path) {\r
+        includePathList.insert(path);\r
     }\r
 \r
     /**\r
@@ -268,8 +211,8 @@ public class MakeDeps extends Task {
 \r
      @param     input   The Input object from nested Input type of element\r
      **/\r
-    public void addInput(Input inputFile) {\r
-        inputFileList.add(inputFile);\r
+    public void addConfiguredInput(Input inputFile) {\r
+        inputFileList.insert(inputFile);\r
     }\r
 \r
     /**\r
@@ -279,9 +222,10 @@ public class MakeDeps extends Task {
      @returns   false   The dependency list file is outofdate. Re-generation is needed.\r
      **/\r
     private boolean isUptodate() {\r
-        File df = new File(depsFile);\r
+        String dfName = depsFile.getValue();\r
+        File df = new File(dfName);\r
         if (!df.exists()) {\r
-            EdkLog.log(this, EdkLog.EDK_VERBOSE, depsFile + " doesn't exist!");\r
+            EdkLog.log(this, EdkLog.EDK_VERBOSE, dfName + " doesn't exist!");\r
             return false;\r
         }\r
 \r
@@ -290,16 +234,12 @@ public class MakeDeps extends Task {
         // re-generate the dependency list file\r
         //\r
         long depsFileTimeStamp = df.lastModified();\r
-        Iterator<Input> iterator = (Iterator<Input>)inputFileList.iterator();\r
-        while (iterator.hasNext()) {\r
-            Input inputFile = iterator.next();\r
-            List<String> fileList = inputFile.getNameList();\r
-            for (int i = 0, length = fileList.size(); i < length; ++i) {\r
-                File sf = new File(fileList.get(i));\r
-                if (sf.lastModified() > depsFileTimeStamp) {\r
-                    EdkLog.log(this, EdkLog.EDK_VERBOSE, sf.getPath() + " has been changed since last build!");\r
-                    return false;\r
-                }\r
+        List<String> fileList = inputFileList.getNameList();\r
+        for (int i = 0, length = fileList.size(); i < length; ++i) {\r
+            File sf = new File(fileList.get(i));\r
+            if (sf.lastModified() > depsFileTimeStamp) {\r
+                EdkLog.log(this, EdkLog.EDK_VERBOSE, sf.getPath() + " has been changed since last build!");\r
+                return false;\r
             }\r
         }\r
 \r
@@ -350,7 +290,7 @@ public class MakeDeps extends Task {
             // check if the .dep file is empty\r
             // \r
             if (lines == 0) {\r
-                EdkLog.log(this, EdkLog.EDK_VERBOSE, depsFile + " is empty!");\r
+                EdkLog.log(this, EdkLog.EDK_VERBOSE, dfName + " is empty!");\r
                 ret = false;\r
             }\r
 \r
index e01b0404a8a6363ad2fd092c4ecfc1a09416cea7..58920645090ea73814f3ba6e1ca97aa45ed7d32a 100644 (file)
@@ -33,39 +33,39 @@ import org.tianocore.common.logger.EdkLog;
   ModifyInfTask is used to call Modify.exe to generate inf file.\r
 **/\r
 public class ModifyInfTask extends Task implements EfiDefine {\r
-    ///\r
-    /// tool name\r
-    ///\r
+    //\r
+    // tool name\r
+    //\r
     private String toolName = "ModifyInf";\r
 \r
-    ///\r
-    /// input FV inf file\r
-    ///\r
-    private String inputFVInfFile = "";\r
+    //\r
+    // input FV inf file\r
+    //\r
+    private FileArg inputFVInfFile = new FileArg();\r
 \r
-    ///\r
-    /// output FV inf file\r
-    ///\r
-    private String outputFVInfFile = "";\r
+    //\r
+    // output FV inf file\r
+    //\r
+    private FileArg outputFVInfFile = new FileArg();\r
 \r
-    ///\r
-    /// pattern string\r
-    ///\r
-    private String patternStr = "";\r
+    //\r
+    // pattern string\r
+    //\r
+    private ToolArg patternStr = new ToolArg();\r
 \r
-       ///\r
-       ///  Output dir\r
-       ///\r
-       private String outputDir = "";\r
+       //\r
+       //  Output dir\r
+       //\r
+       private String outputDir = ".";\r
 \r
     /**\r
-     * execute\r
-     *\r
-     * ModifyInfTask execute function is to assemble tool command line & execute\r
-     * tool command line\r
-     *\r
-     * @throws BuidException\r
-     */\r
+      execute\r
+     \r
+      ModifyInfTask 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
@@ -83,18 +83,7 @@ public class ModifyInfTask extends Task implements EfiDefine {
         //\r
         // argument of tools\r
         //\r
-               File file = new File(outputFVInfFile);\r
-        if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
-                       argument = this.inputFVInfFile +\r
-                                      this.outputDir +\r
-                                          File.separatorChar +\r
-                                          this.outputFVInfFile +\r
-                                          this.patternStr;\r
-               } else {\r
-                       argument = this.inputFVInfFile +\r
-                                      this.outputFVInfFile +\r
-                                      this.patternStr;\r
-               }\r
+        argument = "" + this.inputFVInfFile + this.outputFVInfFile + this.patternStr;\r
         //\r
         // return value of fwimage execution\r
         //\r
@@ -111,24 +100,27 @@ public class ModifyInfTask 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.inputFVInfFile)).getName());\r
-            revl = runner.execute();\r
+            EdkLog.log(this, EdkLog.EDK_INFO, this.inputFVInfFile.toFileList()\r
+                + " => " + this.inputFVInfFile.toFileList());\r
 \r
+            revl = runner.execute();\r
             if (EFI_SUCCESS == revl) {\r
                 //\r
                 // command execution success\r
                 //\r
-                EdkLog.log(this, EdkLog.EDK_VERBOSE, "ModifyInfTask 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("ModifyInfTask failed!");\r
+                throw new BuildException(toolName + " failed!");\r
             }\r
         } catch (Exception e) {\r
             throw new BuildException(e.getMessage());\r
@@ -136,93 +128,93 @@ public class ModifyInfTask extends Task implements EfiDefine {
     }\r
 \r
     /**\r
-     * getinputFVInfFile\r
-     *\r
-     * This function is to get class member "inputFVInfFile".\r
-     *\r
-     * @return string of input inf file name.\r
-     */\r
+      getinputFVInfFile\r
+     \r
+      This function is to get class member "inputFVInfFile".\r
+     \r
+      @return string of input inf file name.\r
+     **/\r
     public String getinputFVInfFile() {\r
-        return this.inputFVInfFile;\r
+        return this.inputFVInfFile.getValue();\r
     }\r
 \r
     /**\r
-     * setinputFVInfFile\r
-     *\r
-     * This function is to set class member "inputFVInfFile".\r
-     *\r
-     * @param inputFile\r
-     *            string of input inf file name.\r
-     */\r
+      setinputFVInfFile\r
+     \r
+      This function is to set class member "inputFVInfFile".\r
+     \r
+      @param inputFile\r
+                 string of input inf file name.\r
+     **/\r
     public void setinputFVInfFile(String inputFVInfFileName) {\r
-        this.inputFVInfFile= inputFVInfFileName + " ";\r
+        this.inputFVInfFile.setArg(" ", inputFVInfFileName);\r
     }\r
 \r
     /**\r
-     * getoutputFVInfFile\r
-     *\r
-     * This function is to get class member "outputFVInfFile"\r
-     *\r
-     * @return outputFVInfFile string of output inf file name.\r
-     */\r
+      getoutputFVInfFile\r
+     \r
+      This function is to get class member "outputFVInfFile"\r
+     \r
+      @return outputFVInfFile string of output inf file name.\r
+     **/\r
     public String getoutputFVInfFile() {\r
-        return this.outputFVInfFile;\r
+        return this.outputFVInfFile.getValue();\r
     }\r
 \r
     /**\r
-     * setoutputFVInfFile\r
-     *\r
-     * This function is to set class member "outputFVInfFile"\r
-     *\r
-     * @param outputFVInfFile\r
-     *            string of output  inf file name.\r
-     */\r
+      setoutputFVInfFile\r
+     \r
+      This function is to set class member "outputFVInfFile"\r
+     \r
+      @param outputFVInfFile\r
+                 string of output  inf file name.\r
+     **/\r
     public void setoutputFVInfFile(String outputFVInfFileName) {\r
-        this.outputFVInfFile = outputFVInfFileName  + " ";\r
+        this.outputFVInfFile.setArg(" ", outputFVInfFileName);\r
     }\r
 \r
     /**\r
-     * getpatternStr\r
-     *\r
-     * This function is to get class member "patternStr"\r
-     *\r
-     * @return patternStr string of pattern.\r
-     */\r
+      getpatternStr\r
+     \r
+      This function is to get class member "patternStr"\r
+     \r
+      @return patternStr string of pattern.\r
+     **/\r
     public String getpatternStr() {\r
-        return this.patternStr;\r
+        return this.patternStr.getValue();\r
     }\r
 \r
     /**\r
-     * setpatternStr\r
-     *\r
-     * This function is to set class member "patternStr"\r
-     *\r
-     * @param patternStr\r
-     *            string of patternStr.\r
-     */\r
+      setpatternStr\r
+     \r
+      This function is to set class member "patternStr"\r
+     \r
+      @param patternStr\r
+                 string of patternStr.\r
+     **/\r
     public void setpatternStr(String patternStr) {\r
-        this.patternStr = patternStr;\r
+        this.patternStr.setArg(" ", patternStr);\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 this.outputDir;\r
     }\r
 \r
     /**\r
-     * setoutputDir\r
-     *\r
-     * This function is to set class member "outputDir"\r
-     *\r
-     * @param patternStr\r
-     *            string of output directory.\r
-     */\r
+      setoutputDir\r
+     \r
+      This function is to set class member "outputDir"\r
+     \r
+      @param patternStr\r
+                 string of output directory.\r
+     **/\r
     public void setoutputDir(String outputDir) {\r
         this.outputDir = outputDir;\r
     }\r
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
index 3e2dd1a8ba5bce384782d54b447c4b35731b5a40..2f9bc46b8fd4266d7ac79203254e8ddde12004f2 100644 (file)
@@ -33,39 +33,39 @@ import org.tianocore.common.logger.EdkLog;
  * SecFixupTask is used to call SecFixup.exe to fix up sec image.\r
  */\r
 public class SecFixupTask extends Task implements EfiDefine {\r
-    // /\r
-    // tool name\r
-    // /\r
+    //\r
+    // tool name\r
+    //\r
     private String toolName = "SecFixup";\r
 \r
-    // /\r
-    // input file\r
-    // /\r
-    private String secExeFile = "";\r
+    //\r
+    // input file\r
+    //\r
+    private FileArg secExeFile = new FileArg();\r
 \r
-    // /\r
-    // output file\r
-    // /\r
-    private String resetVectorDataFile = "";\r
+    //\r
+    // output file\r
+    //\r
+    private FileArg resetVectorDataFile = new FileArg();\r
 \r
-    // /\r
-    // / output directory, this variable is added by jave wrap\r
-    // /\r
-    private String outputFile = "";\r
+    //\r
+    // output file\r
+    //\r
+    private FileArg outputFile = new FileArg();\r
 \r
-    // /\r
-    // / output directory\r
-    // /\r
-    private String outputDir = "";\r
+    //\r
+    // output directory, this variable is added by jave wrap\r
+    //\r
+    private String outputDir = ".";\r
 \r
     /**\r
-     * execute\r
-     *\r
-     * SecFixupTask execute function is to assemble tool command line & execute\r
-     * tool command line\r
-     *\r
-     * @throws BuidException\r
-     */\r
+      execute\r
+     \r
+      SecFixupTask 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
@@ -84,13 +84,7 @@ public class SecFixupTask extends Task implements EfiDefine {
         //\r
         // argument of tools\r
         //\r
-        if (!this.outputDir.equalsIgnoreCase("")) {\r
-            argument = this.secExeFile + " " + this.resetVectorDataFile + " "\r
-                    + this.outputDir + File.separatorChar + this.outputFile;\r
-        } else {\r
-            argument = this.secExeFile + " " + this.resetVectorDataFile + " "\r
-                    + this.outputFile;\r
-        }\r
+        argument = "" + secExeFile + resetVectorDataFile + outputFile;\r
 \r
         //\r
         // return value of fwimage execution\r
@@ -108,10 +102,14 @@ public class SecFixupTask 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, secExeFile.toFileList() \r
+                + resetVectorDataFile.toFileList() + " => " + outputFile.toFileList());\r
 \r
             revl = runner.execute();\r
 \r
@@ -119,13 +117,13 @@ public class SecFixupTask extends Task implements EfiDefine {
                 //\r
                 // command execution success\r
                 //\r
-                EdkLog.log(this, EdkLog.EDK_VERBOSE, "SecFixup 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("SecFixup failed!");\r
+                throw new BuildException(toolName + " failed!");\r
             }\r
         } catch (Exception e) {\r
             throw new BuildException(e.getMessage());\r
@@ -133,93 +131,93 @@ public class SecFixupTask extends Task implements EfiDefine {
     }\r
 \r
     /**\r
-     * getSecExeFile\r
-     *\r
-     * This function is to get class member "secExeFile".\r
-     *\r
-     * @return string of sectExe file name.\r
-     */\r
+      getSecExeFile\r
+     \r
+      This function is to get class member "secExeFile".\r
+     \r
+      @return string of sectExe file name.\r
+     **/\r
     public String getSecExeFile() {\r
-        return this.secExeFile;\r
+        return this.secExeFile.getValue();\r
     }\r
 \r
     /**\r
-     * setSecExeFile\r
-     *\r
-     * This function is to set class member "secExeFile".\r
-     *\r
-     * @param secExeFile\r
-     *            string of secExe file name.\r
-     */\r
+      setSecExeFile\r
+     \r
+      This function is to set class member "secExeFile".\r
+     \r
+      @param secExeFile\r
+                 string of secExe file name.\r
+     **/\r
     public void setSecExeFile(String secExeFile) {\r
-        this.secExeFile = secExeFile;\r
+        this.secExeFile.setArg(" ", secExeFile);\r
     }\r
 \r
     /**\r
-     * getResetVectorDataFile\r
-     *\r
-     * This function is to get class member "resetVectorDataFile"\r
-     *\r
-     * @return resetVectorDataFile string of resetVectorData file name.\r
-     */\r
+      getResetVectorDataFile\r
+     \r
+      This function is to get class member "resetVectorDataFile"\r
+     \r
+      @return resetVectorDataFile string of resetVectorData file name.\r
+     **/\r
     public String getResetVectorDataFile() {\r
-        return this.resetVectorDataFile;\r
+        return this.resetVectorDataFile.getValue();\r
     }\r
 \r
     /**\r
-     * setResetVectorDataFile\r
-     *\r
-     * This function is to set class member "resetVectorDataFile"\r
-     *\r
-     * @param resetVectorDataFile\r
-     *            string of resetVectorData file name.\r
-     */\r
+      setResetVectorDataFile\r
+     \r
+      This function is to set class member "resetVectorDataFile"\r
+     \r
+      @param resetVectorDataFile\r
+                 string of resetVectorData file name.\r
+     **/\r
     public void setResetVectorDataFile(String resetVectorDataFile) {\r
-        this.resetVectorDataFile = resetVectorDataFile;\r
+        this.resetVectorDataFile.setArg(" ", resetVectorDataFile);\r
     }\r
 \r
     /**\r
-     * getOutputFile\r
-     *\r
-     * This function is to get class member "outputFile"\r
-     *\r
-     * @return outputFile string of output file name.\r
-     */\r
+      getOutputFile\r
+     \r
+      This function is to get class member "outputFile"\r
+     \r
+      @return outputFile string of output file name.\r
+     **/\r
     public String getOutputFile() {\r
-        return outputFile;\r
+        return this.outputFile.getValue();\r
     }\r
 \r
     /**\r
-     * setOutputFile\r
-     *\r
-     * This function is to set class member "outputFile"\r
-     *\r
-     * @param outputFile\r
-     *            string of output file name.\r
-     */\r
+      setOutputFile\r
+     \r
+      This function is to set class member "outputFile"\r
+     \r
+      @param outputFile\r
+                 string of output file name.\r
+     **/\r
     public void setOutputFile(String outputFile) {\r
-        this.outputFile = outputFile;\r
+        this.outputFile.setArg(" ", outputFile);\r
     }\r
 \r
     /**\r
-     * getOutputDir\r
-     *\r
-     * This function is to get class member "outputDir"\r
-     *\r
-     * @return outputDir name of output directory\r
-     */\r
+      getOutputDir\r
+     \r
+      This function is to get class member "outputDir"\r
+     \r
+      @return outputDir name 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
-     *            name of output directory\r
-     */\r
+      setOutputDir\r
+     \r
+      This function is to set class member "outputDir"\r
+     \r
+      @param outputDir\r
+                 name of output directory\r
+     **/\r
     public void setOutputDir(String outputDir) {\r
         this.outputDir = outputDir;\r
     }\r
index a06d312d06fc80227353307d9431ffe9f96b366c..dc3a96e8e55d86fc3efbf46aa6c7b9ca3a8faa4c 100644 (file)
@@ -22,6 +22,8 @@ import org.apache.tools.ant.taskdefs.Execute;
 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
  Class SetStampTask is a wrap class for setstamp.exe.\r
  **/\r
@@ -32,10 +34,14 @@ public class SetStampTask extends Task implements EfiDefine {
          -peFile  : file of PE\r
          -timeFile: Txt file of time\r
      **/ \r
-    \r
-    private String peFile = "";\r
 \r
-    private String timeFile = "";\r
+    private static String toolName = "SetStamp";\r
+\r
+    private FileArg peFile = new FileArg();\r
+\r
+    private FileArg timeFile = new FileArg();\r
+\r
+    private String outputDir = ".";\r
 \r
     /**\r
      assemble tool command line & execute tool command line\r
@@ -51,14 +57,14 @@ public class SetStampTask extends Task implements EfiDefine {
         String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
         String command;\r
         if (path == null) {\r
-            command = "SetStamp";\r
+            command = toolName;\r
         } else {\r
-            command = path + "/" + "SetStamp";\r
+            command = path + File.separator + toolName;\r
         }\r
         ///\r
         /// argument of SetStamp tool\r
         ///\r
-        String argument = peFile + timeFile;\r
+        String argument = "" + peFile + timeFile;\r
         ///\r
         /// reture value of SetStamp execution\r
         ///\r
@@ -75,19 +81,20 @@ public class SetStampTask extends Task implements EfiDefine {
             Execute runner = new Execute(streamHandler, null);\r
             runner.setAntRun(project);\r
             runner.setCommandline(commandLine.getCommandline());\r
+            runner.setWorkingDirectory(new File(outputDir));\r
 \r
-            log(Commandline.toString(commandLine.getCommandline()), Project.MSG_VERBOSE);\r
-            log((new File(this.peFile)).getName());\r
+            EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(commandLine.getCommandline()));\r
+            EdkLog.log(this, peFile.toFileList() + " < " + timeFile.toFileList());\r
 \r
             returnVal = runner.execute();\r
             if (EFI_SUCCESS == returnVal) {\r
-                log("SetStamp succeeded!", Project.MSG_VERBOSE);\r
+                EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
             } else {\r
                 ///\r
                 /// command execution fail\r
                 ///\r
-                log("ERROR = " + Integer.toHexString(returnVal));\r
-                throw new BuildException("SetStamp failed!");\r
+                EdkLog.log(this, "ERROR = " + Integer.toHexString(returnVal));\r
+                throw new BuildException(toolName + " failed!");\r
             }\r
         } catch (Exception e) {\r
             throw new BuildException(e.getMessage());\r
@@ -100,7 +107,7 @@ public class SetStampTask extends Task implements EfiDefine {
      @param     peFile  name of PE File\r
      **/\r
     public void setPeFile(String peFile) {\r
-        this.peFile = " " + peFile;\r
+        this.peFile.setArg(" ", peFile);\r
     }\r
 \r
     /**\r
@@ -109,7 +116,7 @@ public class SetStampTask extends Task implements EfiDefine {
      @return    peFile  name of PE file\r
      **/\r
     public String getPeFile() {\r
-        return this.peFile;\r
+        return this.peFile.getValue();\r
     }\r
 \r
     /**\r
@@ -118,7 +125,7 @@ public class SetStampTask extends Task implements EfiDefine {
      @param     timeFile    name of time file\r
      **/\r
     public void setTimeFile(String timeFile) {\r
-        this.timeFile = " " + timeFile;\r
+        this.timeFile.setArg(" ", timeFile);\r
     }\r
 \r
     /**\r
@@ -127,7 +134,29 @@ public class SetStampTask extends Task implements EfiDefine {
      @returns   name of time file\r
      **/\r
     public String getTimeFile() {\r
-        return this.timeFile;\r
+        return this.timeFile.getValue();\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
+    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
+    public void setOutputDir(String outputDir) {\r
+        this.outputDir = outputDir;\r
+    }\r
 }\r
index 01abde7da0ee2ec90bc64db93053e07c3d21d590..7c1882aaf01108ee0dbc4db6e206da0cda4984cc 100644 (file)
@@ -35,25 +35,34 @@ import org.tianocore.common.logger.EdkLog;
   file.\r
 **/\r
 public class SplitfileTask extends Task implements EfiDefine {\r
-    ///\r
-    /// input file\r
-    ///\r
-    private String inputFile = "";\r
-\r
-    ///\r
-    /// offset value\r
-    ///\r
-    private String offset = "";\r
-\r
+    //\r
+    // Tool name\r
+    // \r
+    private static String toolName = "SplitFile";\r
+\r
+    //\r
+    // input file\r
+    //\r
+    private FileArg inputFile = new FileArg();\r
+\r
+    //\r
+    // offset value\r
+    //\r
+    private ToolArg offset = new ToolArg();\r
+\r
+    //\r
+    // Output directory\r
+    // \r
+    private String outputDir = ".";\r
 \r
     /**\r
-     * execute\r
-     *\r
-     * SplitfleTask execute function is to assemble tool command line & execute\r
-     * tool command line\r
-     *\r
-     * @throws BuidException\r
-     */\r
+      execute\r
+     \r
+      SplitfleTask 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
@@ -65,15 +74,15 @@ public class SplitfileTask extends Task implements EfiDefine {
         String command;\r
         String argument;\r
         if (path == null) {\r
-            command = "SplitFile";\r
+            command = toolName;\r
         } else {\r
-            command = path + File.separatorChar + "SplitFile";\r
+            command = path + File.separator + toolName;\r
         }\r
 \r
         //\r
         // argument of tools\r
         //\r
-        argument = inputFile + " " + offset;\r
+        argument = "" + inputFile + offset;\r
 \r
         //\r
         // return value of fwimage execution\r
@@ -91,21 +100,24 @@ public class SplitfileTask extends Task implements EfiDefine {
 \r
             runner.setAntRun(project);\r
             runner.setCommandline(cmdline.getCommandline());\r
+            runner.setWorkingDirectory(new File(outputDir));\r
 \r
             EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
-            EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.inputFile)).getName());\r
+            String fileName = inputFile.toFileList();\r
+            EdkLog.log(this, EdkLog.EDK_INFO, fileName + " => " + fileName + "1 " + fileName + "2");\r
+\r
             revl = runner.execute();\r
             if (EFI_SUCCESS == revl) {\r
                 //\r
                 // command execution success\r
                 //\r
-                EdkLog.log(this, EdkLog.EDK_VERBOSE, "SplitFile 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("SplitFile failed!");\r
+                throw new BuildException(toolName + " failed!");\r
             }\r
         } catch (Exception e) {\r
             throw new BuildException(e.getMessage());\r
@@ -113,26 +125,26 @@ public class SplitfileTask extends Task implements EfiDefine {
     }\r
 \r
     /**\r
-     * getInputFile\r
-     *\r
-     * This function is to get class member "inputFile".\r
-     *\r
-     * @return string of input file name.\r
-     */\r
+      getInputFile\r
+     \r
+      This function is to get class member "inputFile".\r
+     \r
+      @return string of input file name.\r
+     **/\r
     public String getInputFile() {\r
-        return inputFile;\r
+        return inputFile.getValue();\r
     }\r
 \r
     /**\r
-     * setComponentType\r
-     *\r
-     * This function is to set class member "inputFile".\r
-     *\r
-     * @param inputFile\r
-     *            string of input file name.\r
-     */\r
+      setComponentType\r
+     \r
+      This function is to set class member "inputFile".\r
+     \r
+      @param inputFile\r
+                 string of input file name.\r
+     **/\r
     public void setInputFile(String inputFile) {\r
-        this.inputFile = inputFile;\r
+        this.inputFile.setArg(" ", inputFile);\r
     }\r
 \r
     /**\r
@@ -143,7 +155,7 @@ public class SplitfileTask extends Task implements EfiDefine {
       @return offset value of string.\r
     **/\r
     public String getOffset() {\r
-        return offset;\r
+        return offset.getValue();\r
     }\r
 \r
     /**\r
@@ -155,7 +167,29 @@ public class SplitfileTask extends Task implements EfiDefine {
                  string of offset value.\r
     **/\r
     public void setOffset(String offset) {\r
-        this.offset = offset;\r
+        this.offset.setArg(" ", offset);\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
+    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
+    public void setOutputDir(String outputDir) {\r
+        this.outputDir = outputDir;\r
+    }\r
 }\r
index 2a7b8a7e27cddae7986016d20e31c7006b441450..541e96f54f785b2b0f06d4a14c5e892138a82243 100644 (file)
@@ -44,16 +44,21 @@ import org.tianocore.common.logger.EdkLog;
       -outputHpk      : create an HII export pack of the strings\r
  **/\r
 public class StrGatherTask extends Task implements EfiDefine {\r
-    ///\r
-    /// common options\r
-    ///\r
+    //\r
+    // Tool name\r
+    // \r
+    private static String toolName = "StrGather";\r
+\r
+    //\r
+    // common options\r
+    //\r
     private ToolArg commandType = new ToolArg();\r
 \r
     private ToolArg baseName = new ToolArg();\r
 \r
-    ///\r
-    /// "all/read/write"\r
-    ///\r
+    //\r
+    // "all/read/write"\r
+    //\r
     private ToolArg verbose = new ToolArg();\r
 \r
     private FileArg outputDatabase = new FileArg();\r
@@ -62,25 +67,25 @@ public class StrGatherTask extends Task implements EfiDefine {
 \r
     private InputFile inputFileList = new InputFile();\r
 \r
-    ///\r
-    /// parse options newDatabase -- "ture/false" unquoteString -- "ture/false"\r
-    ///\r
+    //\r
+    // parse options newDatabase -- "ture/false" unquoteString -- "ture/false"\r
+    //\r
     private ToolArg newDatabase = new ToolArg();\r
 \r
     private ToolArg unquotedString = new ToolArg();\r
 \r
     private IncludePath includePathList = new IncludePath();\r
 \r
-    ///\r
-    /// scan options ignoreNotFound -- "ture/false"\r
-    ///\r
+    //\r
+    // scan options ignoreNotFound -- "ture/false"\r
+    //\r
     private ToolArg ignoreNotFound = new ToolArg();\r
 \r
     private SkipExt skipExtList = new SkipExt();\r
 \r
-    ///\r
-    /// dump options\r
-    ///\r
+    //\r
+    // dump options\r
+    //\r
     private ToolArg outputString = new ToolArg();\r
 \r
     private ToolArg outputDefines = new ToolArg();\r
@@ -93,9 +98,9 @@ public class StrGatherTask extends Task implements EfiDefine {
 \r
     private FileArg outputHpk = new FileArg();\r
 \r
-    ///\r
-    /// global variable\r
-    ///\r
+    //\r
+    // global variable\r
+    //\r
     static private Project project;\r
 \r
     /**\r
@@ -112,9 +117,9 @@ public class StrGatherTask extends Task implements EfiDefine {
         String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH"); \r
         String command;\r
         if (path == null) {\r
-            command = "StrGather";\r
+            command = toolName;\r
         } else {\r
-            command = path + File.separator + "StrGather";\r
+            command = path + File.separator + toolName;\r
         }\r
 \r
         ///\r
@@ -157,13 +162,13 @@ public class StrGatherTask extends Task implements EfiDefine {
 \r
             revl = runner.execute();\r
             if (EFI_SUCCESS == revl) {\r
-                EdkLog.log(this, EdkLog.EDK_VERBOSE, "StrGather succeeded!");\r
+                EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");\r
             } else {\r
                 ///\r
                 /// command execution fail\r
                 ///\r
                 EdkLog.log(this, "ERROR = " + Integer.toHexString(revl));\r
-                throw new BuildException("StrGather failed!");\r
+                throw new BuildException(toolName + " failed!");\r
             }\r
         } catch (Exception e) {\r
             throw new BuildException(e.getMessage());\r
index 14488be8fc81a64f02580f111f1b26012366b66f..9558f703b9b618cf4df0139bb1173f34bfad6107 100644 (file)
@@ -33,30 +33,34 @@ import org.tianocore.common.logger.EdkLog;
   StripTask is used to call Strip.exe to strip input file.\r
  */\r
 public class StripTask extends Task implements EfiDefine {\r
-    // /\r
-    // / input file\r
-    // /\r
-    private String inputFile = "";\r
-\r
-    // /\r
-    // / output file\r
-    // /\r
-    private String outputFile = "";\r
-\r
-    // /\r
-    // / output directory, this variable is added by jave wrap\r
-    // /\r
-    private String outputDir = "";\r
+    //\r
+    // \r
+    // \r
+    private static String toolName = "Strip";\r
+    //\r
+    // input file\r
+    //\r
+    private FileArg inputFile = new FileArg();\r
+\r
+    //\r
+    // output file\r
+    //\r
+    private FileArg outputFile = new FileArg();\r
+\r
+    //\r
+    // output directory, this variable is added by jave wrap\r
+    //\r
+    private String outputDir = ".";\r
 \r
 \r
     /**\r
-     * execute\r
-     *\r
-     * StripTask execute function is to assemble tool command line & execute\r
-     * tool command line\r
-     *\r
-     * @throws BuidException\r
-     */\r
+      execute\r
+     \r
+      StripTask 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
@@ -67,21 +71,18 @@ public class StripTask extends Task implements EfiDefine {
         String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
         String command;\r
         String argument;\r
+\r
         if (path == null) {\r
-            command = "Strip";\r
+            command = toolName;\r
         } else {\r
-            command = path + File.separatorChar + "Strip";\r
+            command = path + File.separator + toolName;\r
         }\r
+\r
         //\r
         // argument of tools\r
         //\r
-        File file = new File(outputFile);\r
-        if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
-            argument = inputFile + " " + outputDir + File.separatorChar\r
-                    + outputFile;\r
-        } else {\r
-            argument = inputFile + " " + outputFile;\r
-        }\r
+        argument = "" + inputFile + outputFile;\r
+\r
         //\r
         // return value of fwimage execution\r
         //\r
@@ -98,11 +99,13 @@ public class StripTask 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.inputFile)).getName());\r
+            EdkLog.log(this, EdkLog.EDK_INFO, inputFile.toFileList() + " => " + outputFile.toFileList());\r
 \r
             revl = runner.execute();\r
 \r
@@ -110,13 +113,13 @@ public class StripTask extends Task implements EfiDefine {
                 //\r
                 // command execution success\r
                 //\r
-                EdkLog.log(this, EdkLog.EDK_VERBOSE, "Strip 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("Strip failed!");\r
+                throw new BuildException(toolName + " failed!");\r
             }\r
         } catch (Exception e) {\r
             throw new BuildException(e.getMessage());\r
@@ -124,70 +127,70 @@ public class StripTask extends Task implements EfiDefine {
     }\r
 \r
     /**\r
-     * getInputFile\r
-     *\r
-     * This function is to get class member "inputFile".\r
-     *\r
-     * @return string of input file name.\r
-     */\r
+      getInputFile\r
+     \r
+      This function is to get class member "inputFile".\r
+     \r
+      @return string of input file name.\r
+     **/\r
     public String getInputFile() {\r
-        return inputFile;\r
+        return inputFile.getValue();\r
     }\r
 \r
     /**\r
-     * setComponentType\r
-     *\r
-     * This function is to set class member "inputFile".\r
-     *\r
-     * @param inputFile\r
-     *            string of input file name.\r
-     */\r
+      setComponentType\r
+     \r
+      This function is to set class member "inputFile".\r
+     \r
+      @param inputFile\r
+                 string of input file name.\r
+     **/\r
     public void setInputFile(String inputFile) {\r
-        this.inputFile = inputFile;\r
+        this.inputFile.setArg(" ", inputFile);\r
     }\r
 \r
     /**\r
-     * getOutputFile\r
-     *\r
-     * This function is to get class member "outputFile"\r
-     *\r
-     * @return outputFile string of output file name.\r
-     */\r
+      getOutputFile\r
+     \r
+      This function is to get class member "outputFile"\r
+     \r
+      @return outputFile string of output file name.\r
+     **/\r
     public String getOutputFile() {\r
-        return outputFile;\r
+        return outputFile.getValue();\r
     }\r
 \r
     /**\r
-     * setOutputFile\r
-     *\r
-     * This function is to set class member "outputFile"\r
-     *\r
-     * @param outputFile\r
-     *            string of output file name.\r
-     */\r
+      setOutputFile\r
+     \r
+      This function is to set class member "outputFile"\r
+     \r
+      @param outputFile\r
+                 string of output file name.\r
+     **/\r
     public void setOutputFile(String outputFile) {\r
-        this.outputFile = outputFile;\r
+        this.outputFile.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
index e67e15d7867fb21ebc872fe5e3d09242733c982c..0ef2a6ea7c22941d7bbb7709e49a7cd2ccc443bd 100644 (file)
@@ -49,7 +49,7 @@ public class Tool implements EfiDefine, Section {
         try {\r
             executeTool ();\r
         } catch (Exception e) {\r
-            throw new BuildException("Call to executeTool failed!\n");\r
+            throw new BuildException("Call to executeTool failed!\n" + e.getMessage());\r
         }\r
 \r
         ///\r
@@ -83,7 +83,7 @@ public class Tool implements EfiDefine, Section {
                 buffer.writeByte(0);\r
             }\r
         } catch (Exception e) {\r
-            System.out.print(e.getMessage());\r
+            EdkLog.log(e.getMessage());\r
             throw new BuildException("Tool call, toBuffer failed!\n");\r
         } finally {\r
             try {\r
@@ -94,7 +94,7 @@ public class Tool implements EfiDefine, Section {
                     fs.close();\r
                 }\r
             } catch (Exception e) {\r
-                System.out.println("WARNING: Cannot close " + outputFile.getPath());\r
+                EdkLog.log("WARNING: Cannot close " + outputFile.getPath());\r
             }\r
         }\r
     }\r
@@ -129,7 +129,7 @@ public class Tool implements EfiDefine, Section {
                     sect.toBuffer(Do);\r
                 }\r
                 catch (BuildException e) {\r
-                    System.out.print(e.getMessage());\r
+                    EdkLog.log(e.getMessage());\r
                     throw new BuildException ("GenSection failed at Tool!");\r
                 }  \r
                 Do.close();\r
@@ -150,7 +150,7 @@ public class Tool implements EfiDefine, Section {
             Process process = Runtime.getRuntime().exec(command + " " + argument);\r
             process.waitFor();\r
         } catch (Exception e) {\r
-            System.out.print (e.getMessage());\r
+            EdkLog.log(e.getMessage());\r
             throw new BuildException("Execution of externalTool task failed!\n");\r
         }\r
     }\r
index a6df4949f5dbfcb0854ab70eac5e3a9c3a0e8132..f60b8a6bb8dabc0cda7995034423651ae98d5923 100644 (file)
@@ -33,30 +33,34 @@ import org.tianocore.common.logger.EdkLog;
   ZeroDebugDataTask is used to call ZeroDebugData.exe to remove debug data.\r
 **/\r
 public class ZeroDebugDataTask extends Task implements EfiDefine {\r
-    // /\r
-    // / input PE file\r
-    // /\r
-    private String peFile = "";\r
-\r
-    // /\r
-    // / output file\r
-    // /\r
-    private String outputFile = "DebugData.dat";\r
-\r
-    // /\r
-    // / output directory, this variable is added by jave wrap\r
-    // /\r
-    private String outputDir = "";\r
+    //\r
+    // Tool name\r
+    // \r
+    private static String toolName = "ZeroDebugData";\r
+    //\r
+    // input PE file\r
+    //\r
+    private FileArg peFile = new FileArg();\r
+\r
+    //\r
+    // output file\r
+    //\r
+    private FileArg outputFile = new FileArg(" ", "DebugData.dat");\r
+\r
+    //\r
+    // output directory, this variable is added by jave wrap\r
+    //\r
+    private String outputDir = ".";\r
 \r
 \r
     /**\r
-     * execute\r
-     *\r
-     * ZeroDebugDataTask execute function is to assemble tool command line & execute\r
-     * tool command line\r
-     *\r
-     * @throws BuidException\r
-     */\r
+      execute\r
+     \r
+      ZeroDebugDataTask 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
@@ -68,20 +72,16 @@ public class ZeroDebugDataTask extends Task implements EfiDefine {
         String command;\r
         String argument;\r
         if (path == null) {\r
-            command = "ZeroDebugData";\r
+            command = toolName;\r
         } else {\r
-            command = path + File.separatorChar + "ZeroDebugData";\r
+            command = path + File.separatorChar + toolName;\r
         }\r
+\r
         //\r
         // argument of tools\r
         //\r
-        File file = new File(outputFile);\r
-        if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
-            argument = this.peFile + " " + outputDir + File.separatorChar\r
-                    + outputFile;\r
-        } else {\r
-            argument = this.peFile + " " + outputFile;\r
-        }\r
+        argument = "" + peFile + outputFile;\r
+\r
         //\r
         // return value of fwimage execution\r
         //\r
@@ -98,11 +98,12 @@ public class ZeroDebugDataTask extends Task implements EfiDefine {
 \r
             runner.setAntRun(project);\r
             runner.setCommandline(cmdline.getCommandline());\r
+            runner.setWorkingDirectory(new File(outputDir)); \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.peFile)).getName());\r
+            EdkLog.log(this, EdkLog.EDK_INFO, peFile.toFileList() + " => " + outputFile.toFileList());\r
 \r
             revl = runner.execute();\r
 \r
@@ -117,7 +118,6 @@ public class ZeroDebugDataTask extends Task implements EfiDefine {
                 //\r
                 EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));\r
                 throw new BuildException("ZeroDebugData failed!");\r
-\r
             }\r
         } catch (Exception e) {\r
             throw new BuildException(e.getMessage());\r
@@ -125,70 +125,70 @@ public class ZeroDebugDataTask extends Task implements EfiDefine {
     }\r
 \r
     /**\r
-     * getPeFile\r
-     *\r
-     * This function is to get class member "inputFile".\r
-     *\r
-     * @return string of input file name.\r
-     */\r
+      getPeFile\r
+     \r
+      This function is to get class member "inputFile".\r
+     \r
+      @return string of input file name.\r
+     **/\r
     public String getPeFile() {\r
-        return this.peFile;\r
+        return this.peFile.getValue();\r
     }\r
 \r
     /**\r
-     * setPeFile\r
-     *\r
-     * This function is to set class member "peFile".\r
-     *\r
-     * @param peFile\r
-     *            string of input file name.\r
-     */\r
+      setPeFile\r
+     \r
+      This function is to set class member "peFile".\r
+     \r
+      @param peFile\r
+                 string of input file name.\r
+     **/\r
     public void setPeFile(String peFile) {\r
-        this.peFile = peFile;\r
+        this.peFile.setArg(" ", peFile);\r
     }\r
 \r
     /**\r
-     * getOutputFile\r
-     *\r
-     * This function is to get class member "outputFile"\r
-     *\r
-     * @return outputFile string of output file name.\r
-     */\r
+      getOutputFile\r
+     \r
+      This function is to get class member "outputFile"\r
+     \r
+      @return outputFile string of output file name.\r
+     **/\r
     public String getOutputFile() {\r
-        return outputFile;\r
+        return this.outputFile.getValue();\r
     }\r
 \r
     /**\r
-     * setOutputFile\r
-     *\r
-     * This function is to set class member "outputFile"\r
-     *\r
-     * @param outputFile\r
-     *            string of output file name.\r
-     */\r
+      setOutputFile\r
+     \r
+      This function is to set class member "outputFile"\r
+     \r
+      @param outputFile\r
+                 string of output file name.\r
+     **/\r
     public void setOutputFile(String outputFile) {\r
-        this.outputFile = outputFile;\r
+        this.outputFile.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
index 78cde756046c49f8d9d28552a630001a7da86c78..af6590f5b6e9c0226aa3bc12334ee77a730896b3 100644 (file)
@@ -15,6 +15,7 @@ package org.tianocore.build.global;
 \r
 import org.apache.tools.ant.types.DataType;\r
 import org.apache.tools.ant.types.Path;\r
+import org.apache.tools.ant.BuildException;\r
 \r
 import java.io.File;\r
 import java.io.FileReader;\r
@@ -77,7 +78,7 @@ public class DpFile  extends DataType {
             lineReader.close();\r
             fileReader.close();\r
         } catch (IOException e) {\r
-            System.out.println (e.getMessage());\r
+            throw new BuildException(e.getMessage());\r
         }\r
     }\r
 \r
index 6ad4d44388aa14b6ca0419e2d1de4de3c8e847f0..fa1fc239f4ffd26d6ff1637176aa77503fd85a6f 100644 (file)
@@ -50,7 +50,7 @@ public class ConfigReader {
 \r
       @return   String[][]      The variables defined in the config file\r
 \r
-      @throws   EdkException\r
+      @throws   GenBuildException\r
                 Config file's format is not valid\r
     **/\r
     public static synchronized String[][] parse(File configFile) throws GenBuildException {\r
@@ -78,7 +78,8 @@ public class ConfigReader {
                 // \r
                 int index;\r
                 if ((index = str.indexOf('=')) <= 0) {\r
-                    throw new GenBuildException("ERROR Processing file [" + configFile.getAbsolutePath() \r
+                    throw new GenBuildException("ERROR Processing file [" \r
+                        + configFile.getAbsolutePath() \r
                         + "] (line " + lines + ").\n");\r
                 }\r
 \r
@@ -88,9 +89,12 @@ public class ConfigReader {
                 keyList.add(str.substring(0, index).trim());\r
                 valueList.add(str.substring(index + 1).trim());\r
             }\r
-        } catch (Exception e) {\r
-            throw new GenBuildException("ERROR Processing file [" + configFile.getAbsolutePath() \r
-                + "] (line " + lines + ").\n" + e.getMessage());\r
+        } catch (Exception ex) {\r
+            GenBuildException e = new GenBuildException("ERROR Processing file [" \r
+                + configFile.getAbsolutePath() \r
+                + "] (line " + lines + ").\n" + ex.getMessage());\r
+            e.setStackTrace(ex.getStackTrace());\r
+            throw e;\r
         }\r
 \r
         String[][] definitions = new String[2][keyList.size()];\r