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 2006/10/07 10:40:09 UTC

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

Author: bommel
Date: Sat Oct  7 01:40:09 2006
New Revision: 453862

URL: http://svn.apache.org/viewvc?view=rev&rev=453862
Log:
[TOBAGO-139] Apt Plugin should support fork mode

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=453862&r1=453861&r2=453862
==============================================================================
--- 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 Oct  7 01:40:09 2006
@@ -83,6 +83,13 @@
      */
     protected List targetFiles;
 
+   /**
+     * enables resource filtering for generated resources
+     *
+     * @parameter    default-value="false"
+
+    protected boolean resourceFiltering;
+     */
     /**
      *  targetPath for generated resources
      *
@@ -241,6 +248,7 @@
             setStandards( cmd );
             setClasspath( cmd );
             List sourceFiles = new ArrayList();
+
             if( !setSourcepath( sourceFiles ) )
             {
                 if( getLog().isDebugEnabled() )
@@ -251,9 +259,12 @@
             }
             else
             {
-                if ( !sourceFiles.isEmpty() )
+
+                if ( fork)
                 {
-                     File file = new File( tempRoot, "files" );
+
+                     File file = new File( tempRoot , "files" );
+
                      if( !getLog().isDebugEnabled())
                      {
                          file.deleteOnExit();
@@ -262,7 +273,7 @@
                      {
                          FileUtils.fileWrite( file.getAbsolutePath(),
                                  StringUtils.join( sourceFiles.iterator(), "\n" ) );
-                         cmd.createArgument().setValue( "@" + file.getAbsoluteFile() );
+                         cmd.createArgument().setValue( "@files" );
                      }
 
                      catch ( IOException e )
@@ -270,6 +281,15 @@
                          throw new MojoExecutionException( "Unable to write temporary file for command execution", e );
                      }
                 }
+                else
+                {
+                    Iterator sourceIt = sourceFiles.iterator();
+                    while ( sourceIt.hasNext() )
+                    {
+                        cmdAdd(cmd, (String) sourceIt.next());
+                    }
+                }
+
 
 
             }
@@ -277,9 +297,9 @@
             {
                 if( getLog().isDebugEnabled() )
                 {
-                    getLog().debug( "Working dir: " + basedir.getAbsolutePath() );
+                    getLog().debug( "Working dir: " + tempRoot.getAbsolutePath() );
                 }
-                cmd.setWorkingDirectory( basedir.getAbsolutePath() );
+                cmd.setWorkingDirectory( tempRoot.getAbsolutePath() );
                 cmd.setExecutable( getAptPath() );
 
                 if( getLog().isDebugEnabled() )
@@ -444,7 +464,7 @@
             {
                 getOutputDirectory().mkdirs();
             }
-            cmdAdd( cmd, "-d", getOutputDirectory().getCanonicalPath() );
+            cmdAdd( cmd, "-d", quotedPathArgument(getOutputDirectory().getCanonicalPath()) );
         } catch ( Exception ex )
         {
             throw new MojoExecutionException( //
@@ -511,7 +531,7 @@
                 File src = (File) jt.next();
                 if( fork )
                 {
-                    cmd.add(quotedPathArgument( src.getAbsolutePath() ) );
+                    cmd.add( quotedPathArgument( src.getAbsolutePath() ) );
                 }
                 else
                 {