2 SecApResetVectorFixupTask class.
4 SecApResetVectorFixupTask is used to call SecApResetVectorFixup.exe to place
8 Copyright (c) 2006, Intel Corporation
9 All rights reserved. This program and the accompanying materials
10 are licensed and made available under the terms and conditions of the BSD License
11 which accompanies this distribution. The full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 package org
.tianocore
.framework
.tasks
;
22 import org
.apache
.tools
.ant
.Task
;
23 import org
.apache
.tools
.ant
.Project
;
24 import org
.apache
.tools
.ant
.BuildException
;
25 import org
.apache
.tools
.ant
.taskdefs
.Execute
;
26 import org
.apache
.tools
.ant
.taskdefs
.LogStreamHandler
;
27 import org
.apache
.tools
.ant
.types
.Commandline
;
29 import org
.tianocore
.common
.logger
.EdkLog
;
32 SecApResetVectorFixupTask class.
34 SecApResetVectorFixupTask is used to call SecApResetVectorFixup.exe to place
37 public class SecApResetVectorFixupTask
extends Task
implements EfiDefine
{
41 private String toolName
= "SecApResetVectorFixup";
43 // input FV recovery file
45 private FileArg fvInputFile
= new FileArg();
50 private FileArg fvOutputFile
= new FileArg();
53 // output directory, this variable is added by jave wrap
55 private String outputDir
= ".";
61 SecApResetVectorFixupTask execute function is to assemble tool command line & execute
66 public void execute() throws BuildException
{
68 Project project
= this.getOwningTarget().getProject();
70 // absolute path of efi tools
72 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
78 command
= path
+ File
.separator
+ toolName
;
83 argument
= "" + this.fvInputFile
+ this.fvOutputFile
;
85 // return value of fwimage execution
90 Commandline cmdline
= new Commandline();
91 cmdline
.setExecutable(command
);
92 cmdline
.createArgument().setLine(argument
);
94 LogStreamHandler streamHandler
= new LogStreamHandler(this,
95 Project
.MSG_INFO
, Project
.MSG_WARN
);
96 Execute runner
= new Execute(streamHandler
, null);
98 runner
.setAntRun(project
);
99 runner
.setCommandline(cmdline
.getCommandline());
100 runner
.setWorkingDirectory(new File(outputDir
));
103 // Set debug log information.
105 EdkLog
.log(this, EdkLog
.EDK_VERBOSE
, Commandline
.toString(cmdline
.getCommandline()));
106 EdkLog
.log(this, EdkLog
.EDK_INFO
, this.fvInputFile
.toFileList()
107 + " => " + this.fvOutputFile
.toFileList());
109 revl
= runner
.execute();
111 if (EFI_SUCCESS
== revl
) {
113 // command execution success
115 EdkLog
.log(this, EdkLog
.EDK_VERBOSE
, toolName
+ " succeeded!");
118 // command execution fail
120 EdkLog
.log(this, EdkLog
.EDK_INFO
, "ERROR = " + Integer
.toHexString(revl
));
121 throw new BuildException(toolName
+ " failed!");
123 } catch (Exception e
) {
124 throw new BuildException(e
.getMessage());
131 This function is to get class member "fvInputFile".
133 @return string of input file name.
135 public String
getfvInputFile() {
136 return this.fvInputFile
.getValue();
142 This function is to set class member "fvInputFile".
145 string of input file name.
147 public void setFvInputFile(String inputFile
) {
148 this.fvInputFile
.setArg(" ", inputFile
);
154 This function is to get class member "fvOutputFile"
156 @return outputFile string of output file name.
158 public String
getOutputFile() {
159 return this.fvOutputFile
.getValue();
165 This function is to set class member "fvOutputFile"
168 string of output file name.
170 public void setFvOutputFile(String outputFile
) {
171 this.fvOutputFile
.setArg(" ", outputFile
);
177 This function is to get class member "outputDir"
179 @return outputDir string of output directory.
181 public String
getOutputDir() {
188 This function is to set class member "outputDir"
191 string of output directory.
193 public void setOutputDir(String outputDir
) {
194 this.outputDir
= outputDir
;