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