summaryrefslogtreecommitdiff
path: root/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/StripTask.java
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/StripTask.java')
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/StripTask.java155
1 files changed, 79 insertions, 76 deletions
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;
}