added java main that builds class graph
authorAnthony Bargnesi <abargnesi@gmail.com>
Thu, 22 Sep 2016 17:09:59 +0000 (13:09 -0400)
committerAnthony Bargnesi <abargnesi@gmail.com>
Thu, 22 Sep 2016 17:09:59 +0000 (13:09 -0400)
defaults to output to working directory for java process (*user.dir*)

src/main/java/eu/svjatoslav/inspector/java/methods/Main.java [new file with mode: 0644]

diff --git a/src/main/java/eu/svjatoslav/inspector/java/methods/Main.java b/src/main/java/eu/svjatoslav/inspector/java/methods/Main.java
new file mode 100644 (file)
index 0000000..7450c99
--- /dev/null
@@ -0,0 +1,30 @@
+package eu.svjatoslav.inspector.java.methods;
+
+import eu.svjatoslav.inspector.java.structure.ClassGraph;
+
+import java.io.File;
+
+import static java.lang.System.getProperty;
+
+public class Main {
+       public static void main(String[] args) {
+               if (args.length == 0) {
+                       System.err.println("usage: javainspect [PROJECT_DIR] [PACKAGE_GLOB] [GRAPH_NAME]");
+                       System.exit(1);
+               }
+
+               String projectDir  = args[0];
+               String packageGlob = args[1];
+               String graphName   = args[2];
+
+               ClassGraph cg = new ClassGraph();
+               cg.setTargetDirectory(getProperty("user.dir") + File.separator);
+
+               cg.addProject(projectDir);
+               cg.whitelistClassPattern(packageGlob);
+               cg.setKeepDotFile(true);
+               cg.generateGraph(graphName);
+
+               System.exit(0);
+       }
+}