Author: lcorneliussen
Date: Tue May  8 19:08:14 2012
New Revision: 1335701

URL: http://svn.apache.org/viewvc?rev=1335701&view=rev
Log:
[NPANDAY-210, NPANDAY-418, NPANDAY-582] Deprecate includeSources in favor of 
include/exclude patterns + More

o now including the sources directly without copying them
o handling additional source directories
o make test and compile sources exclude each other if in the same dir

Modified:
    
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/CompilerConfig.java
    
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/CompilerContext.java
    
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/BaseCompiler.java
    
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DefaultCompiler.java
    
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DotGNUCompiler.java
    
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/NemerleCompiler.java
    
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/PhpCompiler.java
    
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/RubyCompiler.java
    
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerContextImpl.java
    
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AbstractCompilerMojo.java
    
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/CompilerMojo.java
    
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/SourceProcessorMojo.java
    
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/TestCompilerMojo.java
    
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/TestSourceProcessorMojo.java

Modified: 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/CompilerConfig.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/CompilerConfig.java?rev=1335701&r1=1335700&r2=1335701&view=diff
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/CompilerConfig.java
 (original)
+++ 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/CompilerConfig.java
 Tue May  8 19:08:14 2012
@@ -42,12 +42,24 @@ public class CompilerConfig
 
     private File localRepository;
 
-    private List<String> includeSources;
+    private List<String> deprecatedIncludeSourcesConfiguration;
 
     private File outputDirectory;
 
     private File assemblyPath;
 
+    private String[] includes;
+
+    private String[] excludes;
+
+    private String[] testIncludes;
+
+    private String[] testExcludes;
+
+    private String language;
+
+    private String languageFileExtension;
+
 
     /**
      * The target artifact for the compile: library, module, exe, winexe or 
nar.
@@ -131,21 +143,21 @@ public class CompilerConfig
 
 
     /**
-     * Sets Include Sources
+     * @deprecated Rather use setSourceExcludes + setSourceIncludes!
      *
-     * @param includeSources sources file List
+     * @param deprecatedIncludeSourcesConfiguration sources file List
      */
-    public void setIncludeSources( List<String> includeSources )
+    public void setDeprecatedIncludeSourcesConfiguration( List<String> 
deprecatedIncludeSourcesConfiguration )
     {
-        this.includeSources = includeSources;
+        this.deprecatedIncludeSourcesConfiguration = 
deprecatedIncludeSourcesConfiguration;
     }
 
     /**
      * Gets Include Sources
      */
-    public List<String> getIncludeSources()
+    public List<String> getDeprecatedIncludeSourcesConfiguration()
     {
-        return includeSources;
+        return deprecatedIncludeSourcesConfiguration;
     }
 
     /**
@@ -181,4 +193,48 @@ public class CompilerConfig
     {
         return assemblyPath;
     }
+
+    public void setSourcePatterns( String[] includes, String[] excludes, 
String[] testIncludes, String[] testExcludes)
+    {
+        this.includes = includes;
+        this.excludes = excludes;
+        this.testIncludes = testIncludes;
+        this.testExcludes = testExcludes;
+    }
+
+    public String[] getIncludes()
+    {
+        return includes;
+    }
+
+    public String[] getExcludes()
+    {
+        return excludes;
+    }
+
+    public String[] getTestIncludes()
+    {
+        return testIncludes;
+    }
+
+    public String[] getTestExcludes()
+    {
+        return testExcludes;
+    }
+
+    public void setLanguage( String language, String languageFileExtension )
+    {
+       this.language = language;
+        this.languageFileExtension = languageFileExtension;
+    }
+
+    public String getLanguage()
+    {
+        return language;
+    }
+
+    public String getLanguageFileExtension()
+    {
+        return languageFileExtension;
+    }
 }

Modified: 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/CompilerContext.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/CompilerContext.java?rev=1335701&r1=1335700&r2=1335701&view=diff
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/CompilerContext.java
 (original)
+++ 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/CompilerContext.java
 Tue May  8 19:08:14 2012
@@ -29,6 +29,7 @@ import org.apache.maven.project.MavenPro
 
 import java.io.File;
 import java.util.List;
+import java.util.Set;
 
 /**
  * Interface defining compiler services.
@@ -97,14 +98,6 @@ public interface CompilerContext
      */
     List<Artifact> getModuleDependencies();
 
-    /**
-     * Returns the source directory (or test source directory) path of the 
class files. These are defined in the pom.xml
-     * by the properties ${build.sourceDirectory} or 
${build.testSourceDirectory}.
-     *
-     * @return Returns the source directory (or test source directory) path of 
the class files.
-     */
-    String getSourceDirectoryName();
-    
     File getTargetDirectory();
 
     /**
@@ -189,7 +182,7 @@ public interface CompilerContext
     /**
      * The list of sources to be included in the compilation.
      */
-    List<String> getIncludeSources();
+    Set<File> expandIncludedSourceFiles();
 
     /**
      * The directory to store the compile output too.

Modified: 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/BaseCompiler.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/BaseCompiler.java?rev=1335701&r1=1335700&r2=1335701&view=diff
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/BaseCompiler.java
 (original)
+++ 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/BaseCompiler.java
 Tue May  8 19:08:14 2012
@@ -105,15 +105,6 @@ abstract class BaseCompiler
      */
     public ExecutionResult execute() throws ExecutionException, 
