maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vmas...@apache.org
Subject svn commit: r327233 - in /maven/components/trunk/maven-plugins/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover: AbstractCloverMojo.java CloverCheckMojo.java CloverInstrumentMojo.java
Date Fri, 21 Oct 2005 18:20:23 GMT
Author: vmassol
Date: Fri Oct 21 11:20:17 2005
New Revision: 327233

URL: http://svn.apache.org/viewcvs?rev=327233&view=rev
Log:
First pass at fixing MNG-1136. This is still not working as the jdk config property is not
passed by the check mojo. Thus the jdk property is always null

Modified:
    maven/components/trunk/maven-plugins/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/AbstractCloverMojo.java
    maven/components/trunk/maven-plugins/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverCheckMojo.java
    maven/components/trunk/maven-plugins/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverInstrumentMojo.java

Modified: maven/components/trunk/maven-plugins/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/AbstractCloverMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/AbstractCloverMojo.java?rev=327233&r1=327232&r2=327233&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/AbstractCloverMojo.java
(original)
+++ maven/components/trunk/maven-plugins/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/AbstractCloverMojo.java
Fri Oct 21 11:20:17 2005
@@ -27,6 +27,14 @@
     private String licenseFile;
 
     /**
+     * Whether the Clover instrumentation should use the Clover <code>jdk14</code>
or
+     * <code>jdk15<code> flags to parse sources.
+     *
+     * @parameter
+     */
+    protected String jdk;
+    
+    /**
      * Registers the license file for Clover runtime by setting the
      * <code>clover.license.path</code> system property. If the <code>licenseFile</code>
      * property has not been defined by the user we look it up in the classpath in

Modified: maven/components/trunk/maven-plugins/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverCheckMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverCheckMojo.java?rev=327233&r1=327232&r2=327233&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverCheckMojo.java
(original)
+++ maven/components/trunk/maven-plugins/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverCheckMojo.java
Fri Oct 21 11:20:17 2005
@@ -39,13 +39,13 @@
      * @parameter expression="${project.build.directory}/clover/clover.db"
      * @required
      */
-    protected String cloverDatabase;
+    private String cloverDatabase;
 
     /**
      * @parameter default-value="70%"
      * @required
      */
-    protected String targetPercentage;
+    private String targetPercentage;
 
     public void execute()
         throws MojoExecutionException

Modified: maven/components/trunk/maven-plugins/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverInstrumentMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverInstrumentMojo.java?rev=327233&r1=327232&r2=327233&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverInstrumentMojo.java
(original)
+++ maven/components/trunk/maven-plugins/maven-clover-plugin/src/main/java/org/apache/maven/plugin/clover/CloverInstrumentMojo.java
Fri Oct 21 11:20:17 2005
@@ -23,6 +23,7 @@
 import org.apache.maven.project.MavenProject;
 
 import java.io.File;
+import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -149,11 +150,47 @@
      * @return the CLI args to be passed to CloverInstr
      * @todo handle multiple source roots. At the moment only the first source root is instrumented
      */
-    private String[] createCliArgs()
+    private String[] createCliArgs() throws MojoExecutionException
     {
-        // TODO: Temporary while we wait for surefire to be able to fork unit tests. See
-        // http://jira.codehaus.org/browse/MNG-441
-        return new String[]{"-p", "threaded", "-f", "100", "-i", this.cloverDatabase, "-s",
-            (String) this.project.getCompileSourceRoots().get( 0 ), "-d", this.cloverOutputSourceDirectory};
+        List parameters = new ArrayList();
+     
+        // TODO: The usage of the threaded flushpolicy model and a flush policy is temporary
while 
+        // we wait for surefire to be able to fork unit tests. See http://jira.codehaus.org/browse/MNG-441
+
+        parameters.add( "-p" );
+        parameters.add( "threaded" );
+        parameters.add( "-f" );
+        parameters.add( "100" );
+
+        parameters.add( "-i" );
+        parameters.add( this.cloverDatabase );
+        parameters.add( "-s" );
+
+        // TODO: Allow support for several source roots in the future.
+        parameters.add( (String) this.project.getCompileSourceRoots().get( 0 ) );
+
+        parameters.add( "-d" );
+        parameters.add( this.cloverOutputSourceDirectory );
+
+        if ( this.jdk != null )
+        {
+            if ( this.jdk.equals( "1.4" ) )
+            {
+                parameters.add( "-jdk14" );
+            }
+            else if ( this.jdk.equals( "1.5" ) )
+            {
+                parameters.add( "-jdk15" );
+            }
+            else
+            {
+                throw new MojoExecutionException("Unsupported jdk version [" + this.jdk 
+                    + "]. Valid values are [1.4] and [1.5]");
+            }
+        }
+        
+        getLog().debug( "Instrumenting using parameters [" + parameters.toString() + "]");
+        
+        return (String[]) parameters.toArray(new String[0]);
     }
 }



Mime
View raw message