4 GenTeImageTask is used to call GenTEImage.exe to generate TE image .
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 * GenTeImageTask class.
33 * GenTeImageTask is used to call GenAcpiTable.exe to generate ACPI Table image .
35 public class GenTeImageTask
extends Task
implements EfiDefine
{
39 private String toolName
= "GenTeImage";
43 private FileArg inputFile
= new FileArg();
48 private FileArg outputFile
= new FileArg();
51 // output directory, this variable is added by jave wrap
53 private String outputDir
= "";
58 private ToolArg verbose
= new ToolArg();
63 private ToolArg dump
= new ToolArg();
68 GenTeImgaeTask execute function is to assemble tool command line & execute
73 public void execute() throws BuildException
{
75 Project project
= this.getOwningTarget().getProject();
77 // absolute path of efi tools
79 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
85 command
= path
+ File
.separator
+ toolName
;
90 argument
= "" + this.verbose
+ this.dump
+ this.outputFile
+ this.inputFile
;
92 // return value of fwimage execution
97 Commandline cmdline
= new Commandline();
98 cmdline
.setExecutable(command
);
99 cmdline
.createArgument().setLine(argument
);
101 LogStreamHandler streamHandler
= new LogStreamHandler(this,
102 Project
.MSG_INFO
, Project
.MSG_WARN
);
103 Execute runner
= new Execute(streamHandler
, null);
105 runner
.setAntRun(project
);
106 runner
.setCommandline(cmdline
.getCommandline());
107 runner
.setWorkingDirectory(new File(outputDir
));
110 // Set debug log information.
112 EdkLog
.log(this, EdkLog
.EDK_VERBOSE
, Commandline
.toString(cmdline
.getCommandline()));
113 EdkLog
.log(this, EdkLog
.EDK_INFO
, this.inputFile
.toFileList()
114 + " => " + this.outputFile
.toFileList());
116 revl
= runner
.execute();
118 if (EFI_SUCCESS
== revl
) {
120 // command execution success
122 EdkLog
.log(this, EdkLog
.EDK_VERBOSE
, toolName
+ " succeeded!");
125 // command execution fail
127 EdkLog
.log(this, EdkLog
.EDK_INFO
, "ERROR = "+ Integer
.toHexString(revl
));
128 throw new BuildException(toolName
+ " failed!");
130 } catch (Exception e
) {
131 throw new BuildException(e
.getMessage());
138 This function is to get class member "inputFile".
140 @return string of input file name.
142 public String
getInputFile() {
143 return inputFile
.getValue();
149 This function is to set class member "inputFile".
152 string of input file name.
154 public void setInputFile(String inputFile
) {
155 this.inputFile
.setArg(" ", inputFile
);
161 This function is to get class member "outputFile"
163 @return outputFile string of output file name.
165 public String
getOutputFile() {
166 return outputFile
.getValue();
172 This function is to set class member "outputFile"
175 string of output file name.
177 public void setOutputFile(String outputFile
) {
178 this.outputFile
.setArg(" -o ", outputFile
);
184 This function is to get class member "outputDir"
186 @return outputDir string of output directory.
188 public String
getOutputDir() {
195 This function is to set class member "outputDir"
198 string of output directory.
200 public void setOutputDir(String outputDir
) {
201 this.outputDir
= outputDir
;
207 This function is to get class member "verbose"
209 @return verbose the flag of verbose.
211 public String
getVerbose() {
212 return this.verbose
.getValue();
218 This function is to set class member "verbose"
223 public void setVerbose(boolean verbose
) {
225 this.verbose
.setArg(" -", "v");
232 This function is to get class member "dump"
234 @return verbose the flag of dump.
236 public String
getDump() {
237 return dump
.getValue();
243 This function is to set class member "dump"
248 public void setDump(boolean dump
) {
250 this.dump
.setArg(" -", "dump");