From 00af092f9ad2425cc925e74b81abc9247ed0d668 Mon Sep 17 00:00:00 2001 From: Anthony Bargnesi Date: Thu, 22 Sep 2016 13:09:59 -0400 Subject: [PATCH] added java main that builds class graph defaults to output to working directory for java process (*user.dir*) --- .../inspector/java/methods/Main.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/main/java/eu/svjatoslav/inspector/java/methods/Main.java 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); + } +} -- 2.20.1