From b3e74e4897c621e49a470a84d3fbb8e8171f7ad8 Mon Sep 17 00:00:00 2001 From: Sam Harwell <sam@tunnelvisionlabs.com> Date: Mon, 26 Jan 2015 20:57:08 -0600 Subject: [PATCH] Make template visualization optional (disabled by default) --- .../antlr4/testgen/Antlr4TestGeneratorMojo.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/antlr4-testgen-maven-plugin/src/main/java/org/antlr/mojo/antlr4/testgen/Antlr4TestGeneratorMojo.java b/antlr4-testgen-maven-plugin/src/main/java/org/antlr/mojo/antlr4/testgen/Antlr4TestGeneratorMojo.java index 52557ddc9..ffaf7a72c 100644 --- a/antlr4-testgen-maven-plugin/src/main/java/org/antlr/mojo/antlr4/testgen/Antlr4TestGeneratorMojo.java +++ b/antlr4-testgen-maven-plugin/src/main/java/org/antlr/mojo/antlr4/testgen/Antlr4TestGeneratorMojo.java @@ -71,6 +71,9 @@ public class Antlr4TestGeneratorMojo extends AbstractMojo { @Parameter(defaultValue = "${project.build.directory}/generated-test-sources/antlr4-tests") private File outputDirectory; + @Parameter + private boolean visualize; + @Override public void execute() throws MojoExecutionException, MojoFailureException { STGroup targetGroup = new STGroupFile(runtimeTemplates.getPath()); @@ -128,10 +131,13 @@ public class Antlr4TestGeneratorMojo extends AbstractMojo { ST testFileTemplate = targetGroup.getInstanceOf("TestFile"); testFileTemplate.addAggr("file.{Options,name,tests}", index.rawGetDictionary("Options"), testFile, templates); - STViz viz = testFileTemplate.inspect(); - try { - viz.waitForClose(); - } catch (InterruptedException ex) { + + if (visualize) { + STViz viz = testFileTemplate.inspect(); + try { + viz.waitForClose(); + } catch (InterruptedException ex) { + } } File targetFolder = new File(outputDirectory, templateFolder.substring(0, templateFolder.indexOf("/templates")));