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
;
28 import org
.tianocore
.common
.logger
.EdkLog
;
33 ModifyInfTask is used to call Modify.exe to generate inf file.
35 public class ModifyInfTask
extends Task
implements EfiDefine
{
39 private String toolName
= "ModifyInf";
44 private String inputFVInfFileName
= "";
47 /// output FV inf file
49 private String outputFVInfFileName
= "";
54 private String patternStr
= "";
59 private String outputDir
= "";
64 * ModifyInfTask execute function is to assemble tool command line & execute
67 * @throws BuidException
69 public void execute() throws BuildException
{
71 Project project
= this.getOwningTarget().getProject();
75 FrameworkLogger logger
= new FrameworkLogger(project
, "modifyinftask");
76 EdkLog
.setLogLevel(project
.getProperty("env.LOGLEVEL"));
77 EdkLog
.setLogger(logger
);
79 // absolute path of efi tools
81 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
87 command
= path
+ File
.separatorChar
+ toolName
;
92 File file
= new File(outputFVInfFileName
);
93 if (!file
.isAbsolute() && (!this.outputDir
.equalsIgnoreCase(""))) {
94 argument
= this.inputFVInfFileName
+
97 this.outputFVInfFileName
+
100 argument
= this.inputFVInfFileName
+
101 this.outputFVInfFileName
+
105 // return value of fwimage execution
110 Commandline cmdline
= new Commandline();
111 cmdline
.setExecutable(command
);
112 cmdline
.createArgument().setLine(argument
);
114 LogStreamHandler streamHandler
= new LogStreamHandler(this,
115 Project
.MSG_INFO
, Project
.MSG_WARN
);
116 Execute runner
= new Execute(streamHandler
, null);
118 runner
.setAntRun(project
);
119 runner
.setCommandline(cmdline
.getCommandline());
121 // Set debug log information.
123 EdkLog
.log(EdkLog
.EDK_VERBOSE
, Commandline
.toString(cmdline
.getCommandline()));
124 EdkLog
.log(EdkLog
.EDK_INFO
, (new File(this.inputFVInfFileName
)).getName());
125 revl
= runner
.execute();
127 if (EFI_SUCCESS
== revl
) {
129 // command execution success
131 EdkLog
.log(EdkLog
.EDK_VERBOSE
, "ModifyInfTask succeeded!");
134 // command execution fail
136 EdkLog
.log(EdkLog
.EDK_INFO
, "ERROR = " + Integer
.toHexString(revl
));
137 throw new BuildException("ModifyInfTask failed!");
139 } catch (Exception e
) {
140 throw new BuildException(e
.getMessage());
145 * getinputFVInfFileName
147 * This function is to get class member "inputFVInfFileName".
149 * @return string of input inf file name.
151 public String
getinputFVInfFileName() {
152 return this.inputFVInfFileName
;
156 * setinputFVInfFileName
158 * This function is to set class member "inputFVInfFileName".
161 * string of input inf file name.
163 public void setinputFVInfFileName(String inputFVInfFileName
) {
164 this.inputFVInfFileName
= inputFVInfFileName
+ " ";
168 * getoutputFVInfFileName
170 * This function is to get class member "outputFVInfFileName"
172 * @return outputFVInfFileName string of output inf file name.
174 public String
getoutputFVInfFileName() {
175 return this.outputFVInfFileName
;
179 * setoutputFVInfFileName
181 * This function is to set class member "outputFVInfFileName"
183 * @param outputFVInfFileName
184 * string of output inf file name.
186 public void setoutputFVInfFileName(String outputFVInfFileName
) {
187 this.outputFVInfFileName
= outputFVInfFileName
+ " ";
193 * This function is to get class member "patternStr"
195 * @return patternStr string of pattern.
197 public String
getpatternStr() {
198 return this.patternStr
;
204 * This function is to set class member "patternStr"
207 * string of patternStr.
209 public void setpatternStr(String patternStr
) {
210 this.patternStr
= patternStr
;
216 * This function is to get class member "outputDir"
218 * @return outputDir string of output directory.
220 public String
getoutputDir() {
221 return this.outputDir
;
227 * This function is to set class member "outputDir"
230 * string of output directory.
232 public void setoutputDir(String outputDir
) {
233 this.outputDir
= outputDir
;