01: package com.ibm.sigtest;
02:
03: /**
04: * This class generates a project file which contains a snapshot of the current
05: * signatures of the specified classes.
06: * @author Matthew J. Duftler (duftler@us.ibm.com)
07: */
08: public class ProjectFileGenerator {
09:
10: private static void printUsage() {
11: System.err.println("Usage:\n\n" + " java "
12: + ProjectFileGenerator.class.getName() + " [args]\n\n"
13: + " args:\n\n"
14: + " -classListFile name of file containing "
15: + "CR-separated list of classes\n"
16: + " to include\n"
17: + " -projectFile name of file to generate\n"
18: + " [-overwrite (on|off)] default: off"
19: + " (Overwrite existing files?)");
20: System.exit(1);
21: }
22:
23: public static void main(String[] argv) throws Exception {
24: long startTime = System.currentTimeMillis();
25:
26: if (argv.length % 2 != 0) {
27: printUsage();
28: }
29:
30: String classListFile = null;
31: String projectFile = null;
32: boolean overwrite = false;
33:
34: for (int i = 0; i < argv.length; i += 2) {
35: String option = argv[i];
36: String value = argv[i + 1];
37:
38: if (option.equals("-classListFile")) {
39: classListFile = value;
40: } else if (option.equals("-projectFile")) {
41: projectFile = value;
42: } else if (option.equals("-overwrite")) {
43: overwrite = value.equals("on");
44: } else {
45: printUsage();
46: }
47: }
48:
49: if (classListFile == null || projectFile == null) {
50: printUsage();
51: }
52:
53: SigTestUtils.generateProjectFile(classListFile, projectFile,
54: overwrite);
55:
56: long endTime = System.currentTimeMillis();
57:
58: System.out.println("Done.\n" + "Elapsed time: "
59: + (endTime - startTime) + "ms");
60: }
61: }
|