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 FileArg inputFVInfFile
= new FileArg();
49 private FileArg outputFVInfFile
= new FileArg();
54 private ToolArg patternStr
= new ToolArg();
59 private String outputDir
= ".";
64 ModifyInfTask execute function is to assemble tool command line & execute
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 argument
= "" + this.inputFVInfFile
+ this.outputFVInfFile
+ this.patternStr
;
88 // return value of fwimage execution
93 Commandline cmdline
= new Commandline();
94 cmdline
.setExecutable(command
);
95 cmdline
.createArgument().setLine(argument
);
97 LogStreamHandler streamHandler
= new LogStreamHandler(this,
98 Project
.MSG_INFO
, Project
.MSG_WARN
);
99 Execute runner
= new Execute(streamHandler
, null);
101 runner
.setAntRun(project
);
102 runner
.setCommandline(cmdline
.getCommandline());
103 runner
.setWorkingDirectory(new File(outputDir
));
106 // Set debug log information.
108 EdkLog
.log(this, EdkLog
.EDK_VERBOSE
, Commandline
.toString(cmdline
.getCommandline()));
109 EdkLog
.log(this, EdkLog
.EDK_INFO
, this.inputFVInfFile
.toFileList()
110 + " => " + this.inputFVInfFile
.toFileList());
112 revl
= runner
.execute();
113 if (EFI_SUCCESS
== revl
) {
115 // command execution success
117 EdkLog
.log(this, EdkLog
.EDK_VERBOSE
, toolName
+ " succeeded!");
120 // command execution fail
122 EdkLog
.log(this, EdkLog
.EDK_INFO
, "ERROR = " + Integer
.toHexString(revl
));
123 throw new BuildException(toolName
+ " failed!");
125 } catch (Exception e
) {
126 throw new BuildException(e
.getMessage());
133 This function is to get class member "inputFVInfFile".
135 @return string of input inf file name.
137 public String
getinputFVInfFile() {
138 return this.inputFVInfFile
.getValue();
144 This function is to set class member "inputFVInfFile".
147 string of input inf file name.
149 public void setinputFVInfFile(String inputFVInfFileName
) {
150 this.inputFVInfFile
.setArg(" ", inputFVInfFileName
);
156 This function is to get class member "outputFVInfFile"
158 @return outputFVInfFile string of output inf file name.
160 public String
getoutputFVInfFile() {
161 return this.outputFVInfFile
.getValue();
167 This function is to set class member "outputFVInfFile"
169 @param outputFVInfFile
170 string of output inf file name.
172 public void setoutputFVInfFile(String outputFVInfFileName
) {
173 this.outputFVInfFile
.setArg(" ", outputFVInfFileName
);
179 This function is to get class member "patternStr"
181 @return patternStr string of pattern.
183 public String
getpatternStr() {
184 return this.patternStr
.getValue();
190 This function is to set class member "patternStr"
193 string of patternStr.
195 public void setpatternStr(String patternStr
) {
196 this.patternStr
.setArg(" ", patternStr
);
202 This function is to get class member "outputDir"
204 @return outputDir string of output directory.
206 public String
getoutputDir() {
207 return this.outputDir
;
213 This function is to set class member "outputDir"
216 string of output directory.
218 public void setoutputDir(String outputDir
) {
219 this.outputDir
= outputDir
;