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 static String toolName
= "ZeroDebugData";
43 private FileArg peFile
= new FileArg();
48 private FileArg outputFile
= new FileArg(" ", "DebugData.dat");
51 // output directory, this variable is added by jave wrap
53 private String outputDir
= ".";
59 ZeroDebugDataTask execute function is to assemble tool command line & execute
64 public void execute() throws BuildException
{
66 Project project
= this.getOwningTarget().getProject();
69 // absolute path of efi tools
71 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
77 command
= path
+ File
.separatorChar
+ toolName
;
83 argument
= "" + peFile
+ outputFile
;
86 // return value of fwimage execution
91 Commandline cmdline
= new Commandline();
92 cmdline
.setExecutable(command
);
93 cmdline
.createArgument().setLine(argument
);
95 LogStreamHandler streamHandler
= new LogStreamHandler(this,
96 Project
.MSG_INFO
, Project
.MSG_WARN
);
97 Execute runner
= new Execute(streamHandler
, null);
99 runner
.setAntRun(project
);
100 runner
.setCommandline(cmdline
.getCommandline());
101 runner
.setWorkingDirectory(new File(outputDir
));
103 // Set debug log information.
105 EdkLog
.log(this, EdkLog
.EDK_VERBOSE
, Commandline
.toString(cmdline
.getCommandline()));
106 EdkLog
.log(this, EdkLog
.EDK_INFO
, peFile
.toFileList() + " => " + outputFile
.toFileList());
108 revl
= runner
.execute();
110 if (EFI_SUCCESS
== revl
) {
112 // command execution success
114 EdkLog
.log(this, EdkLog
.EDK_VERBOSE
, "ZeroDebugData succeeded!");
117 // command execution fail
119 EdkLog
.log(this, EdkLog
.EDK_INFO
, "ERROR = " + Integer
.toHexString(revl
));
120 throw new BuildException("ZeroDebugData failed!");
122 } catch (Exception e
) {
123 throw new BuildException(e
.getMessage());
130 This function is to get class member "inputFile".
132 @return string of input file name.
134 public String
getPeFile() {
135 return this.peFile
.getValue();
141 This function is to set class member "peFile".
144 string of input file name.
146 public void setPeFile(String peFile
) {
147 this.peFile
.setArg(" ", peFile
);
153 This function is to get class member "outputFile"
155 @return outputFile string of output file name.
157 public String
getOutputFile() {
158 return this.outputFile
.getValue();
164 This function is to set class member "outputFile"
167 string of output file name.
169 public void setOutputFile(String outputFile
) {
170 this.outputFile
.setArg(" ", outputFile
);
176 This function is to get class member "outputDir"
178 @return outputDir string of output directory.
180 public String
getOutputDir() {
187 This function is to set class member "outputDir"
190 string of output directory.
192 public void setOutputDir(String outputDir
) {
193 this.outputDir
= outputDir
;