]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java
1) Changed ToolArg class to abstract generic arguments of a tool
[mirror_edk2.git] / Tools / Source / FrameworkTasks / org / tianocore / framework / tasks / Tool.java
index ea9546487a54d0fa73338f26b82deba695ea2ec3..31781eb1d680404aa998425025f00e56992772a1 100644 (file)
@@ -32,13 +32,12 @@ import org.tianocore.common.logger.EdkLog;
  **/\r
 public class Tool implements EfiDefine, Section {\r
 \r
-    String toolName     = "";\r
-    List<Object>   toolArgList  = new ArrayList<Object>();\r
-    String outputPath;\r
-    File outputFile ;\r
-    List<Input>    inputFiles = new ArrayList<Input>();\r
-    List<Section>  gensectList = new ArrayList<Section>();\r
-    String inputArg = "-i ";\r
+    private String toolName     = "";\r
+    private ToolArg toolArgList = new ToolArg();\r
+    private Input inputFiles = new Input();\r
+    private String outputPath;\r
+    private File outputFile ;\r
+    private List<Section>  gensectList = new ArrayList<Section>();\r
     /**\r
      Call extern tool\r
 \r
@@ -108,11 +107,6 @@ public class Tool implements EfiDefine, Section {
         String command   = "";\r
         String argument  = "";\r
         command          = toolName;\r
-        Iterator argIter = toolArgList.iterator();\r
-        Iterator inputIter = inputFiles.iterator();\r
-        ToolArg toolArg;\r
-        Input file = null;\r
-              \r
         \r
         //\r
         //  Get each section which under the compress {};\r
@@ -126,7 +120,7 @@ public class Tool implements EfiDefine, Section {
                 //\r
                 // Parse <genSection> element\r
                 //\r
-                File outputFile = File.createTempFile("temp", "sec1",new File(outputPath));\r
+                File outputFile = File.createTempFile("temp", "sec1", new File(outputPath));\r
                 FileOutputStream bo = new FileOutputStream(outputFile);\r
                 DataOutputStream Do = new DataOutputStream (bo);\r
                 //\r
@@ -140,33 +134,17 @@ public class Tool implements EfiDefine, Section {
                     throw new BuildException ("GenSection failed at Tool!");\r
                 }  \r
                 Do.close();\r
-                this.inputArg += outputFile.getPath() + " ";                        \r
+                this.inputFiles.insFile(outputFile.getPath());                        \r
             }        \r
         } catch (IOException e){\r
             throw new BuildException ("Gensection failed at tool!");\r
         }\r
 \r
-        \r
-        ///\r
-        /// argument of tools\r
-        ///\r
-        while (argIter.hasNext()) {\r
-            toolArg = (ToolArg)argIter.next();\r
-            argument = argument + toolArg.getLine() + " ";\r
-\r
-        }\r
-\r
-        ///\r
-        /// input files for tools\r
-        ///\r
-        while (inputIter.hasNext()) {\r
-            file = (Input)inputIter.next();\r
-            inputArg += file.toString(" ");\r
-        }\r
         try {\r
             outputFile = File.createTempFile("temp", null, new File(outputPath));\r
-            argument   = argument + inputArg + " -o " + outputFile.getPath();\r
-            EdkLog.log(EdkLog.EDK_INFO, argument);\r
+            argument   = toolArgList + inputFiles.toStringWithSinglepPrefix(" -i ") \r
+                         + " -o " + outputFile.getPath();\r
+            EdkLog.log(this, EdkLog.EDK_VERBOSE, command + " " + argument);\r
             ///\r
             /// execute command line\r
             ///\r
@@ -183,8 +161,8 @@ public class Tool implements EfiDefine, Section {
 \r
      @param     toolArg     The ToolArg object containing arguments for the tool\r
      **/\r
-    public void addToolArg (ToolArg toolArg) {\r
-        toolArgList.add (toolArg);\r
+    public void addConfiguredToolArg (ToolArg toolArg) {\r
+        toolArgList.insert(toolArg);\r
     }\r
 \r
     /**\r
@@ -228,8 +206,8 @@ public class Tool implements EfiDefine, Section {
 \r
      @param     file    The Input objec which represents a file\r
      **/\r
-    public void addInput(Input file) {\r
-        inputFiles.add(file);\r
+    public void addConfiguredInput(Input file) {\r
+        inputFiles.insert(file);\r
     }\r
     \r
 //    /**\r
@@ -245,8 +223,7 @@ public class Tool implements EfiDefine, Section {
     \r
     public void addGenSection(GenSectionTask genSect){\r
         this.gensectList.add(genSect);\r
-    }\r
-    \r
+    }    \r
 }\r
 \r
 \r