]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1) Changed ToolArg class to abstract generic arguments of a tool
authorjwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 13 Sep 2006 02:15:32 +0000 (02:15 +0000)
committerjwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 13 Sep 2006 02:15:32 +0000 (02:15 +0000)
2) Added FileArg class to abstract arguments which represent the path of a file
3) Changed the log method to EdkLog and the message format for flashmap, fwimage, gendepex, genfvimage, gensection, peirebase, strgather and vfrcompile tool. And changed these tools to use ToolArg and FileArg to keep their arguments.
4) Added more verbose message for OnDependency task
5) Changed MakeDeps tool to insert a file end flag. This is very useful when dependency check is broken occasionally
6) Cleaned the coding style of java code

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

16 files changed:
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressSection.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FileArg.java [new file with mode: 0644]
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FlashMapTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FwImageTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenDepexTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFvImageTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenSectionTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/NestElement.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/PeiReBaseTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/StrGatherTask.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/ToolArg.java
Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/VfrCompilerTask.java
Tools/Source/GenBuild/org/tianocore/build/global/OnDependency.java
Tools/Source/TianoTools/MakeDeps/MakeDeps.c

index d0cc2f50dd3221db6135d665a2bf280d100f499a..5f35685fbe3b4232c64630612e4d95c4201ecaff 100644 (file)
@@ -32,7 +32,7 @@ import org.apache.tools.ant.BuildException;
   CompressSection indicate that all section which in it should be compressed. \r
  \r
 **/\r
   CompressSection indicate that all section which in it should be compressed. \r
  \r
 **/\r
