4 ModifyInfTask is used to call Modify.exe to generate inf file.
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 ModifyInfTask is used to call Modify.exe to generate inf file.
34 public class ModifyInfTask
extends Task
implements EfiDefine
{
38 private String toolName
= "ModifyInf";
43 private String inputFVInfFileName
= "";
46 /// output FV inf file
48 private String outputFVInfFileName
= "";
53 private String patternStr
= "";
58 private String outputDir
= "";
63 * ModifyInfTask execute function is to assemble tool command line & execute
66 * @throws BuidException
68 public void execute() throws BuildException
{
70 Project project
= this.getOwningTarget().getProject();
74 FrameworkLogger logger
= new FrameworkLogger(project
, "modifytask");
75 EdkLog
.setLogLevel(project
.getProperty("env.LOGLEVEL"));
76 EdkLog
.setLogger(logger
);
78 // absolute path of efi tools
80 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
86 command
= path
+ File
.separatorChar
+ toolName
;
91 File file
= new File(outputFVInfFileName
);
92 if (!file
.isAbsolute() && (!this.outputDir
.equalsIgnoreCase(""))) {
93 argument
= this.inputFVInfFileName
+
96 this.outputFVInfFileName
+
99 argument
= this.inputFVInfFileName
+
100 this.outputFVInfFileName
+
104 // return value of fwimage execution
109 Commandline cmdline
= new Commandline();
110 cmdline
.setExecutable(command
);
111 cmdline
.createArgument().setLine(argument
);
113 LogStreamHandler streamHandler
= new LogStreamHandler(this,
114 Project
.MSG_INFO
, Project
.MSG_WARN
);
115 Execute runner
= new Execute(streamHandler
, null);
117 runner
.setAntRun(project
);
118 runner
.setCommandline(cmdline
.getCommandline());
120 // Set debug log information.
122 EdkLog
.log(EdkLog
.EDK_INFO
, Commandline
.toString(cmdline
125 revl
= runner
.execute();
127 if (EFI_SUCCESS
== revl
) {
129 // command execution success
131 EdkLog
.log(EdkLog
.EDK_INFO
, "ModifyInfTask succeeded!");
134 // command execution fail
136 EdkLog
.log(EdkLog
.EDK_ERROR
, "ModifyInfTask failed. (error="
137 + Integer
.toHexString(revl
) + ")");
138 throw new BuildException("ModifyInfTask failed. (error="
139 + Integer
.toHexString(revl
) + ")");
142 } catch (Exception e
) {
143 throw new BuildException(e
.getMessage());
148 * getinputFVInfFileName
150 * This function is to get class member "inputFVInfFileName".
152 * @return string of input inf file name.
154 public String
getinputFVInfFileName() {
155 return this.inputFVInfFileName
;
159 * setinputFVInfFileName
161 * This function is to set class member "inputFVInfFileName".
164 * string of input inf file name.
166 public void setinputFVInfFileName(String inputFVInfFileName
) {
167 this.inputFVInfFileName
= inputFVInfFileName
+ " ";
171 * getoutputFVInfFileName
173 * This function is to get class member "outputFVInfFileName"
175 * @return outputFVInfFileName string of output inf file name.
177 public String
getoutputFVInfFileName() {
178 return this.outputFVInfFileName
;
182 * setoutputFVInfFileName
184 * This function is to set class member "outputFVInfFileName"
186 * @param outputFVInfFileName
187 * string of output inf file name.
189 public void setoutputFVInfFileName(String outputFVInfFileName
) {
190 this.outputFVInfFileName
= outputFVInfFileName
+ " ";
196 * This function is to get class member "patternStr"
198 * @return patternStr string of pattern.
200 public String
getpatternStr() {
201 return this.patternStr
;
207 * This function is to set class member "patternStr"
210 * string of patternStr.
212 public void setpatternStr(String patternStr
) {
213 this.patternStr
= patternStr
;
219 * This function is to get class member "outputDir"
221 * @return outputDir string of output directory.
223 public String
getoutputDir() {
224 return this.outputDir
;
230 * This function is to set class member "outputDir"
233 * string of output directory.
235 public void setoutputDir(String outputDir
) {
236 this.outputDir
= outputDir
;