]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GuidChkTask.java
4 GuidChkTask is to call GuidChk.exe to generate Section.
6 Copyright (c) 2006, Intel Corporation
7 All rights reserved. This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 package org
.tianocore
.framework
.tasks
;
17 import java
.io
.BufferedReader
;
18 import java
.io
.InputStreamReader
;
19 import java
.io
.PrintWriter
;
22 import org
.apache
.tools
.ant
.BuildException
;
23 import org
.apache
.tools
.ant
.Project
;
24 import org
.apache
.tools
.ant
.Task
;
26 import org
.tianocore
.common
.logger
.EdkLog
;
31 GuidChkTask is to call GuidChk.exe to generate Section.
34 public class GuidChkTask
extends Task
implements EfiDefine
{
38 * -exDir : directory name of exclusion searching
39 * -exFile : file name of exclusion searching
40 * -exExt : extension name of exclusion searching
41 * -exSubDir: extesnion name of sub dir which excluded searching
42 * -outFile : out put file wrote internal GUID+basename list
43 * -chkGui : check for duplicate guids
44 * -chkSign : check for duplicate signatures
45 * -printGuiDef : if set will print guid+defined symbol name
46 * -printAllGuid: if set will print all GUIDS found
47 * -outPut : redirection file name
48 * -fos : out put redirect to this file
54 private static String toolName
= "GuidChk";
56 // Directory name of exclusion searching
58 private FileArg exDir
= new FileArg();
60 // File name of exclusion searching.
62 private FileArg exFile
= new FileArg();
64 // Extension name of exclusion searching.
66 private FileArg exExt
= new FileArg();
68 // Extesnion name of sub dir which excluded searching.
70 private FileArg exSubDir
= new FileArg();
72 // Out put file wrote internal GUID+basename list
74 private FileArg outFile
= new FileArg();
76 // Check for duplicate guids.
78 private ToolArg chkGui
= new ToolArg();
80 // Check for duplicate signatures
82 private ToolArg chkSign
= new ToolArg();
84 // If set will print guid+defined symbol name
86 private ToolArg printGuiDef
= new ToolArg();
88 // If set will print all GUIDS found
90 private ToolArg printAllGuid
= new ToolArg();
92 // redirection file name.
94 private String outPut
= "";
96 // out put redirect to this file.
98 protected PrintWriter fos
= null;
101 // overload class execute method
103 public void execute() throws BuildException
{
104 Project project
= this.getOwningTarget().getProject();
105 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
110 command
= path
+ File
.separatorChar
+ toolName
;
112 String argument
= "" + exDir
+
122 EdkLog
.log(this, EdkLog
.EDK_VERBOSE
, command
+ " " + argument
);
124 // execute command line
126 Process proc
= Runtime
.getRuntime().exec(command
+ " " + argument
);
128 // if set output, redirect out put to output file, else print output to screen
130 if ( !this.outPut
.equals("")) {
131 fos
= new PrintWriter(this.outPut
);
132 BufferedReader bin
= new BufferedReader(new InputStreamReader(proc
.getInputStream()));
133 String line
= bin
.readLine();
134 while (line
!= null ){
136 line
= bin
.readLine();
141 BufferedReader bin
= new BufferedReader(new InputStreamReader(proc
.getInputStream()));
142 String line
= bin
.readLine();
143 while (line
!= null ){
144 line
= bin
.readLine();
147 EdkLog
.log(this, EdkLog
.EDK_VERBOSE
, toolName
+ " Succeeded!");
148 } catch (Exception e
) {
149 throw new BuildException(toolName
+ " failed!");
155 This function is to get the string of flag of ChkGui
157 @return string of flag of ChkGui
159 public String
getChkGui() {
160 return chkGui
.getValue();
166 This function is to set chkGui
168 @param chkGui set class member of chkGui
170 public void setChkGui(boolean chkGui
) {
172 this.chkGui
.setArg(" -", "g");
179 This function is to get chkSign
183 public String
getChkSign() {
184 return chkSign
.getValue();
190 This function is to set class member of chkSign
193 public void setChkSign(boolean chkSign
) {
195 this.chkSign
.setArg(" -", "s");
201 This function is to get class member of exDir
205 public String
getExDir() {
206 return exDir
.getValue();
212 This function is to set class member of exDir
216 public void setExDir(String exDir
) {
217 this.exDir
.setArg(" -d ", exDir
);
223 This function is to get class member of exExt
227 public String
getExExt() {
228 return exExt
.getValue();
234 This function is to set class member of exExt
237 public void setExExt(String exExt
) {
238 this.exExt
.setArg(" -e ", exExt
);
244 This function is to get class member of exFile
247 public String
getExFile() {
248 return exFile
.getValue();
254 This function is to set class member of exFile.
258 public void setExFile(String exFile
) {
259 this.exFile
.setArg(" -f ", exFile
);
265 This function is to get class member of exSubDir
269 public String
getExSubDir() {
270 return exSubDir
.getValue();
276 This function is to set class member of exSubDir.
279 public void setExSubDir(String exSubDir
) {
280 this.exSubDir
.setArg(" -u ", exSubDir
);
286 This function is to get outFile
290 public String
getOutFile() {
291 return outFile
.getValue();
294 * set class member of outFile
297 public void setOutFile(String outFile
) {
298 this.outFile
.setArg(" -b ", outFile
);
303 This function is to get printGuidDef
305 @return flage of printing (guid+defined symbol name)
307 public String
getPrintGuiDef() {
308 return printGuiDef
.getValue();
315 This function is to set class member of printGuiDef.
318 public void setPrintGuiDef(boolean printGuiDef
) {
320 this.printGuiDef
.setArg(" -", "x");
328 This function is to get output
330 @return name of outPut file
332 public String
getOutPut() {
339 This function is to set class member of outPut.
342 public void setOutPut(String outPut
) {
343 this.outPut
= outPut
;
349 This function is to get printAllGuid
352 public String
getPrintAllGuid() {
353 return printAllGuid
.getValue();
359 This function is to set class member of printAllGuid.
362 public void setPrintAllGuid(boolean printAllGuid
) {
364 this.printAllGuid
.setArg(" -", "p");