4 GenAcpiTable is used to call GenAcpiTable.exe to generate ACPI Table 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
;
27 import org
.tianocore
.logger
.EdkLog
;
32 GenAcpiTable is used to call GenAcpiTable.exe to generate ACPI Table image .
34 public class GenAcpiTableTask
extends Task
implements EfiDefine
{
38 private String inputFile
= "";
43 private String outputFile
= "";
46 // / output directory, this variable is added by jave wrap
48 private String outputDir
= "";
53 * StripTask execute function is to assemble tool command line & execute
56 * @throws BuidException
58 public void execute() throws BuildException
{
60 Project project
= this.getOwningTarget().getProject();
64 FrameworkLogger logger
= new FrameworkLogger(project
, "genacpitable");
65 EdkLog
.setLogLevel(project
.getProperty("env.LOGLEVEL"));
66 EdkLog
.setLogger(logger
);
68 // absolute path of efi tools
70 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
74 command
= "GenAcpiTable";
76 command
= path
+ File
.separatorChar
+ "GenAcpiTable";
81 File file
= new File(outputFile
);
82 if (!file
.isAbsolute() && (!this.outputDir
.equalsIgnoreCase(""))) {
83 argument
= inputFile
+ " " + outputDir
+ File
.separatorChar
86 argument
= inputFile
+ " " + outputFile
;
89 // return value of fwimage execution
94 Commandline cmdline
= new Commandline();
95 cmdline
.setExecutable(command
);
96 cmdline
.createArgument().setLine(argument
);
98 LogStreamHandler streamHandler
= new LogStreamHandler(this,
99 Project
.MSG_INFO
, Project
.MSG_WARN
);
100 Execute runner
= new Execute(streamHandler
, null);
102 runner
.setAntRun(project
);
103 runner
.setCommandline(cmdline
.getCommandline());
105 // Set debug log information.
107 EdkLog
.log(EdkLog
.EDK_INFO
, Commandline
.toString(cmdline
.getCommandline()));
109 revl
= runner
.execute();
111 if (EFI_SUCCESS
== revl
) {
113 // command execution success
115 EdkLog
.log(EdkLog
.EDK_INFO
,"GenAcpiTable successed!");
118 // command execution fail
120 EdkLog
.log(EdkLog
.EDK_ERROR
, "GenAcpiTable failed. (error="
121 + Integer
.toHexString(revl
) + ")");
122 throw new BuildException("GenAcpiTable failed. (error="
123 + Integer
.toHexString(revl
) + ")");
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
getInputFile() {
145 * This function is to set class member "inputFile".
148 * string of input file name.
150 public void setInputFile(String inputFile
) {
151 this.inputFile
= inputFile
;
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
;