The excludes are for Visual Studio generated files which we don't want
copied: they should be hard-coded. With the flat directory structure, the
main source files are located in the projectA directory. The test class
files are located in the projectA/Test directory, so the main processor
needs to exclude the ./Test, while the test processor needs to copy only
those files under the ./Test directory.  If we start creating abstract
mojos, we break encapsulation and just need to be more careful about the
shared configuration parameters.

Shane
On Jan 10, 2008 12:54 AM, Evan Worley <[EMAIL PROTECTED]> wrote:

> Ok, sounds fine.  You're the expert :)
>
> On the excludes front, it seems the hard coded excludes were just chosen
> randomly.  Should we have these entries, or rely on the other excludes
> which
> come from the pom configuration?
>
> -Evan
>
> On Jan 9, 2008 8:00 PM, Shane Isbell <[EMAIL PROTECTED]> wrote:
>
> > On Jan 9, 2008 7:31 PM, Evan Worley <[EMAIL PROTECTED]> wrote:
> >
> > > Right, the AbstractCompilerMojo was based on your CompilerMojo, with
> the
> > > unique bits pulled out to be specified by the concrete classes.  The
> > > setArtifactType was copied to the TestCompilerMojo, and hence appeared
> > to
> > > be
> > > the same, but yes this needs to be fixed.  As for the set keyfile,
> that
> > > was
> > > directly from the CompilerMojo, so if it doesn't perform a check, then
> > > that's how I found it.
> > >
> > > Abstracting the CompilerMojo and the SourceProcessor was a first
> attempt
> > > to
> > > unify the duplicate work that was being performed, it still needs some
> > > work.  Please feel free to touch it up as you see fit, after all you
> > wrote
> > > 90% of the code in there.
> >
> >
> > Okay I'm going to revert back the AbstractCompilerMojo. The primary job
> of
> > the abstract mojo is to set the CompilerConfig but since we have to pass
> > up
> > a bunch of those configuration parameters from methods in the concrete
> > class
> > to the abstract class, we don't gain anything. All the real work is
> > handled
> > by the CSharpCompiler implementation anyway.
> >
> > Also the AbstractSourceProcessorMojo uses the same excludes list but
> since
> > we are using a flat directory structure, we can't do this. The main
> > compiler
> > needs to exclude the entire ./Test directory, while the test compiler
> > needs
> > to include only those classes under the ./Test directory.
> >
> > Shane
> >
> >
> > >
> > >
> > > Thanks for catching these,
> > > Evan
> > >
> > > On Jan 9, 2008 7:25 PM, Shane Isbell <[EMAIL PROTECTED]> wrote:
> > >
> > > > If the project type is say dotnet:exe, this code in the
> > > > AbstractCompilerMojo
> > > > is going to compile the test library also as a dotnet:exe, when it
> > > should
> > > > be
> > > > compiled to a library.
> > > >
> > > >        compilerConfig.setArtifactType(
> > > >            ArtifactType.valueOf( project.getPackaging().split( "[:]"
> > > > )[1].toUpperCase() ) );
> > > >
> > > > Also
> > > >  keyInfo.setKeyFileUri( keyfile.toURI() );
> > > >
> > > > needlessly signs the test artifact.
> > > >
> > > > Specifying a single target language within the AbstractCompilerMojo
> a
> > > > makes
> > > > it impossible to write the unit tests and main source files in
> > different
> > > > languages.
> > > > Shane
> > > > On Jan 3, 2008 10:38 PM, <[EMAIL PROTECTED]> wrote:
> > > >
> > > > > Author: eworley
> > > > > Date: Thu Jan  3 22:38:03 2008
> > > > > New Revision: 608757
> > > > >
> > > > > URL: http://svn.apache.org/viewvc?rev=608757&view=rev
> > > > > Log:
> > > > > Cleaned up the abstract compiler mojo, base classes now passing
> > > > > configuration up, this is more flexible and removes the need for
> > > > extraneous
> > > > > methods to control config
> > > > >
> > > > > Modified:
> > > > >
> > > > >
> > > >
> > >
> >
>  
> incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/AbstractCompilerMojo.java
> > > > >
> > > > >
> > > >
> > >
> >
>  
> incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java
> > > > >
> > > > >
> > > >
> > >
> >
>  
> incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/TestCompilerMojo.java
> > > > >
> > > > > Modified:
> > > > >
> > > >
> > >
> >
> incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/AbstractCompilerMojo.java
> > > > > URL:
> > > > >
> > > >
> > >
> >
> http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/AbstractCompilerMojo.java?rev=608757&r1=608756&r2=608757&view=diff
> > > > >
> > > > >
> > > >
> > >
> >
> ==============================================================================
> > > > > ---
> > > > >
> > > >
> > >
> >
> incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/AbstractCompilerMojo.java
> > > > > (original)
> > > > > +++
> > > > >
> > > >
> > >
> >
> incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/AbstractCompilerMojo.java
> > > > > Thu Jan  3 22:38:03 2008
> > > > > @@ -2,8 +2,6 @@
> > > > >
> > > > >  import java.io.File;
> > > > >  import java.io.IOException;
> > > > > -import java.net.URI;
> > > > > -import java.net.URISyntaxException;
> > > > >
> > > > >  import org.apache.maven.dotnet.ArtifactType;
> > > > >  import org.apache.maven.dotnet.InitializationException;
> > > > > @@ -84,7 +82,9 @@
> > > > >      *
> > > > >      * @throws MojoExecutionException
> > > > >      */
> > > > > -    protected File compile() throws MojoExecutionException {
> > > > > +    protected File compile( DotnetCompilerConfig compilerConfig )
> > > > > +        throws MojoExecutionException
> > > > > +    {
> > > > >         String outputDir = project.getBuild().getDirectory();
> > > > >         File sourceDir =
> > > > >             new File( outputDir, getSourceDirectoryName());
> > > > > @@ -105,7 +105,7 @@
> > > > >         }
> > > > >
> > > > >         getLog().info( ".NET Vendor: " + vendor );
> > > > > -        DotnetCompilerConfig compilerConfig =
> > > > > DotnetCompilerConfig.Factory.createDefaultCompilerConfig();
> > > > > +
> > > > >         compilerConfig.setArtifactType(
> > > > >             ArtifactType.valueOf( project.getPackaging().split(
> > "[:]"
> > > > > )[1].toUpperCase() ) );
> > > > >         compilerConfig.setCompilerPlatformVersion(
> > > > > DotnetCompilerPlatformVersion.valueFromVersion( frameworkVersion )
> > );
> > > > > @@ -113,14 +113,7 @@
> > > > >         KeyInfo keyInfo = KeyInfo.Factory.createDefaultKeyInfo();
> > > > >         if ( keyfile != null )
> > > > >         {
> > > > > -//            try
> > > > > -//            {
> > > > > -                keyInfo.setKeyFileUri( keyfile.toURI() );
> > > > > -//            }
> > > > > -//            catch ( URISyntaxException e )
> > > > > -//            {
> > > > > -//                throw new MojoExecutionException( e.getMessage
> ()
> > );
> > > > > -//            }
> > > > > +            keyInfo.setKeyFileUri( keyfile.toURI() );
> > > > >         }
> > > > >
> > > > >         keyInfo.setKeyContainerName( keycontainer );
> > > > > @@ -128,7 +121,6 @@
> > > > >
> > > > >         compilerConfig.setLocalRepository( localRepository );
> > > > >         compilerConfig.setProgrammingLanguage(
> > > > ProgrammingLanguage.C_SHARP);
> > > > > -        compilerConfig.setTestCompile( isTestCompile() );
> > > > >         compilerConfig.setCompilerSourceDirectory( sourceDir );
> > > > >         compilerConfig.setVendor( vendor );
> > > > >         compilerConfig.setTargetDirectory( new File( outputDir )
> );
> > > > > @@ -173,14 +165,5 @@
> > > > >      */
> > > > >     protected String getAssemblySuffix() {
> > > > >         return "";
> > > > > -    }
> > > > > -
> > > > > -    /**
> > > > > -     * Sub classes can override this to configure the compiler
> > > > > -     * for test compilation
> > > > > -     * @return <code>boolean</code> true if test compile, else
> > false
> > > > > -     */
> > > > > -    protected boolean isTestCompile() {
> > > > > -        return false;
> > > > >     }
> > > > >  }
> > > > >
> > > > > Modified:
> > > > >
> > > >
> > >
> >
> incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java
> > > > > URL:
> > > > >
> > > >
> > >
> >
> http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java?rev=608757&r1=608756&r2=608757&view=diff
> > > > >
> > > > >
> > > >
> > >
> >
> ==============================================================================
> > > > > ---
> > > > >
> > > >
> > >
> >
> incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java
> > > > > (original)
> > > > > +++
> > > > >
> > > >
> > >
> >
> incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java
> > > > > Thu Jan  3 22:38:03 2008
> > > > > @@ -18,7 +18,10 @@
> > > > >  */
> > > > >  package org.apache.maven.dotnet.plugin.compiler;
> > > > >
> > > > > +import java.io.File;
> > > > > +
> > > > >  import org.apache.maven.dotnet.BuildDirectories;
> > > > > +import org.apache.maven.dotnet.compiler.DotnetCompilerConfig;
> > > > >  import org.apache.maven.plugin.MojoExecutionException;
> > > > >  import org.apache.maven.plugin.MojoFailureException;
> > > > >
> > > > > @@ -42,6 +45,9 @@
> > > > >     public void execute()
> > > > >         throws MojoExecutionException, MojoFailureException
> > > > >     {
> > > > > -        project.getArtifact().setFile( compile() );
> > > > > +        DotnetCompilerConfig compilerConfig =
> > > > > DotnetCompilerConfig.Factory.createDefaultCompilerConfig();
> > > > > +
> > > > > +        File assembly = compile( compilerConfig );
> > > > > +        project.getArtifact().setFile( assembly );
> > > > >     }
> > > > >  }
> > > > >
> > > > > Modified:
> > > > >
> > > >
> > >
> >
> incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/TestCompilerMojo.java
> > > > > URL:
> > > > >
> > > >
> > >
> >
> http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/TestCompilerMojo.java?rev=608757&r1=608756&r2=608757&view=diff
> > > > >
> > > > >
> > > >
> > >
> >
> ==============================================================================
> > > > > ---
> > > > >
> > > >
> > >
> >
> incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/TestCompilerMojo.java
> > > > > (original)
> > > > > +++
> > > > >
> > > >
> > >
> >
> incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/TestCompilerMojo.java
> > > > > Thu Jan  3 22:38:03 2008
> > > > > @@ -19,6 +19,7 @@
> > > > >  package org.apache.maven.dotnet.plugin.compiler;
> > > > >
> > > > >  import org.apache.maven.dotnet.BuildDirectories;
> > > > > +import org.apache.maven.dotnet.compiler.DotnetCompilerConfig;
> > > > >  import org.apache.maven.plugin.MojoExecutionException;
> > > > >  import org.apache.maven.plugin.MojoFailureException;
> > > > >
> > > > > @@ -43,7 +44,11 @@
> > > > >             return;
> > > > >         }
> > > > >
> > > > > -        compile();
> > > > > +        DotnetCompilerConfig compilerConfig =
> > > > > DotnetCompilerConfig.Factory.createDefaultCompilerConfig();
> > > > > +
> > > > > +        compilerConfig.setTestCompile( true );
> > > > > +
> > > > > +        compile( compilerConfig );
> > > > >     }
> > > > >
> > > > >     @Override
> > > > > @@ -56,11 +61,5 @@
> > > > >     protected String getAssemblySuffix()
> > > > >     {
> > > > >         return "-test";
> > > > > -    }
> > > > > -
> > > > > -    @Override
> > > > > -    protected boolean isTestCompile()
> > > > > -    {
> > > > > -        return true;
> > > > >     }
> > > > >  }
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>

Reply via email to