-public class CompressSection implements Section, FfsTypes{\r
+public class CompressSection implements Section, FfsTypes {\r
     //\r
     // The attribute of compressName.\r
     //\r
     //\r
     // The attribute of compressName.\r
     //\r
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FileArg.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FileArg.java
new file mode 100644 (file)
index 0000000..86adb07
--- /dev/null
@@ -0,0 +1,65 @@
+/** @file\r
+This file is used to nest elements which is meant for file path\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
+\r
+/**\r
+ FileArg class is defined to represent tool's argument which specifies file path.\r
+ **/\r
+public class FileArg extends ToolArg {\r
+    /**\r
+       Default constructor\r
+     **/\r
+    public FileArg() {\r
+    }\r
+\r
+    /**\r
+       Constructor which accepts argument prefix and its value as parameters\r
+\r
+       @param prefix    The prefix of argument\r
+       @param value     The value of argument\r
+     **/\r
+    public FileArg(String prefix, String value) {\r
+        super(prefix);\r
+        this.setValue(value);\r
+    }\r
+\r
+    /**\r
+       Set the prefix and value of an argument\r
+\r
+       @param prefix    The prefix of argument\r
+       @param value     The value of argument \r
+     **/\r
+    public void setArg(String prefix, String value) {\r
+        super.setPrefix(prefix);\r
+        this.setValue(value);\r
+    }\r
+\r
+    /**\r
+       Set the value of an argument\r
+\r
+       @param value     The value of the argument\r
+     **/\r
+    public void setValue(String value) {\r
+        super.setFile(value);\r
+    }\r
+\r
+    /**\r
+       Add a value of an argument\r
+\r
+       @param value     The value of the argument\r
+     **/\r
+    public void insValue(String value) {\r
+        super.insFile(value);\r
+    }\r
+}\r
index 44c5b9c6be73e64cbd8ffd437b589c1dd0bc88e0..847abebb32ad79abfd74189f54e7cc08567057a0 100644 (file)
@@ -26,6 +26,9 @@ import java.util.List;
 import org.apache.tools.ant.Task;\r
 import org.apache.tools.ant.Project;\r
 import org.apache.tools.ant.BuildException;\r
 import org.apache.tools.ant.Task;\r
 import org.apache.tools.ant.Project;\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
 import org.tianocore.common.logger.EdkLog;\r
 \r
@@ -35,109 +38,108 @@ import org.tianocore.common.logger.EdkLog;
  * FlashMapTask is used to call FlashMap.exe to generate flash map defition files and fd files.\r
  */\r
 public class FlashMapTask extends Task implements EfiDefine {\r
  * FlashMapTask is used to call FlashMap.exe to generate flash map defition files and fd files.\r
  */\r
 public class FlashMapTask extends Task implements EfiDefine {\r
-    // /\r
-    // tool name\r
-    // /\r
+    //\r
+    // tool name\r
+    //\r
     private final String toolName = "FlashMap";\r
 \r
     private final String toolName = "FlashMap";\r
 \r
-    // /\r
-    // Flash definition file\r
-    // /\r
-    private String flashDefFile = "";\r
-\r
-    // /\r
-    // Flash device\r
-    // /\r
-    private String flashDevice = "";\r
-\r
-    // /\r
-    // Flash device Image\r
-    // /\r
-    private String flashDeviceImage = "";\r
-\r
-    // /\r
-    // MCI file\r
-    // /\r
-    private String mciFile = "";\r
-\r
-    // /\r
-    // MCO file\r
-    // /\r
-    private String mcoFile = "";\r
-\r
-    // /\r
-    // Discover FD image\r
-    // /\r
-    private String fdImage = "";\r
-\r
-    // /\r
-    // Dsc file\r
-    // /\r
-    private String dscFile = "";\r
-\r
-    // /\r
-    // Asm INC file\r
-    // /\r
-    private String asmIncFile = "";\r
-\r
-    // /\r
-    // Image out file\r
-    // /\r
-    private String imageOutFile = "";\r
-\r
-    // /\r
-    // Header file\r
-    // /\r
-    private String headerFile = "";\r
-\r
-    // /\r
-    // Input string file\r
-    // /\r
+    //\r
+    // Flash definition file\r
+    //\r
+    private FileArg flashDefFile = new FileArg();\r
+\r
+    //\r
+    // Flash device\r
+    //\r
+    private ToolArg flashDevice = new ToolArg();\r
+\r
+    //\r
+    // Flash device Image\r
+    //\r
+    private ToolArg flashDeviceImage = new ToolArg();\r
+\r
+    //\r
+    // MCI file\r
+    //\r
+    private FileArg mciFile = new FileArg();\r
+\r
+    //\r
+    // MCO file\r
+    //\r
+    private FileArg mcoFile = new FileArg();\r
+\r
+    //\r
+    // Discover FD image\r
+    //\r
+    private ToolArg fdImage = new ToolArg();\r
+\r
+    //\r
+    // Dsc file\r
+    //\r
+    private FileArg dscFile = new FileArg();\r
+\r
+    //\r
+    // Asm INC file\r
+    //\r
+    private FileArg asmIncFile = new FileArg();\r
+\r
+    //\r
+    // Image out file\r
+    //\r
+    private FileArg imageOutFile = new FileArg();\r
+\r
+    //\r
+    // Header file\r
+    //\r
+    private FileArg headerFile = new FileArg();\r
+\r
+    //\r
+    // Input string file\r
+    //\r
     private String inStrFile = "";\r
 \r
     private String inStrFile = "";\r
 \r
-    // /\r
-    // Output string file\r
-    // /\r
+    //\r
+    // Output string file\r
+    //\r
     private String outStrFile = "";\r
 \r
     private String outStrFile = "";\r
 \r
-    // /\r
-    // / Base address\r
-    // /\r
-    private String baseAddr = "";\r
-\r
-    // /\r
-    // / Aligment\r
-    // /\r
-    private String aligment = "";\r
-\r
-    // /\r
-    // / Padding value\r
-    // /\r
-    private String padValue = "";\r
-\r
-    // /\r
-    // / output directory\r
-    // /\r
+    //\r
+    // \r
+    // \r
+    private FileArg strFile = new FileArg();\r
+    //\r
+    // Base address\r
+    //\r
+    private ToolArg baseAddr = new ToolArg();\r
+\r
+    //\r
+    // Aligment\r
+    //\r
+    private ToolArg aligment = new ToolArg();\r
+\r
+    //\r
+    // Padding value\r
+    //\r
+    private ToolArg padValue = new ToolArg();\r
+\r
+    //\r
+    // output directory\r
+    //\r
     private String outputDir = ".";\r
 \r
     private String outputDir = ".";\r
 \r
-    // /\r
-    // / MCI file array\r
-    // /\r
-    List<Input> mciFileArray = new ArrayList<Input>();\r
-\r
-    // /\r
-    // / command and argument list\r
-    // /\r
-    LinkedList<String> argList = new LinkedList<String>();\r
+    //\r
+    // MCI file array\r
+    //\r
+    FileArg mciFileArray = new FileArg();\r
 \r
     /**\r
 \r
     /**\r
-     * execute\r
-     *\r
-     * FlashMapTask execute function is to assemble tool command line & execute\r
-     * tool command line\r
-     *\r
-     * @throws BuidException\r
-     */\r
+      execute\r
+     \r
+      FlashMapTask 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
     public void execute() throws BuildException {\r
 \r
         Project project = this.getOwningTarget().getProject();\r
@@ -149,54 +151,66 @@ public class FlashMapTask extends Task implements EfiDefine {
         if (path == null) {\r
             command = toolName;\r
         } else {\r
         if (path == null) {\r
             command = toolName;\r
         } else {\r
-            command = path + File.separatorChar + toolName;\r
+            command = path + File.separator + toolName;\r
         }\r
         }\r
-        argList.addFirst(command);\r
 \r
         //\r
         // add substituted input file and output file\r
         //\r
         if (this.inStrFile != null && this.outStrFile != null\r
 \r
         //\r
         // add substituted input file and output file\r
         //\r
         if (this.inStrFile != null && this.outStrFile != null\r
-                && !this.inStrFile.equalsIgnoreCase("")\r
-                && !this.inStrFile.equalsIgnoreCase("")) {\r
-            argList.add("-strsub");\r
-            argList.add(this.inStrFile);\r
-            argList.add(this.outStrFile);\r
+            && this.inStrFile.length() > 0 && this.outStrFile.length() > 0) {\r
+            strFile.setPrefix(" -strsub ");\r
+            strFile.insValue(this.inStrFile);\r
+            strFile.insValue(this.outStrFile);\r
         }\r
 \r
         }\r
 \r
+        String argument = "" + flashDefFile + flashDevice + flashDeviceImage\r
+                             + mciFile + mcoFile + fdImage + dscFile + asmIncFile\r
+                             + imageOutFile + headerFile + strFile + baseAddr\r
+                             + aligment + padValue + mciFileArray;\r
 \r
 \r
-        //\r
-        // add microcode binary files\r
-        //\r
-        if (mciFileArray.size() > 0) {\r
-            argList.add("-mcmerge");\r
-            Iterator mciList = mciFileArray.iterator();\r
-            while (mciList.hasNext()) {\r
-                argList.addAll(((Input) mciList.next()).getNameList());\r
-            }\r
-        }\r
 \r
         //\r
         // lauch the program\r
         //\r
 \r
         //\r
         // lauch the program\r
         //\r
-        ProcessBuilder pb = new ProcessBuilder(argList);\r
-        pb.directory(new File(outputDir));\r
+        // ProcessBuilder pb = new ProcessBuilder(argList);\r
+        // pb.directory(new File(outputDir));\r
         int exitCode = 0;\r
         try {\r
         int exitCode = 0;\r
         try {\r
-            Process cmdProc = pb.start();\r
-            InputStreamReader cmdOut = new InputStreamReader(cmdProc\r
-                    .getInputStream());\r
-            char[] buf = new char[1024];\r
+            Commandline cmdline = new Commandline();\r
+            cmdline.setExecutable(command);\r
+            cmdline.createArgument().setLine(argument);\r
+\r
+            LogStreamHandler streamHandler = new LogStreamHandler(this,\r
+                    Project.MSG_INFO, Project.MSG_WARN);\r
+            Execute runner = new Execute(streamHandler, null);\r
 \r
 \r
-            exitCode = cmdProc.waitFor();\r
+            runner.setAntRun(project);\r
+            runner.setCommandline(cmdline.getCommandline());\r
+\r
+            if (outputDir != null) {\r
+                runner.setWorkingDirectory(new File(outputDir)); \r
+            }\r
             //\r
             // log command line string.\r
             //\r
             //\r
             // log command line string.\r
             //\r
-            EdkLog.log(this, EdkLog.EDK_VERBOSE, cmdProc.getOutputStream().toString());\r
-            EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.flashDefFile)).getName());\r
+            EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
+            EdkLog.log(this, flashDefFile.toFileList() \r
+                             + mciFile.toFileList()\r
+                             + mciFileArray.toFileList()\r
+                             + fdImage.toFileList()\r
+                             + inStrFile\r
+                             + " => " \r
+                             + headerFile.toFileList() \r
+                             + imageOutFile.toFileList()\r
+                             + mcoFile.toFileList()\r
+                             + dscFile.toFileList()\r
+                             + asmIncFile.toFileList()\r
+                             + outStrFile);\r
+\r
+            exitCode = runner.execute();\r
             if (exitCode != 0) {\r
             if (exitCode != 0) {\r
-                int len = cmdOut.read(buf, 0, 1024);\r
-                EdkLog.log(this, EdkLog.EDK_INFO, new String(buf, 0, len));\r
+                EdkLog.log(this, "ERROR = " + Integer.toHexString(exitCode));\r
             } else {\r
                 EdkLog.log(this, EdkLog.EDK_VERBOSE, "FlashMap succeeded!");\r
             }\r
             } else {\r
                 EdkLog.log(this, EdkLog.EDK_VERBOSE, "FlashMap succeeded!");\r
             }\r
@@ -210,408 +224,383 @@ public class FlashMapTask extends Task implements EfiDefine {
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * getFlashDefFile\r
-     *\r
-     * This function is to get class member "flashDefFile"\r
-     *\r
-     * @return flashDeFile Name of flash definition file.\r
-     */\r
+      getFlashDefFile\r
+     \r
+      This function is to get class member "flashDefFile"\r
+     \r
+      @return flashDeFile Name of flash definition file.\r
+     **/\r
     public String getFlashDefFile() {\r
     public String getFlashDefFile() {\r
-        return flashDefFile;\r
+        return this.flashDefFile.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * setFlashDefFile\r
-     *\r
-     * This function is to set class member "flashDefFile"\r
-     *\r
-     * @param flashDefFile\r
-     *            Name of flash definition file.\r
-     */\r
+      setFlashDefFile\r
+     \r
+      This function is to set class member "flashDefFile"\r
+     \r
+      @param flashDefFile\r
+                 Name of flash definition file.\r
+     **/\r
     public void setFlashDefFile(String flashDefFile) {\r
     public void setFlashDefFile(String flashDefFile) {\r
-        this.flashDefFile = flashDefFile;\r
-        argList.add("-fdf");\r
-        argList.add(this.flashDefFile);\r
+        this.flashDefFile.setArg(" -fdf ", flashDefFile);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * getAligment\r
-     *\r
-     * This function is to get class member "aligment"\r
-     *\r
-     * @return aligment String of aligment value.\r
-     */\r
+      getAligment\r
+     \r
+      This function is to get class member "aligment"\r
+     \r
+      @return aligment String of aligment value.\r
+     **/\r
     public String getAligment() {\r
     public String getAligment() {\r
-        return aligment;\r
+        return this.aligment.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * setAligment\r
-     *\r
-     * This function is to set class member "aligment"\r
-     *\r
-     * @param aligment\r
-     *            String of aligment value.\r
-     */\r
+      setAligment\r
+     \r
+      This function is to set class member "aligment"\r
+     \r
+      @param aligment\r
+                 String of aligment value.\r
+     **/\r
     public void setAligment(String aligment) {\r
     public void setAligment(String aligment) {\r
-        this.aligment = aligment;\r
-        argList.add("-align");\r
-        argList.add(this.aligment);\r
+        this.aligment.setArg(" -align ", aligment);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * getAsmIncFile\r
-     *\r
-     * This function is to get class member "asmIncFile"\r
-     *\r
-     * @return asmIncFile String of ASM include file.\r
-     */\r
+      getAsmIncFile\r
+     \r
+      This function is to get class member "asmIncFile"\r
+     \r
+      @return asmIncFile String of ASM include file.\r
+     **/\r
     public String getAsmIncFile() {\r
     public String getAsmIncFile() {\r
-        return asmIncFile;\r
+        return this.asmIncFile.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * setAsmIncFile\r
-     *\r
-     * This function is to set class member "asmIncFile"\r
-     *\r
-     * @param asmIncFile\r
-     *            String of ASM include file.\r
-     */\r
+      setAsmIncFile\r
+     \r
+      This function is to set class member "asmIncFile"\r
+     \r
+      @param asmIncFile\r
+                 String of ASM include file.\r
+     **/\r
     public void setAsmIncFile(String asmIncFile) {\r
     public void setAsmIncFile(String asmIncFile) {\r
-        this.asmIncFile = asmIncFile;\r
-        argList.add("-asmincfile");\r
-        argList.add(this.asmIncFile);\r
+        this.asmIncFile.setArg(" -asmincfile ", asmIncFile);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * getBaseAddr\r
-     *\r
-     * This function is to get class member "baseAddr"\r
-     *\r
-     * @return baseAddr String of base address value.\r
-     */\r
+      getBaseAddr\r
+     \r
+      This function is to get class member "baseAddr"\r
+     \r
+      @return baseAddr String of base address value.\r
+     **/\r
     public String getBaseAddr() {\r
     public String getBaseAddr() {\r
-        return baseAddr;\r
+        return this.baseAddr.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * setBaseAddr\r
-     *\r
-     * This function is to set class member "baseAddr"\r
-     *\r
-     * @param baseAddr\r
-     *            String of base address value.\r
-     */\r
+      setBaseAddr\r
+     \r
+      This function is to set class member "baseAddr"\r
+     \r
+      @param baseAddr\r
+                 String of base address value.\r
+     **/\r
     public void setBaseAddr(String baseAddr) {\r
     public void setBaseAddr(String baseAddr) {\r
-        this.baseAddr = baseAddr;\r
-        argList.add("-baseaddr");\r
-        argList.add(this.baseAddr);\r
+        this.baseAddr.setArg(" -baseaddr ", baseAddr);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * getDscFile\r
-     *\r
-     * This function is to get class member "dscFile"\r
-     *\r
-     * @return dscFile name of DSC file\r
-     */\r
+      getDscFile\r
+     \r
+      This function is to get class member "dscFile"\r
+     \r
+      @return dscFile name of DSC file\r
+     **/\r
     public String getDscFile() {\r
     public String getDscFile() {\r
-        return dscFile;\r
+        return this.dscFile.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * setDscFile\r
-     *\r
-     * This function is to set class member "dscFile"\r
-     *\r
-     * @param dscFile\r
-     *            name of DSC file\r
-     */\r
+      setDscFile\r
+     \r
+      This function is to set class member "dscFile"\r
+     \r
+      @param dscFile\r
+                 name of DSC file\r
+     **/\r
     public void setDscFile(String dscFile) {\r
     public void setDscFile(String dscFile) {\r
-        this.dscFile = dscFile;\r
-        argList.add("-dsc");\r
-        argList.add(this.dscFile);\r
+        this.dscFile.setArg(" -dsc ", dscFile);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * getFdImage\r
-     *\r
-     * This function is to get class member "fdImage"\r
-     *\r
-     * @return fdImage name of input FDI image file.\r
-     */\r
+      getFdImage\r
+     \r
+      This function is to get class member "fdImage"\r
+     \r
+      @return fdImage name of input FDI image file.\r
+     **/\r
     public String getFdImage() {\r
     public String getFdImage() {\r
-        return fdImage;\r
+        return this.fdImage.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * setFdImage\r
-     *\r
-     * This function is to set class member "fdImage"\r
-     *\r
-     * @param fdImage\r
-     *            name of input FDI image file.\r
-     */\r
+      setFdImage\r
+     \r
+      This function is to set class member "fdImage"\r
+     \r
+      @param fdImage\r
+                 name of input FDI image file.\r
+     **/\r
     public void setFdImage(String fdImage) {\r
     public void setFdImage(String fdImage) {\r
-        this.fdImage = fdImage;\r
-        argList.add("-discover");\r
-        argList.add(this.fdImage);\r
+        this.fdImage.setArg(" -discover ", fdImage);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * getFlashDevice\r
-     *\r
-     * This function is to get class member "flashDevice".\r
-     *\r
-     * @return flashDevice name of flash device.\r
-     */\r
+      getFlashDevice\r
+     \r
+      This function is to get class member "flashDevice".\r
+     \r
+      @return flashDevice name of flash device.\r
+     **/\r
     public String getFlashDevice() {\r
     public String getFlashDevice() {\r
-        return flashDevice;\r
+        return this.flashDevice.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * setFlashDevice\r
-     *\r
-     * This function is to set class member "flashDevice"\r
-     *\r
-     * @param flashDevice\r
-     *            name of flash device.\r
-     */\r
+      setFlashDevice\r
+     \r
+      This function is to set class member "flashDevice"\r
+     \r
+      @param flashDevice\r
+                 name of flash device.\r
+     **/\r
     public void setFlashDevice(String flashDevice) {\r
     public void setFlashDevice(String flashDevice) {\r
-        this.flashDevice = flashDevice;\r
-        argList.add("-flashdevice");\r
-        argList.add(this.flashDevice);\r
+        this.flashDevice.setArg(" -flashdevice ", flashDevice);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * getFlashDeviceImage\r
-     *\r
-     * This function is to get class member "flashDeviceImage"\r
-     *\r
-     * @return flashDeviceImage name of flash device image\r
-     */\r
+      getFlashDeviceImage\r
+     \r
+      This function is to get class member "flashDeviceImage"\r
+     \r
+      @return flashDeviceImage name of flash device image\r
+     **/\r
     public String getFlashDeviceImage() {\r
     public String getFlashDeviceImage() {\r
-        return flashDeviceImage;\r
+        return this.flashDeviceImage.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * setFlashDeviceImage\r
-     *\r
-     * This function is to set class member "flashDeviceImage"\r
-     *\r
-     * @param flashDeviceImage\r
-     *            name of flash device image\r
-     */\r
+      setFlashDeviceImage\r
+     \r
+      This function is to set class member "flashDeviceImage"\r
+     \r
+      @param flashDeviceImage\r
+                 name of flash device image\r
+     **/\r
     public void setFlashDeviceImage(String flashDeviceImage) {\r
     public void setFlashDeviceImage(String flashDeviceImage) {\r
-        this.flashDeviceImage = flashDeviceImage;\r
-        argList.add("-flashdeviceimage");\r
-        argList.add(this.flashDeviceImage);\r
+        this.flashDeviceImage.setArg(" -flashdeviceimage ", flashDeviceImage);\r
 \r
     }\r
 \r
     /**\r
 \r
     }\r
 \r
     /**\r
-     * getHeaderFile\r
-     *\r
-     * This function is to get class member "headerFile"\r
-     *\r
-     * @return headerFile name of include file\r
-     */\r
+      getHeaderFile\r
+     \r
+      This function is to get class member "headerFile"\r
+     \r
+      @return headerFile name of include file\r
+     **/\r
     public String getHeaderFile() {\r
     public String getHeaderFile() {\r
-        return headerFile;\r
+        return this.headerFile.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * setHeaderFile\r
-     *\r
-     * This function is to set class member "headerFile"\r
-     *\r
-     * @param headerFile\r
-     *            name of include file\r
-     */\r
+      setHeaderFile\r
+     \r
+      This function is to set class member "headerFile"\r
+     \r
+      @param headerFile\r
+                 name of include file\r
+     **/\r
     public void setHeaderFile(String headerFile) {\r
     public void setHeaderFile(String headerFile) {\r
-        this.headerFile = headerFile;\r
-        argList.add("-hfile");\r
-        argList.add(this.headerFile);\r
+        this.headerFile.setArg(" -hfile ", headerFile);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * getImageOutFile\r
-     *\r
-     * This function is to get class member "imageOutFile"\r
-     *\r
-     * @return imageOutFile name of output image file\r
-     */\r
+      getImageOutFile\r
+     \r
+      This function is to get class member "imageOutFile"\r
+     \r
+      @return imageOutFile name of output image file\r
+     **/\r
     public String getImageOutFile() {\r
     public String getImageOutFile() {\r
-        return imageOutFile;\r
+        return this.imageOutFile.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * setImageOutFile\r
-     *\r
-     * This function is to set class member "ImageOutFile"\r
-     *\r
-     * @param imageOutFile\r
-     *            name of output image file\r
-     */\r
+      setImageOutFile\r
+     \r
+      This function is to set class member "ImageOutFile"\r
+     \r
+      @param imageOutFile\r
+                 name of output image file\r
+     **/\r
     public void setImageOutFile(String imageOutFile) {\r
     public void setImageOutFile(String imageOutFile) {\r
-        this.imageOutFile = imageOutFile;\r
-        argList.add("-imageout");\r
-        argList.add(this.imageOutFile);\r
+        this.imageOutFile.setArg(" -imageout ", imageOutFile);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * getInStrFile\r
-     *\r
-     * This function is to get class member "inStrFile"\r
-     *\r
-     * @return inStrFile name of input file which used to replace symbol names.\r
-     */\r
+      getInStrFile\r
+     \r
+      This function is to get class member "inStrFile"\r
+     \r
+      @return inStrFile name of input file which used to replace symbol names.\r
+     **/\r
     public String getInStrFile() {\r
     public String getInStrFile() {\r
-        return inStrFile;\r
+        return this.inStrFile;\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * setInStrFile\r
-     *\r
-     * This function is to set class member "inStrFile"\r
-     *\r
-     * @param inStrFile\r
-     *            name of input file which used to replace symbol names.\r
-     */\r
+      setInStrFile\r
+     \r
+      This function is to set class member "inStrFile"\r
+     \r
+      @param inStrFile\r
+                 name of input file which used to replace symbol names.\r
+     **/\r
     public void setInStrFile(String inStrFile) {\r
         this.inStrFile = inStrFile;\r
     }\r
 \r
     /**\r
     public void setInStrFile(String inStrFile) {\r
         this.inStrFile = inStrFile;\r
     }\r
 \r
     /**\r
-     * getMciFile\r
-     *\r
-     * This function is to get class member "mciFile"\r
-     *\r
-     * @return mciFile name of input microcode file\r
-     */\r
+      getMciFile\r
+     \r
+      This function is to get class member "mciFile"\r
+     \r
+      @return mciFile name of input microcode file\r
+     **/\r
     public String getMciFile() {\r
     public String getMciFile() {\r
-        return mciFile;\r
+        return this.mciFile.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * setMciFile\r
-     *\r
-     * This function is to set class member "mciFile"\r
-     *\r
-     * @param mciFile\r
-     *            name of input microcode file\r
-     */\r
+      setMciFile\r
+     \r
+      This function is to set class member "mciFile"\r
+     \r
+      @param mciFile\r
+                 name of input microcode file\r
+     **/\r
     public void setMciFile(String mciFile) {\r
     public void setMciFile(String mciFile) {\r
-        this.mciFile = mciFile;\r
-        argList.add("-mci");\r
-        argList.add(this.mciFile);\r
+        this.mciFile.setArg(" -mci ", mciFile);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * getMcoFile\r
-     *\r
-     * This function is to get class member "mcoFile"\r
-     *\r
-     * @return mcoFile name of output binary microcode image\r
-     */\r
+      getMcoFile\r
+     \r
+      This function is to get class member "mcoFile"\r
+     \r
+      @return mcoFile name of output binary microcode image\r
+     **/\r
     public String getMcoFile() {\r
     public String getMcoFile() {\r
-        return mcoFile;\r
+        return this.mcoFile.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * setMcoFile\r
-     *\r
-     * This function is to set class member "mcoFile"\r
-     *\r
-     * @param mcoFile\r
-     *            name of output binary microcode image\r
-     */\r
+      setMcoFile\r
+     \r
+      This function is to set class member "mcoFile"\r
+     \r
+      @param mcoFile\r
+                 name of output binary microcode image\r
+     **/\r
     public void setMcoFile(String mcoFile) {\r
     public void setMcoFile(String mcoFile) {\r
-        this.mcoFile = mcoFile;\r
-        argList.add("-mco");\r
-        argList.add(this.mcoFile);\r
+        this.mcoFile.setArg(" -mco ", mcoFile);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * getOutStrFile\r
-     *\r
-     * This function is to get class member "outStrFile"\r
-     *\r
-     * @return outStrFile name of output string substitution file\r
-     */\r
+      getOutStrFile\r
+     \r
+      This function is to get class member "outStrFile"\r
+     \r
+      @return outStrFile name of output string substitution file\r
+     **/\r
     public String getOutStrFile() {\r
     public String getOutStrFile() {\r
-        return outStrFile;\r
+        return this.outStrFile;\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * setOutStrFile\r
-     *\r
-     * This function is to set class member "outStrFile"\r
-     *\r
-     * @param outStrFile\r
-     *            name of output string substitution file\r
-     */\r
+      setOutStrFile\r
+     \r
+      This function is to set class member "outStrFile"\r
+     \r
+      @param outStrFile\r
+                 name of output string substitution file\r
+     **/\r
     public void setOutStrFile(String outStrFile) {\r
         this.outStrFile = outStrFile;\r
     }\r
 \r
     /**\r
     public void setOutStrFile(String outStrFile) {\r
         this.outStrFile = outStrFile;\r
     }\r
 \r
     /**\r
-     * getPadValue\r
-     *\r
-     * This function is to get class member "padValue"\r
-     *\r
-     * @return padValue string of byte value to use as padding\r
-     */\r
+      getPadValue\r
+     \r
+      This function is to get class member "padValue"\r
+     \r
+      @return padValue string of byte value to use as padding\r
+     **/\r
     public String getPadValue() {\r
     public String getPadValue() {\r
-        return padValue;\r
+        return this.padValue.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * setPadValue\r
-     *\r
-     * This function is to set class member "padValue"\r
-     *\r
-     * @param padValue\r
-     *            string of byte value to use as padding\r
-     */\r
+      setPadValue\r
+     \r
+      This function is to set class member "padValue"\r
+     \r
+      @param padValue\r
+                 string of byte value to use as padding\r
+     **/\r
     public void setPadValue(String padValue) {\r
     public void setPadValue(String padValue) {\r
-        this.padValue = padValue;\r
-        argList.add("-padvalue");\r
-        argList.add(this.padValue);\r
+        this.padValue.setArg(" -padvalue ", padValue);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * addMciFile\r
-     *\r
-     * This function is to add Microcode binary file\r
-     *\r
-     * @param mciFile\r
-     *            instance of input class\r
-     */\r
-    public void addMciFile(Input mciFile) {\r
-        this.mciFileArray.add(mciFile);\r
+      addMciFile\r
+     \r
+      This function is to add Microcode binary file\r
+     \r
+      @param mciFile\r
+                 instance of input class\r
+     **/\r
+    public void addConfiguredMciFile(FileArg mciFile) {\r
+        this.mciFileArray.setPrefix(" -mcmerge ");\r
+        this.mciFileArray.insert(mciFile);\r
     }\r
 \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
     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
     public void setOutputDir(String outputDir) {\r
         this.outputDir = outputDir;\r
     }\r
index 13df297fa616ae1729c4102161683d1c2f4d51a8..b17e7fbf12f9fc5ed01565beca82540dc29e150b 100644 (file)
@@ -25,29 +25,34 @@ 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.apache.tools.ant.taskdefs.LogStreamHandler;\r
 import org.apache.tools.ant.types.Commandline;\r
 \r
+import org.tianocore.common.logger.EdkLog;\r
+\r
 /**\r
   FwImageTask class.\r
 \r
   FwImageTask is used to call FwImage.ext to generate the FwImage.\r
 **/\r
 /**\r
   FwImageTask class.\r
 \r
   FwImageTask is used to call FwImage.ext to generate the FwImage.\r
 **/\r
-public class FwImageTask extends Task implements EfiDefine{\r
-    ///\r
-    /// time&data\r
-    ///\r
-    private String time = "";\r
-    ///\r
-    /// input PE image\r
-    ///\r
-    private String peImage = "";\r
-    private String peImageName = "";\r
-    ///\r
-    /// output EFI image\r
-    ///\r
-    private String outImage = "";\r
-    ///\r
-    /// component type\r
-    ///\r
-    private String componentType = "";\r
+public class FwImageTask extends Task implements EfiDefine {\r
+    //\r
+    // fwimage tool name\r
+    // \r
+    private static String toolName = "FwImage";\r
+    //\r
+    // time&data\r
+    //\r
+    private ToolArg time = new ToolArg();\r
+    //\r
+    // input PE image\r
+    //\r
+    private FileArg peImage = new FileArg();\r
+    //\r
+    // output EFI image\r
+    //\r
+    private FileArg outImage = new FileArg();\r
+    //\r
+    // component type\r
+    //\r
+    private ToolArg componentType = new ToolArg();\r
 \r
     /**\r
      * assemble tool command line & execute tool command line\r
 \r
     /**\r
      * assemble tool command line & execute tool command line\r
@@ -71,14 +76,14 @@ public class FwImageTask extends Task implements EfiDefine{
         String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
         String command;\r
         if (path == null) {\r
         String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
         String command;\r
         if (path == null) {\r
-            command = "FwImage";\r
+            command = toolName;\r
         } else {\r
         } else {\r
-            command = path + "/" + "FwImage";\r
+            command = path + "/" + toolName;\r
         }\r
         //\r
         // argument of tools\r
         //\r
         }\r
         //\r
         // argument of tools\r
         //\r
-        String argument = time + componentType + peImage + outImage;\r
+        String argument = "" + time + componentType + peImage + outImage;\r
         //\r
         // return value of fwimage execution\r
         //\r
         //\r
         // return value of fwimage execution\r
         //\r
@@ -96,16 +101,17 @@ public class FwImageTask extends Task implements EfiDefine{
             runner.setAntRun(project);\r
             runner.setCommandline(cmdline.getCommandline());\r
 \r
             runner.setAntRun(project);\r
             runner.setCommandline(cmdline.getCommandline());\r
 \r
-            log(Commandline.toString(cmdline.getCommandline()), Project.MSG_VERBOSE);\r
-            log(this.peImageName);\r
+            EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
+            EdkLog.log(this, peImage.toFileList() + " => " + outImage.toFileList());\r
+\r
             revl = runner.execute();\r
             if (EFI_SUCCESS == revl) {\r
             revl = runner.execute();\r
             if (EFI_SUCCESS == revl) {\r
-                log("FwImage succeeded!", Project.MSG_VERBOSE);\r
+                EdkLog.log(this, EdkLog.EDK_VERBOSE, "FwImage succeeded!");\r
             } else {\r
                 //\r
                 // command execution fail\r
                 //\r
             } else {\r
                 //\r
                 // command execution fail\r
                 //\r
-                log("ERROR = " + Integer.toHexString(revl));\r
+                EdkLog.log(this, "ERROR = " + Integer.toHexString(revl));\r
                 throw new BuildException("FwImage failed!");\r
             }\r
         } catch (Exception e) {\r
                 throw new BuildException("FwImage failed!");\r
             }\r
         } catch (Exception e) {\r
@@ -121,7 +127,7 @@ public class FwImageTask extends Task implements EfiDefine{
       @param time            string of time\r
     **/\r
     public void setTime(String time) {\r
       @param time            string of time\r
     **/\r
     public void setTime(String time) {\r
-        this.time = " -t " + time;\r
+        this.time.setArg(" -t ", time);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -131,7 +137,7 @@ public class FwImageTask extends Task implements EfiDefine{
       @return time          string of time\r
     **/\r
     public String getTime() {\r
       @return time          string of time\r
     **/\r
     public String getTime() {\r
-        return this.time;\r
+        return this.time.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -141,7 +147,7 @@ public class FwImageTask extends Task implements EfiDefine{
       @return                name of PE image\r
     **/\r
     public String getPeImage() {\r
       @return                name of PE image\r
     **/\r
     public String getPeImage() {\r
-        return this.peImage;\r
+        return this.peImage.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -151,8 +157,7 @@ public class FwImageTask extends Task implements EfiDefine{
       @param  peImage        name of PE image\r
     **/\r
     public void setPeImage(String peImage) {\r
       @param  peImage        name of PE image\r
     **/\r
     public void setPeImage(String peImage) {\r
-        this.peImageName = (new File(peImage)).getName();\r
-        this.peImage = " " + peImage;\r
+        this.peImage.setArg(" ", peImage);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -162,7 +167,7 @@ public class FwImageTask extends Task implements EfiDefine{
       @return                 name of output EFI image\r
     **/\r
     public String getOutImage() {\r
       @return                 name of output EFI image\r
     **/\r
     public String getOutImage() {\r
-        return this.outImage;\r
+        return this.outImage.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -172,7 +177,7 @@ public class FwImageTask extends Task implements EfiDefine{
       @param outImage         name of output EFI image\r
     **/\r
     public void setOutImage(String outImage) {\r
       @param outImage         name of output EFI image\r
     **/\r
     public void setOutImage(String outImage) {\r
-        this.outImage = " " + outImage;\r
+        this.outImage.setArg(" ", outImage);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -183,7 +188,7 @@ public class FwImageTask extends Task implements EfiDefine{
       @return                 string of componentType\r
     **/\r
     public String getComponentType() {\r
       @return                 string of componentType\r
     **/\r
     public String getComponentType() {\r
-        return this.componentType;\r
+        return this.componentType.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -193,6 +198,6 @@ public class FwImageTask extends Task implements EfiDefine{
       @param  componentType   string of component type\r
     **/\r
     public void setComponentType(String componentType) {\r
       @param  componentType   string of component type\r
     **/\r
     public void setComponentType(String componentType) {\r
-        this.componentType = " " + componentType;\r
+        this.componentType.setArg(" ", componentType);\r
     }\r
 }\r
     }\r
 }\r
index 5a5e115a975e51e74666c3ce1d45842011c8ab56..0e0ad9cc2f56effab960c2e8c9a323ed633a6c2e 100644 (file)
@@ -14,6 +14,7 @@
 \r
  **/\r
 package org.tianocore.framework.tasks;\r
 \r
  **/\r
 package org.tianocore.framework.tasks;\r
+\r
 import java.io.File;\r
 \r
 import org.apache.tools.ant.BuildException;\r
 import java.io.File;\r
 \r
 import org.apache.tools.ant.BuildException;\r
@@ -22,6 +23,9 @@ import org.apache.tools.ant.Task;
 import org.apache.tools.ant.taskdefs.Execute;\r
 import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
 import org.apache.tools.ant.types.Commandline;\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
   GenDepexTask\r
   \r
 /**\r
   GenDepexTask\r
   \r
@@ -29,19 +33,19 @@ import org.apache.tools.ant.types.Commandline;
 \r
 **/\r
 public class GenDepexTask extends Task implements EfiDefine {\r
 \r
 **/\r
 public class GenDepexTask extends Task implements EfiDefine {\r
-    ///\r
-    /// output binary dependency files name\r
-    ///\r
-    private String outputFile = "";\r
-    ///\r
-    /// input pre-processed dependency text files name\r
-    ///\r
-    private String inputFile = "";\r
-    private String inputFileName = "";\r
-    ///\r
-    /// padding integer value\r
-    ///\r
-    private String padding = "";\r
+    private static String toolName = "GenDepex";\r
+    //\r
+    // output binary dependency files name\r
+    //\r
+    private FileArg outputFile = new FileArg();\r
+    //\r
+    // input pre-processed dependency text files name\r
+    //\r
+    private FileArg inputFile = new FileArg();\r
+    //\r
+    // padding integer value\r
+    //\r
+    private ToolArg padding = new FileArg();\r
     /**\r
       execute\r
       \r
     /**\r
       execute\r
       \r
@@ -57,14 +61,14 @@ public class GenDepexTask extends Task implements EfiDefine {
         String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
         String command;\r
         if (path == null) {\r
         String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
         String command;\r
         if (path == null) {\r
-            command = "GenDepex";\r
+            command = toolName;\r
         } else {\r
         } else {\r
-            command = path + "/" + "GenDepex";\r
+            command = path + File.separator + toolName;\r
         }\r
         //\r
         // argument of GenDepex tool\r
         //\r
         }\r
         //\r
         // argument of GenDepex tool\r
         //\r
-        String argument = inputFile + outputFile + padding;\r
+        String argument = "" + inputFile + outputFile + padding;\r
         //\r
         // reture value of GenDepex execution\r
         //\r
         //\r
         // reture value of GenDepex execution\r
         //\r
@@ -82,16 +86,17 @@ public class GenDepexTask extends Task implements EfiDefine {
             runner.setAntRun(project);\r
             runner.setCommandline(commandLine.getCommandline());\r
 \r
             runner.setAntRun(project);\r
             runner.setCommandline(commandLine.getCommandline());\r
 \r
-            log(Commandline.toString(commandLine.getCommandline()), Project.MSG_VERBOSE);\r
-            log(inputFileName);\r
+            EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(commandLine.getCommandline()));\r
+            EdkLog.log(this, inputFile.toFileList() + " => " + outputFile.toFileList());\r
+\r
             returnVal = runner.execute();\r
             if (EFI_SUCCESS == returnVal) {\r
             returnVal = runner.execute();\r
             if (EFI_SUCCESS == returnVal) {\r
-                log("GenDepex succeeded!", Project.MSG_VERBOSE);\r
+                EdkLog.log(this, EdkLog.EDK_VERBOSE, "GenDepex succeeded!");\r
             } else {\r
                 //\r
                 // command execution fail\r
                 //\r
             } else {\r
                 //\r
                 // command execution fail\r
                 //\r
-                log("ERROR = " + Integer.toHexString(returnVal));\r
+                EdkLog.log(this, "ERROR = " + Integer.toHexString(returnVal));\r
                 throw new BuildException("GenDepex failed!");\r
             }\r
         } catch (Exception e) {\r
                 throw new BuildException("GenDepex failed!");\r
             }\r
         } catch (Exception e) {\r
@@ -106,7 +111,7 @@ public class GenDepexTask extends Task implements EfiDefine {
       @param outputFileName        name of output file\r
     **/\r
     public void setOutputFile(String outputFileName) {\r
       @param outputFileName        name of output file\r
     **/\r
     public void setOutputFile(String outputFileName) {\r
-        this.outputFile = " -O " + outputFileName;\r
+        this.outputFile.setArg(" -O ", outputFileName);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -117,7 +122,7 @@ public class GenDepexTask extends Task implements EfiDefine {
       @return name of ouput file\r
     **/\r
     public String getOutputFile() {\r
       @return name of ouput file\r
     **/\r
     public String getOutputFile() {\r
-        return this.outputFile;\r
+        return this.outputFile.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -127,8 +132,7 @@ public class GenDepexTask extends Task implements EfiDefine {
       @param inputFileName          name of inputFile\r
     **/\r
     public void setInputFile(String inputFileName) {\r
       @param inputFileName          name of inputFile\r
     **/\r
     public void setInputFile(String inputFileName) {\r
-        this.inputFileName = (new File(inputFileName)).getName();\r
-        this.inputFile = " -I " + inputFileName;\r
+        this.inputFile.setArg(" -I ", inputFileName);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -138,7 +142,7 @@ public class GenDepexTask extends Task implements EfiDefine {
       @return                       name of input file\r
     **/\r
     public String getInputFile() {\r
       @return                       name of input file\r
     **/\r
     public String getInputFile() {\r
-        return this.inputFile;\r
+        return this.inputFile.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -148,7 +152,7 @@ public class GenDepexTask extends Task implements EfiDefine {
       @param paddingNum             padding value\r
     **/\r
     public void setPadding(String paddingNum) {\r
       @param paddingNum             padding value\r
     **/\r
     public void setPadding(String paddingNum) {\r
-        this.padding = " -P " + paddingNum;\r
+        this.padding.setArg(" -P ", paddingNum);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -158,6 +162,6 @@ public class GenDepexTask extends Task implements EfiDefine {
       @return                       value of padding\r
     **/\r
     public String getPadding() {\r
       @return                       value of padding\r
     **/\r
     public String getPadding() {\r
-        return this.padding;\r
+        return this.padding.getValue();\r
     }\r
 }\r
     }\r
 }\r
index d0c4c5b637f9e881e8a25e0be27bb7e2cb5f57f0..e2a65ccdf65364d9572e372c2cd4f3a3c5312d5a 100644 (file)
@@ -18,12 +18,17 @@ package org.tianocore.framework.tasks;
 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.Project;\r
 import org.apache.tools.ant.Task;\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 java.io.File;\r
 import java.io.InputStreamReader;\r
 import java.lang.ProcessBuilder;\r
 import java.util.LinkedList;\r
 \r
 \r
 import java.io.File;\r
 import java.io.InputStreamReader;\r
 import java.lang.ProcessBuilder;\r
 import java.util.LinkedList;\r
 \r
+import org.tianocore.common.logger.EdkLog;\r
+\r
 /**\r
   GenFvImageTask\r
   \r
 /**\r
   GenFvImageTask\r
   \r
@@ -31,22 +36,18 @@ import java.util.LinkedList;
   \r
 **/\r
 public class GenFvImageTask extends Task implements EfiDefine{\r
   \r
 **/\r
 public class GenFvImageTask extends Task implements EfiDefine{\r
-    ///\r
-    /// tool name\r
-    ///\r
+    //\r
+    // tool name\r
+    //\r
     static final private String toolName = "GenFvImage";\r
     static final private String toolName = "GenFvImage";\r
-    ///\r
-    /// The name of input inf file\r
-    ///\r
-    private String infFile="";\r
-    ///\r
-    /// Output directory\r
-    ///\r
+    //\r
+    // The name of input inf file\r
+    //\r
+    private FileArg infFile = new FileArg();\r
+    //\r
+    // Output directory\r
+    //\r
     private String outputDir = ".";\r
     private String outputDir = ".";\r
-    ///\r
-    /// argument list\r
-    ///\r
-    LinkedList<String> argList = new LinkedList<String>();\r
 \r
     /**\r
       execute\r
 \r
     /**\r
       execute\r
@@ -58,30 +59,41 @@ public class GenFvImageTask extends Task implements EfiDefine{
         Project project = this.getOwningTarget().getProject();\r
         String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
 \r
         Project project = this.getOwningTarget().getProject();\r
         String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
 \r
+        String command;\r
         if (path == null) {\r
         if (path == null) {\r
-            path = "";\r
+            command = toolName;\r
         } else {\r
         } else {\r
-            path += File.separatorChar;\r
+            command = path + File.separator + toolName;\r
         }\r
         }\r
-        argList.addFirst(path + toolName);\r
 \r
 \r
-        /// lauch the program\r
-        ///\r
-        ProcessBuilder pb = new ProcessBuilder(argList);\r
-        pb.directory(new File(outputDir));\r
+        String argument = "" + infFile;\r
+        //\r
+        // lauch the program\r
+        //\r
         int exitCode = 0;\r
         int exitCode = 0;\r
-        log((new File(this.infFile)).getName());\r
         try {\r
         try {\r
-            Process cmdProc = pb.start();\r
-            InputStreamReader cmdOut = new InputStreamReader(cmdProc.getInputStream());\r
-            char[] buf = new char[1024];\r
+            Commandline cmdline = new Commandline();\r
+            cmdline.setExecutable(command);\r
+            cmdline.createArgument().setLine(argument);\r
+\r
+            LogStreamHandler streamHandler = new LogStreamHandler(this,\r
+                    Project.MSG_INFO, Project.MSG_WARN);\r
+            Execute runner = new Execute(streamHandler, null);\r
 \r
 \r
-            exitCode = cmdProc.waitFor();\r
+            runner.setAntRun(project);\r
+            runner.setCommandline(cmdline.getCommandline());\r
+            runner.setWorkingDirectory(new File(outputDir)); \r
+            //\r
+            // log command line string.\r
+            //\r
+            EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
+            EdkLog.log(this, infFile.toFileList());\r
+\r
+            exitCode = runner.execute();\r
             if (exitCode != 0) {\r
             if (exitCode != 0) {\r
-                int len = cmdOut.read(buf, 0, 1024);\r
-                log(new String(buf, 0, len));\r
+                EdkLog.log(this, "ERROR = " + Integer.toHexString(exitCode));\r
             } else {\r
             } else {\r
-                log("GenFvImage succeeded!", Project.MSG_VERBOSE);\r
+                EdkLog.log(this, EdkLog.EDK_VERBOSE, "GenFvImage succeeded!");\r
             }\r
         } catch (Exception e) {\r
             throw new BuildException(e.getMessage());\r
             }\r
         } catch (Exception e) {\r
             throw new BuildException(e.getMessage());\r
@@ -90,7 +102,6 @@ public class GenFvImageTask extends Task implements EfiDefine{
                 throw new BuildException("GenFvImage: failed to generate FV file!");\r
             }\r
         }\r
                 throw new BuildException("GenFvImage: failed to generate FV file!");\r
             }\r
         }\r
-\r
     }\r
     /**\r
       getInfFile\r
     }\r
     /**\r
       getInfFile\r
@@ -99,7 +110,7 @@ public class GenFvImageTask extends Task implements EfiDefine{
       @return String    name of infFile\r
     **/\r
     public String getInfFile() {\r
       @return String    name of infFile\r
     **/\r
     public String getInfFile() {\r
-        return infFile;\r
+        return infFile.getValue();\r
     }\r
     \r
     /**\r
     }\r
     \r
     /**\r
@@ -110,9 +121,7 @@ public class GenFvImageTask extends Task implements EfiDefine{
       @param infFile  name of infFile\r
     **/\r
     public void setInfFile(String infFile) {\r
       @param infFile  name of infFile\r
     **/\r
     public void setInfFile(String infFile) {\r
-        this.infFile = infFile;\r
-        argList.add("-I");\r
-        argList.add(infFile);\r
+        this.infFile.setArg(" -I ", infFile);\r
     }\r
     \r
     /**\r
     }\r
     \r
     /**\r
index fc5ebbf3dc740048fac917081217ae8108c6a3f9..4d335e0ba6c706144cfdfd87c7e2f5c63adb4de0 100644 (file)
@@ -31,34 +31,30 @@ import org.apache.tools.ant.taskdefs.LogStreamHandler;
 import org.apache.tools.ant.types.Commandline;\r
 import org.tianocore.common.logger.EdkLog;\r
 \r
 import org.apache.tools.ant.types.Commandline;\r
 import org.tianocore.common.logger.EdkLog;\r
 \r
-public class GenSectionTask extends Task implements EfiDefine, Section,FfsTypes {\r
-    ///\r
-    /// inputfile name\r
-    ///\r
-    private String inputFile = "";\r
-    ///\r
-    /// \r
-    /// \r
-    private String inputFileName = "";\r
-    ///\r
-    /// outputfile name\r
-    ///\r
-    private String outputFile = "";\r
-    ///\r
-    /// section type\r
-    ///\r
-    private String sectionType = "";\r
-    ///\r
-    /// version number\r
-    ///\r
-    private String versionNum = "";\r
-    ///\r
-    /// interface string\r
-    ///\r
-    private String interfaceString = "";\r
-    ///\r
-    /// Section file list\r
-    ///\r
+public class GenSectionTask extends Task implements EfiDefine, Section, FfsTypes {\r
+    //\r
+    // inputfile name\r
+    //\r
+    private FileArg inputFile = new FileArg();\r
+    //\r
+    // outputfile name\r
+    //\r
+    private FileArg outputFile = new FileArg();\r
+    //\r
+    // section type\r
+    //\r
+    private ToolArg sectionType = new ToolArg();\r
+    //\r
+    // version number\r
+    //\r
+    private ToolArg versionNum = new ToolArg();\r
+    //\r
+    // interface string\r
+    //\r
+    private ToolArg interfaceString = new ToolArg();\r
+    //\r
+    // Section file list\r
+    //\r
     private List<Section> sectFileList = new ArrayList<Section>();\r
    \r
     /**\r
     private List<Section> sectFileList = new ArrayList<Section>();\r
    \r
     /**\r
@@ -84,8 +80,7 @@ public class GenSectionTask extends Task implements EfiDefine, Section,FfsTypes
         //\r
         // argument of tools\r
         //\r
         //\r
         // argument of tools\r
         //\r
-        String argument = inputFile + outputFile + " -s "+ sectionType + versionNum\r
-                + interfaceString;\r
+        String argument = "" + inputFile + outputFile + sectionType + versionNum + interfaceString;\r
         //\r
         // return value of gensection execution\r
         //\r
         //\r
         // return value of gensection execution\r
         //\r
@@ -103,16 +98,17 @@ public class GenSectionTask extends Task implements EfiDefine, Section,FfsTypes
             runner.setAntRun(project);\r
             runner.setCommandline(cmdline.getCommandline());\r
 \r
             runner.setAntRun(project);\r
             runner.setCommandline(cmdline.getCommandline());\r
 \r
-            EdkLog.log(this, EdkLog.EDK_INFO, inputFileName);\r
-            EdkLog.log(this, EdkLog.EDK_DEBUG, Commandline.toString(cmdline.getCommandline()));\r
+            EdkLog.log(this, inputFile.toFileList() + " => " + outputFile.toFileList());\r
+            EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
+\r
             revl = runner.execute();\r
             if (EFI_SUCCESS == revl) {\r
             revl = runner.execute();\r
             if (EFI_SUCCESS == revl) {\r
-                log("GenSection succeeded!", Project.MSG_VERBOSE);\r
+                EdkLog.log(this, EdkLog.EDK_VERBOSE, "GenSection succeeded!");\r
             } else {\r
                 //\r
                 // command execution fail\r
                 //\r
             } else {\r
                 //\r
                 // command execution fail\r
                 //\r
-                log("ERROR = " + Integer.toHexString(revl));\r
+                EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));\r
                 throw new BuildException("GenSection failed!");\r
             }\r
         } catch (Exception e) {\r
                 throw new BuildException("GenSection failed!");\r
             }\r
         } catch (Exception e) {\r
@@ -128,7 +124,7 @@ public class GenSectionTask extends Task implements EfiDefine, Section,FfsTypes
       @return                    name of input file\r
     **/\r
     public String getInputFile() {\r
       @return                    name of input file\r
     **/\r
     public String getInputFile() {\r
-        return this.inputFile;\r
+        return this.inputFile.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -139,8 +135,7 @@ public class GenSectionTask extends Task implements EfiDefine, Section,FfsTypes
       @param inputFile            name of input file\r
     **/\r
     public void setInputFile(String inputFile) {\r
       @param inputFile            name of input file\r
     **/\r
     public void setInputFile(String inputFile) {\r
-        this.inputFileName = (new File(inputFile)).getName();\r
-        this.inputFile = " -i " + inputFile;\r
+        this.inputFile.setArg(" -i ", inputFile);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -151,7 +146,7 @@ public class GenSectionTask extends Task implements EfiDefine, Section,FfsTypes
       @return                      name of output file\r
     **/\r
     public String getOutputFile() {\r
       @return                      name of output file\r
     **/\r
     public String getOutputFile() {\r
-        return this.outputFile;\r
+        return this.outputFile.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -161,7 +156,7 @@ public class GenSectionTask extends Task implements EfiDefine, Section,FfsTypes
       @param  outputFile            name of output file\r
     **/\r
     public void setOutputfile(String outputFile) {\r
       @param  outputFile            name of output file\r
     **/\r
     public void setOutputfile(String outputFile) {\r
-        this.outputFile = " -o " + outputFile;\r
+        this.outputFile.setArg(" -o ", outputFile);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -172,7 +167,7 @@ public class GenSectionTask extends Task implements EfiDefine, Section,FfsTypes
       @return                        sectoin type\r
     **/\r
     public String getSectionType() {\r
       @return                        sectoin type\r
     **/\r
     public String getSectionType() {\r
-        return this.sectionType;\r
+        return this.sectionType.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -183,7 +178,7 @@ public class GenSectionTask extends Task implements EfiDefine, Section,FfsTypes
       @param sectionType              section type\r
     **/\r
     public void setSectionType(String sectionType) {\r
       @param sectionType              section type\r
     **/\r
     public void setSectionType(String sectionType) {\r
-        this.sectionType = sectionType;\r
+        this.sectionType.setArg(" -s ", sectionType);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -193,7 +188,7 @@ public class GenSectionTask extends Task implements EfiDefine, Section,FfsTypes
       @return                         version number\r
     **/\r
     public String getVersionNum() {\r
       @return                         version number\r
     **/\r
     public String getVersionNum() {\r
-        return this.versionNum;\r
+        return this.versionNum.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -203,7 +198,7 @@ public class GenSectionTask extends Task implements EfiDefine, Section,FfsTypes
       @param versionNum               version number\r
     **/\r
     public void setVersionNum(String versionNum) {\r
       @param versionNum               version number\r
     **/\r
     public void setVersionNum(String versionNum) {\r
-        this.versionNum = " -v " + versionNum;\r
+        this.versionNum.setArg(" -v ", versionNum);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -213,7 +208,7 @@ public class GenSectionTask extends Task implements EfiDefine, Section,FfsTypes
       @return                         interface string\r
     **/\r
     public String getInterfaceString() {\r
       @return                         interface string\r
     **/\r
     public String getInterfaceString() {\r
-        return this.interfaceString;\r
+        return this.interfaceString.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -223,7 +218,7 @@ public class GenSectionTask extends Task implements EfiDefine, Section,FfsTypes
       @param interfaceString            interface string\r
     **/\r
     public void setInterfaceString(String interfaceString) {\r
       @param interfaceString            interface string\r
     **/\r
     public void setInterfaceString(String interfaceString) {\r
-        this.interfaceString = " -a " + "\"" + interfaceString + "\"";\r
+        this.interfaceString.setArg(" -a ", "\"" + interfaceString + "\"");\r
     }\r
     \r
     /**\r
     }\r
     \r
     /**\r
@@ -263,7 +258,7 @@ public class GenSectionTask extends Task implements EfiDefine, Section,FfsTypes
         //  Search SectionList find earch section and call it's \r
         //  ToBuffer function.\r
         //\r
         //  Search SectionList find earch section and call it's \r
         //  ToBuffer function.\r
         //\r
-        if (this.sectionType.equalsIgnoreCase("EFI_SECTION_COMPRESSION")){\r
+        if (this.sectionType.getValue().equalsIgnoreCase("EFI_SECTION_COMPRESSION")){\r
             Section    sect;\r
             \r
             //\r
             Section    sect;\r
             \r
             //\r
index 76ab8e071500cd7177d109c6be553283535dd651..997111ae5d661cbee89cfdd4d414e7574d3f5b36 100644 (file)
@@ -281,6 +281,7 @@ public class MakeDeps extends Task {
     private boolean isUptodate() {\r
         File df = new File(depsFile);\r
         if (!df.exists()) {\r
     private boolean isUptodate() {\r
         File df = new File(depsFile);\r
         if (!df.exists()) {\r
+            EdkLog.log(this, EdkLog.EDK_VERBOSE, depsFile + " doesn't exist!");\r
             return false;\r
         }\r
 \r
             return false;\r
         }\r
 \r
@@ -296,6 +297,7 @@ public class MakeDeps extends Task {
             for (int i = 0, length = fileList.size(); i < length; ++i) {\r
                 File sf = new File(fileList.get(i));\r
                 if (sf.lastModified() > depsFileTimeStamp) {\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
                     return false;\r
                 }\r
             }\r
@@ -309,26 +311,53 @@ public class MakeDeps extends Task {
         //\r
         LineNumberReader    lineReader = null;\r
         FileReader          fileReader = null;\r
         //\r
         LineNumberReader    lineReader = null;\r
         FileReader          fileReader = null;\r
-        boolean             ret = true;\r
+        boolean             ret = false;\r
         try {\r
             fileReader = new FileReader(df);\r
             lineReader = new LineNumberReader(fileReader);\r
 \r
             String line = null;\r
         try {\r
             fileReader = new FileReader(df);\r
             lineReader = new LineNumberReader(fileReader);\r
 \r
             String line = null;\r
+            int lines = 0;\r
             while ((line = lineReader.readLine()) != null) {\r
             while ((line = lineReader.readLine()) != null) {\r
-                File sourceFile = new File(line);\r
+                //\r
+                // check file end flag "\t" to see if the .dep was generated correctly\r
+                // \r
+                if (line.equals("\t")) {\r
+                    ret = true;\r
+                    continue;\r
+                }\r
+                line = line.trim();\r
+                //\r
+                // skip empty line\r
+                // \r
+                if (line.length() == 0) {\r
+                    continue;\r
+                }\r
+                ++lines;\r
+\r
                 //\r
                 // If a file cannot be found (moved or removed) or newer, regenerate the dep file\r
                 // \r
                 //\r
                 // If a file cannot be found (moved or removed) or newer, regenerate the dep file\r
                 // \r
+                File sourceFile = new File(line);\r
                 if ((!sourceFile.exists()) || (sourceFile.lastModified() > depsFileTimeStamp)) {\r
                 if ((!sourceFile.exists()) || (sourceFile.lastModified() > depsFileTimeStamp)) {\r
+                    EdkLog.log(this, EdkLog.EDK_VERBOSE, sourceFile.getPath() + " has been (re)moved or changed since last build!");\r
                     ret = false;\r
                     break;\r
                 }\r
             }\r
                     ret = false;\r
                     break;\r
                 }\r
             }\r
+\r
+            //\r
+            // check if the .dep file is empty\r
+            // \r
+            if (lines == 0) {\r
+                EdkLog.log(this, EdkLog.EDK_VERBOSE, depsFile + " is empty!");\r
+                ret = false;\r
+            }\r
+\r
             lineReader.close();\r
             fileReader.close();\r
         } catch (IOException e) {\r
             lineReader.close();\r
             fileReader.close();\r
         } catch (IOException e) {\r
-            log (e.getMessage());\r
+            throw new BuildException(e.getMessage());\r
         }\r
 \r
         return ret;\r
         }\r
 \r
         return ret;\r
index a402392349a3b4a1c2a77f18ce5ef91b6ce80f6b..be1d88aa35a5c131dbb0d1b0ccb723b1a44fbc05 100644 (file)
@@ -34,6 +34,15 @@ public class NestElement extends DataType {
     //\r
     private List<String> nameList = new ArrayList<String>();\r
 \r
     //\r
     private List<String> nameList = new ArrayList<String>();\r
 \r
+    /**\r
+       Insert content in the newElement into this NestElement\r
+\r
+       @param newElement    The new NestElement\r
+     **/\r
+    public void insert(NestElement newElement) {\r
+        this.nameList.addAll(newElement.getNameList());\r
+    }\r
+\r
     /**\r
        Handle "name" attribute. No delimiter and special treatment are assumed.\r
 \r
     /**\r
        Handle "name" attribute. No delimiter and special treatment are assumed.\r
 \r
@@ -41,7 +50,14 @@ public class NestElement extends DataType {
      **/\r
     public void setName(String name) {\r
         if (name.length() > 0) {\r
      **/\r
     public void setName(String name) {\r
         if (name.length() > 0) {\r
-            nameList.add(name);\r
+            this.nameList.clear();\r
+            this.nameList.add(name);\r
+        }\r
+    }\r
+\r
+    public void insName(String name) {\r
+        if (name.length() > 0) {\r
+            this.nameList.add(name);\r
         }\r
     }\r
 \r
         }\r
     }\r
 \r
@@ -56,6 +72,7 @@ public class NestElement extends DataType {
             return;\r
         }\r
 \r
             return;\r
         }\r
 \r
+        this.nameList.clear();\r
         StringTokenizer tokens = new StringTokenizer(nameList, " \t,;", false);\r
         while (tokens.hasMoreTokens()) {\r
             String name = tokens.nextToken().trim();\r
         StringTokenizer tokens = new StringTokenizer(nameList, " \t,;", false);\r
         while (tokens.hasMoreTokens()) {\r
             String name = tokens.nextToken().trim();\r
@@ -91,6 +108,7 @@ public class NestElement extends DataType {
             //\r
             // Read line by line\r
             // \r
             //\r
             // Read line by line\r
             // \r
+            nameList.clear();\r
             while((str = in.readLine()) != null){\r
                 str = str.trim();\r
                 if (str.length() == 0){\r
             while((str = in.readLine()) != null){\r
                 str = str.trim();\r
                 if (str.length() == 0){\r
@@ -98,7 +116,7 @@ public class NestElement extends DataType {
                 }\r
 \r
                 //getProject().replaceProperties(str);\r
                 }\r
 \r
                 //getProject().replaceProperties(str);\r
-                nameList.add(str);\r
+                this.nameList.add(str);\r
             }\r
         } catch (Exception e){\r
             throw new BuildException(e.getMessage());            \r
             }\r
         } catch (Exception e){\r
             throw new BuildException(e.getMessage());            \r
@@ -128,6 +146,15 @@ public class NestElement extends DataType {
         setPath(file);\r
     }\r
 \r
         setPath(file);\r
     }\r
 \r
+    /**\r
+       Add a file or file list into the file list\r
+\r
+       @param file  The path of a file\r
+     **/\r
+    public void insFile(String file) {\r
+        insPath(file);\r
+    }\r
+\r
     /**\r
        Handle "path" attribute. The value of "path" may contain compound path\r
        separator (/ or \) which should be cleaned up. Because the "path" string\r
     /**\r
        Handle "path" attribute. The value of "path" may contain compound path\r
        separator (/ or \) which should be cleaned up. Because the "path" string\r
@@ -139,6 +166,16 @@ public class NestElement extends DataType {
        @param path  String value of a file system path\r
      **/\r
     public void setPath(String path) {\r
        @param path  String value of a file system path\r
      **/\r
     public void setPath(String path) {\r
+        this.nameList.clear();\r
+        insPath(path);\r
+    }\r
+\r
+    /**\r
+       Add a path or path list into the path list\r
+\r
+       @param path  The path string\r
+     **/\r
+    public void insPath(String path) {\r
         if (path.length() == 0) {\r
             return;\r
         }\r
         if (path.length() == 0) {\r
             return;\r
         }\r
@@ -184,6 +221,7 @@ public class NestElement extends DataType {
             //\r
             // Read the file line by line, skipping empty ones\r
             // \r
             //\r
             // Read the file line by line, skipping empty ones\r
             // \r
+            nameList.clear();\r
             while((path = in.readLine()) != null){\r
                 path = path.trim();\r
                 if (path.length() == 0){\r
             while((path = in.readLine()) != null){\r
                 path = path.trim();\r
                 if (path.length() == 0){\r
@@ -254,6 +292,47 @@ public class NestElement extends DataType {
         return string.toString();\r
     }\r
 \r
         return string.toString();\r
     }\r
 \r
+    /**\r
+       Compose and return the name/path string concatenated by space and\r
+       with only one "prefix".\r
+\r
+       @param prefix    The prefix at the beginning of the string\r
+       \r
+       @return String   The string with one prefix at the beginning\r
+     **/\r
+    public String toStringWithSinglepPrefix(String prefix) {\r
+        return prefix + toString(" ");\r
+    }\r
+\r
+    /**\r
+       Compose a string list with file names only, separated by spcified string\r
+\r
+       @param separator     The separator string\r
+       \r
+       @return String       The file list\r
+     **/\r
+    public String toFileList(String separator) {\r
+        StringBuffer string = new StringBuffer(1024);\r
+        int length = nameList.size();\r
+\r
+        for (int i = 0; i < length; ++i) {\r
+            File file = new File(nameList.get(i));\r
+            string.append(file.getName());\r
+            string.append(separator);\r
+        }\r
+\r
+        return string.toString();\r
+    }\r
+\r
+    /**\r
+       Compose a string list with file names only, separated by space\r
+\r
+       @return String   The list string\r
+     **/\r
+    public String toFileList() {\r
+        return toFileList(" ");\r
+    }\r
+\r
     //\r
     // Remove any duplicated path separator or inconsistent path separator\r
     //\r
     //\r
     // Remove any duplicated path separator or inconsistent path separator\r
     //\r
index d7dfc4193ba132300919986dfdd4f2e4593cb04c..76a396c2b53cad4c1ed23aa1d689b20bfce58b1b 100644 (file)
@@ -33,43 +33,39 @@ import org.tianocore.common.logger.EdkLog;
   PeiReBaseTask is used to call PeiReBase.exe to rebase efi fv file.\r
 **/\r
 public class PeiReBaseTask extends Task implements EfiDefine {\r
   PeiReBaseTask is used to call PeiReBase.exe to rebase efi fv file.\r
 **/\r
 public class PeiReBaseTask extends Task implements EfiDefine {\r
-    ///\r
-    /// tool name\r
-    ///\r
+    //\r
+    // tool name\r
+    //\r
     private String toolName = "PeiReBase";\r
     private String toolName = "PeiReBase";\r
-    // /\r
-    // / Input file\r
-    // /\r
-    private String inputFile = "";\r
-    private String inputFileName = "";\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
-    /// Base address\r
-    ///\r
-    private String baseAddr = "";\r
-\r
-    ///\r
-    /// Architecture\r
-    ///\r
-    private String arch = "";\r
+    //\r
+    // Input file\r
+    //\r
+    private FileArg inputFile = new FileArg();\r
+    //\r
+    // Output file\r
+    //\r
+    private FileArg outputFile = new FileArg();\r
+    //\r
+    // Base address\r
+    //\r
+    private ToolArg baseAddr = new ToolArg();\r
+    //\r
+    // \r
+    // \r
+    private FileArg mapFile = new FileArg();\r
+    //\r
+    // Architecture\r
+    //\r
+    private String arch = "IA32";\r
 \r
     /**\r
 \r
     /**\r
-     * execute\r
-     *\r
-     * PeiReBaseTask execute function is to assemble tool command line & execute\r
-     * tool command line\r
-     *\r
-     * @throws BuidException\r
-     */\r
+      execute\r
+     \r
+      PeiReBaseTask 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
     public void execute() throws BuildException {\r
 \r
         Project project = this.getOwningTarget().getProject();\r
@@ -82,28 +78,24 @@ public class PeiReBaseTask extends Task implements EfiDefine {
         String argument;\r
         if (this.arch.equalsIgnoreCase("IA32")){\r
             command = toolName + "_IA32";\r
         String argument;\r
         if (this.arch.equalsIgnoreCase("IA32")){\r
             command = toolName + "_IA32";\r
-        }else if (this.arch.equalsIgnoreCase("X64")){\r
+        } else if (this.arch.equalsIgnoreCase("X64")){\r
             command = toolName + "_X64";\r
             command = toolName + "_X64";\r
-        }else if (this.arch.equalsIgnoreCase("IPF")){\r
+        } else if (this.arch.equalsIgnoreCase("IPF")){\r
             command = toolName + "_IPF";\r
             command = toolName + "_IPF";\r
-        }else {\r
+        } else {\r
             command = toolName + "_IA32";\r
         }\r
         if (path != null) {\r
             command = toolName + "_IA32";\r
         }\r
         if (path != null) {\r
-            command = path + File.separatorChar + command;\r
+            command = path + File.separator + command;\r
         }\r
 \r
         //\r
         // argument of tools\r
         //\r
         }\r
 \r
         //\r
         // argument of tools\r
         //\r
-        File file = new File(outputFile);\r
-        if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
-            argument = inputFile + " " +  "-O " + outputDir + File.separatorChar\r
-                    + outputFile + " " + this.baseAddr + " "\r
-                    + "-M " + outputDir + + File.separatorChar + outputFile + ".map";\r
-        } else {\r
-            argument = inputFile + " " + "-O " + outputFile + " " + this.baseAddr+ " " + "-M " + outputFile + ".map";\r
+        if (mapFile.getValue().length() == 0) {\r
+            mapFile.setArg(" -M ", outputFile.getValue() + ".map");\r
         }\r
         }\r
+        argument = "" + inputFile + outputFile + baseAddr + mapFile;\r
 \r
         //\r
         // return value of fwimage execution\r
 \r
         //\r
         // return value of fwimage execution\r
@@ -125,7 +117,9 @@ public class PeiReBaseTask extends Task implements EfiDefine {
             // Set debug log information.\r
             //\r
             EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
             // Set debug log information.\r
             //\r
             EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
-            EdkLog.log(this, EdkLog.EDK_INFO, this.inputFileName);\r
+            EdkLog.log(this, EdkLog.EDK_INFO, inputFile.toFileList() + " => " \r
+                                              + outputFile.toFileList()\r
+                                              + mapFile.toFileList());\r
 \r
             revl = runner.execute();\r
 \r
 \r
             revl = runner.execute();\r
 \r
@@ -147,116 +141,110 @@ public class PeiReBaseTask extends Task implements EfiDefine {
     }\r
 \r
     /**\r
     }\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
     public String getInputFile() {\r
-        return inputFile;\r
+        return inputFile.getValue();\r
     }\r
 \r
     /**\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
     public void setInputFile(String inputFile) {\r
-        this.inputFileName = (new File(inputFile)).getName();\r
-        this.inputFile = "-I " + inputFile;\r
+        this.inputFile.setArg(" -I ", inputFile);\r
     }\r
 \r
     /**\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
     public String getOutputFile() {\r
-        return outputFile;\r
+        return outputFile.getValue();\r
     }\r
 \r
     /**\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
     public void setOutputFile(String outputFile) {\r
-        this.outputFile = 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
-    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
+        this.outputFile.setArg(" -O ", outputFile);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * getBaseAddr\r
-     *\r
-     * This function is to get class member "baseAddr"\r
-     *\r
-     * @return baseAddr   string of base address.\r
-     */\r
+      getBaseAddr\r
+     \r
+      This function is to get class member "baseAddr"\r
+     \r
+      @return baseAddr   string of base address.\r
+     **/\r
     public String getBaseAddr() {\r
     public String getBaseAddr() {\r
-        return baseAddr;\r
+        return baseAddr.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * setBaseAddr\r
-     *\r
-     * This function is to set class member "baseAddr"\r
-     *\r
-     * @param baseAddr    string of base address\r
-     */\r
+      setBaseAddr\r
+     \r
+      This function is to set class member "baseAddr"\r
+     \r
+      @param baseAddr    string of base address\r
+     **/\r
     public void setBaseAddr(String baseAddr) {\r
     public void setBaseAddr(String baseAddr) {\r
-        this.baseAddr = "-B " +  baseAddr;\r
+        this.baseAddr.setArg(" -B ", baseAddr);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     * getArch\r
-     *\r
-     * This function is to get class member "arch".\r
-     *\r
-     * @return arch       Architecture\r
-     */\r
+      getArch\r
+     \r
+      This function is to get class member "arch".\r
+     \r
+      @return arch       Architecture\r
+     **/\r
     public String getArch() {\r
         return arch;\r
     }\r
 \r
     /**\r
     public String getArch() {\r
         return arch;\r
     }\r
 \r
     /**\r
-     * setArch\r
-     *\r
-     * This function is to set class member "arch"\r
-     *\r
-     * @param arch         Architecture\r
-     */\r
+      setArch\r
+     \r
+      This function is to set class member "arch"\r
+     \r
+      @param arch         Architecture\r
+     **/\r
     public void setArch(String arch) {\r
         this.arch = arch;\r
     }\r
     public void setArch(String arch) {\r
         this.arch = arch;\r
     }\r
+\r
+    /**\r
+       Get the value of map file\r
+\r
+       @return String   The map file path\r
+     **/\r
+    public String getMapFile() {\r
+        return mapFile.getValue();\r
+    }\r
+\r
+    /**\r
+       Set "-M MapFile" argument\r
+\r
+       @param mapFile   The path of map file\r
+     **/\r
+    public void setMapFile(String mapFile) {\r
+        this.mapFile.setArg(" -M ", mapFile);\r
+    }\r
 }\r
 }\r
index b84adf2525d25de9ebfbb769dd7f2d0c12312dca..a92f727376d37c7e3b378f582bd08639f7baf625 100644 (file)
@@ -22,6 +22,7 @@ import org.apache.tools.ant.Task;
 import org.apache.tools.ant.taskdefs.Execute;\r
 import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
 import org.apache.tools.ant.types.Commandline;\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
+import org.tianocore.common.logger.EdkLog;\r
 \r
 /**\r
  StrGather Task Class\r
 \r
 /**\r
  StrGather Task Class\r
@@ -48,51 +49,51 @@ public class StrGatherTask extends Task implements EfiDefine {
     ///\r
     /// common options\r
     ///\r
     ///\r
     /// common options\r
     ///\r
-    private String commandType = "";\r
+    private ToolArg commandType = new ToolArg();\r
 \r
 \r
-    private String baseName = "";\r
+    private ToolArg baseName = new ToolArg();\r
 \r
     ///\r
     /// "all/read/write"\r
     ///\r
 \r
     ///\r
     /// "all/read/write"\r
     ///\r
-    private String verbose = "";\r
+    private ToolArg verbose = new ToolArg();\r
 \r
 \r
-    private String outputDatabase = "";\r
+    private FileArg outputDatabase = new FileArg();\r
 \r
 \r
-    private List<Database> databaseList = new ArrayList<Database>();\r
+    private Database databaseList = new Database();\r
 \r
 \r
-    private List<InputFile> inputFileList = new ArrayList<InputFile>();\r
+    private InputFile inputFileList = new InputFile();\r
 \r
     ///\r
     /// parse options newDatabase -- "ture/false" unquoteString -- "ture/false"\r
     ///\r
 \r
     ///\r
     /// parse options newDatabase -- "ture/false" unquoteString -- "ture/false"\r
     ///\r
-    private String newDatabase = "";\r
+    private ToolArg newDatabase = new ToolArg();\r
 \r
 \r
-    private String unquotedString = "";\r
+    private ToolArg unquotedString = new ToolArg();\r
 \r
 \r
-    private List<IncludePath> includePathList = new ArrayList<IncludePath>();\r
+    private IncludePath includePathList = new IncludePath();\r
 \r
     ///\r
     /// scan options ignoreNotFound -- "ture/false"\r
     ///\r
 \r
     ///\r
     /// scan options ignoreNotFound -- "ture/false"\r
     ///\r
-    private String ignoreNotFound = "";\r
+    private ToolArg ignoreNotFound = new ToolArg();\r
 \r
 \r
-    private List<SkipExt> skipExtList = new ArrayList<SkipExt>();\r
+    private SkipExt skipExtList = new SkipExt();\r
 \r
     ///\r
     /// dump options\r
     ///\r
 \r
     ///\r
     /// dump options\r
     ///\r
-    private String outputString = "";\r
+    private ToolArg outputString = new ToolArg();\r
 \r
 \r
-    private String outputDefines = "";\r
+    private ToolArg outputDefines = new ToolArg();\r
 \r
 \r
-    private String outputUnicode = "";\r
+    private ToolArg outputUnicode = new ToolArg();\r
 \r
 \r
-    private String lang = "";\r
+    private ToolArg lang = new ToolArg();\r
 \r
 \r
-    private String indirectionFile = "";\r
+    private FileArg indirectionFile = new FileArg();\r
 \r
 \r
-    private String outputHpk = "";\r
+    private FileArg outputHpk = new FileArg();\r
 \r
     ///\r
     /// global variable\r
 \r
     ///\r
     /// global variable\r
@@ -118,22 +119,14 @@ public class StrGatherTask extends Task implements EfiDefine {
             command = path + File.separator + "StrGather";\r
         }\r
 \r
             command = path + File.separator + "StrGather";\r
         }\r
 \r
-        ///\r
-        /// transfer nested elements into string\r
-        ///\r
-        String databases = list2Str(databaseList);\r
-        String skipExts = list2Str(skipExtList);\r
-        String includePaths = list2Str(includePathList);\r
-        String inputFiles = list2Str(inputFileList);\r
-\r
         ///\r
         /// assemble argument\r
         ///\r
         ///\r
         /// assemble argument\r
         ///\r
-        String argument = commandType + verbose + databases + baseName\r
-                + outputDatabase + includePaths + newDatabase + unquotedString\r
-                + skipExts + ignoreNotFound + outputString + outputDefines\r
+        String argument = "" + commandType + verbose + databaseList + baseName\r
+                + outputDatabase + includePathList + newDatabase + unquotedString\r
+                + skipExtList + ignoreNotFound + outputString + outputDefines\r
                 + outputUnicode + lang + indirectionFile + outputHpk\r
                 + outputUnicode + lang + indirectionFile + outputHpk\r
-                + inputFiles;\r
+                + inputFileList;\r
         ///\r
         /// return value of fwimage execution\r
         ///\r
         ///\r
         /// return value of fwimage execution\r
         ///\r
@@ -151,16 +144,27 @@ public class StrGatherTask extends Task implements EfiDefine {
             runner.setAntRun(project);\r
             runner.setCommandline(cmdline.getCommandline());\r
 \r
             runner.setAntRun(project);\r
             runner.setCommandline(cmdline.getCommandline());\r
 \r
-            log(Commandline.toString(cmdline.getCommandline()), Project.MSG_VERBOSE);\r
-            log(this.commandType.substring(2));\r
+            String cmdType = getCommandType();\r
+            if (cmdType.equalsIgnoreCase("parse")) {\r
+                EdkLog.log(this, "(parse) " + inputFileList.toFileList() + " => " \r
+                    + databaseList.toFileList());\r
+            } else if (cmdType.equalsIgnoreCase("scan")) {\r
+                EdkLog.log(this, "(scan) " + databaseList.toFileList() + " => " \r
+                    + outputDatabase.toFileList());\r
+            } else {\r
+                EdkLog.log(this, "(dump) " + databaseList.toFileList() + " => " \r
+                    + outputDefines.toFileList() + outputString.toFileList() + outputHpk.toFileList());\r
+            }\r
+            EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
+\r
             revl = runner.execute();\r
             if (EFI_SUCCESS == revl) {\r
             revl = runner.execute();\r
             if (EFI_SUCCESS == revl) {\r
-                log("StrGather succeeded!", Project.MSG_VERBOSE);\r
+                EdkLog.log(this, EdkLog.EDK_VERBOSE, "StrGather succeeded!");\r
             } else {\r
                 ///\r
                 /// command execution fail\r
                 ///\r
             } else {\r
                 ///\r
                 /// command execution fail\r
                 ///\r
-                log("ERROR = " + Integer.toHexString(revl));\r
+                EdkLog.log(this, "ERROR = " + Integer.toHexString(revl));\r
                 throw new BuildException("StrGather failed!");\r
             }\r
         } catch (Exception e) {\r
                 throw new BuildException("StrGather failed!");\r
             }\r
         } catch (Exception e) {\r
@@ -174,7 +178,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @returns commandType parameter\r
      **/\r
     public String getCommandType() {\r
      @returns commandType parameter\r
      **/\r
     public String getCommandType() {\r
-        return this.commandType;\r
+        return this.commandType.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -183,7 +187,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @param     commandType     type of strgather command [parse/scan/dump]\r
      **/\r
     public void setCommandType(String commandType) {\r
      @param     commandType     type of strgather command [parse/scan/dump]\r
      **/\r
     public void setCommandType(String commandType) {\r
-        this.commandType = " -" + commandType;\r
+        this.commandType.setArg(" -", commandType);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -192,7 +196,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @returns verbose parameter\r
      **/\r
     public String getVerbose() {\r
      @returns verbose parameter\r
      **/\r
     public String getVerbose() {\r
-        return this.verbose;\r
+        return this.verbose.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -205,17 +209,17 @@ public class StrGatherTask extends Task implements EfiDefine {
             ///\r
             /// for verbose output\r
             ///\r
             ///\r
             /// for verbose output\r
             ///\r
-            this.verbose = " -v ";\r
+            this.verbose.setArg(" -", "v");\r
         } else if (verbose.equals("read")) {\r
             ///\r
             /// for verbose output when reading database\r
             ///\r
         } else if (verbose.equals("read")) {\r
             ///\r
             /// for verbose output when reading database\r
             ///\r
-            this.verbose = " -vdbr ";\r
+            this.verbose.setArg(" -", "vdbr");\r
         } else if (verbose.equals("write")) {\r
             ///\r
             /// for verbose output when writing database\r
             ///\r
         } else if (verbose.equals("write")) {\r
             ///\r
             /// for verbose output when writing database\r
             ///\r
-            this.verbose = " -vdbw ";\r
+            this.verbose.setArg(" -", "vdbw");\r
         }\r
     }\r
 \r
         }\r
     }\r
 \r
@@ -225,7 +229,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @returns baseName parameter\r
      **/\r
     public String getBaseName() {\r
      @returns baseName parameter\r
      **/\r
     public String getBaseName() {\r
-        return this.baseName;\r
+        return this.baseName.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -234,7 +238,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @param     baseName    name of the output files of .c and .h\r
      **/\r
     public void setBaseName(String baseName) {\r
      @param     baseName    name of the output files of .c and .h\r
      **/\r
     public void setBaseName(String baseName) {\r
-        this.baseName = " -bn " + baseName;\r
+        this.baseName.setArg(" -bn ", baseName);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -243,7 +247,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @returns outputDatabase parameter\r
      **/\r
     public String getOutputDatabase() {\r
      @returns outputDatabase parameter\r
      **/\r
     public String getOutputDatabase() {\r
-        return this.outputDatabase;\r
+        return this.outputDatabase.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -252,7 +256,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @param     outputDatabase  filename of output database file\r
      **/\r
     public void setOutputDatabase(String outputDatabase) {\r
      @param     outputDatabase  filename of output database file\r
      **/\r
     public void setOutputDatabase(String outputDatabase) {\r
-        this.outputDatabase = " -od " + outputDatabase;\r
+        this.outputDatabase.setArg(" -od ", outputDatabase);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -260,8 +264,8 @@ public class StrGatherTask extends Task implements EfiDefine {
      \r
      @returns newDatabase parameter\r
      **/\r
      \r
      @returns newDatabase parameter\r
      **/\r
-    public String getNewDatabse() {\r
-        return this.newDatabase;\r
+    public boolean getNewDatabse() {\r
+        return this.newDatabase.getPrefix().length() > 0;\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -269,9 +273,9 @@ public class StrGatherTask extends Task implements EfiDefine {
      \r
      @param     newDatabase     whether to not read in existing database file\r
      **/\r
      \r
      @param     newDatabase     whether to not read in existing database file\r
      **/\r
-    public void setNewDatabase(String newDatabase) {\r
-        if (newDatabase.equals("true")) {\r
-            this.newDatabase = " -newdb ";\r
+    public void setNewDatabase(boolean newDatabase) {\r
+        if (newDatabase) {\r
+            this.newDatabase.setArg(" -", "newdb");\r
         }\r
     }\r
 \r
         }\r
     }\r
 \r
@@ -280,8 +284,8 @@ public class StrGatherTask extends Task implements EfiDefine {
      \r
      @returns unquotedString parameter\r
      **/\r
      \r
      @returns unquotedString parameter\r
      **/\r
-    public String getUnquotedString() {\r
-        return this.unquotedString;\r
+    public boolean getUnquotedString() {\r
+        return this.unquotedString.getValue().length() > 0;\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -290,9 +294,9 @@ public class StrGatherTask extends Task implements EfiDefine {
      @param unquotedString :\r
                 whether to indicate that unquoted strings are used\r
      **/\r
      @param unquotedString :\r
                 whether to indicate that unquoted strings are used\r
      **/\r
-    public void setUnquotedString(String unquotedString) {\r
-        if (unquotedString.equals("true")) {\r
-            this.unquotedString = " -uqs ";\r
+    public void setUnquotedString(boolean unquotedString) {\r
+        if (unquotedString) {\r
+            this.unquotedString.setArg(" -", "uqs");\r
         }\r
     }\r
 \r
         }\r
     }\r
 \r
@@ -301,8 +305,8 @@ public class StrGatherTask extends Task implements EfiDefine {
      \r
      @returns ignoreNotFound parameter\r
      **/\r
      \r
      @returns ignoreNotFound parameter\r
      **/\r
-    public String getIgnoreNotFound() {\r
-        return this.ignoreNotFound;\r
+    public boolean getIgnoreNotFound() {\r
+        return this.ignoreNotFound.getValue().length() > 0;\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -311,9 +315,9 @@ public class StrGatherTask extends Task implements EfiDefine {
      @param     ignoreNotFound  whether to ignore if a given STRING_TOKEN(STR) \r
                                 is not found in the database\r
      **/\r
      @param     ignoreNotFound  whether to ignore if a given STRING_TOKEN(STR) \r
                                 is not found in the database\r
      **/\r
-    public void setIgnoreNotFound(String ignoreNotFound) {\r
-        if (ignoreNotFound.equals("true")) {\r
-            this.ignoreNotFound = " -ignorenotfound ";\r
+    public void setIgnoreNotFound(boolean ignoreNotFound) {\r
+        if (ignoreNotFound) {\r
+            this.ignoreNotFound.setArg(" -", "ignorenotfound");\r
         }\r
     }\r
 \r
         }\r
     }\r
 \r
@@ -323,7 +327,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @returns outputString parameter\r
      **/\r
     public String getOutputString() {\r
      @returns outputString parameter\r
      **/\r
     public String getOutputString() {\r
-        return this.outputString;\r
+        return this.outputString.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -332,7 +336,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @param     outputString    filename of string data file\r
      **/\r
     public void setOutputString(String outputString) {\r
      @param     outputString    filename of string data file\r
      **/\r
     public void setOutputString(String outputString) {\r
-        this.outputString = " -oc " + outputString;\r
+        this.outputString.setArg(" -oc ", outputString);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -341,7 +345,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @returns outputDefines parameter\r
      **/\r
     public String getOutputDefines() {\r
      @returns outputDefines parameter\r
      **/\r
     public String getOutputDefines() {\r
-        return this.outputDefines;\r
+        return this.outputDefines.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -350,7 +354,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @param     outputDefines   filename of string defines file\r
      **/\r
     public void setOutputDefines(String outputDefines) {\r
      @param     outputDefines   filename of string defines file\r
      **/\r
     public void setOutputDefines(String outputDefines) {\r
-        this.outputDefines = " -oh " + outputDefines;\r
+        this.outputDefines.setArg(" -oh ", outputDefines);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -359,7 +363,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @returns outputUnicode parameter\r
      **/\r
     public String getOutputUnicode() {\r
      @returns outputUnicode parameter\r
      **/\r
     public String getOutputUnicode() {\r
-        return this.outputUnicode;\r
+        return this.outputUnicode.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -368,7 +372,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @param     outputUnicode   filename of unicode file to be dumped database\r
      **/\r
     public void setOutputUnicode(String outputUnicode) {\r
      @param     outputUnicode   filename of unicode file to be dumped database\r
      **/\r
     public void setOutputUnicode(String outputUnicode) {\r
-        this.outputUnicode = " -ou " + outputUnicode;\r
+        this.outputUnicode.setArg(" -ou ", outputUnicode);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -377,7 +381,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @returns lang parameter\r
      **/\r
     public String getLang() {\r
      @returns lang parameter\r
      **/\r
     public String getLang() {\r
-        return this.lang;\r
+        return this.lang.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -386,7 +390,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @param     lang    language of dump\r
      **/\r
     public void setLang(String lang) {\r
      @param     lang    language of dump\r
      **/\r
     public void setLang(String lang) {\r
-        this.lang = " -lang " + lang;\r
+        this.lang.setArg(" -lang ", lang);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -395,7 +399,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @returns indirectionFile parameter\r
      **/\r
     public String getIndirectionFile() {\r
      @returns indirectionFile parameter\r
      **/\r
     public String getIndirectionFile() {\r
-        return this.indirectionFile;\r
+        return this.indirectionFile.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -404,7 +408,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @param     indirectionFile     filename of indirection file\r
      **/\r
     public void setIndirectionFile(String indirectionFile) {\r
      @param     indirectionFile     filename of indirection file\r
      **/\r
     public void setIndirectionFile(String indirectionFile) {\r
-        this.indirectionFile = " -if " + indirectionFile;\r
+        this.indirectionFile.setArg(" -if ", indirectionFile);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -413,7 +417,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @returns outputHpk parameter\r
      **/\r
     public String getOutputHpk() {\r
      @returns outputHpk parameter\r
      **/\r
     public String getOutputHpk() {\r
-        return this.outputHpk;\r
+        return this.outputHpk.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -422,7 +426,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @param     outputHpk   filename of output HII export pack of the strings\r
      **/\r
     public void setOutputHpk(String outputHpk) {\r
      @param     outputHpk   filename of output HII export pack of the strings\r
      **/\r
     public void setOutputHpk(String outputHpk) {\r
-        this.outputHpk = " -hpk " + outputHpk;\r
+        this.outputHpk.setArg(" -hpk ", outputHpk);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -430,8 +434,8 @@ public class StrGatherTask extends Task implements EfiDefine {
      \r
      @param     skipExt     skipExt element\r
      **/\r
      \r
      @param     skipExt     skipExt element\r
      **/\r
-    public void addSkipext(SkipExt skipExt) {\r
-        skipExtList.add(skipExt);\r
+    public void addConfiguredSkipext(SkipExt skipExt) {\r
+        this.skipExtList.insert(skipExt);\r
     };\r
 \r
     /**\r
     };\r
 \r
     /**\r
@@ -439,8 +443,8 @@ public class StrGatherTask extends Task implements EfiDefine {
      \r
      @param     includePath     includePath element\r
      **/\r
      \r
      @param     includePath     includePath element\r
      **/\r
-    public void addIncludepath(IncludePath includePath) {\r
-        includePathList.add(includePath);\r
+    public void addConfiguredIncludepath(IncludePath includePath) {\r
+        this.includePathList.insert(includePath);\r
     };\r
 \r
     /**\r
     };\r
 \r
     /**\r
@@ -448,8 +452,8 @@ public class StrGatherTask extends Task implements EfiDefine {
      \r
      @param     inputFile   inputFile element\r
      **/\r
      \r
      @param     inputFile   inputFile element\r
      **/\r
-    public void addInputfile(InputFile inputFile) {\r
-        inputFileList.add(inputFile);\r
+    public void addConfiguredInputfile(InputFile inputFile) {\r
+        this.inputFileList.insert(inputFile);\r
     };\r
 \r
     /**\r
     };\r
 \r
     /**\r
@@ -458,25 +462,7 @@ public class StrGatherTask extends Task implements EfiDefine {
      @param database :\r
                 database element\r
      **/\r
      @param database :\r
                 database element\r
      **/\r
-    public void addDatabase(Database database) {\r
-        databaseList.add(database);\r
-    }\r
-\r
-    /**\r
-       Compose the content in each NestElement into a single string.\r
-\r
-       @param list  The NestElement list\r
-       \r
-       @return String\r
-     **/\r
-    private String list2Str(List list) {\r
-        int listLength = list.size();\r
-        String str = "";\r
-        for (int i = 0; i < listLength; ++i) {\r
-            NestElement e = (NestElement)list.get(i);\r
-            str += e.toString();\r
-        }\r
-\r
-        return str;\r
+    public void addConfiguredDatabase(Database database) {\r
+        this.databaseList.insert(database);\r
     }\r
 }\r
     }\r
 }\r
index ea9546487a54d0fa73338f26b82deba695ea2ec3..31781eb1d680404aa998425025f00e56992772a1 100644 (file)
@@ -32,13 +32,12 @@ import org.tianocore.common.logger.EdkLog;
  **/\r
 public class Tool implements EfiDefine, Section {\r
 \r
  **/\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
     /**\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
         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
         \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
                 //\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
                 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
                     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
         } 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
         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
             ///\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
 \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
     }\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
 \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
     }\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
     public void addGenSection(GenSectionTask genSect){\r
         this.gensectList.add(genSect);\r
-    }\r
-    \r
+    }    \r
 }\r
 \r
 \r
 }\r
 \r
 \r
index b5fbdfe81e2fa2c0532be53cf0da6e01d0caee0c..2694f036deff31ced80fb58ffb5b561459483fa3 100644 (file)
@@ -1,5 +1,5 @@
 /** @file\r
 /** @file\r
-This file is to define nested element which is meant for specifying tool arguments\r
+This file is used to nest elements which is meant for tool's argument\r
 \r
 Copyright (c) 2006, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 \r
 Copyright (c) 2006, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
@@ -14,29 +14,129 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 package org.tianocore.framework.tasks;\r
 \r
 /**\r
 package org.tianocore.framework.tasks;\r
 \r
 /**\r
- Class ToolArg is just used to specify arguments for genffsfile tool\r
+ ToolArg class is defined to represent the argument of a tool. The argument \r
+ includes the prefix (e.g. -I, -o) and the value.\r
  **/\r
  **/\r
-public class ToolArg {\r
+public class ToolArg extends NestElement {\r
     ///\r
     ///\r
-    /// keep the argument string\r
-    ///\r
-    private String line = "";\r
+    /// A constant which is used to represent an empty argument\r
+    /// \r
+    public final static ToolArg EMPTY_ARG = new ToolArg();\r
 \r
 \r
-    /**\r
-     Get method of ANT task/datatype for attribute "line"\r
+    //\r
+    // Keep track the prefix of this argument\r
+    // \r
+    private String prefix = "";\r
 \r
 \r
-     @returns   The argument string\r
+    /**\r
+       Default constructor\r
      **/\r
      **/\r
-    public String getLine() {\r
-        return line;\r
+    public ToolArg() {\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
-     Set method of ANT task/datatype for attribute "line"\r
+       Constructor which will initialize the prefix of this argument\r
 \r
 \r
-     @param     line    The argument string\r
-     **/\r
+       @param prefix    The string of prefix\r
+     */\r
+    public ToolArg(String prefix) {\r
+        this.prefix = prefix;\r
+    }\r
+\r
+    /**\r
+       Constructor which will initialize both the prefix and value of this argument\r
+       \r
+       @param prefix    The prefix of this argument\r
+       @param value     The value of this argument\r
+     */\r
+    public ToolArg(String prefix, String value) {\r
+        setArg(prefix, value);\r
+    }\r
+\r
+    /**\r
+       Set the prefix and value of this argument\r
+\r
+       @param prefix    The prefix of this argument\r
+       @param value     The value of this argument \r
+     */\r
+    public void setArg(String prefix, String value) {\r
+        this.prefix = prefix;\r
+        super.setName(value);\r
+    }\r
+\r
+    /**\r
+       Set the prefix of this argument\r
+\r
+       @param prefix    The prefix of this argument\r
+     */\r
+    public void setPrefix(String prefix) {\r
+        this.prefix = prefix;\r
+    }\r
+\r
+    /**\r
+       Get the prefix of this argument\r
+\r
+       @return String   The prefix of this argument\r
+     */\r
+    public String getPrefix() {\r
+        return this.prefix.trim();\r
+    }\r
+\r
+    /**\r
+       Set the value of this argument\r
+\r
+       @param value     The value of this argument\r
+     */\r
+    public void setValue(String value) {\r
+        super.setName(value);\r
+    }\r
+\r
+    /**\r
+       Add a value for this argument\r
+\r
+       @param value     The value of this argument\r
+     */\r
+    public void insValue(String value) {\r
+        super.insName(value);\r
+    }\r
+\r
+    /**\r
+       Get the value list of this argument, separated by space\r
+\r
+       @return String   The value list\r
+     */\r
+    public String getValue() {\r
+        return super.toString(" ").trim();\r
+    }\r
+\r
+    /**\r
+       Set the argument as a whole\r
+\r
+       @param line      The argument string line\r
+     */\r
     public void setLine(String line) {\r
     public void setLine(String line) {\r
-        this.line = line;\r
-    }   \r
-}
\ No newline at end of file
+        //\r
+        // Since the prefix is in the "line", we don't need another prefix.\r
+        // \r
+        this.prefix = " ";\r
+        super.setName(line);\r
+    }\r
+\r
+    /**\r
+       Get the argument line\r
+\r
+       @return String   The argument string line\r
+     */\r
+    public String getLine() {\r
+        return this.toString();\r
+    }\r
+\r
+    /**\r
+       Compose a complete argument string.\r
+\r
+       @return String   The complete argument\r
+     */\r
+    public String toString() {\r
+        return super.toString(prefix);\r
+    }\r
+}\r
index 198ba5eeefe9254c605514eb8c2d51a7fff66183..13b855cdd881038fa46e18b54da15f44c7df82bc 100644 (file)
@@ -25,6 +25,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.apache.tools.ant.taskdefs.LogStreamHandler;\r
 import org.apache.tools.ant.types.Commandline;\r
 \r
+import org.tianocore.common.logger.EdkLog;\r
+\r
 /**\r
  VfrcompilerTask Task Class\r
   class member \r
 /**\r
  VfrcompilerTask Task Class\r
   class member \r
@@ -36,23 +38,22 @@ import org.apache.tools.ant.types.Commandline;
       -includepathList : add IncPath to the search path for VFR included files\r
  **/\r
 public class VfrCompilerTask extends Task implements EfiDefine {\r
       -includepathList : add IncPath to the search path for VFR included files\r
  **/\r
 public class VfrCompilerTask extends Task implements EfiDefine {\r
-    private String createListFile = "";\r
-    private String outPutDir = "";\r
-    private File outPutFile;\r
-    private String createIfrBinFile = "";\r
-    private String processerArg ="";\r
-    private String vfrFile = "";\r
-    private String vfrFileName = "";\r
+    private static String toolName = "VfrCompile";\r
 \r
 \r
-    private List<IncludePath> includepathList = new ArrayList<IncludePath>();\r
+    private ToolArg createListFile = new ToolArg();\r
+    private ToolArg createIfrBinFile = new ToolArg();\r
+    private ToolArg processerArg = new ToolArg();\r
+    private FileArg vfrFile = new FileArg();\r
+    private IncludePath includepathList = new IncludePath();\r
+    private FileArg outPutDir = new FileArg(" -od ", ".");\r
 \r
     /**\r
      get class member of createList file\r
 \r
      @returns file name of createList\r
      **/\r
 \r
     /**\r
      get class member of createList file\r
 \r
      @returns file name of createList\r
      **/\r
-    public String getCreateListFile() {\r
-        return createListFile;\r
+    public boolean getCreateListFile() {\r
+        return this.createListFile.getValue().length() > 0;\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -60,9 +61,10 @@ public class VfrCompilerTask extends Task implements EfiDefine {
 \r
      @param     createListFile  if createList string equal "on" set '-l' flag\r
      **/\r
 \r
      @param     createListFile  if createList string equal "on" set '-l' flag\r
      **/\r
-    public void setCreateListFile(String createListFile) {\r
-        if (createListFile.equals("ON")||createListFile.equals("on"))\r
-            this.createListFile = " -l";\r
+    public void setCreateListFile(boolean createListFile) {\r
+        if (createListFile) {\r
+            this.createListFile.setArg(" -", "l");\r
+        }\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -71,7 +73,7 @@ public class VfrCompilerTask extends Task implements EfiDefine {
      @returns name of output dir\r
      **/\r
     public String getOutPutDir() {\r
      @returns name of output dir\r
      **/\r
     public String getOutPutDir() {\r
-        return outPutDir;\r
+        return this.outPutDir.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -80,10 +82,7 @@ public class VfrCompilerTask extends Task implements EfiDefine {
      @param     outPutDir   The directory name for ouput file\r
      **/\r
     public void setOutPutDir(String outPutDir) {\r
      @param     outPutDir   The directory name for ouput file\r
      **/\r
     public void setOutPutDir(String outPutDir) {\r
-        if (outPutDir != null) {\r
-            outPutFile = new File(outPutDir);\r
-        }\r
-        this.outPutDir = " -od " + outPutDir;\r
+        this.outPutDir.setArg(" -od ", outPutDir);\r
     }\r
 \r
 \r
     }\r
 \r
 \r
@@ -92,8 +91,8 @@ public class VfrCompilerTask extends Task implements EfiDefine {
 \r
      @return file name of ifrBinFile\r
      **/\r
 \r
      @return file name of ifrBinFile\r
      **/\r
-    public String getCreateIfrBinFile() {\r
-        return createIfrBinFile;\r
+    public boolean getCreateIfrBinFile() {\r
+        return this.createIfrBinFile.getValue().length() > 0;\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -102,9 +101,10 @@ public class VfrCompilerTask extends Task implements EfiDefine {
      @param     createIfrBinFile    The flag to specify if the IFR binary file should\r
                                     be generated or not\r
      */\r
      @param     createIfrBinFile    The flag to specify if the IFR binary file should\r
                                     be generated or not\r
      */\r
-    public void setCreateIfrBinFile(String createIfrBinFile) {\r
-        if (createIfrBinFile.equals("ON") || createIfrBinFile.equals("on"));\r
-        this.createIfrBinFile = " -ibin";\r
+    public void setCreateIfrBinFile(boolean createIfrBinFile) {\r
+        if (createIfrBinFile) {\r
+            this.createIfrBinFile.setArg(" -", "ibin");\r
+        }\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -113,7 +113,7 @@ public class VfrCompilerTask extends Task implements EfiDefine {
      @returns name of vfrFile\r
      **/\r
     public String getVfrFile() {\r
      @returns name of vfrFile\r
      **/\r
     public String getVfrFile() {\r
-        return vfrFile;\r
+        return this.vfrFile.getValue();\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -122,8 +122,7 @@ public class VfrCompilerTask extends Task implements EfiDefine {
      @param     vfrFile The name of VFR file\r
      **/\r
     public void setVfrFile(String vfrFile) {\r
      @param     vfrFile The name of VFR file\r
      **/\r
     public void setVfrFile(String vfrFile) {\r
-        this.vfrFileName = (new File(vfrFile)).getName();\r
-        this.vfrFile = " " + vfrFile;\r
+        this.vfrFile.setArg(" ", vfrFile);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -131,18 +130,17 @@ public class VfrCompilerTask extends Task implements EfiDefine {
 \r
      @param     includepath The IncludePath object which represents include path\r
      **/\r
 \r
      @param     includepath The IncludePath object which represents include path\r
      **/\r
-    public void addIncludepath(IncludePath includepath){\r
-        includepathList.add(includepath);\r
+    public void addConfiguredIncludepath(IncludePath includepath){\r
+        this.includepathList.insert(includepath);\r
     }\r
 \r
     }\r
 \r
-\r
     /**\r
      get class member of processerArg\r
 \r
      @returns processer argument\r
      **/\r
     public String getProcesserArg() {\r
     /**\r
      get class member of processerArg\r
 \r
      @returns processer argument\r
      **/\r
     public String getProcesserArg() {\r
-        return processerArg;\r
+        return this.processerArg.getValue();\r
     }\r
 \r
 \r
     }\r
 \r
 \r
@@ -152,7 +150,7 @@ public class VfrCompilerTask extends Task implements EfiDefine {
      @param     processerArg    The processor argument\r
      */\r
     public void setProcesserArg(String processerArg) {\r
      @param     processerArg    The processor argument\r
      */\r
     public void setProcesserArg(String processerArg) {\r
-        this.processerArg = " -ppflag " + processerArg;\r
+        this.processerArg.setArg(" -ppflag ", processerArg);\r
     }\r
 \r
     /**\r
     }\r
 \r
     /**\r
@@ -163,23 +161,17 @@ public class VfrCompilerTask extends Task implements EfiDefine {
         String  toolPath= project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
         String  command;\r
         if (toolPath == null) {\r
         String  toolPath= project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
         String  command;\r
         if (toolPath == null) {\r
-            command = "VfrCompile";\r
+            command = toolName;\r
         } else {\r
         } else {\r
-            command = toolPath + "/" + "VfrCompile";\r
+            command = toolPath + File.separator + toolName;\r
         }\r
         }\r
-        String incPath = "";        \r
 \r
 \r
-        int count = includepathList.size();    \r
-        for (int i = 0; i < count; i++) {\r
-            incPath += includepathList.get(i).toString();\r
-        }\r
-\r
-        String argument = this.createIfrBinFile +\r
-                          this.processerArg + \r
-                          incPath +\r
-                          this.outPutDir + \r
-                          this.createListFile +\r
-                          this.vfrFile ;\r
+        String argument = "" + createIfrBinFile\r
+                             + processerArg  \r
+                             + includepathList\r
+                             + outPutDir\r
+                             + createListFile\r
+                             + vfrFile;\r
         try {\r
             ///\r
             /// constructs the command-line\r
         try {\r
             ///\r
             /// constructs the command-line\r
@@ -196,21 +188,18 @@ public class VfrCompilerTask extends Task implements EfiDefine {
                                                                   Project.MSG_WARN);\r
 \r
             Execute runner = new Execute(streamHandler,null);\r
                                                                   Project.MSG_WARN);\r
 \r
             Execute runner = new Execute(streamHandler,null);\r
-            runner.setAntRun(project);\r
-            \r
+            runner.setAntRun(project);            \r
             runner.setCommandline(commandLine.getCommandline());\r
             runner.setCommandline(commandLine.getCommandline());\r
+            runner.setWorkingDirectory(new File(outPutDir.getValue())); \r
             \r
             \r
-            if (outPutFile != null && outPutFile.exists()) {\r
-                runner.setWorkingDirectory(outPutFile); \r
-            }\r
+            EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(commandLine.getCommandline()));\r
+            EdkLog.log(this, vfrFile.toFileList());\r
 \r
 \r
-            log(Commandline.toString(commandLine.getCommandline()), Project.MSG_VERBOSE);\r
-            log(vfrFileName);\r
             int returnVal = runner.execute();\r
             if (EFI_SUCCESS == returnVal) {\r
             int returnVal = runner.execute();\r
             if (EFI_SUCCESS == returnVal) {\r
-                log("VfrCompile succeeded!", Project.MSG_VERBOSE);\r
+                EdkLog.log(this, EdkLog.EDK_VERBOSE, "VfrCompile succeeded!");\r
             } else {\r
             } else {\r
-                log("ERROR = " + Integer.toHexString(returnVal));\r
+                EdkLog.log(this, "ERROR = " + Integer.toHexString(returnVal));\r
                 throw new BuildException("VfrCompile failed!");\r
             }\r
         } catch (IOException e) {\r
                 throw new BuildException("VfrCompile failed!");\r
             }\r
         } catch (IOException e) {\r
index 6f845ea371680f08972439dd445f9443df65342a..84383151fa4b7957a6f85f19c89a5fdae847d293 100644 (file)
@@ -21,6 +21,7 @@ import java.util.Map;
 import org.apache.tools.ant.BuildException;\r
 import org.apache.tools.ant.Task;\r
 import org.apache.tools.ant.taskdefs.Sequential;\r
 import org.apache.tools.ant.BuildException;\r
 import org.apache.tools.ant.Task;\r
 import org.apache.tools.ant.taskdefs.Sequential;\r
+import org.tianocore.common.logger.EdkLog;\r
 \r
 /**\r
  Class OnDepdendency is used to check the timestamp between source files and\r
 \r
 /**\r
  Class OnDepdendency is used to check the timestamp between source files and\r
@@ -54,7 +55,7 @@ public class OnDependency extends Task {
     /**\r
      Standard execute method of ANT task\r
      **/\r
     /**\r
      Standard execute method of ANT task\r
      **/\r
-    public void execute() {\r
+    public void execute() throws BuildException {\r
         if (isOutOfDate() && task != null) {\r
             task.perform();\r
         }\r
         if (isOutOfDate() && task != null) {\r
             task.perform();\r
         }\r
@@ -68,6 +69,7 @@ public class OnDependency extends Task {
         /// if no source files specified, take it as a fresh start\r
         ///\r
         if (sources.nameList.size() == 0) {\r
         /// if no source files specified, take it as a fresh start\r
         ///\r
         if (sources.nameList.size() == 0) {\r
+            EdkLog.log(this, EdkLog.EDK_VERBOSE, "No source file spcified!");\r
             return true;\r
         }\r
 \r
             return true;\r
         }\r
 \r
@@ -76,6 +78,7 @@ public class OnDependency extends Task {
             String dstFileName = (String)dstIt.next();\r
             File dstFile = new File(dstFileName);\r
             if (!dstFile.exists()) {\r
             String dstFileName = (String)dstIt.next();\r
             File dstFile = new File(dstFileName);\r
             if (!dstFile.exists()) {\r
+                EdkLog.log(this, EdkLog.EDK_VERBOSE, "Target file [" + dstFileName + "] doesn't exist!");\r
                 return true;\r
             }\r
 \r
                 return true;\r
             }\r
 \r
@@ -97,6 +100,7 @@ public class OnDependency extends Task {
                 }\r
 \r
                 if (dstTimeStamp < srcTimeStamp) {\r
                 }\r
 \r
                 if (dstTimeStamp < srcTimeStamp) {\r
+                    EdkLog.log(this, EdkLog.EDK_VERBOSE, "Source file [" + srcFileName + "] has been changed since last build!");\r
                     return true;\r
                 }\r
             }\r
                     return true;\r
                 }\r
             }\r
index 62964d0037210a3d43d4acb36ee8b41b146b04bb..3943df065426d7c1753a921bfda417515f636217 100755 (executable)
@@ -286,6 +286,7 @@ Finish:
   // Close our output file\r
   //\r
   if ((mGlobals.OutFptr != stdout) && (mGlobals.OutFptr != NULL)) {\r
   // Close our output file\r
   //\r
   if ((mGlobals.OutFptr != stdout) && (mGlobals.OutFptr != NULL)) {\r
+    fprintf(mGlobals.OutFptr, "\t\n");  // file ending flag\r
     fclose (mGlobals.OutFptr);\r
   }\r
 \r
     fclose (mGlobals.OutFptr);\r
   }\r
 \r