You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2007/02/24 19:53:49 UTC

svn commit: r511324 - /myfaces/tobago/trunk/tobago-tool/maven-apt-plugin/src/main/java/org/apache/myfaces/maven/plugin/AbstractAPTMojo.java

Author: bommel
Date: Sat Feb 24 10:53:49 2007
New Revision: 511324

URL: http://svn.apache.org/viewvc?view=rev&rev=511324
Log:
(TOBAGO-300) apt plugin doesn't set the sourcepath parameter of apt

Modified:
    myfaces/tobago/trunk/tobago-tool/maven-apt-plugin/src/main/java/org/apache/myfaces/maven/plugin/AbstractAPTMojo.java

Modified: myfaces/tobago/trunk/tobago-tool/maven-apt-plugin/src/main/java/org/apache/myfaces/maven/plugin/AbstractAPTMojo.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/maven-apt-plugin/src/main/java/org/apache/myfaces/maven/plugin/AbstractAPTMojo.java?view=diff&rev=511324&r1=511323&r2=511324
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/maven-apt-plugin/src/main/java/org/apache/myfaces/maven/plugin/AbstractAPTMojo.java (original)
+++ myfaces/tobago/trunk/tobago-tool/maven-apt-plugin/src/main/java/org/apache/myfaces/maven/plugin/AbstractAPTMojo.java Sat Feb 24 10:53:49 2007
@@ -340,7 +340,7 @@
             setStandards( cmd );
             setClasspath( cmd );
             List sourceFiles = new ArrayList();
-            if ( !setSourcepath( sourceFiles ) )
+            if ( !fillSourcelist( sourceFiles ) )
             {
                 if ( getLog().isDebugEnabled() )
                 {
@@ -560,6 +560,9 @@
         {
             cmdAdd( cmd, "-verbose" );
         }
+
+        // add sourcepath directory
+        setSourcepath(cmd);
         // add output directory
         try
         {
@@ -567,7 +570,7 @@
             {
                 getOutputDirectory().mkdirs();
             }
-            cmdAdd( cmd, "-d", quotedPathArgument( getOutputDirectory().getCanonicalPath() ) );
+            cmdAdd( cmd, "-d", getOutputDirectory().getCanonicalPath() );
         }
         catch ( Exception ex )
         {
@@ -576,13 +579,41 @@
         }
     }
 
+    private void setSourcepath(Commandline cmd) {
+        StringBuffer buffer = new StringBuffer();
+        for ( Iterator it = getCompileSourceRoots().iterator(); it.hasNext();)
+        {
+            buffer.append( it.next() );
+            if ( it.hasNext() )
+            {
+                buffer.append( PATH_SEPARATOR );
+            }
+        }
+        if ( getAptSourceRoots() != null)
+        {
+            if (buffer.length() > 0 && getAptSourceRoots().size() > 0)
+            {
+                buffer.append( PATH_SEPARATOR );
+            }
+            for ( Iterator it = getAptSourceRoots().iterator(); it.hasNext();)
+            {
+                buffer.append( it.next() );
+                if ( it.hasNext() )
+                {
+                    buffer.append( PATH_SEPARATOR );
+                }
+            }
+        }
+        cmdAdd( cmd, "-sourcepath", buffer.toString() );
+    }
+
   /**
    *
    * @param cmd
    * @return
    * @throws MojoExecutionException
    */
-    private boolean setSourcepath( List cmd ) throws MojoExecutionException
+    private boolean fillSourcelist( List cmd ) throws MojoExecutionException
     {
         boolean has = false;
         // sources ....