Author: sisbell
Date: Tue Dec 11 15:53:16 2007
New Revision: 603417

URL: http://svn.apache.org/viewvc?rev=603417&view=rev
Log:
Compiling now working.

Added:
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-extensions-maven/src/main/resources/
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-extensions-maven/src/main/resources/META-INF/
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-extensions-maven/src/main/resources/META-INF/nmaven/
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-extensions-maven/src/main/resources/META-INF/nmaven/annotation-resources.txt
   (with props)
Modified:
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/ClassCompiler.java
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CommandExecutor.java
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerConfig.java
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerContext.java
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerConfig.java
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerContext.java
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-extensions-maven/src/main/java/org/apache/maven/dotnet/extensions/compiler/CSharpClassCompiler.java
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java
    
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/SourceProcessorMojo.java

Modified: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/ClassCompiler.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/ClassCompiler.java?rev=603417&r1=603416&r2=603417&view=diff
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/ClassCompiler.java
 (original)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/ClassCompiler.java
 Tue Dec 11 15:53:16 2007
@@ -2,17 +2,10 @@
 
 import java.io.File;
 import java.util.Set;
+import java.util.List;
 
 public interface ClassCompiler
 {
-    /**
-     * Returns a file pointing to the compiled artifact for this executable.
-     *
-     * @return a file pointing to the compiled artifact for this executable
-     * @throws InvalidArtifactException if the artifact is invalid
-     */
-    File getCompiledArtifact()
-        throws InvalidArtifactException;
 
     /**
      * Returns true to fail the build if the compiler writes anything to the 
error stream, otherwise return false.
@@ -26,7 +19,7 @@
      *
      * @return the commands that this compiler will use to compile the 
application
      */
-    Set<String> getCommands();
+    List<String> getCommands();
 
     /**
      * Resets the commands to be used by the executable. This should only be 
used if the executable is being reused with
@@ -34,12 +27,13 @@
      *
      * @param commands
      */
-    void resetCommands( Set<String> commands );
+    void resetCommands( List<String> commands );
 
     /**
      * Compiles class files.
+     * @return a file pointing to the compiled artifact
      */
-    void compile();
+    File compile() throws InvalidArtifactException;
 
     /**
      * Returns the executable file name that this compiler will use to compile 
the application.

Modified: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CommandExecutor.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CommandExecutor.java?rev=603417&r1=603416&r2=603417&view=diff
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CommandExecutor.java
 (original)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CommandExecutor.java
 Tue Dec 11 15:53:16 2007
@@ -7,9 +7,10 @@
 import org.codehaus.plexus.util.cli.CommandLineException;
 import org.codehaus.plexus.util.cli.DefaultConsumer;
 
-import java.util.ArrayList;
 import java.util.Set;
 import java.util.HashSet;
+import java.util.List;
+import java.util.ArrayList;
 import java.io.File;
 
 /**
@@ -35,7 +36,7 @@
      * @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.
      */
-    void executeCommand( String executable, Set<String> commands )
+    void executeCommand( String executable, List<String> commands )
         throws CompilerException;
 
     /**
@@ -48,7 +49,7 @@
      * @throws org.apache.maven.dotnet.executable.ExecutionException 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, Set<String> commands, boolean 
failsOnErrorOutput )
+    void executeCommand( String executable, List<String> commands, boolean 
failsOnErrorOutput )
         throws CompilerException;
 
     /**
@@ -59,10 +60,10 @@
      * @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.executable.ExecutionException if 
compiler or executable writes anything to the standard error stream (provided 
the
+     * @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, Set<String> commands, File 
workingDirectory, boolean failsOnErrorOutput )
+    void executeCommand( String executable, List<String> commands, File 
workingDirectory, boolean failsOnErrorOutput )
         throws CompilerException;
 
     /**
@@ -135,25 +136,25 @@
                 }
 
 
-                public void executeCommand( String executable, Set<String> 
commands )
+                public void executeCommand( String executable, List<String> 
commands )
                     throws CompilerException
                 {
                     executeCommand( executable, commands, null, true );
                 }
 
-                public void executeCommand( String executable, Set<String> 
commands, boolean failsOnErrorOutput )
+                public void executeCommand( String executable, List<String> 
commands, boolean failsOnErrorOutput )
                     throws CompilerException
                 {
                     executeCommand( executable, commands, null, 
failsOnErrorOutput );
                 }
 
-                public void executeCommand( String executable, Set<String> 
commands, File workingDirectory,
+                public void executeCommand( String executable, List<String> 
commands, File workingDirectory,
                                             boolean failsOnErrorOutput )
                     throws CompilerException
                 {
                     if ( commands == null )
                     {
-                        commands = new HashSet<String>();
+                        commands = new ArrayList<String>();
                     }
                     stdOut = new StreamConsumerImpl();
                     stdErr = new ErrorStreamConsumer();

Modified: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerConfig.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerConfig.java?rev=603417&r1=603416&r2=603417&view=diff
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerConfig.java
 (original)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerConfig.java
 Tue Dec 11 15:53:16 2007
@@ -79,6 +79,8 @@
 
     String getArtifactFileName();
 
+    void setArtifactFileName(String artifactFileName);
+
     void verifyCompilerConfig() throws IllegalArgumentException;
 
 

Modified: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerContext.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerContext.java?rev=603417&r1=603416&r2=603417&view=diff
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerContext.java
 (original)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerContext.java
 Tue Dec 11 15:53:16 2007
@@ -2,6 +2,9 @@
 
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.dotnet.PlatformUnsupportedException;
+import org.apache.maven.dotnet.InitializationException;
+
+import java.io.IOException;
 
 public interface CompilerContext
 {
@@ -22,6 +25,6 @@
 
     MavenProject getMavenProject();
 
-    void init( MavenProject project, CompilerConfig compilerConfig) throws 
PlatformUnsupportedException;
+    void init( MavenProject project, CompilerConfig compilerConfig) throws 
InitializationException, IOException;
 
 }

Modified: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerConfig.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerConfig.java?rev=603417&r1=603416&r2=603417&view=diff
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerConfig.java
 (original)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerConfig.java
 Tue Dec 11 15:53:16 2007
@@ -75,6 +75,7 @@
                 {
                     this.artifactFileName = artifactFileName;
                 }
+
                 public KeyInfo getKeyInfo()
                 {
                     return keyInfo;

Modified: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerContext.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerContext.java?rev=603417&r1=603416&r2=603417&view=diff
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerContext.java
 (original)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerContext.java
 Tue Dec 11 15:53:16 2007
@@ -7,6 +7,10 @@
 
 public interface DotnetCompilerContext extends CompilerContext
 {
+    /**
+     * Role used to register component implementations with the container.
+     */
+    String ROLE = DotnetCompilerContext.class.getName();
 
     /**
      * Returns assembly names that should be referenced by the compiler. If 
the List is emtpy, then all core assemblies

Modified: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java?rev=603417&r1=603416&r2=603417&view=diff
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java
 (original)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java
 Tue Dec 11 15:53:16 2007
@@ -2,12 +2,13 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
 import java.util.Enumeration;
-import java.util.jar.JarFile;
-import java.util.jar.JarEntry;
+import java.net.URL;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.dotnet.compiler.ClassCompiler;
@@ -15,8 +16,8 @@
 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.PlatformUnsupportedException;
 import org.apache.maven.dotnet.Vendor;
+import org.apache.maven.dotnet.InitializationException;
 import org.apache.maven.dotnet.compiler.CompilerAnnotation;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.logging.Logger;
@@ -54,6 +55,7 @@
 
     private boolean assemblyExistsCheck = true;
 
+    private boolean compilerExistsCheck = true;
 
     public Set<String> getCoreAssemblyNames()
     {
@@ -111,7 +113,7 @@
     }
 
     public void init( MavenProject project, CompilerConfig compilerConfig )
-        throws PlatformUnsupportedException
+        throws InitializationException, IOException
     {
         if ( project == null )
         {
@@ -199,68 +201,50 @@
                 }
             }//end for loop
         }
-        System.out.println(System.getProperty( "java.class.path" ));
-        String[] classPathJars = System.getProperty( "java.class.path" 
).split( "[" + File.pathSeparator + "]" );
-        for ( String classPathJar : classPathJars )
-        {   System.out.println(classPathJar);
-            if ( classPathJar.contains( "dotnet-extensions-" ) )
+
+        Enumeration<URL> resources =
+            this.getClass().getClassLoader().getResources( 
"/META-INF/nmaven/annotation-resources.txt" );
+
+        while ( resources.hasMoreElements() )
+        {
+            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 );
+                    Class c = Class.forName( annotatedClass );
+                    className = c.getName();
+                    CompilerAnnotation annotation = (CompilerAnnotation) 
c.getAnnotation( CompilerAnnotation.class );
+                    if ( annotation != null && isMatchBetween( 
(DotnetCompilerConfig) compilerConfig, annotation ) )
+                    {
+                        classCompiler = (ClassCompiler) c.newInstance();
+                        classCompiler.init( this );
+                    }
                 }
-                catch ( IOException e )
+                catch ( ClassNotFoundException e )
                 {
-                    e.printStackTrace();
+                    throw new InitializationException(
+                        "NMAVEN-061-007: Unable to create NetCompiler: Class 
Name = " + className, e );
                 }
-                Enumeration jarEntries = jarFile.entries();
-
-                while ( jarEntries.hasMoreElements() )
+                catch ( InstantiationException e )
                 {
-                    JarEntry jarEntry = (JarEntry) jarEntries.nextElement();
-                     System.out.println(jarEntry.getName());
-                    if ( jarEntry.isDirectory() || 
!jarEntry.getName().endsWith( "class" ) )
-                    {
-                        continue;
-                    }
-
-                    String className = null;
-                    try
-                    {
-                        String[] tokens = jarEntry.getName().split( "[//]" );
-
-                        Class c = Class.forName( tokens[tokens.length - 
1].split( "[.]" )[0] );
-                        className = c.getName();
-                        CompilerAnnotation annotation =
-                            (CompilerAnnotation) c.getAnnotation( 
CompilerAnnotation.class );
-                        if ( annotation != null && isMatchBetween( 
(DotnetCompilerConfig) compilerConfig, annotation ) )
-                        {
-                            classCompiler = (ClassCompiler) c.newInstance();
-                            classCompiler.init( this );
-                        }
-                    }
-                    catch ( ClassNotFoundException e )
-                    {
-                        throw new PlatformUnsupportedException(
-                            "NMAVEN-061-007: Unable to create NetCompiler: 
Class Name = " + className, e );
-                    }
-                    catch ( InstantiationException e )
-                    {
-                        throw new PlatformUnsupportedException(
-                            "NMAVEN-061-005: Unable to create NetCompiler: 
Class Name = " + className, e );
-                    }
-                    catch ( IllegalAccessException e )
-                    {
-                        throw new PlatformUnsupportedException(
-                            "NMAVEN-061-006: Unable to create NetCompiler: 
Class Name = " + className, e );
-                    }
+                    throw new InitializationException(
+                        "NMAVEN-061-005: Unable to create NetCompiler: Class 
Name = " + className, e );
+                }
+                catch ( IllegalAccessException e )
+                {
+                    throw new InitializationException(
+                        "NMAVEN-061-006: Unable to create NetCompiler: Class 
Name = " + className, e );
                 }
             }
         }
-        if ( classCompiler == null )
+
+        if ( classCompiler == null && compilerExistsCheck)
         {
-           // throw new PlatformUnsupportedException("Could not find 
compiler");
+             throw new InitializationException("Could not find compiler");
         }
         String basedir = project.getBuild().getDirectory() + File.separator + 
"assembly-resources" + File.separator;
         linkedResources = new File( basedir, "linkresource" ).exists() ? new 
HashSet<File>(
@@ -276,7 +260,7 @@
             File[] icons = win32IconDir.listFiles();
             if ( icons.length > 1 )
             {
-                throw new PlatformUnsupportedException(
+                throw new InitializationException(
                     "NMAVEN-061-002: There is more than one win32icon in 
resource directory: Number = " + icons
                         .length );
             }
@@ -297,6 +281,16 @@
         this.assemblyExistsCheck = true;
     }
 
+    protected void turnOffCompilerExistsCheck()
+    {
+        this.compilerExistsCheck = false;
+    }
+
+    protected void turnOnCompilerExistsCheck()
+    {
+        this.compilerExistsCheck = true;
+    }
+
     private static boolean isMatchBetween( DotnetCompilerConfig 
compilerConfig, CompilerAnnotation compilerAnnotation )
     {
         return Arrays.asList( compilerAnnotation.vendors() ).contains( 
compilerConfig.getVendor() ) &&
@@ -306,7 +300,7 @@
     }
 
     private String getGacRootForMono()
-        throws PlatformUnsupportedException
+        throws InitializationException
     {
         String path = System.getProperty( "PATH" ) != null ? 
System.getProperty( "PATH" ) : System.getenv( "PATH" );
         if ( path != null )
@@ -338,20 +332,20 @@
         }
         else
         {
-            throw new PlatformUnsupportedException(
+            throw new InitializationException(
                 "NMAVEN-061-003: Could not locate Global Assembly Cache for 
Mono. Try setting the MONO_ROOT environmental variable." );
         }
     }
 
     private void setArtifactGacFile( String gacRoot, Artifact artifact )
-        throws PlatformUnsupportedException
+        throws InitializationException
     {
         File gacFile = new File( gacRoot, artifact.getArtifactId() + 
File.separator + artifact.getVersion() + "__" +
             artifact.getClassifier() + File.separator + 
artifact.getArtifactId() + ".dll" );
 
         if ( assemblyExistsCheck && !gacFile.exists() )
         {
-            throw new PlatformUnsupportedException(
+            throw new InitializationException(
                 "NMAVEN-061-004: Could not find GAC dependency: File = " + 
gacFile.getAbsolutePath() );
         }
         artifact.setFile( gacFile );

Modified: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java?rev=603417&r1=603416&r2=603417&view=diff
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java
 (original)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java
 Tue Dec 11 15:53:16 2007
@@ -3,6 +3,7 @@
 import java.util.HashSet;
 import java.util.Set;
 import java.io.File;
+import java.io.IOException;
 
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.artifact.Artifact;
@@ -17,6 +18,7 @@
 import org.apache.maven.dotnet.compiler.DotnetCompilerPlatformVersion;
 import org.apache.maven.dotnet.ProgrammingLanguage;
 import org.apache.maven.dotnet.Vendor;
+import org.apache.maven.dotnet.InitializationException;
 import org.apache.maven.dotnet.compiler.ClassCompiler;
 
 import org.junit.Test;
@@ -29,7 +31,7 @@
 {
     @Test(expected = IllegalArgumentException.class)
     public void init_WithNullProject()
-        throws PlatformUnsupportedException
+        throws InitializationException, IOException
     {
         DotnetCompilerContextImpl ctx = new DotnetCompilerContextImpl();
         DotnetCompilerConfig compilerConfig = 
DotnetCompilerConfig.Factory.createDefaultCompilerConfig();
@@ -40,7 +42,7 @@
 
     @Test(expected = IllegalArgumentException.class)
     public void init_WithNullCompilerConfig()
-        throws PlatformUnsupportedException
+        throws InitializationException, IOException
     {
         DotnetCompilerContextImpl ctx = new DotnetCompilerContextImpl();
         ctx.init( new MavenProject(), null );
@@ -48,7 +50,7 @@
 
     @Test
     public void testInit_WithModule()
-        throws PlatformUnsupportedException
+        throws InitializationException, IOException
     {
         DotnetCompilerContextImpl ctx = new DotnetCompilerContextImpl();
         MavenProject project = new MavenProject();
@@ -64,6 +66,7 @@
         build.setDirectory( "" );
         project.setBuild( build );
 
+        ctx.turnOffCompilerExistsCheck();
         ctx.init( project, getDefaultDotnetCompilerConfig() );
 
         Set<Artifact> modules = ctx.getModuleDependencies();
@@ -72,7 +75,7 @@
 
     @Test
     public void testInit_WithLibrary()
-        throws PlatformUnsupportedException
+        throws InitializationException, IOException
     {
         DotnetCompilerContextImpl ctx = new DotnetCompilerContextImpl();
         MavenProject project = new MavenProject();
@@ -88,6 +91,7 @@
         build.setDirectory( "" );
         project.setBuild( build );
 
+        ctx.turnOffCompilerExistsCheck();
         ctx.init( project, getDefaultDotnetCompilerConfig() );
 
         Set<Artifact> libraries = ctx.getLibraryDependencies();
@@ -96,7 +100,7 @@
 
     @Test
     public void testInit_WithExe()
-        throws PlatformUnsupportedException
+        throws InitializationException, IOException
     {
         DotnetCompilerContextImpl ctx = new DotnetCompilerContextImpl();
         MavenProject project = new MavenProject();
@@ -111,6 +115,7 @@
         build.setDirectory( "" );
         project.setBuild( build );
 
+        ctx.turnOffCompilerExistsCheck();
         ctx.init( project, getDefaultDotnetCompilerConfig() );
 
         Set<Artifact> libraries = ctx.getLibraryDependencies();
@@ -119,7 +124,7 @@
 
     @Test
     public void testInit_WithGacGenericAndMicrosoft()
-        throws PlatformUnsupportedException
+        throws InitializationException, IOException
     {
         DotnetCompilerContextImpl ctx = new DotnetCompilerContextImpl();
         MavenProject project = new MavenProject();
@@ -136,6 +141,7 @@
         project.setBuild( build );
 
         ctx.turnOffAssemblyExistsCheck();
+        ctx.turnOffCompilerExistsCheck();
 
         ctx.init( project, getDefaultDotnetCompilerConfig() );
 
@@ -161,7 +167,7 @@
 
     @Test
     public void testInit_WithGacGenericAndNovellAndPath()
-        throws PlatformUnsupportedException
+        throws InitializationException, IOException
     {
         System.setProperty( "PATH", "C:\\Program Files\\Mono\\bin" );
         DotnetCompilerContextImpl ctx = new DotnetCompilerContextImpl();
@@ -182,6 +188,7 @@
         DotnetCompilerConfig compilerConfig = getDefaultDotnetCompilerConfig();
         compilerConfig.setVendor( Vendor.NOVELL );
 
+        ctx.turnOffCompilerExistsCheck();
         ctx.init( project, compilerConfig );
 
         Set<Artifact> libraries = ctx.getLibraryDependencies();
@@ -192,7 +199,7 @@
 
     @Test
     public void testInit_WithGacGenericAndNovellAndMonoRoot()
-        throws PlatformUnsupportedException
+        throws InitializationException, IOException
     {
         System.setProperty( "MONO_ROOT", "C:\\Program Files\\Mono\\bin" );
         DotnetCompilerContextImpl ctx = new DotnetCompilerContextImpl();
@@ -213,6 +220,7 @@
         DotnetCompilerConfig compilerConfig = getDefaultDotnetCompilerConfig();
         compilerConfig.setVendor( Vendor.NOVELL );
 
+        ctx.turnOffCompilerExistsCheck();
         ctx.init( project, compilerConfig );
 
         Set<Artifact> libraries = ctx.getLibraryDependencies();
@@ -222,8 +230,9 @@
     }
 
 //    @Test
+
     public void testInit_ForCorrectCompiler()
-        throws PlatformUnsupportedException
+        throws InitializationException, IOException
     {
         DotnetCompilerContextImpl ctx = new DotnetCompilerContextImpl();
         MavenProject project = new MavenProject();

Modified: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-extensions-maven/src/main/java/org/apache/maven/dotnet/extensions/compiler/CSharpClassCompiler.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-extensions-maven/src/main/java/org/apache/maven/dotnet/extensions/compiler/CSharpClassCompiler.java?rev=603417&r1=603416&r2=603417&view=diff
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-extensions-maven/src/main/java/org/apache/maven/dotnet/extensions/compiler/CSharpClassCompiler.java
 (original)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-extensions-maven/src/main/java/org/apache/maven/dotnet/extensions/compiler/CSharpClassCompiler.java
 Tue Dec 11 15:53:16 2007
@@ -1,9 +1,10 @@
 package org.apache.maven.dotnet.extensions.compiler;
 
 import java.io.File;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
+import java.util.List;
+import java.util.ArrayList;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.dotnet.compiler.CommandExecutor;
@@ -27,33 +28,22 @@
 
     private File compiledArtifact;
 
-    public File getCompiledArtifact()
-        throws InvalidArtifactException
-    {
-        if ( compiledArtifact == null || !compiledArtifact.exists() )
-        {
-            throw new InvalidArtifactException();
-        }
-        return compiledArtifact;
-    }
-
     public boolean failOnErrorOutput()
     {
         return false;
     }
 
-    public Set<String> getCommands()
+    public List<String> getCommands()
     {
         DotnetCompilerConfig config = (DotnetCompilerConfig) 
compilerContext.getCompilerConfig();
         Set<Artifact> references = compilerContext.getLibraryDependencies();
         Set<Artifact> modules = compilerContext.getDirectModuleDependencies();
 
         File sourceDirectory = config.getCompilerDirectory();
-        compiledArtifact =
-            new File( config.getTargetDirectory(), 
compilerContext.getCompilerConfig().getArtifactFileName() );
+
         String targetArtifactType = 
config.getArtifactType().getTargetCompileType();
 
-        Set<String> commands = new HashSet<String>();
+        List<String> commands = new ArrayList<String>();
         commands.add( "/out:" + compiledArtifact.getAbsolutePath() );
         commands.add( "/target:" + targetArtifactType );
         commands.add( "/recurse:" + sourceDirectory + File.separator + "**" );
@@ -146,12 +136,12 @@
         return commands;
     }
 
-    public void resetCommands( Set<String> commands )
+    public void resetCommands( List<String> commands )
     {
 
     }
 
-    public void compile()
+    public File compile() throws InvalidArtifactException
     {
         CommandExecutor commandExecutor = 
CommandExecutor.Factory.createDefaultCommmandExecutor();
         //commandExecutor.setLogger( logger );
@@ -163,6 +153,11 @@
         {
             e.printStackTrace();
         }
+        if ( compiledArtifact == null || !compiledArtifact.exists() )
+        {
+            throw new InvalidArtifactException();
+        }
+        return compiledArtifact;
     }
 
     public String getCompilerFileName()
@@ -188,5 +183,7 @@
             throw new IllegalArgumentException( "compilerContext" );
         }
         this.compilerContext = (DotnetCompilerContext) compilerContext;
+        compiledArtifact = new File( 
compilerContext.getCompilerConfig().getTargetDirectory(),
+                                     
compilerContext.getCompilerConfig().getArtifactFileName() );
     }
 }

Added: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-extensions-maven/src/main/resources/META-INF/nmaven/annotation-resources.txt
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-extensions-maven/src/main/resources/META-INF/nmaven/annotation-resources.txt?rev=603417&view=auto
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-extensions-maven/src/main/resources/META-INF/nmaven/annotation-resources.txt
 (added)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-extensions-maven/src/main/resources/META-INF/nmaven/annotation-resources.txt
 Tue Dec 11 15:53:16 2007
@@ -0,0 +1,4 @@
+org.apache.maven.dotnet.extensions.assembler.DefaultAssemblyInfoMarshaller
+org.apache.maven.dotnet.extensions.assembler.JavaAssemblyInfoMarshaller
+org.apache.maven.dotnet.extensions.assembler.VBAssemblyInfoMarshaller
+org.apache.maven.dotnet.extensions.compiler.CSharpClassCompiler
\ No newline at end of file

Propchange: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-extensions-maven/src/main/resources/META-INF/nmaven/annotation-resources.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java?rev=603417&r1=603416&r2=603417&view=diff
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java
 (original)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java
 Tue Dec 11 15:53:16 2007
@@ -20,15 +20,18 @@
 import org.apache.maven.dotnet.compiler.DotnetCompilerConfig;
 import org.apache.maven.dotnet.compiler.DotnetCompilerPlatformVersion;
 import org.apache.maven.dotnet.compiler.KeyInfo;
+import org.apache.maven.dotnet.compiler.InvalidArtifactException;
 import org.apache.maven.dotnet.ProgrammingLanguage;
 import org.apache.maven.dotnet.PlatformUnsupportedException;
 import org.apache.maven.dotnet.Vendor;
 import org.apache.maven.dotnet.BuildDirectories;
 import org.apache.maven.dotnet.ArtifactType;
+import org.apache.maven.dotnet.InitializationException;
 import org.apache.maven.dotnet.compiler.impl.DotnetCompilerContextImpl;
 import org.apache.maven.project.MavenProject;
 
 import java.io.File;
+import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.List;
@@ -119,16 +122,31 @@
             new File( project.getBuild().getDirectory(), 
BuildDirectories.BUILD_SOURCES.getBuildDirectoryName() ) );
         compilerConfig.setVendor( Vendor.MICROSOFT );
         compilerConfig.setTargetDirectory( new File( 
project.getBuild().getDirectory() ) );
+        compilerConfig.setArtifactFileName(
+            project.getBuild().getFinalName() + "." + 
compilerConfig.getArtifactType().getExtension() );
         DotnetCompilerContext ctx = new DotnetCompilerContextImpl();
         try
         {
             ctx.init( project, compilerConfig );
         }
-        catch ( PlatformUnsupportedException e )
+        catch ( InitializationException e )
         {
             e.printStackTrace();
         }
-        ctx.getClassCompiler().compile();
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+        }
+        try
+        {
+            project.getArtifact().setFile( ctx.getClassCompiler().compile() );
+        }
+        catch ( InvalidArtifactException e )
+        {
+            throw new MojoExecutionException(e.getMessage());
+        }
+
+
     }
 
     private static Set<File> getCompilerSourceDirectoriesFrom( List<String> 
directories )

Modified: 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/SourceProcessorMojo.java
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/SourceProcessorMojo.java?rev=603417&r1=603416&r2=603417&view=diff
==============================================================================
--- 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/SourceProcessorMojo.java
 (original)
+++ 
incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/SourceProcessorMojo.java
 Tue Dec 11 15:53:16 2007
@@ -55,6 +55,13 @@
     public void execute()
         throws MojoExecutionException
     {
+        /*
+        File targetDirectory = new 
File(project.getBuild().getOutputDirectory());
+        if(!targetDirectory.exists())
+        {
+            targetDirectory.mkdir();
+        }
+        */
         File sourceDirectory = new File( 
project.getBuild().getSourceDirectory() );
         File outputDirectory =
             new File( project.getBuild().getDirectory(), 
BuildDirectories.BUILD_SOURCES.getBuildDirectoryName() );


Reply via email to