PlatformUnsupportedException
     {
-        if ( compilerContext.getIncludeSources() == null && !(
-            new File(
-                compilerContext.getSourceDirectoryName()
-            ).exists()
-        ) )
-        {
-            logger.info( "NPANDAY-068-002: No source files to compile." );
-            return null;
-        }
         logger.info(
             "NPANDAY-068-003: Compiling Artifact: Vendor = " + 
compilerContext.getVendor() + ", Language = "
                 + compilerContext.getVendor() + ", Assembly Name = " + 
compilerContext.getArtifact().getAbsolutePath()

Modified: 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DefaultCompiler.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DefaultCompiler.java?rev=1335701&r1=1335700&r2=1335701&view=diff
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DefaultCompiler.java
 (original)
+++ 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DefaultCompiler.java
 Tue May  8 19:08:14 2012
@@ -33,6 +33,7 @@ import java.util.Arrays;
 import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 
 /**
  * A default compiler that can be used in most cases.
@@ -67,7 +68,6 @@ public final class DefaultCompiler
         List<Artifact> references = 
compilerContext.getDirectLibraryDependencies();
         List<Artifact> modules = compilerContext.getDirectModuleDependencies();
 
-        String sourceDirectory = compilerContext.getSourceDirectoryName();
         String artifactFilePath = 
compilerContext.getArtifact().getAbsolutePath();
         String targetArtifactType = 
compilerContext.getTargetArtifactType().getTargetCompileType();
 
@@ -92,10 +92,6 @@ public final class DefaultCompiler
 
 
         commands.add( "/target:" + targetArtifactType );
-        if(compilerContext.getIncludeSources() == null || 
compilerContext.getIncludeSources().isEmpty() )
-        {
-            commands.add( "/recurse:" + sourceDirectory + File.separator + 
"**");
-        }
         if ( modules != null && !modules.isEmpty() )
         {
             StringBuffer sb = new StringBuffer();
@@ -272,50 +268,13 @@ public final class DefaultCompiler
 
         FileUtils.mkdir(TempDir);
 
-        // TODO: move includeSources expansion to the compiler context (handle 
excludes there)
-        if(compilerContext.getIncludeSources() != null && 
!compilerContext.getIncludeSources().isEmpty() )
+        Set<File> sourceFiles = compilerContext.expandIncludedSourceFiles();
+        if( sourceFiles != null && !sourceFiles.isEmpty() )
         {
-            int folderCtr=0;
-            for(String includeSource : compilerContext.getIncludeSources())
+            for(File includeSource : sourceFiles )
             {
-
-                String[] sourceTokens = includeSource.replace('\\', 
'/').split("/");
-
-                String lastToken = sourceTokens[sourceTokens.length-1];
-
-                if(fileExt=="")
-                {
-
-                    String[] extToken = lastToken.split( "\\." );
-                    fileExt = "."+extToken[extToken.length-1];
-                }
-
-                try
-                {
-                    String fileToCheck = TempDir+File.separator+lastToken;
-                    if(FileUtils.fileExists( fileToCheck ))
-                    {
-                        String subTempDir = 
TempDir+File.separator+folderCtr+File.separator;
-                        FileUtils.mkdir( subTempDir );
-                        FileUtils.copyFileToDirectory( includeSource, 
subTempDir);
-                        folderCtr++;
-
-                    }
-                    else
-                    {
-                        FileUtils.copyFileToDirectory( includeSource, TempDir);
-                    }
-                }
-                catch(Exception e)
-                {
-                    System.out.println(e.getMessage());
-                }
-                //part of original code.
-                //filteredCommands.add(includeSource);
+                filteredCommands.add(includeSource.getAbsolutePath());
             }
-            String recurseCmd = "/recurse:" + TempDir+File.separator + "*" + 
fileExt + "";
-            filteredCommands.add(recurseCmd);
-
         }
         if ( logger.isDebugEnabled() )
         {

Modified: 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DotGNUCompiler.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DotGNUCompiler.java?rev=1335701&r1=1335700&r2=1335701&view=diff
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DotGNUCompiler.java
 (original)
+++ 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/DotGNUCompiler.java
 Tue May  8 19:08:14 2012
@@ -26,6 +26,7 @@ import java.io.File;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 
 /**
  * Compiler for DotGNU.
@@ -50,14 +51,12 @@ public final class DotGNUCompiler
         List<Artifact> resources = compilerContext.getLibraryDependencies();
         List<Artifact> modules = compilerContext.getDirectModuleDependencies();
 
-        String sourceDirectory = compilerContext.getSourceDirectoryName();
         String artifactFilePath = 
compilerContext.getArtifact().getAbsolutePath();
         String targetArtifactType = 
compilerContext.getTargetArtifactType().getTargetCompileType();
 
         List<String> commands = new ArrayList<String>();
         commands.add( "/out:" + artifactFilePath );
         commands.add( "/target:" + targetArtifactType );
-        commands.add( "/recurse:" + sourceDirectory + File.separator + "**" );
         if ( !modules.isEmpty() )
         {
             StringBuffer sb = new StringBuffer();
@@ -89,6 +88,17 @@ public final class DotGNUCompiler
         {
             commands.addAll( compilerContext.getCommands() );
         }
+
+        Set<File> sourceFiles = compilerContext.expandIncludedSourceFiles();
+        if( sourceFiles != null && !sourceFiles.isEmpty() )
+        {
+            for(File includeSource : sourceFiles )
+            {
+                // TODO: consider relative paths
+                commands.add(includeSource.getAbsolutePath());
+            }
+        }
+
         //TODO: Apply command filter
         return commands;
     }

Modified: 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/NemerleCompiler.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/NemerleCompiler.java?rev=1335701&r1=1335700&r2=1335701&view=diff
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/NemerleCompiler.java
 (original)
+++ 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/NemerleCompiler.java
 Tue May  8 19:08:14 2012
@@ -23,8 +23,10 @@ import npanday.executable.ExecutionExcep
 import org.apache.maven.artifact.Artifact;
 import org.codehaus.plexus.util.FileUtils;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
 
 
 /**
@@ -48,7 +50,6 @@ public final class NemerleCompiler
         List<Artifact> resources = compilerContext.getLibraryDependencies();
         List<Artifact> modules = compilerContext.getDirectModuleDependencies();
 
-        String sourceDirectory = compilerContext.getSourceDirectoryName();
         String artifactFilePath = 
compilerContext.getArtifact().getAbsolutePath();
         String targetArtifactType = 
compilerContext.getTargetArtifactType().getTargetCompileType();
 
@@ -74,11 +75,17 @@ public final class NemerleCompiler
                 commands.add( "/reference:" + path );
             }
         }
-        String[] files = FileUtils.getFilesFromExtension( sourceDirectory, new 
String[]{"n"} );
-        for ( String file : files )
+
+        Set<File> sourceFiles = compilerContext.expandIncludedSourceFiles();
+        if( sourceFiles != null && !sourceFiles.isEmpty() )
         {
-            commands.add( file );
+            for(File includeSource : sourceFiles )
+            {
+                // TODO: consider relative paths
+                commands.add( includeSource.getAbsolutePath() );
+            }
         }
+
         commands.addAll( compilerContext.getCommands() );
         return commands;
     }

Modified: 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/PhpCompiler.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/PhpCompiler.java?rev=1335701&r1=1335700&r2=1335701&view=diff
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/PhpCompiler.java
 (original)
+++ 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/PhpCompiler.java
 Tue May  8 19:08:14 2012
@@ -43,30 +43,7 @@ public final class PhpCompiler
     public List<String> getCommands()
         throws ExecutionException
     {
-        List<Artifact> resources = compilerContext.getLibraryDependencies();
-
-        String sourceDirectory = compilerContext.getSourceDirectoryName();
-        String artifactFilePath = 
compilerContext.getArtifact().getAbsolutePath();
-        String targetArtifactType = 
compilerContext.getTargetArtifactType().getTargetCompileType();
-
-        List<String> commands = new ArrayList<String>();
-        commands.add( "/out:" + artifactFilePath );
-        commands.add( "/target:" + targetArtifactType );
-
-        if ( !resources.isEmpty() )
-        {
-            for ( Artifact artifact : resources )
-            {
-                String path = artifact.getFile().getAbsolutePath();
-                commands.add( "/reference:" + path );
-            }
-        }
-        String[] files = FileUtils.getFilesFromExtension( sourceDirectory, new 
String[]{"php"} );
-        for ( String file : files )
-        {
-            commands.add( file );
-        }
-        return commands;
+        throw new ExecutionException( "NPANDAY-162-001: Php support has been 
discontinued" );
     }
 
 }

Modified: 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/RubyCompiler.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/RubyCompiler.java?rev=1335701&r1=1335700&r2=1335701&view=diff
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/RubyCompiler.java
 (original)
+++ 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/RubyCompiler.java
 Tue May  8 19:08:14 2012
@@ -44,28 +44,7 @@ public final class RubyCompiler
     public List<String> getCommands()
         throws ExecutionException
     {
-        if ( compilerContext == null )
-        {
-            throw new ExecutionException( "NPANDAY-068-000: Compiler has not 
been initialized with a context" );
-        }
-        List<String> commands = new ArrayList<String>();
-
-        String sourceDirectory = compilerContext.getSourceDirectoryName();
-        File srcDir = new File( sourceDirectory );
-        commands.add( "--" + 
compilerContext.getTargetArtifactType().getExtension() );
-        for ( String command : compilerContext.getCommands() )
-        {
-            if ( command.startsWith( "main:" ) )
-            {   String className = command.split( "[:]" )[1];
-                File classFile = new File("target/build-sources/" + className);
-                commands.add( "'" + classFile.getAbsolutePath() + "'");
-            }
-            else
-            {
-                commands.add( command );
-            }
-        }
-        return commands;
+        throw new ExecutionException( "NPANDAY-068-001: Ruby support has been 
discontinued" );
     }
 
 }

Modified: 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerContextImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerContextImpl.java?rev=1335701&r1=1335700&r2=1335701&view=diff
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerContextImpl.java
 (original)
+++ 
incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerContextImpl.java
 Tue May  8 19:08:14 2012
@@ -20,12 +20,13 @@ package npanday.executable.impl;
  */
 
 import com.google.common.base.Objects;
+import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
 import npanday.ArtifactType;
 import npanday.ArtifactTypeHelper;
 import npanday.PlatformUnsupportedException;
 import npanday.RepositoryNotFoundException;
-import npanday.executable.CommandExecutor;
 import npanday.executable.ExecutionException;
 import npanday.executable.compiler.CompilerCapability;
 import npanday.executable.compiler.CompilerConfig;
@@ -53,8 +54,6 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
-import static com.google.common.base.Preconditions.checkArgument;
-
 /**
  * Provides an implementation of the Compiler Context.
  *
@@ -65,6 +64,9 @@ public final class CompilerContextImpl
     extends ExecutableContextImpl
     implements CompilerContext, LogEnabled
 {
+
+    private String NEW_LINE = System.getProperty( "line.separator" );
+
     /**
      * The maven project
      */
@@ -196,9 +198,10 @@ public final class CompilerContextImpl
 
     public KeyInfo getKeyInfo()
     {
-        if ( ( compilerCapability.getVendorInfo().getVendor().equals( 
Vendor.MICROSOFT )
-            && 
compilerCapability.getVendorInfo().getFrameworkVersion().equals( "1.1.4322" ) )
-            || config.getKeyInfo() == null )
+        if ( (
+            compilerCapability.getVendorInfo().getVendor().equals( 
Vendor.MICROSOFT )
+                && 
compilerCapability.getVendorInfo().getFrameworkVersion().equals( "1.1.4322" )
+        ) || config.getKeyInfo() == null )
         {
             return KeyInfo.Factory.createDefaultKeyInfo();
         }
@@ -217,11 +220,15 @@ public final class CompilerContextImpl
 
     private void addProjectArtifactForTestCompile( List<Artifact> libraries )
     {
-        if ( config.isTestCompile() && ( ArtifactTypeHelper.isDotnetLibrary( 
config.getArtifactType() )
-            || ArtifactTypeHelper.isDotnetMavenPlugin( 
config.getArtifactType() ) )
-            && project.getArtifact().getFile() != null && 
project.getArtifact().getFile().exists()
-            && !libraries.contains( project.getArtifact() ) && 
!ArtifactTypeHelper.isDotnetModule(
-            project.getArtifact().getType() ) )
+        if ( config.isTestCompile() && (
+            ArtifactTypeHelper.isDotnetLibrary( config.getArtifactType() ) || 
ArtifactTypeHelper.isDotnetMavenPlugin(
+                config.getArtifactType()
+            )
+        ) && project.getArtifact().getFile() != null && 
project.getArtifact().getFile().exists() && !libraries.contains(
+            project.getArtifact()
+        ) && !ArtifactTypeHelper.isDotnetModule(
+            project.getArtifact().getType()
+        ) )
         {
             libraries.add( project.getArtifact() );
         }
@@ -233,14 +240,15 @@ public final class CompilerContextImpl
         {
             Artifact artifact = (Artifact) i.next();
 
-            if (!new ScopeArtifactFilter( isTestCompile() ? "test" : "compile" 
).include( artifact ))
+            if ( !new ScopeArtifactFilter( isTestCompile() ? "test" : 
"compile" ).include( artifact ) )
+            {
                 continue;
+            }
 
             // TODO: use isAddedToClassPath instead? May need to annotate types
-            if (
-                !ArtifactTypeHelper.isDotnetLibrary( artifact.getType() )
-                && !ArtifactTypeHelper.isDotnetExecutable( artifact.getType() )
-                && !ArtifactTypeHelper.isDotnetAnyGac( artifact.getType() ) )
+            if ( !ArtifactTypeHelper.isDotnetLibrary( artifact.getType() ) && 
!ArtifactTypeHelper.isDotnetExecutable(
+                artifact.getType()
+            ) && !ArtifactTypeHelper.isDotnetAnyGac( artifact.getType() ) )
             {
                 continue;
             }
@@ -254,9 +262,11 @@ public final class CompilerContextImpl
             for ( Iterator j = project.getDependencies().iterator(); 
j.hasNext() && !found; )
             {
                 Dependency dependency = (Dependency) j.next();
-                if ( dependency.getGroupId().equals( artifact.getGroupId() )
-                    && dependency.getArtifactId().equals( 
artifact.getArtifactId() ) && dependency.getVersion().equals(
-                    artifact.getBaseVersion() ) )
+                if ( dependency.getGroupId().equals( artifact.getGroupId() ) 
&& dependency.getArtifactId().equals(
+                    artifact.getArtifactId()
+                ) && dependency.getVersion().equals(
+                    artifact.getBaseVersion()
+                ) )
                 {
                     found = true;
                 }
@@ -303,11 +313,11 @@ public final class CompilerContextImpl
         return compilerCapability;
     }
 
-    public String getSourceDirectoryName()
+    public File getGeneratedSourcesDirectory()
     {
         return ( config.isTestCompile() )
-            ? project.getBuild().getDirectory() + File.separator + 
"build-test-sources"
-            : project.getBuild().getDirectory() + File.separator + 
"build-sources";
+            ? new File( project.getBuild().getDirectory(), 
"build-test-sources" )
+            : new File( project.getBuild().getDirectory(), "build-sources" );
     }
 
     public File getTargetDirectory()
@@ -322,8 +332,7 @@ public final class CompilerContextImpl
      * @return
      * @throws InvalidArtifactException
      */
-    public File getArtifact()
-        throws InvalidArtifactException
+    public File getArtifact() throws InvalidArtifactException
     {
         ArtifactType artifactType = config.getArtifactType();
         if ( artifactType == null || artifactType.equals( ArtifactType.NULL ) )
@@ -331,7 +340,8 @@ public final class CompilerContextImpl
             throw new InvalidArtifactException( "NPANDAY-061-001: Artifact 
Type cannot be null" );
         }
 
-        //TODO: The test-plugin has a dependency on this fileName/dir. If we 
change it here, it will break the plugin. Fix this encapsulation issue.
+        //TODO: The test-plugin has a dependency on this fileName/dir. If we 
change it here,
+        // it will break the plugin. Fix this encapsulation issue.
         String fileName = ( config.isTestCompile() )
             ? project.getBuild().getDirectory() + File.separator + 
project.getArtifactId() + "-test.dll"
             : project.getBuild().getDirectory() + File.separator + 
project.getArtifactId() + "."
@@ -339,26 +349,25 @@ public final class CompilerContextImpl
         return new File( fileName );
     }
 
-    public CompilerExecutable getCompilerExecutable()
-        throws ExecutionException
+    public CompilerExecutable getCompilerExecutable() throws ExecutionException
     {
-        return (CompilerExecutable)getNetExecutable();
+        return (CompilerExecutable) getNetExecutable();
     }
 
-    public Repository find( String repositoryName )
-        throws RepositoryNotFoundException
+    public Repository find( String repositoryName ) throws 
RepositoryNotFoundException
     {
         Repository repository = repositoryRegistry.find( repositoryName );
         if ( repository == null )
         {
             throw new RepositoryNotFoundException(
-                "NPANDAY-061-002: Could not find repository: Name = " + 
repositoryName );
+                "NPANDAY-061-002: Could not find repository: Name = " + 
repositoryName
+            );
         }
         return repository;
     }
 
-    public void init( CompilerCapability capability, CompilerConfig config, 
MavenProject project )
-        throws PlatformUnsupportedException
+    public void init( CompilerCapability capability, CompilerConfig config, 
MavenProject project ) throws
+        PlatformUnsupportedException
     {
 
         this.project = project;
@@ -384,10 +393,14 @@ public final class CompilerContextImpl
                 {
                     modules.add( artifact );
                 }
-                else if ( ( artifactType != ArtifactType.NULL && (
-                    StringUtils.equals( artifactType.getTargetCompileType(), 
"library" )
-                        || artifactType.getExtension().equals( "dll" ) || 
artifactType.getExtension().equals(
-                        "exe" ) ) ) || type.equals( "jar" ) )
+                else if ( (
+                    artifactType != ArtifactType.NULL && (
+                        StringUtils.equals( 
artifactType.getTargetCompileType(), "library" )
+                            || artifactType.getExtension().equals( "dll" ) || 
artifactType.getExtension().equals(
+                            "exe"
+                        )
+                    )
+                ) || type.equals( "jar" ) )
                 {
                     libraries.add( artifact );
                 }
@@ -397,9 +410,13 @@ public final class CompilerContextImpl
                     moveInteropDllToBuildDirectory( artifact );
                     libraries.add( artifact );
                 }
-                else if ( ( artifactType != null && ( "library".equals( 
artifactType.getTargetCompileType() )
-                    || "dll".equals( artifactType.getExtension() ) || 
"exe".equals( artifactType.getExtension() ) ) )
-                    || "jar".equals( type ) )
+                else if ( (
+                    artifactType != null && (
+                        "library".equals( artifactType.getTargetCompileType() 
) || "dll".equals(
+                            artifactType.getExtension()
+                        ) || "exe".equals( artifactType.getExtension() )
+                    )
+                ) || "jar".equals( type ) )
                 {
                     libraries.add( artifact );
                 }
@@ -409,11 +426,12 @@ public final class CompilerContextImpl
 
         String basedir = project.getBuild().getDirectory() + File.separator + 
"assembly-resources" + File.separator;
         linkedResources = new File( basedir, "linkresource" ).exists() ? 
Arrays.asList(
-            new File( basedir, "linkresource" ).listFiles() ) : new 
ArrayList<File>();
+            new File( basedir, "linkresource" ).listFiles()
+        ) : new ArrayList<File>();
         getEmbeddedResources( new File( basedir, "resource" ) );
-        win32resources = new File( basedir, "win32res" ).exists()
-            ? Arrays.asList( new File( basedir, "win32res" ).listFiles() )
-            : new ArrayList<File>();
+        win32resources = new File( basedir, "win32res" ).exists() ? 
Arrays.asList(
+            new File( basedir, "win32res" ).listFiles()
+        ) : new ArrayList<File>();
         File win32IconDir = new File( basedir, "win32icon" );
         if ( win32IconDir.exists() )
         {
@@ -421,8 +439,8 @@ public final class CompilerContextImpl
             if ( icons.length > 1 )
             {
                 throw new PlatformUnsupportedException(
-                    "NPANDAY-061-007: There is more than one win32icon in 
resource directory: Number = "
-                        + icons.length );
+                    "NPANDAY-061-007: There is more than one win32icon in 
resource directory: Number = " + icons.length
+                );
             }
             if ( icons.length == 1 )
             {
@@ -431,10 +449,215 @@ public final class CompilerContextImpl
         }
     }
 
-    public List<String> getIncludeSources()
+    public Set<File> expandIncludedSourceFiles()
+    {
+        Set<File> files = Sets.newHashSet();
+        if ( config.getDeprecatedIncludeSourcesConfiguration() != null )
+        {
+            for ( String file : 
config.getDeprecatedIncludeSourcesConfiguration() )
+            {
+                files.add( new File( file ) );
+            }
+        }
+
+        files.addAll( expandSources( getGeneratedSourcesDirectory() ) );
+
+        String defaultSourceRoot = isTestCompile() ? 
project.getBuild().getTestSourceDirectory() : 
project.getBuild().getSourceDirectory();
+
+        Set<String> additionalRoots = Sets.newHashSet();
+        List bareRoots = isTestCompile() ? project.getTestCompileSourceRoots() 
: project.getCompileSourceRoots();
+
+        if ( bareRoots != null) {
+            for(Object root : project.getCompileSourceRoots()){
+                if (!root.equals( defaultSourceRoot ) ){
+                    additionalRoots.add( (String)root );
+                }
+            }
+        }
+
+        if ( additionalRoots.size() > 0 )
+        {
+           getLogger().info(
+                "NPANDAY-161-004: Adding additional compile source roots: " + 
additionalRoots
+            );
+
+            for(String root : additionalRoots){
+                files.addAll( expandSources( new File( root ) ) );
+            }
+        }
+
+        if ( !isSourceAndTestsTogether() )
+        {
+            files.addAll( isTestCompile() ? expandTestSourceFilePatterns() : 
expandMainSourceFilePatterns());
+        }
+        else
+        {
+            List<File> mainSources = expandMainSourceFilePatterns();
+            List<File> testSources = expandTestSourceFilePatterns();
+
+            getLogger().info(
+                "NPANDAY-161-002: Since source and tests reside in same 
folder, "
+                    + " test sources will be excluded from main sources and 
vice versa"
+            );
+
+            if ( isTestCompile() )
+            {
+                List<File> sources = Lists.newArrayList();
+                sources.addAll( testSources );
+                sources.removeAll( mainSources );
+                files.addAll( sources );
+            }
+            else
+            {
+                List<File> sources = Lists.newArrayList();
+                sources.addAll( mainSources );
+                sources.removeAll( testSources );
+                files.addAll( sources );
+            }
+        }
+
+        getLogger().info( "NPANDAY-161-004: Found " + files.size() + " source 
files to compile" );
+
+        return files;
+    }
+
+    private List<File> expandMainSourceFilePatterns()
+    {
+        getLogger().debug(
+            "NPANDAY-161-007: Expanding main sources"
+        );
+        List<String> includes = Lists.newArrayList();
+        if ( config.getIncludes() != null )
+        {
+            includes.addAll( Lists.newArrayList( config.getIncludes() ) );
+        }
+        List<String> excludes = Lists.newArrayList();
+        if ( config.getExcludes() != null )
+        {
+            excludes.addAll( Lists.newArrayList( config.getExcludes() ) );
+        }
+
+        if ( includes.size() == 0 )
+        {
+            includes.add( "**/*." + config.getLanguageFileExtension() );
+        }
+
+        //target files
+        excludes.add( "**/obj/**" );
+        excludes.add( "**/bin/**" );
+        excludes.add( "**/target/**" );
+
+        File root = new File( project.getBuild().getSourceDirectory() );
+
+        return expandSources( root, includes, excludes );
+    }
+
+    private List<File> expandTestSourceFilePatterns()
+    {
+        getLogger().debug(
+            "NPANDAY-161-008: Expanding test sources"
+        );
+        List<String> includes = Lists.newArrayList();
+        if ( config.getTestIncludes() != null )
+        {
+            includes.addAll( Lists.newArrayList( config.getTestIncludes() ) );
+        }
+        List<String> excludes = Lists.newArrayList();
+        if ( config.getTestExcludes() != null )
+        {
+            excludes.addAll( Lists.newArrayList( config.getTestExcludes() ) );
+        }
+
+        if ( includes.size() == 0 )
+        {
+            if ( !isSourceAndTestsTogether() )
+            {
+                includes.add( "**/*." + config.getLanguageFileExtension() );
+            }
+            else
+            {
+                getLogger().info(
+                    "NPANDAY-161-006: Since source and tests reside in same 
folder, "
+                        + "and no default includes are stated, conventions for 
finding tests will be applied."
+                );
+                includes.add( "**/Test/*" + config.getLanguageFileExtension() 
);
+                includes.add( "**/Tests/*" + config.getLanguageFileExtension() 
);
+                includes.add( "**/*Tests." + config.getLanguageFileExtension() 
);
+                includes.add( "**/*Test." + config.getLanguageFileExtension() 
);
+            }
+        }
+
+        //target files
+        excludes.add( "**/obj/**" );
+        excludes.add( "**/bin/**" );
+        excludes.add( "**/target/**" );
+
+        File root = new File( project.getBuild().getTestSourceDirectory() );
+
+        return expandSources( root, includes, excludes );
+    }
+
+    private List<File> expandSources( File directory )
     {
-        // TODO: directory scanner should run already here!
-        return config.getIncludeSources();
+        return expandSources( directory, Lists.newArrayList( "**/*." + 
config.getLanguageFileExtension() ), null );
+    }
+
+    private List<File> expandSources( File directory, Iterable<String> 
includes, Iterable<String> excludes )
+    {
+        if ( !directory.exists() || directory.list().length == 0 )
+        {
+            getLogger().debug( "NPANDAY-161-000: " + directory + " is empty; 
no sources found" );
+            return Lists.newArrayList();
+        }
+
+        DirectoryScanner scanner = createScanner( directory, includes, 
excludes );
+        scanner.scan();
+
+        List<File> files = Lists.newArrayList();
+        for ( String fs : scanner.getIncludedFiles() )
+        {
+
+            if ( !fs.endsWith( "." + config.getLanguageFileExtension() ) )
+            {
+                continue;
+            }
+
+            files.add( new File( directory, fs ) );
+        }
+
+        if ( getLogger().isDebugEnabled() )
+        {
+            getLogger().debug(
+                "NPANDAY-161-001: scanned for source files:" + NEW_LINE + " - 
directory: " + directory.getAbsolutePath()
+                    + NEW_LINE + " - includes: " + includes + NEW_LINE + " - 
excludes: " + excludes + NEW_LINE
+                    + " - included (*.*): " + 
scanner.getIncludedFiles().length + NEW_LINE + " - included sources (*."
+                    + config.getLanguageFileExtension() + "): " + files.size() 
+ NEW_LINE + " - excluded: "
+                    + scanner.getExcludedFiles().length + NEW_LINE + " - 
ignored: "
+                    + scanner.getNotIncludedFiles().length
+            );
+        }
+
+        return files;
+    }
+
+    private DirectoryScanner createScanner( File root, Iterable<String> 
includes, Iterable<String> excludes )
+    {
+        DirectoryScanner scanner = new DirectoryScanner();
+        scanner.setBasedir( root );
+
+        if ( includes != null )
+        {
+            scanner.setIncludes( Iterables.toArray( includes, String.class ) );
+        }
+        if ( excludes != null )
+        {
+            scanner.setExcludes( Iterables.toArray( excludes, String.class ) );
+        }
+
+        // TODO: NPANDAY-210 Maven is usually case sensitive, right?
+        scanner.setCaseSensitive( false );
+        scanner.addDefaultExcludes();
+        return scanner;
     }
 
     public File getOutputDirectory()
@@ -471,8 +694,7 @@ public final class CompilerContextImpl
         this.embeddedResourceArgs = embeddedResourceArgs;
     }
 
-    private void moveInteropDllToBuildDirectory( Artifact artifact )
-        throws PlatformUnsupportedException
+    private void moveInteropDllToBuildDirectory( Artifact artifact ) throws 
PlatformUnsupportedException
     {
         try
         {
@@ -501,4 +723,9 @@ public final class CompilerContextImpl
             throw new PlatformUnsupportedException( e );
         }
     }
+
+    public boolean isSourceAndTestsTogether()
+    {
+        return project.getBuild().getSourceDirectory().equals( 
project.getBuild().getTestSourceDirectory() );
+    }
 }

Modified: 
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AbstractCompilerMojo.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AbstractCompilerMojo.java?rev=1335701&r1=1335700&r2=1335701&view=diff
==============================================================================
--- 
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AbstractCompilerMojo.java
 (original)
+++ 
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AbstractCompilerMojo.java
 Tue May  8 19:08:14 2012
@@ -430,19 +430,50 @@ public abstract class AbstractCompilerMo
     protected String[] testImports;
 
     /**
-     * Included Source Codes
+     * Included source files
      *
      * @parameter expression = "${includeSources}"
+     * @deprecated Use includes + excludes instead!
      */
     protected File[] includeSources;
 
     /**
-     * Included Source Codes
+     * Included test source files
      *
      * @parameter expression = "${testIncludeSources}"
+     * @deprecated Use includes + excludes instead!
      */
     protected File[] testIncludeSources;
 
+
+    /**
+     * Source file patterns to be included in compile.
+     *
+     * @parameter
+     */
+    protected String[] includes;
+
+    /**
+     * Source file patterns to be included in compile.
+     *
+     * @parameter
+     */
+    protected String[] excludes;
+
+    /**
+     * Source file patterns to be included in compile.
+     *
+     * @parameter
+     */
+    protected String[] testIncludes;
+
+    /**
+     * Source file patterns to be included in compile.
+     *
+     * @parameter
+     */
+    protected String[] testExcludes;
+
     /**
      * Embed the specified resource
      *
@@ -1375,4 +1406,16 @@ public abstract class AbstractCompilerMo
         }
     }
 
+    public String getLanguageFileExtension() throws MojoExecutionException
+    {
+        try
+        {
+            return assemblerContext.getClassExtensionFor( language );
+        }
+        catch ( PlatformUnsupportedException e )
+        {
+            throw new MojoExecutionException( "NPANDAY-902-011: Language is 
not supported: Language = " + language, e );
+        }
+    }
+
 }

Modified: 
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/CompilerMojo.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/CompilerMojo.java?rev=1335701&r1=1335700&r2=1335701&view=diff
==============================================================================
--- 
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/CompilerMojo.java
 (original)
+++ 
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/CompilerMojo.java
 Tue May  8 19:08:14 2012
@@ -19,6 +19,7 @@ package npanday.plugin.compile;
  * under the License.
  */
 
+import com.google.common.collect.Lists;
 import npanday.ArtifactType;
 import npanday.executable.compiler.CompilerConfig;
 import npanday.executable.compiler.CompilerRequirement;
@@ -27,6 +28,7 @@ import org.apache.maven.plugin.MojoExecu
 
 import java.io.File;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Maven Mojo for compiling Class files to the .NET Intermediate Language.
@@ -89,8 +91,11 @@ public final class CompilerMojo
             compilerConfig.setOutputDirectory(outputDirectory);
         }
 
+        compilerConfig.setLanguage(language, getLanguageFileExtension());
 
+        compilerConfig.setSourcePatterns(includes, excludes, testIncludes, 
testExcludes);
 
+        // TODO: NPANDAY-210 maybe this should be removed?
         if ( includeSources != null && includeSources.length != 0 )
         {
             ArrayList<String> srcs = new ArrayList<String>();
@@ -102,7 +107,7 @@ public final class CompilerMojo
                 }
             }
 
