incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r607948 - in /incubator/nmaven/trunk: ./ components/maven-dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/ components/maven-dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/ components/maven-dotnet-asse...
Date Wed, 02 Jan 2008 00:04:22 GMT
Author: sisbell
Date: Tue Jan  1 16:04:16 2008
New Revision: 607948

URL: http://svn.apache.org/viewvc?rev=607948&view=rev
Log:
The compiler now outputs log results to console. Support for generating assembly info files.

Added:
    incubator/nmaven/trunk/components/maven-dotnet-assembler/src/main/resources/
    incubator/nmaven/trunk/components/maven-dotnet-assembler/src/main/resources/META-INF/
    incubator/nmaven/trunk/components/maven-dotnet-assembler/src/main/resources/META-INF/plexus/
    incubator/nmaven/trunk/components/maven-dotnet-assembler/src/main/resources/META-INF/plexus/components.xml
  (with props)
    incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/AssemblyInfoGeneratorMojo.java
  (with props)
Modified:
    incubator/nmaven/trunk/components/maven-dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblerContext.java
    incubator/nmaven/trunk/components/maven-dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/AssemblerContextImpl.java
    incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CommandExecutor.java
    incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerContext.java
    incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java
    incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/assembler/DefaultAssemblyInfoMarshaller.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
    incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml
    incubator/nmaven/trunk/pom.xml

Modified: incubator/nmaven/trunk/components/maven-dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblerContext.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblerContext.java?rev=607948&r1=607947&r2=607948&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblerContext.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/AssemblerContext.java
Tue Jan  1 16:04:16 2008
@@ -20,6 +20,9 @@
 
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.dotnet.ProgrammingLanguage;
+import org.apache.maven.dotnet.InitializationException;
+
+import java.io.IOException;
 
 /**
  * Provides services for generating of AssemblyInfo.* file.
@@ -55,6 +58,6 @@
      * @param mavenProject the maven project
      */
     void init( MavenProject mavenProject )
-        throws AssemblyInfoException;
+        throws InitializationException, IOException;
 
 }

Modified: incubator/nmaven/trunk/components/maven-dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/AssemblerContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/AssemblerContextImpl.java?rev=607948&r1=607947&r2=607948&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/AssemblerContextImpl.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/AssemblerContextImpl.java
Tue Jan  1 16:04:16 2008
@@ -25,6 +25,7 @@
 import org.apache.maven.dotnet.assembler.AssemblyInfoMarshallerAnnotation;
 import org.apache.maven.dotnet.ProgrammingLanguage;
 import org.apache.maven.dotnet.BuildDirectories;
+import org.apache.maven.dotnet.InitializationException;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.model.Organization;
 
@@ -35,8 +36,8 @@
 import java.io.*;
 import java.util.Enumeration;
 import java.util.List;
-import java.util.jar.JarFile;
-import java.util.jar.JarEntry;
+import java.util.ArrayList;
+import java.net.URL;
 
 /**
  * Provides an implementation of the <code>AssemblerContext</code>.
@@ -138,85 +139,67 @@
         throws AssemblyInfoException
     {
 
-        for(AssemblyInfoMarshaller m : marshallers)
+        for ( AssemblyInfoMarshaller m : marshallers )
         {
-            if(m.getProgrammingLanguageForMarshaller().equals( programmingLanguage))
+            if ( m.getProgrammingLanguageForMarshaller().equals( programmingLanguage ) )
             {
                 return m;
             }
         }
-        return null;
+        throw new AssemblyInfoException("Could not find assembly info marshaller.");
     }
 
     /**
      * @see AssemblerContext#init(org.apache.maven.project.MavenProject)
      */
     public void init( MavenProject mavenProject )
