You are viewing a plain text version of this content. The canonical link for it is here.
Posted to nmaven-commits@incubator.apache.org by si...@apache.org on 2008/01/10 20:47:39 UTC

svn commit: r610926 - in /incubator/nmaven/trunk: ./ plugins/dotnet-test-plugin/ plugins/dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/ plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/

Author: sisbell
Date: Thu Jan 10 12:47:38 2008
New Revision: 610926

URL: http://svn.apache.org/viewvc?rev=610926&view=rev
Log:
Fixed bug where plugin was passing wrong working directory to nunit-console. Added back in code for copying test assemblies.

Modified:
    incubator/nmaven/trunk/maven-dotnet.iml
    incubator/nmaven/trunk/plugins/dotnet-test-plugin/pom.xml
    incubator/nmaven/trunk/plugins/dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java
    incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/AssemblyInfoGeneratorMojo.java
    incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/TestCompilerMojo.java

Modified: incubator/nmaven/trunk/maven-dotnet.iml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/maven-dotnet.iml?rev=610926&r1=610925&r2=610926&view=diff
==============================================================================
--- incubator/nmaven/trunk/maven-dotnet.iml (original)
+++ incubator/nmaven/trunk/maven-dotnet.iml Thu Jan 10 12:47:38 2008
@@ -12,6 +12,7 @@
       <sourceFolder url="file://$MODULE_DIR$/components/maven-dotnet-core/src/main/java" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/components/maven-dotnet-extensions/src/main/java" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/core-integration-tests/src/test/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/plugins/dotnet-test-plugin/src/main/java" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/plugins/maven-compiler-plugin/src/main/java" isTestSource="false" />
     </content>
     <orderEntry type="inheritedJdk" />

Modified: incubator/nmaven/trunk/plugins/dotnet-test-plugin/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/dotnet-test-plugin/pom.xml?rev=610926&r1=610925&r2=610926&view=diff
==============================================================================
--- incubator/nmaven/trunk/plugins/dotnet-test-plugin/pom.xml (original)
+++ incubator/nmaven/trunk/plugins/dotnet-test-plugin/pom.xml Thu Jan 10 12:47:38 2008
@@ -40,7 +40,16 @@
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
-      <artifactId>maven-core</artifactId>
+      <artifactId>maven-project</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.dotnet</groupId>
+      <artifactId>maven-dotnet-core</artifactId>
+      <version>${pom.version}</version>
     </dependency>
   </dependencies>
  

Modified: incubator/nmaven/trunk/plugins/dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java?rev=610926&r1=610925&r2=610926&view=diff
==============================================================================
--- incubator/nmaven/trunk/plugins/dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java (original)
+++ incubator/nmaven/trunk/plugins/dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java Thu Jan 10 12:47:38 2008
@@ -27,6 +27,7 @@
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.dotnet.BuildDirectories;
 import org.codehaus.plexus.util.cli.CommandLineException;
 import org.codehaus.plexus.util.cli.CommandLineUtils;
 import org.codehaus.plexus.util.cli.Commandline;
@@ -80,13 +81,14 @@
         }
         
         // The directory where the test artifact exists
-        String outputDirectory = project.getBuild().getDirectory();
+        File testAssemblies =
+            new File( project.getBuild().getDirectory(), BuildDirectories.TEST_ASSEMBLIES.getBuildDirectoryName() );
 
         Commandline commandline = new Commandline();
 
-        getLog().debug( "NMaven-test: workingDirectory(" + outputDirectory + ")" );
+        getLog().debug( "NMaven-test: workingDirectory(" + testAssemblies.getAbsolutePath() + ")" );
 
-        commandline.setWorkingDirectory( outputDirectory );
+        commandline.setWorkingDirectory( testAssemblies.getAbsolutePath() );
         commandline.setExecutable( NUNIT_EXECUTABLE );
         commandline.addArguments( getNUnitArguments() );
 

Modified: 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=610926&r1=610925&r2=610926&view=diff
==============================================================================
--- incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/AssemblyInfoGeneratorMojo.java (original)
+++ incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/AssemblyInfoGeneratorMojo.java Thu Jan 10 12:47:38 2008
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.apache.maven.dotnet.plugin.compiler;
 
 import org.apache.maven.plugin.AbstractMojo;
@@ -38,40 +56,12 @@
     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.

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=610926&r1=610925&r2=610926&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 10 12:47:38 2008
@@ -20,26 +20,24 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.List;
+import java.util.Set;
 
-import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
 import org.apache.maven.dotnet.ArtifactType;
 import org.apache.maven.dotnet.BuildDirectories;
 import org.apache.maven.dotnet.InitializationException;
 import org.apache.maven.dotnet.ProgrammingLanguage;
 import org.apache.maven.dotnet.Vendor;
+import org.apache.maven.dotnet.ArtifactScope;
 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.compiler.InvalidArtifactException;
-import org.apache.maven.dotnet.compiler.KeyInfo;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.artifact.Artifact;
+import org.codehaus.plexus.util.FileUtils;
 
 /**
  * Maven Mojo for compiling Class files to the .NET Intermediate Language.
@@ -151,13 +149,43 @@
         {
             throw new MojoExecutionException( e.getMessage() );
         }
+
+        File testAssembly;
         try
         {
-            compilerContext.getClassCompiler().compile();
+            testAssembly = compilerContext.getClassCompiler().compile();
         }
         catch ( InvalidArtifactException e )
         {
             throw new MojoExecutionException( e.getMessage() );
+        }
+
+        //Copy test references to target
+        File testAssemblies =
+            new File( project.getBuild().getDirectory(), BuildDirectories.TEST_ASSEMBLIES.getBuildDirectoryName() );
+
+        if ( !testAssemblies.exists() && !testAssemblies.mkdirs() )
+        {
+            throw new MojoExecutionException( "Unable to create test assemblies directory: " + testAssemblies );
+        }
+
+       Set<Artifact> testDependencies = compilerContext.getLibraryDependenciesFor( ArtifactScope.TEST );
+
+        try
+        {
+            for ( Artifact testDependency : testDependencies )
+            {
+                File testDependencyFile = testDependency.getFile();
+                File testAssembliesFile = new File( testAssemblies, testDependencyFile.getName() );
+                FileUtils.copyFile( testDependencyFile, testAssembliesFile );
+            }
+
+            File copiedTestAssembly = new File( testAssemblies, testAssembly.getName() );
+            FileUtils.copyFile( testAssembly, copiedTestAssembly );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "Unable to copy all test assemblies to execution directory" );
         }
     }
 }