incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ewor...@apache.org
Subject svn commit: r608757 - in /incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler: AbstractCompilerMojo.java CompilerMojo.java TestCompilerMojo.java
Date Fri, 04 Jan 2008 06:38:04 GMT
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;
     }
 }



Mime
View raw message