equal
deleted
inserted
replaced
20 * or visit www.oracle.com if you need additional information or have any |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 * |
22 * |
23 */ |
23 */ |
24 |
24 |
25 import java.io.*; |
25 import java.io.File; |
26 import java.util.*; |
26 import java.io.IOException; |
|
27 import java.io.PrintWriter; |
|
28 import java.util.Enumeration; |
|
29 import java.util.Hashtable; |
|
30 import java.util.Iterator; |
|
31 import java.util.List; |
|
32 import java.util.TreeSet; |
|
33 import java.util.Vector; |
27 |
34 |
28 abstract class HsArgHandler extends ArgHandler { |
35 abstract class HsArgHandler extends ArgHandler { |
29 static final int STRING = 1; |
36 static final int STRING = 1; |
30 static final int VECTOR = 2; |
37 static final int VECTOR = 2; |
31 static final int HASH = 3; |
38 static final int HASH = 3; |
343 |
350 |
344 void parseArguments(String[] args) { |
351 void parseArguments(String[] args) { |
345 new ArgsParser(args, |
352 new ArgsParser(args, |
346 new ArgRule[] |
353 new ArgRule[] |
347 { |
354 { |
348 new HsArgRule("-sourceBase", |
355 new ArgRule("-sourceBase", |
349 "SourceBase", |
356 new HsArgHandler() { |
350 " (Did you set the HotSpotWorkSpace environment variable?)", |
357 public void handle(ArgIterator it) { |
351 HsArgHandler.STRING |
358 String cfg = getCfg(it.get()); |
352 ), |
359 if (nextNotKey(it)) { |
|
360 String sb = (String) it.get(); |
|
361 if (sb.endsWith(Util.sep)) { |
|
362 sb = sb.substring(0, sb.length() - 1); |
|
363 } |
|
364 BuildConfig.putField(cfg, "SourceBase", sb); |
|
365 it.next(); |
|
366 } else { |
|
367 empty("-sourceBase", null); |
|
368 } |
|
369 } |
|
370 } |
|
371 ), |
353 |
372 |
354 new HsArgRule("-buildBase", |
373 new HsArgRule("-buildBase", |
355 "BuildBase", |
374 "BuildBase", |
356 " (Did you set the HotSpotBuildSpace environment variable?)", |
375 " (Did you set the HotSpotBuildSpace environment variable?)", |
357 HsArgHandler.STRING |
376 HsArgHandler.STRING |
510 |
529 |
511 new ArgRule("-prelink", |
530 new ArgRule("-prelink", |
512 new HsArgHandler() { |
531 new HsArgHandler() { |
513 public void handle(ArgIterator it) { |
532 public void handle(ArgIterator it) { |
514 if (nextNotKey(it)) { |
533 if (nextNotKey(it)) { |
515 String build = it.get(); |
|
516 if (nextNotKey(it)) { |
534 if (nextNotKey(it)) { |
517 String description = it.get(); |
535 String description = it.get(); |
518 if (nextNotKey(it)) { |
536 if (nextNotKey(it)) { |
519 String command = it.get(); |
537 String command = it.get(); |
520 BuildConfig.putField(null, "PrelinkDescription", description); |
538 BuildConfig.putField(null, "PrelinkDescription", description); |
526 } |
544 } |
527 |
545 |
528 empty(null, "** Error: wrong number of args to -prelink"); |
546 empty(null, "** Error: wrong number of args to -prelink"); |
529 } |
547 } |
530 } |
548 } |
531 ) |
549 ), |
|
550 |
|
551 new ArgRule("-postbuild", |
|
552 new HsArgHandler() { |
|
553 public void handle(ArgIterator it) { |
|
554 if (nextNotKey(it)) { |
|
555 if (nextNotKey(it)) { |
|
556 String description = it.get(); |
|
557 if (nextNotKey(it)) { |
|
558 String command = it.get(); |
|
559 BuildConfig.putField(null, "PostbuildDescription", description); |
|
560 BuildConfig.putField(null, "PostbuildCommand", command); |
|
561 it.next(); |
|
562 return; |
|
563 } |
|
564 } |
|
565 } |
|
566 |
|
567 empty(null, "** Error: wrong number of args to -postbuild"); |
|
568 } |
|
569 } |
|
570 ), |
532 }, |
571 }, |
533 new ArgHandler() { |
572 new ArgHandler() { |
534 public void handle(ArgIterator it) { |
573 public void handle(ArgIterator it) { |
535 |
574 |
536 throw new RuntimeException("Arg Parser: unrecognized option "+it.get()); |
575 throw new RuntimeException("Arg Parser: unrecognized option "+it.get()); |
616 this.attr = attr; |
655 this.attr = attr; |
617 } |
656 } |
618 |
657 |
619 public int compareTo(Object o) { |
658 public int compareTo(Object o) { |
620 FileInfo oo = (FileInfo)o; |
659 FileInfo oo = (FileInfo)o; |
621 // Don't squelch identical short file names where the full |
|
622 // paths are different |
|
623 if (!attr.shortName.equals(oo.attr.shortName)) |
|
624 return attr.shortName.compareTo(oo.attr.shortName); |
|
625 return full.compareTo(oo.full); |
660 return full.compareTo(oo.full); |
626 } |
661 } |
627 |
662 |
628 boolean isHeader() { |
663 boolean isHeader() { |
629 return attr.shortName.endsWith(".h") || attr.shortName.endsWith(".hpp"); |
664 return attr.shortName.endsWith(".h") || attr.shortName.endsWith(".hpp"); |