From: Anthony Bargnesi Date: Thu, 22 Sep 2016 17:09:59 +0000 (-0400) Subject: added java main that builds class graph X-Git-Tag: javainspect-1.7~31^2~9 X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=00af092f9ad2425cc925e74b81abc9247ed0d668;p=javainspect.git added java main that builds class graph defaults to output to working directory for java process (*user.dir*) --- 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 index 0000000..7450c99 --- /dev/null +++ b/src/main/java/eu/svjatoslav/inspector/java/methods/Main.java @@ -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); + } +}