forked from sourcegraph/scip-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
47 lines (37 loc) · 1.38 KB
/
Main.java
File metadata and controls
47 lines (37 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package lsifjava;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
public class Main {
public static void main(String[] args) throws IOException{
System.out.println("Running JVM " + System.getProperty("java.version"));
Arguments arguments = ArgumentParser.parse(args);
PrintWriter writer = createWriter(arguments);
Emitter emitter = new Emitter(writer);
ProjectIndexer indexer = new ProjectIndexer(arguments, emitter);
long start = System.nanoTime();
try {
indexer.index();
} finally {
writer.flush();
writer.close();
}
displayStats(indexer, emitter, start);
}
private static PrintWriter createWriter(Arguments arguments) {
try {
return new PrintWriter(new File(arguments.outFile));
} catch (IOException ex) {
throw new RuntimeException(String.format("Failed to open file %s", arguments.outFile));
}
}
private static void displayStats(ProjectIndexer indexer, Emitter emitter, long start) {
System.out.printf(
"%d file(s), %d def(s), %d element(s)\n",
indexer.numFiles,
indexer.numDefinitions,
emitter.numElements()
);
System.out.printf("Processed in %.0fms", (System.nanoTime() - start) / 1e6);
}
}