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 inputFVInfFile
= "";
47 /// output FV inf file
49 private String outputFVInfFile
= "";
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();
73 // absolute path of efi tools
75 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
81 command
= path
+ File
.separatorChar
+ toolName
;
86 File file
= new File(outputFVInfFile
);
87 if (!file
.isAbsolute() && (!this.outputDir
.equalsIgnoreCase(""))) {
88 argument
= this.inputFVInfFile
+
91 this.outputFVInfFile
+
94 argument
= this.inputFVInfFile
+
95 this.outputFVInfFile
+
99 // return value of fwimage execution
104 Commandline cmdline
= new Commandline();
105 cmdline
.setExecutable(command
);
106 cmdline
.createArgument().setLine(argument
);
108 LogStreamHandler streamHandler
= new LogStreamHandler(this,
109 Project
.MSG_INFO
, Project
.MSG_WARN
);
110 Execute runner
= new Execute(streamHandler
, null);
112 runner
.setAntRun(project
);
113 runner
.setCommandline(cmdline
.getCommandline());
115 // Set debug log information.
117 EdkLog
.log(this, EdkLog
.EDK_VERBOSE
, Commandline
.toString(cmdline
.getCommandline()));
118 EdkLog
.log(this, EdkLog
.EDK_INFO
, (new File(this.inputFVInfFile
)).getName());
119 revl
= runner
.execute();
121 if (EFI_SUCCESS
== revl
) {
123 // command execution success
125 EdkLog
.log(this, EdkLog
.EDK_VERBOSE
, "ModifyInfTask succeeded!");
128 // command execution fail
130 EdkLog
.log(this, EdkLog
.EDK_INFO
, "ERROR = " + Integer
.toHexString(revl
));
131 throw new BuildException("ModifyInfTask failed!");
133 } catch (Exception e
) {
134 throw new BuildException(e
.getMessage());
141 * This function is to get class member "inputFVInfFile".
143 * @return string of input inf file name.
145 public String
getinputFVInfFile() {
146 return this.inputFVInfFile
;
152 * This function is to set class member "inputFVInfFile".
155 * string of input inf file name.
157 public void setinputFVInfFile(String inputFVInfFileName
) {
158 this.inputFVInfFile
= inputFVInfFileName
+ " ";
164 * This function is to get class member "outputFVInfFile"
166 * @return outputFVInfFile string of output inf file name.
168 public String
getoutputFVInfFile() {
169 return this.outputFVInfFile
;
175 * This function is to set class member "outputFVInfFile"
177 * @param outputFVInfFile
178 * string of output inf file name.
180 public void setoutputFVInfFile(String outputFVInfFileName
) {
181 this.outputFVInfFile
= outputFVInfFileName
+ " ";
187 * This function is to get class member "patternStr"
189 * @return patternStr string of pattern.
191 public String
getpatternStr() {
192 return this.patternStr
;
198 * This function is to set class member "patternStr"
201 * string of patternStr.
203 public void setpatternStr(String patternStr
) {
204 this.patternStr
= patternStr
;
210 * This function is to get class member "outputDir"
212 * @return outputDir string of output directory.
214 public String
getoutputDir() {
215 return this.outputDir
;
221 * This function is to set class member "outputDir"
224 * string of output directory.
226 public void setoutputDir(String outputDir
) {
227 this.outputDir
= outputDir
;