Skip to content

Commit

Permalink
Added a sourcesPaths array tag that will add multiple Sources to the …
Browse files Browse the repository at this point in the history
…Cobertura ArgumentBuilder.

E.g.
            <sourcesPaths>
              <scourcesPath>${project.basedir}/src/main/groovy/</scourcesPath>
              <scourcesPath>${project.basedir}/src/main/java/</scourcesPath>
            </sourcesPaths>
Adds support for both groovy files and java files in a GMavenPlus Plugin default layout.
  • Loading branch information
Peter Frank committed May 22, 2017
1 parent 6f4e576 commit 601961a
Showing 1 changed file with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public abstract class AbstractReportMojo extends AbstractMojo {
@Parameter(defaultValue = "${project.basedir}/src/main/java/", required = false)
private String sourcesPath;

@Parameter(defaultValue = "${project.basedir}/src/main/java/", required = false)
private String[] sourcesPaths;

@Parameter(defaultValue = "UTF-8", required = false)
private String encoding;

Expand Down Expand Up @@ -139,6 +142,10 @@ protected String sourcesPath() {
return this.sourcesPath;
}

protected String[] sourcesPaths(){
return this.sourcesPaths;
}

protected String encoding() {
return this.encoding;
}
Expand All @@ -152,13 +159,21 @@ protected String[] formats() {
Arguments buildCoberturaReportArguments(final File sourcesDirectory, final File destinationDirectory, final File dataFile) {
getLog().debug("Building Cobertura report generation arguments");
final ArgumentsBuilder builder = new ArgumentsBuilder();
return builder.setBaseDirectory(sourcesDirectory.getAbsolutePath())
builder.setBaseDirectory(sourcesDirectory.getAbsolutePath())
.setDestinationDirectory(destinationDirectory.getAbsolutePath())
.setDataFile(dataFile.getAbsolutePath())
.setEncoding(encoding())
.calculateMethodComplexity(this.calculateMethodComplexity)
.addSources(sourcesPath, true)
.build();
.calculateMethodComplexity(this.calculateMethodComplexity);

if(sourcesPaths != null && sourcesPaths.length > 0) {
for (String sourcesPath : sourcesPaths) {
builder.addSources(sourcesPath, true);
}
}else{
builder.addSources(this.sourcesPath, true);
}

return builder.build();
}

}

0 comments on commit 601961a

Please sign in to comment.