-               compilerConfig.setIncludeSources(srcs);
+               compilerConfig.setDeprecatedIncludeSourcesConfiguration( srcs );
         }
 
         compilerConfig.setCommands( getParameters() );

Modified: 
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/SourceProcessorMojo.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/SourceProcessorMojo.java?rev=1335701&r1=1335700&r2=1335701&view=diff
==============================================================================
--- 
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/SourceProcessorMojo.java
 (original)
+++ 
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/SourceProcessorMojo.java
 Tue May  8 19:08:14 2012
@@ -19,17 +19,11 @@ package npanday.plugin.compile;
  * under the License.
  */
 
+import npanday.assembler.AssemblerContext;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
-import npanday.assembler.AssemblerContext;
-import npanday.PlatformUnsupportedException;
-import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.DirectoryScanner;
 
 import java.io.File;
-import java.io.IOException;
-import java.util.List;
-import java.util.ArrayList;
 
 /**
  * Copies source files to target directory.
@@ -43,115 +37,11 @@ import java.util.ArrayList;
 public class SourceProcessorMojo
     extends AbstractMojo
 {
-
-    /**
-     * Source directory containing the copied class files.
-     *
-     * @parameter expression = "${sourceDirectory}" 
default-value="${project.build.sourceDirectory}"
-     * @required
-     */
-    private File sourceDirectory;
-
-    /**
-     * Output directory
-     *
-     * @parameter expression = "${outputDirectory}" 
default-value="${project.build.directory}/build-sources"
-     * @required
-     */
-    private File outputDirectory;
-
-    /**
-     * @parameter expression = "${includes}"
-     */
-    private String[] includes;
-
-    /**
-     * @parameter expression = "${excludes}"
-     */
-    private String[] excludes;
-
-    /**
-     * .NET Language. The default value is <code>C_SHARP</code>. Not case or 
white-space sensitive.
-     *
-     * @parameter expression="${language}" default-value = "C_SHARP"
-     * @required
-     */
-    private String language;
-
-    /**
-     * @component
-     */
-    private AssemblerContext assemblerContext;
-
-    public void execute()
-        throws MojoExecutionException
+    public void execute() throws MojoExecutionException
     {
-        long startTime = System.currentTimeMillis();
-
-        if ( !sourceDirectory.exists() )
-        {
-            getLog().info( "NPANDAY-904-001: No source files to copy" );
-            return;
-        }
-        DirectoryScanner directoryScanner = new DirectoryScanner();
-        directoryScanner.setBasedir( sourceDirectory.getAbsolutePath() );
-
-        List<String> excludeList = new ArrayList<String>();
-
-        // TODO: this should use source includes/excludes
-
-        //target files
-        excludeList.add( "obj/**" );
-        excludeList.add( "bin/**" );
-        excludeList.add( "target/**" );
-        //Misc
-        excludeList.add( "Resources/**" );
-        excludeList.add( "Test/**" );
-
-        List<String> includeList = new ArrayList<String>();
-        try
-        {
-            includeList.add( "**/*." + assemblerContext.getClassExtensionFor( 
language ) );
-        }
-        catch ( PlatformUnsupportedException e )
-        {
-            throw new MojoExecutionException( "NPANDAY-904-003: Language is 
not supported: Language = " + language, e );
-        }
-       for (int i = 0; i < includes.length; ++i)
-       {
-               includeList.add(includes[i]);
-       }
-        directoryScanner.setIncludes( includeList.toArray( includes ) );
-        for (int i = 0; i < excludes.length; ++i)
-        {
-               excludeList.add(excludes[i]);
-        }
-        directoryScanner.setExcludes( excludeList.toArray( excludes ) );
-        directoryScanner.addDefaultExcludes();
-
-        directoryScanner.scan();
-        String[] files = directoryScanner.getIncludedFiles();
-        getLog().info( "NPANDAY-904-002: Copying source files: From = " + 
sourceDirectory + ",  To = " +
-            outputDirectory + ", File Count = " + files.length );
-
-        super.getPluginContext().put( "SOURCE_FILES_UP_TO_DATE", Boolean.TRUE 
);
-        for ( String file : files )
-        {
-            try
-            {
-                File sourceFile = new File( sourceDirectory, file );
-                File targetFile = new File( outputDirectory, file );
-                if ( sourceFile.lastModified() > targetFile.lastModified() )
-                {
-                    super.getPluginContext().put( "SOURCE_FILES_UP_TO_DATE", 
Boolean.FALSE );
-                    FileUtils.copyFile( sourceFile, targetFile );
-                    targetFile.setLastModified( System.currentTimeMillis() );
-                }
-            }
-            catch ( IOException e )
-            {
-                throw new MojoExecutionException( "NPANDAY-904-000: Unable to 
process sources", e );
-            }
-        }
+        getLog().info(
+            "NPANDAY-904-002: Copying source files has been skipped (see 
NPANDAY-210) - We could allow filtering of "
+                + "sources here, though!"
+        );
     }
 }

