You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by id...@apache.org on 2006/03/23 22:23:35 UTC

svn commit: r388273 - in /incubator/tobago/trunk/tobago-tool/maven-apt-plugin/src/main/java/org/apache/maven/plugin: AllSourcesInclusionScanner.java AptMojo.java

Author: idus
Date: Thu Mar 23 13:23:32 2006
New Revision: 388273

URL: http://svn.apache.org/viewcvs?rev=388273&view=rev
Log:
preparing code generation of tag classes

Added:
    incubator/tobago/trunk/tobago-tool/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AllSourcesInclusionScanner.java
Modified:
    incubator/tobago/trunk/tobago-tool/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AptMojo.java

Added: incubator/tobago/trunk/tobago-tool/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AllSourcesInclusionScanner.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-tool/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AllSourcesInclusionScanner.java?rev=388273&view=auto
==============================================================================
--- incubator/tobago/trunk/tobago-tool/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AllSourcesInclusionScanner.java (added)
+++ incubator/tobago/trunk/tobago-tool/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AllSourcesInclusionScanner.java Thu Mar 23 13:23:32 2006
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.maven.plugin;
+
+import org.codehaus.plexus.compiler.util.scan.AbstractSourceInclusionScanner;
+import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+
+public class AllSourcesInclusionScanner extends AbstractSourceInclusionScanner
+{
+    private Set sourceIncludes;
+    private Set sourceExcludes;
+
+    public AllSourcesInclusionScanner( Set sourceIncludes,
+                                       Set sourceExcludes )
+    {
+        this.sourceIncludes = sourceIncludes;
+        this.sourceExcludes = sourceExcludes;
+    }
+
+    public Set getIncludedSources( File sourceDir, File targetDir )
+        throws InclusionScanException
+    {
+        String[] sourceNames = scanForSources(sourceDir, sourceIncludes, sourceExcludes);
+        Set sources = new HashSet();
+        for ( int i = 0; i < sourceNames.length; i++ )
+        {
+            String path = sourceNames[i];
+            File sourceFile = new File( sourceDir, path );
+            sources.add(sourceFile);
+        }
+        return sources;
+    }
+}

Modified: incubator/tobago/trunk/tobago-tool/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AptMojo.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-tool/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AptMojo.java?rev=388273&r1=388272&r2=388273&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-tool/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AptMojo.java (original)
+++ incubator/tobago/trunk/tobago-tool/maven-apt-plugin/src/main/java/org/apache/maven/plugin/AptMojo.java Thu Mar 23 13:23:32 2006
@@ -86,6 +86,12 @@
      */
     private File outputDirectory;
 
+    /**
+     * Force apt call without staleness chhecking.
+     *
+     * @parameter default-value="false"
+     */
+    private boolean force;
 
     protected String getGenerated()
     {
@@ -110,7 +116,8 @@
     public void execute() throws MojoExecutionException
     {
         super.execute();
-        project.addCompileSourceRoot( getGenerated() );
+        project.addCompileSourceRoot( 
+            new File( project.getBasedir(), getGenerated() ).getPath() );
         Resource resource = new Resource();
         if ( resourceTargetPath != null )
         {
@@ -143,6 +150,12 @@
         {
             includes.add( "**/*.java" );
         }
+
+        if (force)
+        {
+            return new AllSourcesInclusionScanner(includes, excludes);
+        }
+
         scanner = new StaleSourceScanner( staleMillis, includes, excludes );
         if ( targetFiles!=null && targetFiles.size() > 0 )
         {