]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SecApResetVectorFixupTask.java
- Fixed EDKT146; The override warning message has been reduced to almost none.
[mirror_edk2.git] / Tools / Source / FrameworkTasks / org / tianocore / framework / tasks / SecApResetVectorFixupTask.java
... / ...
CommitLineData
1/** @file\r
2 SecApResetVectorFixupTask class.\r
3\r
4 SecApResetVectorFixupTask is used to call SecApResetVectorFixup.exe to place\r
5 Ap reset vector.\r
6\r
7\r
8 Copyright (c) 2006, Intel Corporation\r
9 All rights reserved. This program and the accompanying materials\r
10 are licensed and made available under the terms and conditions of the BSD License\r
11 which accompanies this distribution. The full text of the license may be found at\r
12 http://opensource.org/licenses/bsd-license.php\r
13\r
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
16\r
17 **/\r
18package org.tianocore.framework.tasks;\r
19\r
20import java.io.File;\r
21\r
22import org.apache.tools.ant.Task;\r
23import org.apache.tools.ant.Project;\r
24import org.apache.tools.ant.BuildException;\r
25import org.apache.tools.ant.taskdefs.Execute;\r
26import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
27import org.apache.tools.ant.types.Commandline;\r
28\r
29import org.tianocore.common.logger.EdkLog;\r
30\r
31/**\r
32 SecApResetVectorFixupTask class.\r
33\r
34 SecApResetVectorFixupTask is used to call SecApResetVectorFixup.exe to place\r
35 Ap reset vector.\r
36**/\r
37public class SecApResetVectorFixupTask extends Task implements EfiDefine {\r
38 ///\r
39 /// tool name\r
40 ///\r
41 private String toolName = "SecApResetVectorFixup";\r
42 // /\r
43 // / input FV recovery file\r
44 // /\r
45 private String fvInputFile = "";\r
46\r
47 // /\r
48 // / output file\r
49 // /\r
50 private String fvOutputFile = "";\r
51\r
52 // /\r
53 // / output directory, this variable is added by jave wrap\r
54 // /\r
55 private String outputDir = "";\r
56\r
57\r
58 /**\r
59 * execute\r
60 *\r
61 * SecApResetVectorFixupTask execute function is to assemble tool command line & execute\r
62 * tool command line\r
63 *\r
64 * @throws BuidException\r
65 */\r
66 public void execute() throws BuildException {\r
67\r
68 Project project = this.getOwningTarget().getProject();\r
69 //\r
70 // set Logger\r
71 //\r
72 FrameworkLogger logger = new FrameworkLogger(project, "secapresetvectorfixup");\r
73 EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));\r
74 EdkLog.setLogger(logger);\r
75 //\r
76 // absolute path of efi tools\r
77 //\r
78 String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
79 String command;\r
80 String argument;\r
81 if (path == null) {\r
82 command = toolName;\r
83 } else {\r
84 command = path + File.separatorChar + toolName;\r
85 }\r
86 //\r
87 // argument of tools\r
88 //\r
89 File file = new File(this.fvOutputFile);\r
90 if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
91 argument = this.fvInputFile + " " + outputDir + File.separatorChar\r
92 + this.fvOutputFile;\r
93 } else {\r
94 argument = this.fvInputFile + " " + this.fvOutputFile;\r
95 }\r
96 //\r
97 // return value of fwimage execution\r
98 //\r
99 int revl = -1;\r
100\r
101 try {\r
102 Commandline cmdline = new Commandline();\r
103 cmdline.setExecutable(command);\r
104 cmdline.createArgument().setLine(argument);\r
105\r
106 LogStreamHandler streamHandler = new LogStreamHandler(this,\r
107 Project.MSG_INFO, Project.MSG_WARN);\r
108 Execute runner = new Execute(streamHandler, null);\r
109\r
110 runner.setAntRun(project);\r
111 runner.setCommandline(cmdline.getCommandline());\r
112 //\r
113 // Set debug log information.\r
114 //\r
115 EdkLog.log(EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r
116 EdkLog.log(EdkLog.EDK_INFO, (new File(this.fvInputFile)).getName());\r
117\r
118 revl = runner.execute();\r
119\r
120 if (EFI_SUCCESS == revl) {\r
121 //\r
122 // command execution success\r
123 //\r
124 EdkLog.log(EdkLog.EDK_VERBOSE, "SecApResetVectorFixup succeeded!");\r
125 } else {\r
126 //\r
127 // command execution fail\r
128 //\r
129 EdkLog.log(EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));\r
130 throw new BuildException("SecApResetVectorFixup failed!");\r
131 }\r
132 } catch (Exception e) {\r
133 throw new BuildException(e.getMessage());\r
134 }\r
135 }\r
136\r
137 /**\r
138 * getInputFile\r
139 *\r
140 * This function is to get class member "fvInputFile".\r
141 *\r
142 * @return string of input file name.\r
143 */\r
144 public String getfvInputFile() {\r
145 return this.fvInputFile;\r
146 }\r
147\r
148 /**\r
149 * setComponentType\r
150 *\r
151 * This function is to set class member "fvInputFile".\r
152 *\r
153 * @param inputFile\r
154 * string of input file name.\r
155 */\r
156 public void setFvInputFile(String inputFile) {\r
157 this.fvInputFile = inputFile;\r
158 }\r
159\r
160 /**\r
161 * getOutputFile\r
162 *\r
163 * This function is to get class member "fvOutputFile"\r
164 *\r
165 * @return outputFile string of output file name.\r
166 */\r
167 public String getOutputFile() {\r
168 return this.fvOutputFile;\r
169 }\r
170\r
171 /**\r
172 * setOutputFile\r
173 *\r
174 * This function is to set class member "fvOutputFile"\r
175 *\r
176 * @param outputFile\r
177 * string of output file name.\r
178 */\r
179 public void setFvOutputFile(String outputFile) {\r
180 this.fvOutputFile = outputFile;\r
181 }\r
182\r
183 /**\r
184 * getOutputDir\r
185 *\r
186 * This function is to get class member "outputDir"\r
187 *\r
188 * @return outputDir string of output directory.\r
189 */\r
190 public String getOutputDir() {\r
191 return outputDir;\r
192 }\r
193\r
194 /**\r
195 * setOutputDir\r
196 *\r
197 * This function is to set class member "outputDir"\r
198 *\r
199 * @param outputDir\r
200 * string of output directory.\r
201 */\r
202 public void setOutputDir(String outputDir) {\r
203 this.outputDir = outputDir;\r
204 }\r
205}\r