Author: eworley
Date: Sun Dec 30 19:50:15 2007
New Revision: 607656
URL: http://svn.apache.org/viewvc?rev=607656&view=rev
Log:
* Removed exists check for sourceDirectory during compiler config validation
* Added sourceDirectory exists fail fast for Source/Test compilers
* Fixed integration test dependencies
Modified:
incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerConfig.java
incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/NetCompilerConfigTest.java
incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/compiler/CSharpClassCompiler.java
incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0004-CSharpCompileWithDependency/It0004.cs
incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0004-CSharpCompileWithDependency/pom.xml
incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0005-CSharpCompileWithTransitiveDependency/It0005.cs
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/CompilerMojo.java
incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/TestCompilerMojo.java
Modified:
incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerConfig.java
URL:
http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerConfig.java?rev=607656&r1=607655&r2=607656&view=diff
==============================================================================
---
incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerConfig.java
(original)
+++
incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerConfig.java
Sun Dec 30 19:50:15 2007
@@ -202,7 +202,7 @@
throw new IllegalArgumentException( "localRepository"
);
}
- if ( compileSourceDirectory == null ||
!compileSourceDirectory.exists() )
+ if ( compileSourceDirectory == null)
{
throw new IllegalArgumentException( "sourceDirectory"
);
}
Modified:
incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/NetCompilerConfigTest.java
URL:
http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/NetCompilerConfigTest.java?rev=607656&r1=607655&r2=607656&view=diff
==============================================================================
---
incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/NetCompilerConfigTest.java
(original)
+++
incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/NetCompilerConfigTest.java
Sun Dec 30 19:50:15 2007
@@ -66,7 +66,7 @@
config.verifyCompilerConfig();
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void verifyCompilerConfig_WithMissingSourceDirectory()
throws IllegalArgumentException
{
Modified:
incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/compiler/CSharpClassCompiler.java
URL:
http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/compiler/CSharpClassCompiler.java?rev=607656&r1=607655&r2=607656&view=diff
==============================================================================
---
incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/compiler/CSharpClassCompiler.java
(original)
+++
incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/compiler/CSharpClassCompiler.java
Sun Dec 30 19:50:15 2007
@@ -37,9 +37,9 @@
import org.apache.maven.dotnet.Vendor;
import org.apache.maven.dotnet.ArtifactScope;
[EMAIL PROTECTED](programmingLanguaqe = ProgrammingLanguage.C_SHARP,
- vendors = {Vendor.MICROSOFT, Vendor.NOVELL, Vendor.ANY},
- dotnetCompilerPlatformVersions =
{DotnetCompilerPlatformVersion.VERSION_2_0_50727,
DotnetCompilerPlatformVersion.VERSION_3_0})
[EMAIL PROTECTED]( programmingLanguaqe = ProgrammingLanguage.C_SHARP, vendors =
{ Vendor.MICROSOFT, Vendor.NOVELL,
+ Vendor.ANY }, dotnetCompilerPlatformVersions = {
DotnetCompilerPlatformVersion.VERSION_2_0_50727,
+ DotnetCompilerPlatformVersion.VERSION_3_0 } )
public final class CSharpClassCompiler
implements org.apache.maven.dotnet.compiler.ClassCompiler
{
@@ -49,19 +49,22 @@
public boolean failOnErrorOutput()
{
- //MONO writes warnings to standard error: this turns off failing
builds on warnings for MONO
- return compilerContext.getCompilerConfig().getVendor().equals(
Vendor.MICROSOFT);
+ // MONO writes warnings to standard error: this turns off failing
builds on warnings for MONO
+ return compilerContext.getCompilerConfig().getVendor().equals(
Vendor.MICROSOFT );
}
public List<String> getCommands()
{
DotnetCompilerConfig config = (DotnetCompilerConfig)
compilerContext.getCompilerConfig();
-
+
Set<Artifact> references = null;
- if (compilerContext.getCompilerConfig().isTestCompile()) {
+ if ( compilerContext.getCompilerConfig().isTestCompile() )
+ {
references = compilerContext.getLibraryDependenciesFor(
ArtifactScope.TEST );
references.add( compilerContext.getMavenProject().getArtifact() );
- } else {
+ }
+ else
+ {
references = compilerContext.getLibraryDependenciesFor(
ArtifactScope.COMPILE );
}
Set<Artifact> modules = compilerContext.getDirectModuleDependencies();
@@ -123,9 +126,10 @@
if ( config.getVendor().equals( Vendor.MICROSOFT ) &&
config.getCompilerPlatformVersion().equals(
DotnetCompilerPlatformVersion.VERSION_3_0 ) )
{
- String wcfRef = "/reference:" + System.getenv( "SystemRoot" ) +
- "\\Microsoft.NET\\Framework\\v3.0\\Windows Communication
Foundation\\";
- //TODO: This is a hard-coded path: Don't have a registry value
either.
+ String wcfRef =
+ "/reference:" + System.getenv( "SystemRoot" ) +
+ "\\Microsoft.NET\\Framework\\v3.0\\Windows Communication
Foundation\\";
+ // TODO: This is a hard-coded path: Don't have a registry value
either.
commands.add( wcfRef + "System.ServiceModel.dll" );
commands.add( wcfRef + "Microsoft.Transactions.Bridge.dll" );
commands.add( wcfRef + "Microsoft.Transactions.Bridge.Dtc.dll" );
@@ -143,12 +147,9 @@
{
commands.add( "/keycontainer:" +
config.getKeyInfo().getKeyContainerName() );
}
-/*
- if ( config.getCommands() != null )
- {
- commands.addAll( config.getCommands() );
- }
- */
+ /*
+ * if ( config.getCommands() != null ) { commands.addAll(
config.getCommands() ); }
+ */
commands.add( "/warnaserror-" );
if ( config.getVendor().equals( Vendor.NOVELL ) )
{
@@ -175,7 +176,7 @@
commandExecutor.setLogger( compilerContext.getPlexusLogger() );
try
{
- commandExecutor.executeCommand( getCompilerFileName(),
getCommands(), failOnErrorOutput());
+ commandExecutor.executeCommand( getCompilerFileName(),
getCommands(), failOnErrorOutput() );
}
catch ( CompilerException e )
{
@@ -206,12 +207,13 @@
public void init( CompilerContext compilerContext )
{
- if ( compilerContext == null || ! ( compilerContext instanceof
DotnetCompilerContext ) )
+ if ( compilerContext == null || !( compilerContext instanceof
DotnetCompilerContext ) )
{
throw new IllegalArgumentException( "compilerContext" );
}
this.compilerContext = (DotnetCompilerContext) compilerContext;
- compiledArtifact = new File(
compilerContext.getCompilerConfig().getTargetDirectory(),
-
compilerContext.getCompilerConfig().getArtifactFileName() );
+ compiledArtifact =
+ new File( compilerContext.getCompilerConfig().getTargetDirectory(),
+
compilerContext.getCompilerConfig().getArtifactFileName() );
}
}
Modified:
incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0004-CSharpCompileWithDependency/It0004.cs
URL:
http://svn.apache.org/viewvc/incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0004-CSharpCompileWithDependency/It0004.cs?rev=607656&r1=607655&r2=607656&view=diff
==============================================================================
---
incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0004-CSharpCompileWithDependency/It0004.cs
(original)
+++
incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0004-CSharpCompileWithDependency/It0004.cs
Sun Dec 30 19:50:15 2007
@@ -2,7 +2,7 @@
public class It0004 {
public static void Main () {
- new It0001();
+ new It0000();
}
}
}
Modified:
incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0004-CSharpCompileWithDependency/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0004-CSharpCompileWithDependency/pom.xml?rev=607656&r1=607655&r2=607656&view=diff
==============================================================================
---
incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0004-CSharpCompileWithDependency/pom.xml
(original)
+++
incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0004-CSharpCompileWithDependency/pom.xml
Sun Dec 30 19:50:15 2007
@@ -20,7 +20,7 @@
<dependencies>
<dependency>
<groupId>NMaven.Its</groupId>
- <artifactId>NMaven.It.It0001</artifactId>
+ <artifactId>NMaven.It.It0000</artifactId>
<version>1.0.0</version>
<type>dotnet:library</type>
</dependency>
Modified:
incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0005-CSharpCompileWithTransitiveDependency/It0005.cs
URL:
http://svn.apache.org/viewvc/incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0005-CSharpCompileWithTransitiveDependency/It0005.cs?rev=607656&r1=607655&r2=607656&view=diff
==============================================================================
---
incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0005-CSharpCompileWithTransitiveDependency/It0005.cs
(original)
+++
incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0005-CSharpCompileWithTransitiveDependency/It0005.cs
Sun Dec 30 19:50:15 2007
@@ -2,7 +2,7 @@
public class It0005 {
public static void Main () {
- new It0001();
+ new It0000();
new It0004();
}
}
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=607656&r1=607655&r2=607656&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
Sun Dec 30 19:50:15 2007
@@ -18,7 +18,6 @@
*/
package org.apache.maven.dotnet.plugin.nunit;
-
import java.io.File;
import org.apache.maven.plugin.AbstractMojo;
@@ -33,7 +32,7 @@
/**
* Maven Mojo for executing nunit tests
- *
+ *
* @goal test
* @phase test
* @description Maven Mojo for executing nunit tests
@@ -43,19 +42,20 @@
{
// Used to determine if nunit-console is not on the path
// TODO: This probably only works on Windows machines
- private static final String COMMAND_NOT_FOUND_FRAGMENT =
- "is not recognized as an internal or external command";
-
+ private static final String COMMAND_NOT_FOUND_FRAGMENT = "is not
recognized as an internal or external command";
+
// Command, options, assembly
private static final String NUNIT_CALL_FMT = "%s %s %s";
-
+
private static final String NUNIT_EXECUTABLE = "nunit-console";
+
private static final String NUNIT_OPTIONS = "";
-// private static final String NUNIT_OPTIONS = "/labels /nologo";
-
+
+ // private static final String NUNIT_OPTIONS = "/labels /nologo";
+
/**
* The maven project.
- *
+ *
* @parameter expression="${project}"
* @required
*/
@@ -68,70 +68,79 @@
String outputDirectory = project.getBuild().getDirectory();
String innvocation = getNUnitInvocation();
-
+
Commandline commandline = new Commandline();
-
- getLog().debug("NMaven-test: workingDirectory(" + outputDirectory +
")");
-
- commandline.setWorkingDirectory(outputDirectory);
- commandline.setExecutable(innvocation);
-
- NUnitStreamConsumer systemOut = new NUnitStreamConsumer(getLog());
- NUnitStreamConsumer systemErr = new NUnitStreamConsumer(getLog());
-
- try
+
+ getLog().debug( "NMaven-test: workingDirectory(" + outputDirectory +
")" );
+
+ commandline.setWorkingDirectory( outputDirectory );
+ commandline.setExecutable( innvocation );
+
+ NUnitStreamConsumer systemOut = new NUnitStreamConsumer( getLog() );
+ NUnitStreamConsumer systemErr = new NUnitStreamConsumer( getLog() );
+
+ try
{
// Execute the commandline
- CommandLineUtils.executeCommandLine(commandline, systemOut,
systemErr);
-
+ CommandLineUtils.executeCommandLine( commandline, systemOut,
systemErr );
+
// Check if nunit-console is not in the path
- if (systemErr.isCommandNotFound())
+ if ( systemErr.isCommandNotFound() )
{
- throw new MojoExecutionException("Please add nunit-console to
your path");
+ throw new MojoExecutionException( "Please add nunit-console to
your path" );
}
- }
- catch (CommandLineException e)
+ }
+ catch ( CommandLineException e )
{
- throw new MojoExecutionException("Failure executing commandline, "
+ e.getMessage());
+ throw new MojoExecutionException( "Failure executing commandline,
" + e.getMessage() );
}
-
+
// TODO: Turn this into a debug
- getLog().info("Executed command: " + commandline);
-
- getLog().info("Done executing tests..");
+ getLog().info( "Executed command: " + commandline );
+
+ getLog().info( "Done executing tests.." );
}
-
- private String getNUnitInvocation() throws MojoExecutionException {
-
+
+ private String getNUnitInvocation()
+ throws MojoExecutionException
+ {
+
File file = project.getArtifact().getFile();
- String pieces = file.getName().substring(0,
file.getName().lastIndexOf('.'));
+ String pieces = file.getName().substring( 0,
file.getName().lastIndexOf( '.' ) );
String testAssemblyName = pieces + "-test.dll";
-
- return String.format(NUNIT_CALL_FMT, NUNIT_EXECUTABLE, NUNIT_OPTIONS,
testAssemblyName);
+
+ return String.format( NUNIT_CALL_FMT, NUNIT_EXECUTABLE, NUNIT_OPTIONS,
testAssemblyName );
}
-
- private static class NUnitStreamConsumer implements StreamConsumer {
+
+ private static class NUnitStreamConsumer
+ implements StreamConsumer
+ {
private boolean commandNotFound;
+
private StringBuilder consumedLines = new StringBuilder();
-
+
private Log log;
-
- private NUnitStreamConsumer(Log log) {
+
+ private NUnitStreamConsumer( Log log )
+ {
this.log = log;
}
-
- public void consumeLine(String line) {
- consumedLines.append(line + "\n");
-
- log.info(line);
-
- if (line.contains(COMMAND_NOT_FOUND_FRAGMENT)) {
+
+ public void consumeLine( String line )
+ {
+ consumedLines.append( line + "\n" );
+
+ log.info( line );
+
+ if ( line.contains( COMMAND_NOT_FOUND_FRAGMENT ) )
+ {
commandNotFound = true;
}
}
-
- public boolean isCommandNotFound() {
+
+ public boolean isCommandNotFound()
+ {
return commandNotFound;
}
}
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=607656&r1=607655&r2=607656&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
Sun Dec 30 19:50:15 2007
@@ -124,6 +124,15 @@
public void execute()
throws MojoExecutionException, MojoFailureException
{
+ File sourceDir =
+ new File( project.getBuild().getDirectory(),
+ BuildDirectories.BUILD_SOURCES.getBuildDirectoryName() );
+
+ // No source to process
+ if (!sourceDir.exists()) {
+ return;
+ }
+
Vendor vendor;
if ( vendorName != null )
{
@@ -136,6 +145,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 ) );
@@ -158,8 +168,7 @@
compilerConfig.setLocalRepository( localRepository );
compilerConfig.setProgrammingLanguage( ProgrammingLanguage.C_SHARP );
- compilerConfig.setCompilerSourceDirectory(
- new File( project.getBuild().getDirectory(),
BuildDirectories.BUILD_SOURCES.getBuildDirectoryName() ) );
+ compilerConfig.setCompilerSourceDirectory( sourceDir );
compilerConfig.setVendor( vendor );
compilerConfig.setTargetDirectory( new File(
project.getBuild().getDirectory() ) );
compilerConfig.setArtifactFileName(
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=607656&r1=607655&r2=607656&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
Sun Dec 30 19:50:15 2007
@@ -121,6 +121,15 @@
public void execute()
throws MojoExecutionException, MojoFailureException
{
+ File sourceDir =
+ new File( project.getBuild().getDirectory(),
+ BuildDirectories.TEST_SOURCES.getBuildDirectoryName() );
+
+ // No test source to process
+ if (!sourceDir.exists()) {
+ return;
+ }
+
Vendor vendor;
if ( vendorName != null )
{
@@ -156,8 +165,7 @@
compilerConfig.setLocalRepository( localRepository );
compilerConfig.setProgrammingLanguage( ProgrammingLanguage.C_SHARP );
compilerConfig.setTestCompile( true );
- compilerConfig.setCompilerSourceDirectory(
- new File( project.getBuild().getDirectory(),
BuildDirectories.TEST_SOURCES.getBuildDirectoryName() ) );
+ compilerConfig.setCompilerSourceDirectory( sourceDir );
compilerConfig.setVendor( vendor );
compilerConfig.setTargetDirectory( new File(
project.getBuild().getDirectory() ) );
compilerConfig.setArtifactFileName(