Skip to content

Commit

Permalink
Add support for runtimeGroovydoc optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
keeganwitt committed Oct 8, 2020
1 parent 5f9bbc6 commit 9ff9a3d
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
*/
public abstract class AbstractGroovyDocMojo extends AbstractGroovySourcesMojo {

/**
* Groovy 3.0.0 alpha-4 version.
*/
protected static final Version GROOVY_3_0_0_ALPHA_4 = new Version(3, 0, 0, "alpha-4");

/**
* Groovy 1.6.0 RC-2 version.
*/
Expand Down Expand Up @@ -233,6 +238,14 @@ public abstract class AbstractGroovyDocMojo extends AbstractGroovySourcesMojo {
@Parameter
protected String linkArgumentClass = null;

/**
* Enable attaching GroovyDoc annotation. Requires Groovy 3.0.0 alpha-4 or newer.
*
* @since 1.10.2
*/
@Parameter(defaultValue = "false")
protected boolean attachGroovyDocAnnotation;

/**
* Generates the GroovyDoc for the specified sources.
*
Expand Down Expand Up @@ -279,6 +292,13 @@ protected synchronized void doGroovyDocGeneration(final FileSet[] sourceDirector
Class<?> classpathResourceManagerClass = classWrangler.getClass(this.classpathResourceManagerClass == null ? "org.codehaus.groovy.tools.groovydoc.ClasspathResourceManager" : this.classpathResourceManagerClass);

// set up GroovyDoc options
if (attachGroovyDocAnnotation) {
if (groovyAtLeast(GROOVY_3_0_0_ALPHA_4)) {
System.setProperty("runtimeGroovydoc", "true");
} else {
getLog().warn("Requested to enable attaching GroovyDoc annotation, but your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support it (must be " + GROOVY_3_0_0_ALPHA_4 + " or newer). Ignoring enableGroovyDocAnnotation parameter.");
}
}
Properties docProperties = setupProperties();
Object fileOutputTool = invokeConstructor(findConstructor(fileOutputToolClass));
Object classpathResourceManager = invokeConstructor(findConstructor(classpathResourceManagerClass));
Expand Down

0 comments on commit 9ff9a3d

Please sign in to comment.