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
;
28 import org
.tianocore
.common
.logger
.EdkLog
;
31 ZeroDebugDataTask class.
33 ZeroDebugDataTask is used to call ZeroDebugData.exe to remove debug data.
35 public class ZeroDebugDataTask
extends Task
implements EfiDefine
{
39 private String peFile
= "";
44 private String outputFile
= "DebugData.dat";
47 // / output directory, this variable is added by jave wrap
49 private String outputDir
= "";
55 * ZeroDebugDataTask execute function is to assemble tool command line & execute
58 * @throws BuidException
60 public void execute() throws BuildException
{
62 Project project
= this.getOwningTarget().getProject();
66 FrameworkLogger logger
= new FrameworkLogger(project
, "zerodebugdata");
67 EdkLog
.setLogLevel(project
.getProperty("env.LOGLEVEL"));
68 EdkLog
.setLogger(logger
);
70 // absolute path of efi tools
72 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
76 command
= "ZeroDebugData";
78 command
= path
+ File
.separatorChar
+ "ZeroDebugData";
83 File file
= new File(outputFile
);
84 if (!file
.isAbsolute() && (!this.outputDir
.equalsIgnoreCase(""))) {
85 argument
= this.peFile
+ " " + outputDir
+ File
.separatorChar
88 argument
= this.peFile
+ " " + outputFile
;
91 // return value of fwimage execution
96 Commandline cmdline
= new Commandline();
97 cmdline
.setExecutable(command
);
98 cmdline
.createArgument().setLine(argument
);
100 LogStreamHandler streamHandler
= new LogStreamHandler(this,
101 Project
.MSG_INFO
, Project
.MSG_WARN
);
102 Execute runner
= new Execute(streamHandler
, null);
104 runner
.setAntRun(project
);
105 runner
.setCommandline(cmdline
.getCommandline());
107 // Set debug log information.
109 EdkLog
.log(EdkLog
.EDK_VERBOSE
, Commandline
.toString(cmdline
.getCommandline()));
110 EdkLog
.log(EdkLog
.EDK_INFO
, (new File(this.peFile
)).getName());
112 revl
= runner
.execute();
114 if (EFI_SUCCESS
== revl
) {
116 // command execution success
118 EdkLog
.log(EdkLog
.EDK_VERBOSE
, "ZeroDebugData succeeded!");
121 // command execution fail
123 EdkLog
.log(EdkLog
.EDK_INFO
, "ERROR = " + Integer
.toHexString(revl
));
124 throw new BuildException("ZeroDebugData failed!");
127 } catch (Exception e
) {
128 throw new BuildException(e
.getMessage());
135 * This function is to get class member "inputFile".
137 * @return string of input file name.
139 public String
getPeFile() {
146 * This function is to set class member "peFile".
149 * string of input file name.
151 public void setPeFile(String peFile
) {
152 this.peFile
= peFile
;
158 * This function is to get class member "outputFile"
160 * @return outputFile string of output file name.
162 public String
getOutputFile() {
169 * This function is to set class member "outputFile"
172 * string of output file name.
174 public void setOutputFile(String outputFile
) {
175 this.outputFile
= outputFile
;
181 * This function is to get class member "outputDir"
183 * @return outputDir string of output directory.
185 public String
getOutputDir() {
192 * This function is to set class member "outputDir"
195 * string of output directory.
197 public void setOutputDir(String outputDir
) {
198 this.outputDir
= outputDir
;