-        throws AssemblyInfoException
+        throws InitializationException, IOException
     {
         this.mavenProject = mavenProject;
+        marshallers = new ArrayList<AssemblyInfoMarshaller>();
+
+        Enumeration<URL> resources =
+            this.getClass().getClassLoader().getResources( "/META-INF/nmaven/annotation-resources.txt"
);
 
-        String[] classPathJars = System.getProperty( "java.class.path" ).split( "[" + File.pathSeparator
+ "]" );
-        for ( String classPathJar : classPathJars )
+        while ( resources.hasMoreElements() )
         {
-            if ( classPathJar.contains( "dotnet-extensions-" ) )
+            URL url = resources.nextElement();
+            BufferedReader reader = new BufferedReader( new InputStreamReader( url.openStream()
) );
+            String annotatedClass;
+            while ( ( annotatedClass = reader.readLine() ) != null )
             {
-                JarFile jarFile = null;
+                String className = null;
                 try
                 {
-                    jarFile = new JarFile( classPathJar );
-                }
-                catch ( IOException e )
-                {
-                    e.printStackTrace();
-                }
-                Enumeration jarEntries = jarFile.entries();
-
-                while ( jarEntries.hasMoreElements() )
-                {
-                    JarEntry jarEntry = (JarEntry) jarEntries.nextElement();
-                    if ( jarEntry.isDirectory() || !jarEntry.getName().endsWith( "class"
) )
-                    {
-                        continue;
-                    }
-
-                    String className = null;
-                    try
+                    Class c = Class.forName( annotatedClass );
+                    className = c.getName();
+                    AssemblyInfoMarshallerAnnotation annotation =
+                        (AssemblyInfoMarshallerAnnotation) c.getAnnotation( AssemblyInfoMarshallerAnnotation.class
);
+                    if ( annotation != null )
                     {
-                        String[] tokens = jarEntry.getName().split( "[//]" );
-
-                        Class c = Class.forName( tokens[tokens.length - 1].split( "[.]" )[0]
);
-                        className = c.getName();
-                        AssemblyInfoMarshallerAnnotation annotation =
-                            (AssemblyInfoMarshallerAnnotation) c.getAnnotation(
-                                AssemblyInfoMarshallerAnnotation.class );
-                        if ( annotation != null )
+                        for ( ProgrammingLanguage programmingLanguage : annotation.programmingLanguages()
)
                         {
-                            for ( ProgrammingLanguage programmingLanguage : annotation.programmingLanguages()
)
-                            {
-                                AssemblyInfoMarshaller marshaller = (AssemblyInfoMarshaller)
c.newInstance();
-                                marshaller.init( programmingLanguage, new File( mavenProject.getBuild().getDirectory(),
-                                                                                BuildDirectories.BUILD_SOURCES.getBuildDirectoryName()
) );
-                                marshallers.add( marshaller );
-                            }
-
+                            AssemblyInfoMarshaller marshaller = (AssemblyInfoMarshaller)
c.newInstance();
+                            marshaller.init( programmingLanguage, new File( mavenProject.getBuild().getDirectory(),
+                                                                            BuildDirectories.BUILD_SOURCES.getBuildDirectoryName()
) );
+                            marshallers.add( marshaller );
                         }
                     }
-                    catch ( ClassNotFoundException e )
-                    {
-                        throw new AssemblyInfoException(
-                            "NMAVEN-061-007: Unable to create AssemblyInfoMarshaller: Class
Name = " + className, e );
-                    }
-                    catch ( InstantiationException e )
-                    {
-                        throw new AssemblyInfoException(
-                            "NMAVEN-020-003: Unable to create AssemblyInfoMarshaller: Class
Name = " + className, e );
-                    }
-                    catch ( IllegalAccessException e )
-                    {
-                        throw new AssemblyInfoException(
-                            "NMAVEN-020-004: Unable to create AssemblyInfoMarshaller: Class
Name = " + className, e );
-                    }
+                }
+                catch ( ClassNotFoundException e )
+                {
+                    throw new InitializationException(
+                        "NMAVEN-061-007: Unable to create AssemblyInfoMarshaller: Class Name
= " + className, e );
+                }
+                catch ( InstantiationException e )
+                {
+                    throw new InitializationException(
+                        "NMAVEN-020-003: Unable to create AssemblyInfoMarshaller: Class Name
= " + className, e );
+                }
+                catch ( IllegalAccessException e )
+                {
+                    throw new InitializationException(
+                        "NMAVEN-020-004: Unable to create AssemblyInfoMarshaller: Class Name
= " + className, e );
                 }
             }
         }

Added: incubator/nmaven/trunk/components/maven-dotnet-assembler/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-assembler/src/main/resources/META-INF/plexus/components.xml?rev=607948&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-assembler/src/main/resources/META-INF/plexus/components.xml
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-assembler/src/main/resources/META-INF/plexus/components.xml
Tue Jan  1 16:04:16 2008
@@ -0,0 +1,8 @@
+<component-set>
+    <components>
+        <component>
+            <role>org.apache.maven.dotnet.assembler.AssemblerContext</role>
+            <implementation>org.apache.maven.dotnet.assembler.impl.AssemblerContextImpl</implementation>
+        </component>
+    </components>
+</component-set>

Propchange: incubator/nmaven/trunk/components/maven-dotnet-assembler/src/main/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CommandExecutor.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CommandExecutor.java?rev=607948&r1=607947&r2=607948&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CommandExecutor.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CommandExecutor.java
Tue Jan  1 16:04:16 2008
@@ -27,6 +27,7 @@
 
 import java.util.List;
 import java.util.ArrayList;
+import java.util.logging.Level;
 import java.io.File;
 
 /**
@@ -47,8 +48,9 @@
      *
      * @param executable the name of the executable (csc, xsd, etc).
      * @param commands   the command options for the compiler/executable
-     * @throws org.apache.maven.dotnet.executable.ExecutionException if compiler or executable
writes anything to the standard error stream or if the process
-     *                            returns a process result != 0.
+     * @throws org.apache.maven.dotnet.compiler.CompilerException
+     *          if compiler or executable writes anything to the standard error stream or
if the process
+     *          returns a process result != 0.
      */
     void executeCommand( String executable, List<String> commands )
         throws CompilerException;
@@ -60,8 +62,9 @@
      * @param commands           the commands options for the compiler/executable
      * @param failsOnErrorOutput if true, throws an <code>ExecutionException</code>
if there the compiler or executable
      *                           writes anything to the error output stream. By default,
this value is true
-     * @throws org.apache.maven.dotnet.cmpiler.CompilerException if compiler or executable
writes anything to the standard error stream (provided the
-     *                            failsOnErrorOutput is not false) or if the process returns
a process result != 0.
+     * @throws org.apache.maven.dotnet.compiler.CompilerException
+     *          if compiler or executable writes anything to the standard error stream (provided
the
+     *          failsOnErrorOutput is not false) or if the process returns a process result
!= 0.
      */
     void executeCommand( String executable, List<String> commands, boolean failsOnErrorOutput
)
         throws CompilerException;
@@ -74,8 +77,8 @@
      * @param executable       the name of the executable (csc, xsd, etc).
      * @param commands         the command options for the compiler/executable
      * @param workingDirectory the directory where the command will be executed
-     * @throws org.apache.maven.dotnet.compiler.CompilerException if compiler or executable
writes anything to the standard error stream (provided the
-     *                            failsOnErrorOutput is not false) or if the process returns
a process result != 0.
+     * @throws CompilerException if compiler or executable writes anything to the standard
error stream (provided the
+     *                           failsOnErrorOutput is not false) or if the process returns
a process result != 0.
      */
     void executeCommand( String executable, List<String> commands, File workingDirectory,
boolean failsOnErrorOutput )
         throws CompilerException;
@@ -107,6 +110,7 @@
      */
     public static class Factory
     {
+        private static java.util.logging.Logger javaLogger = java.util.logging.Logger.getAnonymousLogger();
 
         /**
          * Constructor
@@ -129,6 +133,7 @@
                  */
                 private Logger logger;
 
+
                 /**
                  * Standard Out
                  */
@@ -175,7 +180,7 @@
 
                     Commandline commandline = new Commandline();
                     commandline.setExecutable( executable );
-                    commandline.addArguments( commands.toArray( new String[commands.size()]));
+                    commandline.addArguments( commands.toArray( new String[commands.size()]
) );
                     if ( workingDirectory != null && workingDirectory.exists() )
                     {
                         commandline.setWorkingDirectory( workingDirectory.getAbsolutePath()
);
@@ -244,7 +249,7 @@
                     {
                         if ( logger == null )
                         {
-                            System.out.println( "NMAVEN-040-003: Error Log not set: Will
not output error logs" );
+                            System.out.println( "NMAVEN-040-003: Error Log not set: Will
use java.util.logging.Logger" );
                         }
                         error = false;
                     }
@@ -256,6 +261,10 @@
                         {
                             logger.error( line );
                         }
+                        else
+                        {
+                            javaLogger.log( Level.WARNING, line );
+                        }
                         error = true;
                     }
 
@@ -299,10 +308,9 @@
                     public void consumeLine( String line )
                     {
                         sb.append( line );
-                        if ( logger != null )
-                        {
-                            consumer.consumeLine( line );
-                        }
+
+                        consumer.consumeLine( line );
+
                     }
 
                     /**

Modified: incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerContext.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerContext.java?rev=607948&r1=607947&r2=607948&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerContext.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerContext.java
Tue Jan  1 16:04:16 2008
@@ -29,10 +29,6 @@
  */
 public interface CompilerContext
 {
-    /**
-     * Role used to register component implementations with the container.
-     */
-    String ROLE = CompilerContext.class.getName();
 
     /**
      * Returns the user provided configuration associated to this context. This is a live
copy, so any changes to the

Modified: incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java?rev=607948&r1=607947&r2=607948&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java
Tue Jan  1 16:04:16 2008
@@ -36,8 +36,6 @@
 import org.apache.maven.dotnet.compiler.CompilerConfig;
 import org.apache.maven.dotnet.compiler.DotnetCompilerConfig;
 import org.apache.maven.dotnet.compiler.DotnetCompilerContext;
-import org.apache.maven.dotnet.compiler.DotnetCompilerPlatformVersion;
-import org.apache.maven.dotnet.Vendor;
 import org.apache.maven.dotnet.InitializationException;
 import org.apache.maven.dotnet.BuildDirectories;
 import org.apache.maven.dotnet.ArtifactType;
@@ -46,7 +44,6 @@
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.logging.LogEnabled;
-import org.codehaus.plexus.util.StringUtils;
 
 public final class DotnetCompilerContextImpl
     implements DotnetCompilerContext, LogEnabled
@@ -139,8 +136,8 @@
 
     public void enableLogging( Logger logger )
     {
-        System.out.println( "Enable logging." );
         this.logger = logger;
+        logger.info( "Logging enabled." );
     }
 
     public void init( MavenProject project, CompilerConfig compilerConfig )

Modified: incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/assembler/DefaultAssemblyInfoMarshaller.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/assembler/DefaultAssemblyInfoMarshaller.java?rev=607948&r1=607947&r2=607948&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/assembler/DefaultAssemblyInfoMarshaller.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/assembler/DefaultAssemblyInfoMarshaller.java
Tue Jan  1 16:04:16 2008
@@ -86,6 +86,10 @@
             {
                 assemblyInfoFileStream.close();
             }
+            if(outputStream != null)
+            {
+                outputStream.close();
+            }
         }
     }
 

Added: incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/AssemblyInfoGeneratorMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/AssemblyInfoGeneratorMojo.java?rev=607948&view=auto
==============================================================================
--- incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/AssemblyInfoGeneratorMojo.java
(added)
+++ incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/AssemblyInfoGeneratorMojo.java
Tue Jan  1 16:04:16 2008
@@ -0,0 +1,162 @@
+package org.apache.maven.dotnet.plugin.compiler;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.dotnet.assembler.AssemblerContext;
+import org.apache.maven.dotnet.assembler.AssemblyInfo;
+import org.apache.maven.dotnet.assembler.AssemblyInfoMarshaller;
+import org.apache.maven.dotnet.assembler.AssemblyInfoException;
+import org.apache.maven.dotnet.ArtifactType;
+import org.apache.maven.dotnet.ProgrammingLanguage;
+import org.apache.maven.dotnet.BuildDirectories;
+import org.apache.maven.dotnet.InitializationException;
+import org.codehaus.plexus.util.FileUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.FileOutputStream;
+import java.util.List;
+
+/**
+ * Generates an AssemblyInfo.* class based on information within the pom file.
+ *
+ * @goal generate-assembly-info
+ * @phase generate-sources
+ * @description Generates an AssemblyInfo.* class based on information within the pom file.
+ */
+public class AssemblyInfoGeneratorMojo
+    extends AbstractMojo
+{
+    /**
+     * The maven project.
+     *
+     * @parameter expression="${project}"
+     * @required
+     * @readonly
+     */
+    private MavenProject project;
+
+    /**
+     * The framework version to compile under: 1.1, 2.0, 3.0
+     *
+     * @parameter expression = "${frameworkVersion}"
+     */
+    private String frameworkVersion;
+
+    /**
+     * .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;
+
+    /**
+     * The vendor for the compiler: MICROSOFT, NOVELL. Not case or white-space sensitive.
+     *
+     * @parameter expression="${vendor}"
+     */
+    private String vendor;
+
+    /**
+     * Specify a strong name key file.
+     *
+     * @parameter expression = "${keyfile}"
+     */
+    private File keyfile;
+
+    /**
+     * Specifies a strong name key container. (not currently supported)
+     *
+     * @parameter expression = "${keycontainer}"
+     */
+    private String keycontainer;
+
+    /**
+     * Source directory containing the copied class files.
+     *
+     * @parameter expression = "${sourceDirectory}" default-value="${project.build.sourceDirectory}"
+     * @required
+     */
+    private String sourceDirectory;
+
+    /**
+     * @component
+     */
+    private AssemblerContext assemblerContext;
+
+
+    /**
+     * If an AssemblyInfo file exists in the source directory, then this method will not
generate an AssemblyInfo.
+     *
+     * @throws org.apache.maven.plugin.MojoExecutionException
+     *
+     */
+    public void execute()
+        throws MojoExecutionException
+    {
+        if ( ArtifactType.MODULE.isMatchByString( project.getArtifact().getType() ) )
+        {
+            return;
+        }
+
+        File srcFile = new File( sourceDirectory );
+        if ( srcFile.exists() )
+        {
+            try
+            {
+                List files = FileUtils.getFiles( srcFile, "**/AssemblyInfo.*", null );
+                if ( files.size() != 0 )
+                {
+                    getLog().info( "NMAVEN-902-001: Found AssemblyInfo file(s), so will not
generate one" );
+                    return;
+                }
+            }
+            catch ( IOException e )
+            {
+                throw new MojoExecutionException(
+                    "NMAVEN-902-004: Could not determine whether an AssemblyInfo file exists",
e );
+            }
+        }
+        getLog().info( "NMAVEN-902-000: Generating Assembly Info: Language = " + language.trim()
);
+
+        try
+        {
+            assemblerContext.init( project );
+        }
+        catch ( InitializationException e )
+        {
+            throw new MojoExecutionException( e.getMessage() );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( e.getMessage() );
+        }
+
+        AssemblyInfo assemblyInfo = assemblerContext.getAssemblyInfo();
+        assemblyInfo.setKeyFile( keyfile );
+        assemblyInfo.setKeyName( keycontainer );
+
+        try
+        {
+            File file = new File( project.getBuild().getDirectory(), BuildDirectories
+                .BUILD_SOURCES.getBuildDirectoryName() + File.separator + "META-INF" + File.separator
+
+                "AssemblyInfo.cs" );
+            FileUtils.mkdir( file.getParent() );
+
+            FileOutputStream fos = new FileOutputStream( file );
+            AssemblyInfoMarshaller marshaller =
+                assemblerContext.getAssemblyInfoMarshallerFor( ProgrammingLanguage.C_SHARP
);
+            marshaller.marshal( assemblyInfo, fos );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "NMAVEN-902-002: Problem generating assembly
info class", e );
+        }
+        catch ( AssemblyInfoException e )
+        {
+            throw new MojoExecutionException( "NMAVEN-902-005: Problem generating assembly
info class", e );
+        }
+    }
+}

Propchange: incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/AssemblyInfoGeneratorMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

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=607948&r1=607947&r2=607948&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
Tue Jan  1 16:04:16 2008
@@ -34,14 +34,11 @@
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.artifact.handler.ArtifactHandler;
 import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
-import org.apache.maven.artifact.factory.ArtifactFactory;
 
 import java.io.File;
 import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.Map;
-import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -109,17 +106,7 @@
     /**
      * @component
      */
-    private DotnetCompilerContext compilerContext;
-
-    /**
-     * @component
-     */
-    private List<ArtifactHandler> artifactHandlers;
-
-    /**
-     * @component
-     */
-    private ArtifactHandlerManager artifactHandlerManager;
+    private DotnetCompilerContext dotnetCompilerContext;
 
     public void execute()
         throws MojoExecutionException, MojoFailureException
@@ -177,7 +164,7 @@
 
         try
         {
-            compilerContext.init( project, compilerConfig );
+            dotnetCompilerContext.init( project, compilerConfig );
         }
         catch ( InitializationException e )
         {
@@ -189,7 +176,7 @@
         }
         try
         {
-            project.getArtifact().setFile( compilerContext.getClassCompiler().compile() );
+            project.getArtifact().setFile( dotnetCompilerContext.getClassCompiler().compile()
);
         }
         catch ( InvalidArtifactException e )
         {

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=607948&r1=607947&r2=607948&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
Tue Jan  1 16:04:16 2008
@@ -137,7 +137,7 @@
         if (!sourceDir.exists()) {
             return;
         }
-        
+        this.getLog();
         Vendor vendor;
         if ( vendorName != null )
         {

Modified: incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml?rev=607948&r1=607947&r2=607948&view=diff
==============================================================================
--- incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml
(original)
+++ incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml
Tue Jan  1 16:04:16 2008
@@ -9,6 +9,9 @@
       </implementation>
       <configuration>
         <phases>
+          <generate-sources>
+            org.apache.maven.dotnet.plugins:maven-compiler-plugin:generate-assembly-info
+          </generate-sources>
           <process-sources>
             org.apache.maven.dotnet.plugins:maven-compiler-plugin:process-sources
           </process-sources>

Modified: incubator/nmaven/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/pom.xml?rev=607948&r1=607947&r2=607948&view=diff
==============================================================================
--- incubator/nmaven/trunk/pom.xml (original)
+++ incubator/nmaven/trunk/pom.xml Tue Jan  1 16:04:16 2008
@@ -213,11 +213,11 @@
       <dependency>
         <groupId>org.codehaus.plexus</groupId>
         <artifactId>plexus-container-default</artifactId>
-        <version>1.0-alpha-40</version>
+        <version>1.0-alpha-32</version>
       </dependency>
     </dependencies>
   </dependencyManagement>
-    <profiles>
+  <profiles>
     <profile>
       <id>run-its</id>
       <modules>



Mime
View raw message