]>
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
;
29 GuidChkTask is to call GuidChk.exe to generate Section.
32 public class GuidChkTask
extends Task
implements EfiDefine
{
36 * -exDir : directory name of exclusion searching
37 * -exFile : file name of exclusion searching
38 * -exExt : extension name of exclusion searching
39 * -exSubDir: extesnion name of sub dir which excluded searching
40 * -outFile : out put file wrote internal GUID+basename list
41 * -chkGui : check for duplicate guids
42 * -chkSign : check for duplicate signatures
43 * -printGuiDef : if set will print guid+defined symbol name
44 * -printAllGuid: if set will print all GUIDS found
45 * -outPut : redirection file name
46 * -fos : out put redirect to this file
50 /// Directory name of exclusion searching
52 private String exDir
= "";
54 /// File name of exclusion searching.
56 private String exFile
= "";
58 /// Extension name of exclusion searching.
60 private String exExt
= "";
62 /// Extesnion name of sub dir which excluded searching.
64 private String exSubDir
= "";
66 /// Out put file wrote internal GUID+basename list
68 private String outFile
= "";
70 /// Check for duplicate guids.
72 private String chkGui
= "";
74 /// Check for duplicate signatures
76 private String chkSign
= "";
78 /// If set will print guid+defined symbol name
80 private String printGuiDef
= "";
82 /// If set will print all GUIDS found
84 private String printAllGuid
= "";
86 /// redirection file name.
88 private String outPut
= "";
90 /// out put redirect to this file.
92 protected PrintWriter fos
= null;
95 // overload class execute method
97 public void execute() throws BuildException
{
98 Project project
= this.getOwningTarget().getProject();
99 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
104 command
= path
+ File
.separatorChar
+ "GuidChk";
106 String argument
= exDir
+
116 log(command
+ " " + argument
, Project
.MSG_VERBOSE
);
118 // execute command line
120 Process proc
= Runtime
.getRuntime().exec(command
+ "" + argument
);
122 // if set output, redirect out put to output file, else print output to screen
124 if ( !this.outPut
.equals("")) {
125 fos
= new PrintWriter(this.outPut
);
126 BufferedReader bin
= new BufferedReader(new InputStreamReader(proc
.getInputStream()));
127 String line
= bin
.readLine();
128 while (line
!= null ){
130 line
= bin
.readLine();
135 BufferedReader bin
= new BufferedReader(new InputStreamReader(proc
.getInputStream()));
136 String line
= bin
.readLine();
137 while (line
!= null ){
138 line
= bin
.readLine();
141 log("GuidChkTask Succeeded!", Project
.MSG_VERBOSE
);
142 } catch (Exception e
) {
143 throw new BuildException("GuidChkTask failed!");
149 This function is to get the string of flag of ChkGui
151 @return string of flag of ChkGui
153 public String
getChkGui() {
160 This function is to set chkGui
162 @param chkGui set class member of chkGui
164 public void setChkGui(String chkGui
) {
165 if (chkGui
.equals("on")||(chkGui
.equals("ON"))){
166 this.chkGui
= " -g ";
174 This function is to get chkSign
178 public String
getChkSign() {
185 This function is to set class member of chkSign
188 public void setChkSign(String chkSign
) {
189 if (chkSign
.equals("on")|| chkSign
.equals("ON")){
190 this.chkSign
= " -s ";
196 This function is to get class member of exDir
200 public String
getExDir() {
207 This function is to set class member of exDir
211 public void setExDir(String exDir
) {
212 this.exDir
= " -d " + exDir
;
218 This function is to get class member of exExt
222 public String
getExExt() {
229 This function is to set class member of exExt
232 public void setExExt(String exExt
) {
233 this.exExt
= " -e " + exExt
;
239 This function is to get class member of exFile
242 public String
getExFile() {
249 This function is to set class member of exFile.
253 public void setExFile(String exFile
) {
254 this.exFile
= " -f " + exFile
;
260 This function is to get class member of exSubDir
264 public String
getExSubDir() {
271 This function is to set class member of exSubDir.
274 public void setExSubDir(String exSubDir
) {
275 this.exSubDir
= " -u " + exSubDir
;
281 This function is to get outFile
285 public String
getOutFile() {
289 * set class member of outFile
292 public void setOutFile(String outFile
) {
293 this.outFile
= " -b " + outFile
;
298 This function is to get printGuidDef
300 @return flage of printing (guid+defined symbol name)
302 public String
getPrintGuiDef() {
310 This function is to set class member of printGuiDef.
313 public void setPrintGuiDef(String printGuiDef
) {
314 if (printGuiDef
.equals("on")|| printGuiDef
.equals("ON")){
315 this.printGuiDef
= " -x ";
323 This function is to get output
325 @return name of outPut file
327 public String
getOutPut() {
334 This function is to set class member of outPut.
337 public void setOutPut(String outPut
) {
338 this.outPut
= outPut
;
344 This function is to get printAllGuid
347 public String
getPrintAllGuid() {
354 This function is to set class member of printAllGuid.
357 public void setPrintAllGuid(String printAllGuid
) {
358 if (printAllGuid
.equals("on")||printAllGuid
.equals("ON")) {
359 this.printAllGuid
= " -p ";