Modified: 
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/TestCompilerMojo.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/TestCompilerMojo.java?rev=1335701&r1=1335700&r2=1335701&view=diff
==============================================================================
--- 
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/TestCompilerMojo.java
 (original)
+++ 
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/TestCompilerMojo.java
 Tue May  8 19:08:14 2012
@@ -19,7 +19,10 @@ package npanday.plugin.compile;
  * under the License.
  */
 
+import com.google.common.collect.Lists;
 import npanday.ArtifactType;
+import npanday.PlatformUnsupportedException;
+import npanday.assembler.AssemblerContext;
 import npanday.executable.compiler.CompilerConfig;
 import npanday.executable.compiler.CompilerRequirement;
 import npanday.executable.compiler.KeyInfo;
@@ -27,6 +30,7 @@ import org.apache.maven.plugin.MojoExecu
 
 import java.io.File;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Compiles test classes.
@@ -39,7 +43,6 @@ import java.util.ArrayList;
 public final class TestCompilerMojo
     extends AbstractCompilerMojo
 {
-
     /**
      * Compiles the class files.
      *
@@ -63,9 +66,6 @@ public final class TestCompilerMojo
 
     }
 
-
-
-
     protected void initializeDefaults()
     {
         if ( testLanguage == null )
@@ -85,9 +85,6 @@ public final class TestCompilerMojo
 
     }
 
-
-
-
     protected CompilerRequirement getCompilerRequirement() throws 
MojoExecutionException
     {
         return new CompilerRequirement(
@@ -106,10 +103,6 @@ public final class TestCompilerMojo
         compilerConfig.setTestCompile( true );
         compilerConfig.setLocalRepository( localRepository );
 
-
-
-
-
         if ( testKeyfile != null )
         {
             KeyInfo keyInfo = KeyInfo.Factory.createDefaultKeyInfo();
@@ -117,8 +110,11 @@ public final class TestCompilerMojo
             compilerConfig.setKeyInfo( keyInfo );
         }
 
+        compilerConfig.setLanguage(language, getLanguageFileExtension());
 
+        compilerConfig.setSourcePatterns(includes, excludes, testIncludes, 
testExcludes);
 
+        // TODO: NPANDAY-210 maybe this should be removed?
         if ( testIncludeSources != null && testIncludeSources.length != 0 )
         {
             ArrayList<String> srcs = new ArrayList<String>();
@@ -130,7 +126,7 @@ public final class TestCompilerMojo
                 }
             }
 
-               compilerConfig.setIncludeSources(srcs);
+               compilerConfig.setDeprecatedIncludeSourcesConfiguration( srcs );
         }
 
 
@@ -311,7 +307,5 @@ public final class TestCompilerMojo
 
         return params;
     }
-
-
 }
 

Modified: 
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/TestSourceProcessorMojo.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/TestSourceProcessorMojo.java?rev=1335701&r1=1335700&r2=1335701&view=diff
==============================================================================
--- 
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/TestSourceProcessorMojo.java
 (original)
+++ 
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/TestSourceProcessorMojo.java
 Tue May  8 19:08:14 2012
@@ -42,38 +42,6 @@ import java.util.ArrayList;
 public class TestSourceProcessorMojo
     extends AbstractMojo
 {
-
-    /**
-     * Source directory containing the copied test class files.
-     *
-     * @parameter expression = "${sourceDirectory}" 
default-value="${project.build.testSourceDirectory}"
-     * @required
-     */
-    private File sourceDirectory;
-
-    /**
-     * Output directory for the test sources.
-     *
-     * @parameter expression = "${outputDirectory}" 
default-value="${project.build.directory}/build-test-sources"
-     * @required
-     */
-    private File outputDirectory;
-
-    /**
-     * @parameter expression = "${testExcludes}"
-     */
-    private String[] testExcludes;
-    
-    /**
-     * @parameter expression = "${includes}"
-     */
-    private String[] includes;    
-    
-    /**
-     * @component
-     */
-    private AssemblerContext assemblerContext;
-    
     /**
      * .NET Language. The default value is <code>C_SHARP</code>. Not case or 
white-space sensitive.
      *
@@ -85,70 +53,9 @@ public class TestSourceProcessorMojo
     public void execute()
         throws MojoExecutionException
     {
-        long startTime = System.currentTimeMillis();
-
-        if ( !sourceDirectory.exists() )
-        {
-            getLog().info( "NPANDAY-905-001: No test source files to copy" );
-            return;
-        }
-        DirectoryScanner directoryScanner = new DirectoryScanner();
-        directoryScanner.setBasedir( sourceDirectory.getAbsolutePath() );
-
-        // TODO: this should use test source includes/excludes
-
-        List<String> excludeList = new ArrayList<String>();
-        excludeList.add( "*.suo" );
-        excludeList.add( "*.csproj" );
-        excludeList.add( "*.vbproj" );
-        excludeList.add( "*.sln" );
-        excludeList.add( "obj/**" );
-        excludeList.add( "bin/**" );
-        excludeList.add( "target/**" );
-        
-        List<String> includeList = new ArrayList<String>();
-        try
-        {
-            includeList.add( "**/*." + assemblerContext.getClassExtensionFor( 
language ) );
-        }
-        catch ( PlatformUnsupportedException e )
-        {
-            throw new MojoExecutionException( "NPANDAY-904-003: Language is 
not supported: Language = " + language, e );
-        }
-        for (int i = 0; i < includes.length; ++i)
-        {
-            includeList.add(includes[i]);
-        }
-        directoryScanner.setIncludes( includeList.toArray( includes ) );
-        
-        for ( int i = 0; i < testExcludes.length; ++i )
-        {
-            excludeList.add( testExcludes[i] );
-        }
-        directoryScanner.setExcludes( excludeList.toArray( new 
String[excludeList.size()] ) );
-
-        directoryScanner.addDefaultExcludes();
-        directoryScanner.scan();
-        String[] files = directoryScanner.getIncludedFiles();
         getLog().info(
-            "NPANDAY-905-002: Copying test source files: From = " + 
sourceDirectory + ",  To = " + outputDirectory );
-        for ( String file : files )
-        {
-            try
-            {
-                File sourceFile = new File( sourceDirectory, file );
-                File targetFile = new File( outputDirectory, file );
-                if ( sourceFile.lastModified() > targetFile.lastModified() )
-                {
-                    FileUtils.copyFile( sourceFile, targetFile );
-                }
-            }
-            catch ( IOException e )
-            {
-                throw new MojoExecutionException( "NPANDAY-905-000: Unable to 
process test sources", e );
-            }
-        }
-        long endTime = System.currentTimeMillis();
-        getLog().info( "Mojo Execution Time = " + ( endTime - startTime ) );
+            "NPANDAY-905-002: Copying test source files has been skipped (see 
NPANDAY-210) - We could allow filtering of "
+                + "test sources here, though!"
+        );
     }
 }


Reply via email to