]>
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 System
.out
.println(command
+ " " + argument
);
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 System
.out
.println(line
);
138 while (line
!= null ){
139 System
.out
.print(line
);
140 line
= bin
.readLine();
143 System
.out
.println("GuidChkTask Success!");
144 } catch (Exception e
) {
145 System
.out
.println("GuidChkTask failed!");
146 System
.out
.println(e
.getMessage());
153 This function is to get the string of flag of ChkGui
155 @return string of flag of ChkGui
157 public String
getChkGui() {
164 This function is to set chkGui
166 @param chkGui set class member of chkGui
168 public void setChkGui(String chkGui
) {
169 if (chkGui
.equals("on")||(chkGui
.equals("ON"))){
170 this.chkGui
= " -g ";
178 This function is to get chkSign
182 public String
getChkSign() {
189 This function is to set class member of chkSign
192 public void setChkSign(String chkSign
) {
193 if (chkSign
.equals("on")|| chkSign
.equals("ON")){
194 this.chkSign
= " -s ";
200 This function is to get class member of exDir
204 public String
getExDir() {
211 This function is to set class member of exDir
215 public void setExDir(String exDir
) {
216 this.exDir
= " -d " + exDir
;
222 This function is to get class member of exExt
226 public String
getExExt() {
233 This function is to set class member of exExt
236 public void setExExt(String exExt
) {
237 this.exExt
= " -e " + exExt
;
243 This function is to get class member of exFile
246 public String
getExFile() {
253 This function is to set class member of exFile.
257 public void setExFile(String exFile
) {
258 this.exFile
= " -f " + exFile
;
264 This function is to get class member of exSubDir
268 public String
getExSubDir() {
275 This function is to set class member of exSubDir.
278 public void setExSubDir(String exSubDir
) {
279 this.exSubDir
= " -u " + exSubDir
;
285 This function is to get outFile
289 public String
getOutFile() {
293 * set class member of outFile
296 public void setOutFile(String outFile
) {
297 this.outFile
= " -b " + outFile
;
302 This function is to get printGuidDef
304 @return flage of printing (guid+defined symbol name)
306 public String
getPrintGuiDef() {
314 This function is to set class member of printGuiDef.
317 public void setPrintGuiDef(String printGuiDef
) {
318 if (printGuiDef
.equals("on")|| printGuiDef
.equals("ON")){
319 this.printGuiDef
= " -x ";
327 This function is to get output
329 @return name of outPut file
331 public String
getOutPut() {
338 This function is to set class member of outPut.
341 public void setOutPut(String outPut
) {
342 this.outPut
= outPut
;
348 This function is to get printAllGuid
351 public String
getPrintAllGuid() {
358 This function is to set class member of printAllGuid.
361 public void setPrintAllGuid(String printAllGuid
) {
362 if (printAllGuid
.equals("on")||printAllGuid
.equals("ON")) {
363 this.printAllGuid
= " -p ";