2 ZeroDebugDataTask class.
4 ZeroDebugDataTask is used to call ZeroDebugData.exe to remove debug data.
7 Copyright (c) 2006, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 package org
.tianocore
.framework
.tasks
;
21 import org
.apache
.tools
.ant
.Task
;
22 import org
.apache
.tools
.ant
.Project
;
23 import org
.apache
.tools
.ant
.BuildException
;
24 import org
.apache
.tools
.ant
.taskdefs
.Execute
;
25 import org
.apache
.tools
.ant
.taskdefs
.LogStreamHandler
;
26 import org
.apache
.tools
.ant
.types
.Commandline
;
27 import org
.tianocore
.logger
.EdkLog
;
30 ZeroDebugDataTask class.
32 ZeroDebugDataTask is used to call ZeroDebugData.exe to remove debug data.
34 public class ZeroDebugDataTask
extends Task
implements EfiDefine
{
38 private String peFile
= "";
43 private String outputFile
= "DebugData.dat";
46 // / output directory, this variable is added by jave wrap
48 private String outputDir
= "";
54 * ZeroDebugDataTask execute function is to assemble tool command line & execute
57 * @throws BuidException
59 public void execute() throws BuildException
{
61 Project project
= this.getOwningTarget().getProject();
65 FrameworkLogger logger
= new FrameworkLogger(project
, "zerodebugdata");
66 EdkLog
.setLogLevel(project
.getProperty("env.LOGLEVEL"));
67 EdkLog
.setLogger(logger
);
69 // absolute path of efi tools
71 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
75 command
= "ZeroDebugData";
77 command
= path
+ File
.separatorChar
+ "ZeroDebugData";
82 File file
= new File(outputFile
);
83 if (!file
.isAbsolute() && (!this.outputDir
.equalsIgnoreCase(""))) {
84 argument
= this.peFile
+ " " + outputDir
+ File
.separatorChar
87 argument
= this.peFile
+ " " + outputFile
;
90 // return value of fwimage execution
95 Commandline cmdline
= new Commandline();
96 cmdline
.setExecutable(command
);
97 cmdline
.createArgument().setLine(argument
);
99 LogStreamHandler streamHandler
= new LogStreamHandler(this,
100 Project
.MSG_INFO
, Project
.MSG_WARN
);
101 Execute runner
= new Execute(streamHandler
, null);
103 runner
.setAntRun(project
);
104 runner
.setCommandline(cmdline
.getCommandline());
106 // Set debug log information.
108 EdkLog
.log(EdkLog
.EDK_VERBOSE
, Commandline
.toString(cmdline
.getCommandline()));
109 EdkLog
.log(EdkLog
.EDK_INFO
, (new File(this.peFile
)).getName());
111 revl
= runner
.execute();
113 if (EFI_SUCCESS
== revl
) {
115 // command execution success
117 EdkLog
.log(EdkLog
.EDK_VERBOSE
, "ZeroDebugData succeeded!");
120 // command execution fail
122 EdkLog
.log(EdkLog
.EDK_INFO
, "ERROR = " + Integer
.toHexString(revl
));
123 throw new BuildException("ZeroDebugData failed!");
126 } catch (Exception e
) {
127 throw new BuildException(e
.getMessage());
134 * This function is to get class member "inputFile".
136 * @return string of input file name.
138 public String
getPeFile() {
145 * This function is to set class member "peFile".
148 * string of input file name.
150 public void setPeFile(String peFile
) {
151 this.peFile
= peFile
;
157 * This function is to get class member "outputFile"
159 * @return outputFile string of output file name.
161 public String
getOutputFile() {
168 * This function is to set class member "outputFile"
171 * string of output file name.
173 public void setOutputFile(String outputFile
) {
174 this.outputFile
= outputFile
;
180 * This function is to get class member "outputDir"
182 * @return outputDir string of output directory.
184 public String
getOutputDir() {
191 * This function is to set class member "outputDir"
194 * string of output directory.
196 public void setOutputDir(String outputDir
) {
197 this.outputDir
= outputDir
;