incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ewor...@apache.org
Subject svn commit: r608270 - in /incubator/nmaven/trunk: core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/ core-integration-tests/src/test/resources/MavenITmng-0018-CSharpSynchronizeTargetWithSource/ core-integration-tests/src/tes...
Date Wed, 02 Jan 2008 22:44:07 GMT
Author: eworley
Date: Wed Jan  2 14:44:06 2008
New Revision: 608270

URL: http://svn.apache.org/viewvc?rev=608270&view=rev
Log:
Apply patch from Zak to synchronize src and compilation staging repo.  Migrated his test to
0018

Added:
    incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/MavenITmng0018CSharpSynchronizeTargetWithSource.java
    incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0018-CSharpSynchronizeTargetWithSource/
    incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0018-CSharpSynchronizeTargetWithSource/pom.xml
    incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0018-CSharpSynchronizeTargetWithSource/src/
    incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0018-CSharpSynchronizeTargetWithSource/src/It0018.cs
    incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0018-CSharpSynchronizeTargetWithSource/test/
    incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0018-CSharpSynchronizeTargetWithSource/test/It0018.cs
Modified:
    incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/IntegrationTestSuite.java
    incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/SourceProcessorMojo.java
    incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/TestSourceProcessorMojo.java

Modified: incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/IntegrationTestSuite.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/IntegrationTestSuite.java?rev=608270&r1=608269&r2=608270&view=diff
==============================================================================
--- incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/IntegrationTestSuite.java
(original)
+++ incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/IntegrationTestSuite.java
Wed Jan  2 14:44:06 2008
@@ -44,7 +44,7 @@
         suite.addTestSuite( MavenITmng0014ResolveLibraryDependency.class );
         suite.addTestSuite( MavenITmng0015DeployLibraryAsSnapshot.class );
         suite.addTestSuite( MavenITmng0016CSharpAssemblyInfoGeneration.class );
-        suite.addTestSuite( MavenITmng0017CSharpStrongNamedAssembly.class );
+        suite.addTestSuite( MavenITmng0018CSharpSynchronizeTargetWithSource.class );
         return suite;
     }
 }

Added: incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/MavenITmng0018CSharpSynchronizeTargetWithSource.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/MavenITmng0018CSharpSynchronizeTargetWithSource.java?rev=608270&view=auto
==============================================================================
--- incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/MavenITmng0018CSharpSynchronizeTargetWithSource.java
(added)
+++ incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/MavenITmng0018CSharpSynchronizeTargetWithSource.java
Wed Jan  2 14:44:06 2008
@@ -0,0 +1,64 @@
+package org.apache.maven.dotnet.integrationtests;
+
+import org.apache.maven.integrationtests.AbstractMavenIntegrationTestCase;
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+import org.apache.maven.dotnet.BuildDirectories;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+
+public class MavenITmng0018CSharpSynchronizeTargetWithSource
+    extends AbstractMavenIntegrationTestCase
+{
+	
+	private static final String CS_GEN_FILENAME = "It0018Gen.cs";
+	
+	private static final String CS_GEN_SOURCE = 
+		"namespace NMaven.IT {\n" +
+		"public class It0018Gen {\n" +
+		"    public static void Main () {\n" +
+		"    }\n" +
+		"}" +
+		"}";
+	
+    public void testit0018()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/MavenITmng-0018-CSharpSynchronizeTargetWithSource"
);
+        
+        // Generate a new CS source file
+        File generatedCSSourceFile = new File( testDir, "src/" + CS_GEN_FILENAME );
+        BufferedWriter fileWriter = new BufferedWriter( new FileWriter( generatedCSSourceFile
) );
+        fileWriter.write( CS_GEN_SOURCE );
+        fileWriter.close();
+        
+        // Generate a new CS test file
+        File generatedCSTargetFile = new File( testDir, "test/" + CS_GEN_FILENAME );
+        fileWriter = new BufferedWriter( new FileWriter( generatedCSTargetFile ) );
+        fileWriter.write( CS_GEN_SOURCE );
+        fileWriter.close();
+        
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.executeGoal( "install" );
+        verifier.assertFilePresent( "target/" + BuildDirectories.BUILD_SOURCES.getBuildDirectoryName()
+ "/It0018.cs" );
+        verifier.assertFilePresent( "target/" + BuildDirectories.BUILD_SOURCES.getBuildDirectoryName()
+ "/It0018Gen.cs" );
+        verifier.assertFilePresent( "target/" + BuildDirectories.TEST_SOURCES.getBuildDirectoryName()
+ "/It0018.cs" );
+        verifier.assertFilePresent( "target/" + BuildDirectories.TEST_SOURCES.getBuildDirectoryName()
+ "/It0018Gen.cs" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+        
+        // Delete the generated file
+        assertTrue( "Unable to delete generated source file", generatedCSSourceFile.delete()
);
+        assertTrue( "Unable to delete generated test file", generatedCSTargetFile.delete()
);
+        
+        verifier.executeGoal( "install" );
+        
+        // Verify that the deleted file is purged from the staging compilation directory
+        verifier.assertFileNotPresent( "target/" + BuildDirectories.BUILD_SOURCES.getBuildDirectoryName()
+ "/It0018Gen.cs" );
+        verifier.assertFileNotPresent( "target/" + BuildDirectories.TEST_SOURCES.getBuildDirectoryName()
+ "/It0018Gen.cs" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+    }
+}

