]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Java/Source/CheckTools/src/org/tianocore/CheckTools/ToolChecks.java
2 Verify the tool configuration file for location of the correct tools.
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 * This tool checks to see if specified tool chain paths exist.
17 * It will check all specified paths, as indicated by the last field of the
18 * tool property line equal to _PATH
20 * no option = check 1) the file specified in target.txt or 2) tools_def.txt
21 * if neither is found, we check the tools_def.template file.
22 * -i = INIT checks the tools_def.template file
24 * -s = SCAN will check all standard locations for tool chains
25 * C:\Program Files\Microsoft Visual Studio *
32 * -f = FILE check the tools in this file instead of tools_def.txt, or
33 * a file that was specified in target.txt
35 package org
.tianocore
.CheckTools
;
40 public class ToolChecks
{
41 private static int DEBUG
= 0;
43 private final int DEFAULT
= 1;
45 private final int TEST
= 2;
47 private final int SCAN
= 4;
49 private final int DUMP
= 8;
51 private final int INTERACTIVE
= 16;
53 private final int PASS
= 0;
55 private final int FAIL
= 1;
57 private ArrayList
<String
> errLog
= new ArrayList
<String
>();
59 private ArrayList
<String
> goodLog
= new ArrayList
<String
>();
61 private ArrayList
<String
> warnLog
= new ArrayList
<String
>();
63 public int checkTools(String toolConfFile
, int cmdCode
, int VERBOSE
, boolean QUIET
) {
65 int returnCode
= FAIL
;
66 boolean interActive
= false;
68 if ((DEBUG
> 0) || (VERBOSE
> 0)) {
69 if ((cmdCode
& DUMP
) == DUMP
)
70 System
.out
.print("Using Tool Configuration File: " + toolConfFile
+ " ");
72 System
.out
.println("Using Tool Configuration File: " + toolConfFile
);
76 System
.out
.println("The cmdCode: " + cmdCode
);
78 if ((cmdCode
& INTERACTIVE
) == INTERACTIVE
) {
81 System
.out
.println("***** WARNING ***** The Interactive function has not been implemented yet!");
84 if ((cmdCode
& DUMP
) == DUMP
) {
85 returnCode
= dumpFile(toolConfFile
, VERBOSE
, QUIET
);
87 System
.out
.println("dumpFile returned: " + returnCode
);
90 if ((cmdCode
& SCAN
) == SCAN
) {
91 returnCode
= scanFile(toolConfFile
, interActive
, VERBOSE
, QUIET
);
94 if (((cmdCode
& TEST
) == TEST
) || ((cmdCode
& DEFAULT
) == DEFAULT
))
95 returnCode
= testFile(toolConfFile
, interActive
, VERBOSE
, QUIET
);
97 if ((errLog
.isEmpty() == false) && (QUIET
== false)) {
98 // We had ERRORS, not just Warnings.
99 // System.out.println("Tool Configuration File: " + toolConfFile);
100 System
.out
.println(" goodLog has: " + goodLog
.size() + " entries");
101 if ((goodLog
.isEmpty() == false) && (VERBOSE
> 1))
102 for (int i
= 0; i
< goodLog
.size(); i
++)
103 System
.out
.println("Tool Chain Tag Name: " + goodLog
.get(i
) + " is valid!");
104 for (int i
= 0; i
< errLog
.size(); i
++)
105 System
.out
.println(errLog
.get(i
));
106 if (warnLog
.isEmpty() == false)
107 for (int i
= 0; i
< warnLog
.size(); i
++)
108 System
.out
.println(" " + warnLog
.get(i
));
110 System
.out
.println();
111 System
.out
.println("You can remove these WARNING messages by editing the file:");
112 System
.out
.println(" " + toolConfFile
);
113 System
.out
.println("and commenting out out or deleting the entries for the tool");
114 System
.out
.println("chain tag names that do not apply to your system.");
117 if (QUIET
== false) {
118 if ((cmdCode
& DUMP
) == DUMP
)
119 System
.out
.println("");
121 System
.out
.print("Valid Tag Names:");
122 for (int i
= 0; i
< goodLog
.size(); i
++)
123 System
.out
.print(" " + goodLog
.get(i
));
124 System
.out
.println("");
126 if (warnLog
.isEmpty() == false)
127 for (int i
= 0; i
< warnLog
.size(); i
++)
128 System
.out
.println(" " + warnLog
.get(i
));
130 if (warnLog
.isEmpty())
131 System
.out
.println(" Tool Configuration File: " + toolConfFile
+ " is valid!");
133 System
.out
.println(" Tool Configuration File: " + toolConfFile
134 + " is valid! However, there are WARNINGS!");
136 System
.out
.println(" Tool Configuration File: " + toolConfFile
137 + " contains INVALID tool tag names!");
144 private int scanFile(String testFile
, boolean interActive
, int VERBOSE
, boolean QUIET
) {
145 if ((DEBUG
> 0) || (VERBOSE
> 0))
146 System
.out
.println("Scanning the Normal Installation Locations ...");
147 System
.out
.println("The Scan function has not been implemented yet!");
151 private int dumpFile(String testFile
, int VERBOSE
, boolean QUIET
) {
155 // initialize local variables
157 ArrayList
<ToolInfo
> info
= new ArrayList
<ToolInfo
>();
158 String readLine
= "";
159 String fileLine
[] = new String
[2];
160 String property
[] = new String
[5];
161 ToolInfo toolInf
= null;
162 String lastTagName
= "arf";
163 String lastFamily
= "arf";
164 String lastArch
= "IA32";
165 String lastCmdCode
= "arf";
166 // String lastFlags = "arf";
167 boolean found
= false;
168 String tFamily
= "arf";
169 String tCmdName
= "arf";
170 String acpiPath
= "";
177 FileReader toolConfFile
= new FileReader(testFile
);
178 BufferedReader bufReader
= new BufferedReader(toolConfFile
);
180 while ((readLine
= bufReader
.readLine()) != null) {
181 if (!readLine
.startsWith("#")) {
182 if (readLine
.contains("IDENTIFIER")) {
183 readLine
= readLine
.trim();
184 fileLine
= readLine
.split("=");
186 System
.out
.println("IDENTIFIER: " + fileLine
[1].trim());
187 toolInf
= new ToolInfo();
189 } else if (readLine
.contains("_")) {
191 * This section should complete array values
196 * ArrayList<String> Targets
197 * ArrayList<String> CmdCode
198 * ArrayList<String> Path
199 * ArrayList<String> Arguments
202 System
.out
.println("Processing: " + readLine
.trim());
203 readLine
= readLine
.trim();
204 readLine
= readLine
.replaceFirst("=", "_SPLIT_HERE_");
205 fileLine
= readLine
.split("_SPLIT_HERE_");
206 fileLine
[0] = fileLine
[0].trim();
207 fileLine
[1] = fileLine
[1].trim();
208 property
= fileLine
[0].split("_");
210 // Covert to simple string names
211 String tTarget
= property
[0].trim();
212 if (tTarget
.contentEquals("*"))
213 tTarget
= "All Targets";
214 String tTag
= property
[1].trim();
215 String tArch
= property
[2].trim();
216 String tCmdCode
= property
[3].trim();
217 String tArg
= property
[4].trim();
218 if (tArg
.contentEquals("FAMILY"))
219 tFamily
= fileLine
[1].trim();
220 if (tArg
.contentEquals("NAME")) {
221 tCmdName
= fileLine
[1].trim();
222 tCmdCode
= tCmdCode
+ " (" + tCmdName
+ ")";
225 String tVal
= fileLine
[1].trim();
227 // Process the TagName
228 if ((!tTag
.contentEquals(lastTagName
))
229 || ((!tArch
.contentEquals(lastArch
)) && (!tArch
.contentEquals("*")))
230 || (!tFamily
.contentEquals(lastFamily
))) {
232 System
.out
.println(" LAST Tag: " + lastTagName
+ " Arch: " + lastArch
+ " Family: "
234 System
.out
.println(" NEXT Tag: " + tTag
+ " Arch: " + tArch
+ " Family: " + tFamily
);
236 if ((!lastTagName
.equals("arf")) && (!tTag
.equals("*"))) {
237 toolInf
.setTagName(lastTagName
);
238 toolInf
.setFamily(lastFamily
);
239 toolInf
.setArch(lastArch
);
240 if (toolInf
.getCmdCode().size() < 1)
241 toolInf
.addCmdCode(lastCmdCode
);
243 toolInf
= new ToolInfo();
246 System
.out
.println(" ADDED " + ctr
+ " Tag: " + lastTagName
+ " Arch: " + lastArch
247 + " Family: " + lastFamily
+ " CmdCode: " + lastCmdCode
);
252 if ((!tTag
.contentEquals("*")) && (!tTag
.contentEquals(lastTagName
)))
255 if ((!tArch
.contentEquals(lastArch
)) && (!tArch
.contentEquals("*")))
257 if ((!tArch
.contentEquals(lastArch
)) && (tArch
.contentEquals("*")))
260 if (!tFamily
.contentEquals(lastFamily
))
261 lastFamily
= tFamily
;
263 System
.out
.println(" Setting Tag: " + lastTagName
+ " Arch: " + lastArch
264 + " Family: " + lastFamily
);
268 if ((!lastArch
.contentEquals(tArch
)) && (!tArch
.contentEquals("*"))) {
269 toolInf
.setArch(tArch
);
272 System
.out
.println(" Setting Arch: " + tArch
);
275 // Process Target field - making sure we add only unique values.
276 if (!tTarget
.contains("*")) {
278 for (int k
= 0; k
< toolInf
.getTargetName().size(); k
++)
279 if (toolInf
.getTargetName(k
).contentEquals(tTarget
))
282 toolInf
.addTargetName(tTarget
);
284 System
.out
.println(" Adding Target: " + tTarget
);
288 // Process Command Code Field - making sure we add only unique values.
289 if (!tCmdCode
.contentEquals("*")) {
291 for (int k
= 0; k
< toolInf
.getCmdCode().size(); k
++)
292 if (toolInf
.getCmdCode(k
).startsWith(tCmdCode
))
295 if (!tCmdCode
.contains(" (")) {
297 for (int m
= toolInf
.size(); m
>= 0; --m
) {
299 ArrayList
<String
> lastCmdEntry
= info
.get(m
).getCmdCode();
300 for (int l
= 0; l
< lastCmdEntry
.size(); l
++) {
301 if (lastCmdEntry
.get(l
).startsWith(tCmdCode
)) {
302 tCmdCode
= lastCmdEntry
.get(l
).trim();
304 System
.out
.println("found tCmdCode here: " + tCmdCode
);
311 toolInf
.addCmdCode(tCmdCode
);
313 System
.out
.println(" Adding previous CmdCode: " + tCmdCode
);
316 toolInf
.addCmdCode(tCmdCode
);
317 lastCmdCode
= tCmdCode
;
319 System
.out
.println(" Adding first CmdCode: " + tCmdCode
);
324 // Process Path Field - making sure we add only unique values.
325 if (tArg
.contentEquals("PATH")) {
326 String prefix
= "PATH_";
327 if (tCmdCode
.contentEquals("ASM"))
329 if (tCmdCode
.contentEquals("ASMLINK"))
331 if (tCmdCode
.contentEquals("ASL"))
333 File path
= new File(tVal
);
336 for (int k
= 0; k
< toolInf
.getPath().size(); k
++)
337 if (toolInf
.getPath(k
).startsWith(prefix
))
339 if (found
== false) {
340 toolInf
.addPath(prefix
+ tVal
);
342 System
.out
.println(" Adding valid path: " + tVal
);
344 if (prefix
.contentEquals("ASLPATH_"))
346 if (prefix
.contentEquals("PATH_"))
348 if (prefix
.contentEquals("ASMPATH_"))
351 toolInf
.setInvalid();
352 for (int k
= 0; k
< toolInf
.getBadPath().size(); k
++)
353 if (toolInf
.getBadPath(k
).startsWith(prefix
))
356 toolInf
.addBadPath(prefix
+ tVal
);
358 System
.out
.println(" Adding NOT valid Path: " + tVal
);
364 if (tArg
.contentEquals("DPATH")) {
366 File path
= new File(tVal
);
368 for (int k
= 0; k
< toolInf
.getPath().size(); k
++)
369 if (toolInf
.getPath(k
).startsWith("DPATH_"))
372 toolInf
.addPath("DPATH_" + tVal
);
374 System
.out
.println(" Adding valid DPath: " + tVal
);
377 toolInf
.setInvalid();
378 for (int k
= 0; k
< toolInf
.getBadPath().size(); k
++)
379 if (toolInf
.getBadPath(k
).contentEquals("DPATH_" + tVal
))
382 toolInf
.addBadPath("DPATH_" + tVal
);
384 System
.out
.println(" Adding NOT valid DPath: " + tVal
);
390 if (tArg
.contentEquals("SPATH")) {
392 File path
= new File(tVal
);
394 for (int k
= 0; k
< toolInf
.getPath().size(); k
++)
395 if (toolInf
.getPath(k
).contentEquals("SPATH_" + tVal
))
398 toolInf
.addPath("SPATH_" + tVal
);
400 System
.out
.println(" Adding valid SPath: " + tVal
);
403 toolInf
.setInvalid();
404 for (int k
= 0; k
< toolInf
.getBadPath().size(); k
++)
405 if (toolInf
.getBadPath(k
).contentEquals("SPATH_" + tVal
))
408 toolInf
.addBadPath("SPATH_" + tVal
);
410 System
.out
.println(" Adding NOT valid SPath: " + tVal
);
416 if (tArg
.equals("INCLUDEPATH")) {
418 File path
= new File(tVal
);
420 for (int k
= 0; k
< toolInf
.getPath().size(); k
++)
421 if (toolInf
.getPath(k
).contentEquals("INCLUDEPATH_" + tVal
))
424 toolInf
.addPath("INCLUDEPATH_" + tVal
);
426 System
.out
.println(" Adding valid IPath: " + tVal
);
429 toolInf
.setInvalid();
430 for (int k
= 0; k
< toolInf
.getBadPath().size(); k
++)
431 if (toolInf
.getBadPath(k
).contentEquals("INCLUDE_" + tVal
))
434 toolInf
.addBadPath("INCLUDE_" + tVal
);
436 System
.out
.println(" Adding NOT valid IPath: " + tVal
);
442 if (tArg
.equals("LIBPATH")) {
444 File path
= new File(tVal
);
446 for (int k
= 0; k
< toolInf
.getPath().size(); k
++)
447 if (toolInf
.getPath(k
).contentEquals("LIB_" + tVal
))
450 toolInf
.addPath("LIB_" + tVal
);
452 System
.out
.println(" Adding valid LPath: " + tVal
);
455 toolInf
.setInvalid();
456 for (int k
= 0; k
< toolInf
.getBadPath().size(); k
++)
457 if (toolInf
.getBadPath(k
).contentEquals("LIB_" + tVal
))
460 toolInf
.addBadPath("LIB_" + tVal
);
462 System
.out
.println(" Adding NOT valid LPath: " + tVal
);
468 if (tArg
.equals("FLAGS")) {
469 String flags
= fileLine
[1].trim();
470 String fLine
= tTarget
+ "_" + tCmdCode
+ "_FLAGS_" + flags
;
471 toolInf
.addArguments(fLine
);
473 System
.out
.println(" Adding flag line: " + fLine
);
478 toolInf
.setArch(lastArch
);
479 toolInf
.setFamily(lastFamily
);
480 toolInf
.setTagName(lastTagName
);
483 System
.out
.println(" ADDED " + ctr
+ " LAST Tag: " + lastTagName
+ " Arch: " + lastArch
+ " Family: "
484 + lastFamily
+ " Last CmdCode: " + lastCmdCode
);
486 // Finished collecting data, print it out in Human Readable Format
487 if (info
.size() > 0) {
489 System
.out
.println(" **** TOOL CHAINS ****");
490 if ((DEBUG
> 0) || (VERBOSE
> 1))
491 System
.out
.println("There are " + info
.size()
492 + " different combinations of Tag Names and Architectures.");
495 boolean asmExists
= false;
496 boolean asmPathDefined
= false;
498 boolean cmdPathDefined
= false;
499 boolean dPathDefined
= false;
501 boolean acpiPathDefined
= false;
502 boolean acpiDeclared
= false;
503 ArrayList
<String
> warnMsgs
= null;
505 for (int i
= 0; i
< info
.size(); i
++) {
506 if (!lastTagName
.contentEquals(info
.get(i
).getTagName())) {
507 if ((acpiDeclared
== false) && (!lastTagName
.contentEquals("arf"))) {
508 if (QUIET
== false) {
510 .println(" ----WARNING: No ACPI assembler has been defined for "
512 + ", you will not be able to successfully create a complete firmware image.");
513 System
.out
.println("");
516 if ((asmExists
== false) && (!lastTagName
.contentEquals("arf"))) {
517 if (QUIET
== false) {
518 System
.out
.println(" ----WARNING: No Assembler has been defined for " + lastTagName
519 + ", you will not be able to successfully compile all platforms.");
520 System
.out
.println("");
524 asmPathDefined
= false;
526 cmdPathDefined
= false;
527 dPathDefined
= false;
529 acpiPathDefined
= false;
530 acpiDeclared
= false;
531 warnMsgs
= new ArrayList
<String
>();
532 lastTagName
= info
.get(i
).getTagName();
535 if ((DEBUG
> 0) || (VERBOSE
> 1))
536 System
.out
.print("Tool Chain " + i
+ " Tag Name: " + info
.get(i
).getTagName() + ", Family: "
537 + info
.get(i
).getFamily());
538 else if (QUIET
== false)
539 System
.out
.print("Tool Chain Tag Name: " + info
.get(i
).getTagName() + ", Family: "
540 + info
.get(i
).getFamily());
542 if (info
.get(i
).isValid()) {
543 ToolInfo vTool
= info
.get(i
);
545 System
.out
.println(" is Valid for Architecture: " + info
.get(i
).getArch());
546 // OK, let's print out the command w/flags
548 for (int m
= 0; m
< vTool
.getPath().size(); m
++) {
549 String pathName
[] = vTool
.getPath(m
).split("_");
550 String prefix
= " Tool Path: ";
551 if (pathName
[0].startsWith("DPATH")) {
552 prefix
= " Dynamic Linker Path: ";
555 if (pathName
[0].startsWith("PATH")) {
556 cmdPathDefined
= true;
557 cmdPath
= pathName
[1].trim();
559 if (pathName
[0].startsWith("APATH")) {
560 asmPathDefined
= true;
561 asmPath
= pathName
[1].trim();
563 if (pathName
[0].startsWith("ASLPATH")) {
564 acpiPathDefined
= true;
565 acpiPath
= pathName
[1].trim();
568 System
.out
.println(prefix
+ pathName
[1].trim());
570 if (acpiPathDefined
== false) {
572 warnMsgs
.add(" ---- WARNING: " + vTool
.getTagName() + "ACPI Path is not defined!");
574 if ((VERBOSE
== 0) && (QUIET
== false))
575 System
.out
.print("Defined Targets: ");
576 for (int k
= 0; k
< vTool
.getTargetName().size(); k
++) {
577 String tTarget
= vTool
.getTargetName(k
);
578 if (tTarget
.contentEquals("*"))
582 System
.out
.println("+++ " + tTarget
+ " +++");
583 else if (QUIET
== false)
584 System
.out
.print(" " + tTarget
);
586 for (int j
= 0; j
< vTool
.getCmdCode().size(); j
++) {
587 String tCommand
= vTool
.getCmdCode(j
);
588 if (tCommand
.contains("ASL ")) {
590 if (acpiPathDefined
) {
591 // TODO: Check the acpi tool path
594 if (vTool
.getArguments().size() > 1) {
596 if (!cmdPathDefined
) {
597 warnMsgs
.add(" ---- ERROR: Command Path is not defined!");
599 if ((vTool
.getFamily().contentEquals("MSFT")) && (!dPathDefined
)) {
601 .add(" ---- ERROR: Microsoft Tool Chains require a Path (DPATH) to the mspdbXX.dll file");
604 // Process Flag lines!
605 for (int n
= 0; n
< vTool
.getArguments().size(); n
++) {
606 String tFlags
= vTool
.getArguments(n
);
607 String aFlags
[] = new String
[2];
608 aFlags
= tFlags
.split("FLAGS_");
609 String tsCmd
[] = tCommand
.split(" ");
610 tsCmd
[0] = tsCmd
[0].trim();
612 System
.out
.println(" tCmd: " + tsCmd
[0] + ", aFlags[0]: " + aFlags
[0]
613 + ", tTarget: " + tTarget
);
614 if (aFlags
[0].contains(tsCmd
[0])) {
615 if ((tFlags
.contains("All")) || (aFlags
[0].contains(tTarget
))) {
616 String flagLine
= aFlags
[1].trim();
617 if (info
.get(i
).getFamily().contentEquals("MSFT")) {
618 if (tCommand
.startsWith("PP")) {
620 if ((!flagLine
.contains("/P "))
621 && (!flagLine
.contains("/E "))) {
623 .println(" **** ERROR **** Pre-Processor Flags are NOT VALID!");
629 if (tCommand
.contains("ASM ")) {
630 cmdExe
= tCommand
.replace("ASM (", "");
631 cmdExe
= cmdExe
.replace(")", "");
633 cmdExe
= asmPath
.trim() + File
.separator
+ cmdExe
.trim();
635 cmdExe
= cmdPath
.trim() + File
.separator
+ cmdExe
.trim();
636 File testCmd
= new File(cmdExe
);
637 // System.out.println("Check: " + cmdExe);
638 if (!testCmd
.exists()) {
639 String errMsg
= " **** ERROR **** Assembler Command Defined, but does not exist! "
642 System
.out
.println(errMsg
);
645 for (int r
= 0; r
< warnMsgs
.size(); r
++)
646 if (warnMsgs
.get(r
).contentEquals(errMsg
))
649 warnMsgs
.add(errMsg
);
655 if ((tCommand
.contains("ASM ")) && (asmPathDefined
== false)
658 .println(" --- WARNING: Assembler - "
660 + " defined, but a Separate Path to the Assembler was not defined, using: "
662 if ((asmPathDefined
) && (tCommand
.contains("ASM "))
663 && (asmPathDefined
== false) && (VERBOSE
== 0)) {
664 String msgIs
= " --- WARNING: "
665 + info
.get(i
).getTagName()
667 + info
.get(i
).getArch()
670 + " defined, but a Separate Path to the Assembler was not defined, using: "
673 for (int r
= 0; r
< warnMsgs
.size(); r
++)
674 if (warnMsgs
.get(r
).contentEquals(msgIs
))
680 System
.out
.println(" " + tCommand
+ " " + flagLine
);
686 System
.out
.println(" " + tCommand
+ " has no arguments defined.");
693 System
.out
.println(" is NOT VALID for Architecture: " + info
.get(i
).getArch());
695 for (int k
= 0; k
< info
.get(i
).getBadPath().size(); k
++) {
696 String failureString
= "";
697 String tempString
= info
.get(i
).getBadPath(k
);
698 if (tempString
.startsWith("PATH_"))
699 failureString
= "Common Command Path: " + tempString
.replace("PATH_", "")
701 if (tempString
.startsWith("SPATH"))
702 failureString
= "Static Linker Path: " + tempString
.replace("SPATH_", "")
704 if (tempString
.startsWith("DPATH"))
705 failureString
= "Dynamic Linker Path: " + tempString
.replace("DPATH_", "")
707 if (tempString
.startsWith("LIB_"))
708 failureString
= "System Lib Path: " + tempString
.replace("LIB_", "")
710 if (tempString
.startsWith("INCLUDEPATH_"))
711 failureString
= "System include Path: " + tempString
.replace("INCLUDEPATH_", "")
713 if (tempString
.startsWith("APATH"))
714 failureString
= "Assembler Path: " + tempString
.replace("APATH_", "")
716 if (tempString
.startsWith("ALPATH"))
717 failureString
= "Assembler Link Path: " + tempString
.replace("ALPATH_", "")
719 if (tempString
.startsWith("ASLPATH"))
720 failureString
= "ACPI Path: " + tempString
.replace("ASLPATH_", "")
723 System
.out
.println(" --- " + failureString
);
728 if ((VERBOSE
== 0) && (QUIET
== false)) {
729 System
.out
.println("");
730 for (int p
= 0; p
< warnMsgs
.size(); p
++)
731 System
.out
.println(warnMsgs
.get(p
));
734 System
.out
.println("");
739 } catch (IOException e
) {
741 System
.out
.println("I/O Failure: " + e
);
748 private int testFile(String testFile
, boolean interActive
, int VERBOSE
, boolean QUIET
) {
751 String readLine
= "";
752 String fileLine
[] = new String
[2];
753 boolean definedAsl
= false;
756 FileReader toolConfFile
= new FileReader(testFile
);
757 BufferedReader reader
= new BufferedReader(toolConfFile
);
759 String props
[] = new String
[5];
760 String lastErrTag
= "barf";
761 String lastTag
= "barf";
762 while ((readLine
= reader
.readLine()) != null) {
763 if ((!readLine
.startsWith("#")) && (readLine
.contains("_PATH"))) {
765 System
.out
.println(" PATH LINE: " + readLine
);
767 readLine
= readLine
.trim();
768 fileLine
= readLine
.split("=");
769 path
= fileLine
[1].trim();
770 props
= fileLine
[0].split("_");
771 String tagName
= props
[1].trim();
772 // System.out.println(" Testing TagName: " + tagName);
773 String cmdTag
= props
[3].trim();
774 if (!lastTag
.contentEquals(tagName
)) {
775 // we have a new tagName
776 // first past lastTag = barf, lastErrTag = barf, tagName = something other than BARF
778 System
.out
.println(" lastTag: " + lastTag
+ " this Tag: " + tagName
+ " lastErrTag: "
781 if ((definedAsl
== false) && (lastTag
.contentEquals("barf") == false))
782 warnLog
.add(" -- WARNING: Tool Chain Tag Name: " + lastTag
783 + " does not have an ACPI assembler defined!");
786 if ((lastErrTag
.contentEquals("barf")) || (!tagName
.contentEquals(lastErrTag
))) {
787 if ((DEBUG
> 2) || (VERBOSE
> 3))
788 System
.out
.println("Adding tag: " + tagName
+ " to the goodLog");
789 goodLog
.add(tagName
);
794 } // end of adding the new tag name to the goodLog and
795 // checking if we had an ACPI compiler defined for the TagName
796 File testPath
= new File(path
);
797 if (cmdTag
.contentEquals("ASL"))
799 if (!testPath
.exists()) {
801 System
.out
.println(" Invalid path: " + path
+ ", path does not exist!");
802 if (!tagName
.contentEquals(lastErrTag
)) {
803 errLog
.add(" -- WARNING: Tool Chain Tag Name: " + tagName
+ " is NOT valid!");
804 errLog
.add(" Tool Code: [" + cmdTag
+ "] Path: " + path
+ " does not exist!");
807 lastErrTag
= tagName
;
811 if ((DEBUG
> 0) || (VERBOSE
> 0)) {
812 if ((!tagName
.contentEquals(lastTag
)) && (!tagName
.contentEquals(lastErrTag
))
813 && (!lastTag
.contentEquals("barf"))) {
814 String goodMsg
= "Tool Chain: " + tagName
+ " is valid";
815 System
.out
.println(goodMsg
);
818 } // end of path existence check
819 } // end of parsing the PATH line
820 } // end of reading file
821 // Check the LAST Tag to see of ACPI has been defined.
822 if (definedAsl
== false)
823 warnLog
.add(" -- WARNING: Tool Chain Tag Name: " + lastTag
824 + " does not have an ACPI assembler defined!");
826 toolConfFile
.close();
827 } catch (IOException e
) {
829 System
.out
.println(" [" + testFile
+ "] " + e
);
831 } // end of TRY-CATCH for reading file
833 if ((errLog
.isEmpty() == false) && (QUIET
== false))
834 for (int i
= 0; i
< goodLog
.size(); i
++) {
835 for (int j
= 0; j
< errLog
.size(); j
++) {
836 System
.out
.println(" Error Log [" + j
+ "] is " + errLog
.get(j
));
837 if (errLog
.get(j
).contains(goodLog
.get(i
).trim())) {
839 System
.out
.println(" Removing: " + goodLog
.get(i
).trim());
846 System
.out
.println("Returning with goodLog having: " + goodLog
.size());