+++ /dev/null
-/** @file\r
- ZeroDebugDataTask class.\r
-\r
- ZeroDebugDataTask is used to call ZeroDebugData.exe to remove debug data.\r
-\r
-\r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
- **/\r
-package org.tianocore.framework.tasks;\r
-\r
-import java.io.File;\r
-\r
-import org.apache.tools.ant.Task;\r
-import org.apache.tools.ant.Project;\r
-import org.apache.tools.ant.BuildException;\r
-import org.apache.tools.ant.taskdefs.Execute;\r
-import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
-import org.apache.tools.ant.types.Commandline;\r
-\r
-import org.tianocore.common.logger.EdkLog;\r
-\r
-/**\r
- ZeroDebugDataTask class.\r
-\r
- ZeroDebugDataTask is used to call ZeroDebugData.exe to remove debug data.\r
-**/\r
-public class ZeroDebugDataTask extends Task implements EfiDefine {\r
- //\r
- // Tool name\r
- // \r
- private static String toolName = "ZeroDebugData";\r
- //\r
- // input PE file\r
- //\r
- private FileArg peFile = new FileArg();\r
-\r
- //\r
- // output file\r
- //\r
- private FileArg outputFile = new FileArg(" ", "DebugData.dat");\r
-\r
- //\r
- // output directory, this variable is added by jave wrap\r
- //\r
- private String outputDir = ".";\r
-\r
-\r
- /**\r
- execute\r
- \r
- ZeroDebugDataTask execute function is to assemble tool command line & execute\r
- tool command line\r
- \r
- @throws BuidException\r
- **/\r
- public void execute() throws BuildException {\r
-\r
- Project project = this.getOwningTarget().getProject();\r
-\r
- //\r
- // absolute path of efi tools\r
- //\r
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
- String command;\r
- String argument;\r
- if (path == null) {\r
- command = toolName;\r
- } else {\r
- command = path + File.separatorChar + toolName;\r
- }\r
-\r
- //\r
- // argument of tools\r
- //\r
- argument = "" + peFile + outputFile;\r
-\r
- //\r
- // return value of fwimage execution\r
- //\r
- int revl = -1;\r
-\r
- try {\r
- Commandline cmdline = new Commandline();\r
- cmdline.setExecutable(command);\r
- cmdline.createArgument().setLine(argument);\r
-\r
- LogStreamHandler streamHandler = new LogStreamHandler(this,\r
- Project.MSG_INFO, Project.MSG_WARN);\r
- Execute runner = new Execute(streamHandler, null);\r
-\r
- runner.setAntRun(project);\r
- runner.setCommandline(cmdline.getCommandline());\r
- runner.setWorkingDirectory(new File(outputDir)); \r
- //\r
- // Set debug log information.\r
- //\r
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
- EdkLog.log(this, EdkLog.EDK_INFO, peFile.toFileList() + " => " + outputFile.toFileList());\r
-\r
- revl = runner.execute();\r
-\r
- if (EFI_SUCCESS == revl) {\r
- //\r
- // command execution success\r
- //\r
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "ZeroDebugData succeeded!");\r
- } else {\r
- //\r
- // command execution fail\r
- //\r
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));\r
- throw new BuildException("ZeroDebugData failed!");\r
- }\r
- } catch (Exception e) {\r
- throw new BuildException(e.getMessage());\r
- }\r
- }\r
-\r
- /**\r
- getPeFile\r
- \r
- This function is to get class member "inputFile".\r
- \r
- @return string of input file name.\r
- **/\r
- public String getPeFile() {\r
- return this.peFile.getValue();\r
- }\r
-\r
- /**\r
- setPeFile\r
- \r
- This function is to set class member "peFile".\r
- \r
- @param peFile\r
- string of input file name.\r
- **/\r
- public void setPeFile(String peFile) {\r
- this.peFile.setArg(" ", peFile);\r
- }\r
-\r
- /**\r
- getOutputFile\r
- \r
- This function is to get class member "outputFile"\r
- \r
- @return outputFile string of output file name.\r
- **/\r
- public String getOutputFile() {\r
- return this.outputFile.getValue();\r
- }\r
-\r
- /**\r
- setOutputFile\r
- \r
- This function is to set class member "outputFile"\r
- \r
- @param outputFile\r
- string of output file name.\r
- **/\r
- public void setOutputFile(String outputFile) {\r
- this.outputFile.setArg(" ", outputFile);\r
- }\r
-\r
- /**\r
- getOutputDir\r
- \r
- This function is to get class member "outputDir"\r
- \r
- @return outputDir string of output directory.\r
- **/\r
- public String getOutputDir() {\r
- return outputDir;\r
- }\r
-\r
- /**\r
- setOutputDir\r
- \r
- This function is to set class member "outputDir"\r
- \r
- @param outputDir\r
- string of output directory.\r
- **/\r
- public void setOutputDir(String outputDir) {\r
- this.outputDir = outputDir;\r
- }\r
-}\r