aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Mandrikov <138671+Godin@users.noreply.github.com>2019-01-10 22:06:42 +0100
committerMarc R. Hoffmann <hoffmann@mountainminds.com>2019-01-10 22:06:42 +0100
commitee1324d7dd35de7781a452932fa4701d2f410c3f (patch)
tree3ed051ff272b4af943843ac51ffa69ffe3b350ae
parentdb5fefeb4c45b22c67b5a14a7fdf945050a2a6bf (diff)
downloadplatform_external_jacoco-ee1324d7dd35de7781a452932fa4701d2f410c3f.tar.gz
platform_external_jacoco-ee1324d7dd35de7781a452932fa4701d2f410c3f.tar.bz2
platform_external_jacoco-ee1324d7dd35de7781a452932fa4701d2f410c3f.zip
Remove misleading parameters of jacoco-maven-plugin goals (#827)
-rw-r--r--jacoco-maven-plugin/src/org/jacoco/maven/AbstractAgentMojo.java30
-rw-r--r--jacoco-maven-plugin/src/org/jacoco/maven/AbstractJacocoMojo.java36
-rw-r--r--jacoco-maven-plugin/src/org/jacoco/maven/CheckMojo.java17
-rw-r--r--jacoco-maven-plugin/src/org/jacoco/maven/InstrumentMojo.java17
-rw-r--r--org.jacoco.doc/docroot/doc/changes.html5
5 files changed, 58 insertions, 47 deletions
diff --git a/jacoco-maven-plugin/src/org/jacoco/maven/AbstractAgentMojo.java b/jacoco-maven-plugin/src/org/jacoco/maven/AbstractAgentMojo.java
index 1d3f34e6..cc85b7f7 100644
--- a/jacoco-maven-plugin/src/org/jacoco/maven/AbstractAgentMojo.java
+++ b/jacoco-maven-plugin/src/org/jacoco/maven/AbstractAgentMojo.java
@@ -12,6 +12,7 @@
package org.jacoco.maven;
import java.io.File;
+import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -57,6 +58,21 @@ public abstract class AbstractAgentMojo extends AbstractJacocoMojo {
*/
@Parameter(property = "jacoco.append")
Boolean append;
+
+ /**
+ * A list of class names to include in instrumentation. May use wildcard
+ * characters (* and ?). When not specified everything will be included.
+ */
+ @Parameter
+ private List<String> includes;
+
+ /**
+ * A list of class names to exclude from instrumentation. May use wildcard
+ * characters (* and ?). When not specified nothing will be excluded.
+ */
+ @Parameter
+ private List<String> excludes;
+
/**
* A list of class loader names, that should be excluded from execution
* analysis. The list entries are separated by a colon (:) and may use
@@ -168,15 +184,13 @@ public abstract class AbstractAgentMojo extends AbstractJacocoMojo {
if (append != null) {
agentOptions.setAppend(append.booleanValue());
}
- if (getIncludes() != null && !getIncludes().isEmpty()) {
- final String agentIncludes = StringUtils.join(getIncludes()
- .iterator(), ":");
- agentOptions.setIncludes(agentIncludes);
+ if (includes != null && !includes.isEmpty()) {
+ agentOptions
+ .setIncludes(StringUtils.join(includes.iterator(), ":"));
}
- if (getExcludes() != null && !getExcludes().isEmpty()) {
- final String agentExcludes = StringUtils.join(getExcludes()
- .iterator(), ":");
- agentOptions.setExcludes(agentExcludes);
+ if (excludes != null && !excludes.isEmpty()) {
+ agentOptions
+ .setExcludes(StringUtils.join(excludes.iterator(), ":"));
}
if (exclClassLoaders != null) {
agentOptions.setExclClassloader(exclClassLoaders);
diff --git a/jacoco-maven-plugin/src/org/jacoco/maven/AbstractJacocoMojo.java b/jacoco-maven-plugin/src/org/jacoco/maven/AbstractJacocoMojo.java
index d1612ab6..3ed86ec0 100644
--- a/jacoco-maven-plugin/src/org/jacoco/maven/AbstractJacocoMojo.java
+++ b/jacoco-maven-plugin/src/org/jacoco/maven/AbstractJacocoMojo.java
@@ -11,8 +11,6 @@
*******************************************************************************/
package org.jacoco.maven;
-import java.util.List;
-
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -31,22 +29,6 @@ public abstract class AbstractJacocoMojo extends AbstractMojo {
private MavenProject project;
/**
- * A list of class files to include in instrumentation/analysis/reports. May
- * use wildcard characters (* and ?). When not specified everything will be
- * included.
- */
- @Parameter
- private List<String> includes;
-
- /**
- * A list of class files to exclude from instrumentation/analysis/reports.
- * May use wildcard characters (* and ?). When not specified nothing will be
- * excluded.
- */
- @Parameter
- private List<String> excludes;
-
- /**
* Flag used to suppress execution.
*/
@Parameter(property = "jacoco.skip", defaultValue = "false")
@@ -90,22 +72,4 @@ public abstract class AbstractJacocoMojo extends AbstractMojo {
return project;
}
- /**
- * Returns the list of class files to include.
- *
- * @return class files to include, may contain wildcard characters
- */
- protected List<String> getIncludes() {
- return includes;
- }
-
- /**
- * Returns the list of class files to exclude.
- *
- * @return class files to exclude, may contain wildcard characters
- */
- protected List<String> getExcludes() {
- return excludes;
- }
-
}
diff --git a/jacoco-maven-plugin/src/org/jacoco/maven/CheckMojo.java b/jacoco-maven-plugin/src/org/jacoco/maven/CheckMojo.java
index ad021b37..3b46f8ed 100644
--- a/jacoco-maven-plugin/src/org/jacoco/maven/CheckMojo.java
+++ b/jacoco-maven-plugin/src/org/jacoco/maven/CheckMojo.java
@@ -128,6 +128,20 @@ public class CheckMojo extends AbstractJacocoMojo implements IViolationsOutput {
@Parameter(defaultValue = "${project.build.directory}/jacoco.exec")
private File dataFile;
+ /**
+ * A list of class files to include into analysis. May use wildcard
+ * characters (* and ?). When not specified everything will be included.
+ */
+ @Parameter
+ private List<String> includes;
+
+ /**
+ * A list of class files to exclude from analysis. May use wildcard
+ * characters (* and ?). When not specified nothing will be excluded.
+ */
+ @Parameter
+ private List<String> excludes;
+
private boolean violations;
private boolean canCheckCoverage() {
@@ -169,8 +183,7 @@ public class CheckMojo extends AbstractJacocoMojo implements IViolationsOutput {
try {
final IReportVisitor visitor = support.initRootVisitor();
support.loadExecutionData(dataFile);
- support.processProject(visitor, getProject(), this.getIncludes(),
- this.getExcludes());
+ support.processProject(visitor, getProject(), includes, excludes);
visitor.visitEnd();
} catch (final IOException e) {
throw new MojoExecutionException(
diff --git a/jacoco-maven-plugin/src/org/jacoco/maven/InstrumentMojo.java b/jacoco-maven-plugin/src/org/jacoco/maven/InstrumentMojo.java
index c74cf6bb..df31b930 100644
--- a/jacoco-maven-plugin/src/org/jacoco/maven/InstrumentMojo.java
+++ b/jacoco-maven-plugin/src/org/jacoco/maven/InstrumentMojo.java
@@ -23,6 +23,7 @@ import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
import org.jacoco.core.instr.Instrumenter;
@@ -44,6 +45,20 @@ import org.jacoco.core.runtime.OfflineInstrumentationAccessGenerator;
@Mojo(name = "instrument", defaultPhase = LifecyclePhase.PROCESS_CLASSES, threadSafe = true)
public class InstrumentMojo extends AbstractJacocoMojo {
+ /**
+ * A list of class files to include in instrumentation. May use wildcard
+ * characters (* and ?). When not specified everything will be included.
+ */
+ @Parameter
+ private List<String> includes;
+
+ /**
+ * A list of class files to exclude from instrumentation. May use wildcard
+ * characters (* and ?). When not specified nothing will be excluded.
+ */
+ @Parameter
+ private List<String> excludes;
+
@Override
public void executeMojo() throws MojoExecutionException,
MojoFailureException {
@@ -61,7 +76,7 @@ public class InstrumentMojo extends AbstractJacocoMojo {
final List<String> fileNames;
try {
- fileNames = new FileFilter(this.getIncludes(), this.getExcludes())
+ fileNames = new FileFilter(includes, excludes)
.getFileNames(classesDir);
} catch (final IOException e1) {
throw new MojoExecutionException(
diff --git a/org.jacoco.doc/docroot/doc/changes.html b/org.jacoco.doc/docroot/doc/changes.html
index 9b535b0f..c2cd337e 100644
--- a/org.jacoco.doc/docroot/doc/changes.html
+++ b/org.jacoco.doc/docroot/doc/changes.html
@@ -59,6 +59,11 @@
<li><code>synthetic</code> methods that represent Kotlin <code>suspend</code>
functions should not be ignored
(GitHub <a href="https://github.com/jacoco/jacoco/issues/804">#804</a>).</li>
+ <li>Removed misleading parameters <code>includes</code> and
+ <code>excludes</code> from <code>dump</code>, <code>merge</code> and
+ <code>restore-instrumented-classes</code> goals of jacoco-maven-plugin,
+ because they have no effect
+ (GitHub <a href="https://github.com/jacoco/jacoco/issues/827">#827</a>).</li>
</ul>
<h3>Non-functional Changes</h3>