Added: incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0018-CSharpSynchronizeTargetWithSource/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0018-CSharpSynchronizeTargetWithSource/pom.xml?rev=608270&view=auto
==============================================================================
--- incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0018-CSharpSynchronizeTargetWithSource/pom.xml
(added)
+++ incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0018-CSharpSynchronizeTargetWithSource/pom.xml
Wed Jan  2 14:44:06 2008
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project> 
+  <modelVersion>4.0.0</modelVersion>  
+  <groupId>NMaven.Its</groupId>
+  <artifactId>NMaven.It.It0018</artifactId>
+  <packaging>dotnet:library</packaging>
+  <version>1.0.0</version>
+  <name>NMaven.It.It0018</name>
+  <build> 
+    <sourceDirectory>src</sourceDirectory>
+    <testSourceDirectory>test</testSourceDirectory>    
+    <plugins> 
+      <plugin> 
+        <groupId>org.apache.maven.dotnet.plugins</groupId>  
+        <artifactId>maven-compiler-plugin</artifactId>  
+        <extensions>true</extensions> 
+      </plugin> 
+    </plugins> 
+  </build> 
+</project>

Added: incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0018-CSharpSynchronizeTargetWithSource/src/It0018.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0018-CSharpSynchronizeTargetWithSource/src/It0018.cs?rev=608270&view=auto
==============================================================================
--- incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0018-CSharpSynchronizeTargetWithSource/src/It0018.cs
(added)
+++ incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0018-CSharpSynchronizeTargetWithSource/src/It0018.cs
Wed Jan  2 14:44:06 2008
@@ -0,0 +1,8 @@
+namespace NMaven.IT {
+
+public class It0018 {
+	public static void Main () { 
+		System.Console.Write("Hello World!"); 
+	} 
+}
+}

Added: incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0018-CSharpSynchronizeTargetWithSource/test/It0018.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0018-CSharpSynchronizeTargetWithSource/test/It0018.cs?rev=608270&view=auto
==============================================================================
--- incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0018-CSharpSynchronizeTargetWithSource/test/It0018.cs
(added)
+++ incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0018-CSharpSynchronizeTargetWithSource/test/It0018.cs
Wed Jan  2 14:44:06 2008
@@ -0,0 +1,8 @@
+namespace NMaven.IT {
+
+public class It0018 {
+	public static void Main () { 
+		System.Console.Write("Hello World!"); 
+	} 
+}
+}

Modified: incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/SourceProcessorMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/SourceProcessorMojo.java?rev=608270&r1=608269&r2=608270&view=diff
==============================================================================
--- incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/SourceProcessorMojo.java
(original)
+++ incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/SourceProcessorMojo.java
Wed Jan  2 14:44:06 2008
@@ -126,5 +126,25 @@
                 throw new MojoExecutionException( "NMAVEN-904-000: Unable to process sources",
e );
             }
         }
+        
+        // Update the scanner to scan the output directory, and rescan
+        directoryScanner.setBasedir(outputDirectory);
+        directoryScanner.scan();
+        
+        // Synchronize the target folder with the source.  Specifically delete the targetFile
if
+        // the source file no longer exists
+        for ( String file : directoryScanner.getIncludedFiles() )
+        {
+        	File sourceFile = new File( sourceDirectory, file );
+        	File targetFile = new File( outputDirectory, file );
+             
+            if ( !sourceFile.exists() && targetFile.exists() )
+            {
+            	if ( !targetFile.delete() ) 
+            	{
+            		getLog().warn( "Unable to delete stale target file " + targetFile.getPath()
);
+            	}
+            }
+        }
     }
 }

Modified: incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/TestSourceProcessorMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/TestSourceProcessorMojo.java?rev=608270&r1=608269&r2=608270&view=diff
==============================================================================
--- incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/TestSourceProcessorMojo.java
(original)
+++ incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/TestSourceProcessorMojo.java
Wed Jan  2 14:44:06 2008
@@ -125,5 +125,25 @@
                 throw new MojoExecutionException( "NMAVEN-904-000: Unable to process test
sources", e );
             }
         }
+        
+        // Update the scanner to scan the output directory, and rescan
+        directoryScanner.setBasedir(outputDirectory);
+        directoryScanner.scan();
+        
+    	// Synchronize the target folder with the source.  Specifically delete the targetFile
if
+        // the source file no longer exists
+        for ( String file : directoryScanner.getIncludedFiles() )
+        {
+        	File sourceFile = new File( testSourceDirectory, file );
+        	File targetFile = new File( outputDirectory, file );
+             
+            if ( !sourceFile.exists() && targetFile.exists() )
+            {
+            	if ( !targetFile.delete() ) 
+            	{
+            		getLog().warn( "Unable to delete stale target file " + targetFile.getPath()
);
+            	}
+            }
+        }
     }
 }



Mime
View raw message