Skip to content

Commit

Permalink
Add parameters to override Groovydoc templates
Browse files Browse the repository at this point in the history
(closes #105)
  • Loading branch information
keeganwitt committed Sep 1, 2020
1 parent fda479c commit 48ef0eb
Showing 1 changed file with 33 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,30 @@ public abstract class AbstractGroovyDocMojo extends AbstractGroovySourcesMojo {
@Parameter(defaultValue = "PROJECT_ONLY")
protected IncludeClasspath includeClasspath;

/**
* Override the default Groovydoc default top-level templates. Uses Groovy's standard templates by default.
*
* @since 1.10.1
*/
@Parameter
protected String[] defaultDocTemplates;

/**
* Override the default Groovydoc package-level templates. Uses Groovy's standard templates by default.
*
* @since 1.10.1
*/
@Parameter
protected String[] defaultPackageTemplates;

/**
* Override the default Groovydoc class-level templates. Uses Groovy's standard templates by default.
*
* @since 1.10.1
*/
@Parameter
protected String[] defaultClassTemplates;

/**
* Generates the GroovyDoc for the specified sources.
*
Expand Down Expand Up @@ -317,19 +341,19 @@ protected Object createGroovyDocTool(final Class<?> groovyDocToolClass, final Cl
groovyDocTool = invokeConstructor(findConstructor(groovyDocToolClass, resourceManagerClass, String[].class, String[].class, String[].class, String[].class, List.class, Properties.class),
classpathResourceManager,
sourceDirectories.toArray(new String[0]),
groovyDocTemplateInfo.defaultDocTemplates(),
groovyDocTemplateInfo.defaultPackageTemplates(),
groovyDocTemplateInfo.defaultClassTemplates(),
defaultDocTemplates == null ? groovyDocTemplateInfo.defaultDocTemplates() : defaultDocTemplates,
defaultPackageTemplates == null ? groovyDocTemplateInfo.defaultPackageTemplates() : defaultPackageTemplates,
defaultClassTemplates == null ? groovyDocTemplateInfo.defaultClassTemplates() : defaultClassTemplates,
groovyDocLinks,
docProperties
);
} else if (groovyAtLeast(GROOVY_1_5_2)) {
groovyDocTool = invokeConstructor(findConstructor(groovyDocToolClass, resourceManagerClass, String.class, String[].class, String[].class, String[].class, List.class),
classpathResourceManager,
sourceDirectories.get(0),
groovyDocTemplateInfo.defaultDocTemplates(),
groovyDocTemplateInfo.defaultPackageTemplates(),
groovyDocTemplateInfo.defaultClassTemplates(),
defaultDocTemplates == null ? groovyDocTemplateInfo.defaultDocTemplates() : defaultDocTemplates,
defaultPackageTemplates == null ? groovyDocTemplateInfo.defaultPackageTemplates() : defaultPackageTemplates,
defaultClassTemplates == null ? groovyDocTemplateInfo.defaultClassTemplates() : defaultClassTemplates,
groovyDocLinks
);
if (sourceDirectories.size() > 1) {
Expand All @@ -339,9 +363,9 @@ protected Object createGroovyDocTool(final Class<?> groovyDocToolClass, final Cl
groovyDocTool = invokeConstructor(findConstructor(groovyDocToolClass, resourceManagerClass, String.class, String[].class, String[].class, String[].class),
classpathResourceManager,
sourceDirectories.get(0),
groovyDocTemplateInfo.defaultDocTemplates(),
groovyDocTemplateInfo.defaultPackageTemplates(),
groovyDocTemplateInfo.defaultClassTemplates()
defaultDocTemplates == null ? groovyDocTemplateInfo.defaultDocTemplates() : defaultDocTemplates,
defaultPackageTemplates == null ? groovyDocTemplateInfo.defaultPackageTemplates() : defaultPackageTemplates,
defaultClassTemplates == null ? groovyDocTemplateInfo.defaultClassTemplates() : defaultClassTemplates
);
if (sourceDirectories.size() > 1) {
getLog().warn("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support more than one GroovyDoc source directory (must be 1.6-RC-2 or newer). Only using first source directory (" + sourceDirectories.get(0) + ").");
Expand Down

0 comments on commit 48ef0eb

Please sign in to comment.