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/01 05:25:22 UTC
svn commit: r607803 - in /incubator/nmaven/trunk:
components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/
components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/
core-integration-tests/src/tes...
Author: sisbell
Date: Mon Dec 31 21:25:21 2007
New Revision: 607803
URL: http://svn.apache.org/viewvc?rev=607803&view=rev
Log:
Support for system dependencies.
Added:
incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/MavenITmng0009CSharpCompileWithProvidedGacDependency.java (with props)
incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0009-CSharpCompileWithProvidedGacDependency/
incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0009-CSharpCompileWithProvidedGacDependency/It0009.cs
incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0009-CSharpCompileWithProvidedGacDependency/pom.xml (with props)
Modified:
incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java
incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java
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/resources/META-INF/plexus/components.xml
Modified: incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java?rev=607803&r1=607802&r2=607803&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java (original)
+++ incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java Mon Dec 31 21:25:21 2007
@@ -191,6 +191,62 @@
}
moduleDependencies.add( artifact );
}
+ /*
+ else if ( type.startsWith( "dotnet:gac" ) )
+ {
+ if ( ArtifactScope.PROVIDED.isMatchByString( scope ) )
+ {
+
+ }
+
+ if ( StringUtils.isEmpty( artifact.getClassifier() ) )
+ {
+ throw new IllegalArgumentException( "classifier" );
+ }
+ if ( type.equals( ArtifactType.GAC_GENERIC.getPackagingType() ) )
+ {
+ String gacRoot = null;
+ if ( netCompilerConfig.getVendor().equals( Vendor.MICROSOFT ) &&
+ ( netCompilerConfig.getCompilerPlatformVersion().compareTo(
+ DotnetCompilerPlatformVersion.VERSION_2_0_50727 ) >= 0 ) )
+ {
+ gacRoot = replaceFileSeparator( System.getenv( "SystemRoot" ) + "\\assembly\\GAC_MSIL\\" );
+ }
+ else if ( netCompilerConfig.getVendor().equals( Vendor.MICROSOFT ) &&
+ netCompilerConfig.equals( DotnetCompilerPlatformVersion.VERSION_1_1_4322 ) )
+ {
+ gacRoot = replaceFileSeparator( System.getenv( "SystemRoot" ) + "\\assembly\\GAC\\" );
+ }
+ else if ( netCompilerConfig.getVendor().equals( Vendor.NOVELL ) )
+ {
+ gacRoot = getGacRootForMono();
+ }
+
+ if ( gacRoot != null )
+ {
+ setArtifactGacFile( gacRoot, artifact );
+ }
+ }
+ else if ( type.equals( ArtifactType.GAC.getPackagingType() ) )
+ {
+ String gacRoot = ( netCompilerConfig.getVendor().equals( Vendor.NOVELL ) ) ? getGacRootForMono()
+ : replaceFileSeparator( System.getenv( "SystemRoot" ) + "\\assembly\\GAC\\" );
+ setArtifactGacFile( gacRoot, artifact );
+ }
+ else if ( type.equals( ArtifactType.GAC_32.getPackagingType() ) )
+ {
+ String gacRoot = ( netCompilerConfig.getVendor().equals( Vendor.NOVELL ) ) ? getGacRootForMono()
+ : replaceFileSeparator( System.getenv( "SystemRoot" ) + "\\assembly\\GAC_32\\" );
+ setArtifactGacFile( gacRoot, artifact );
+ }
+ else if ( type.equals( ArtifactType.GAC_MSIL.getPackagingType() ) )
+ {
+ String gacRoot = ( netCompilerConfig.getVendor().equals( Vendor.NOVELL ) ) ? getGacRootForMono()
+ : replaceFileSeparator( System.getenv( "SystemRoot" ) + "\\assembly\\GAC_MSIL\\" );
+ setArtifactGacFile( gacRoot, artifact );
+ }
+
+ } */
}
}
addLibraryArtifactsToTarget( project.getCompileArtifacts(), compileLibraryDependencies );
@@ -346,11 +402,12 @@
{
String type = artifact.getType();
if ( ArtifactType.LIBRARY.isMatchByString( type ) || ArtifactType.EXE.isMatchByString( type ) ||
- ArtifactType.WINEXE.isMatchByString( type ) )
+ ArtifactType.WINEXE.isMatchByString( type ) || type.startsWith( "dotnet:gac" ) )
{
targetArtifacts.add( artifact );
}
- else if ( type.startsWith( "dotnet:gac" ) )
+ else if ( type.startsWith( "dotnet:gac" ) &&
+ !( artifact.getScope().equals( "provided" ) || artifact.getScope().equals( "system" ) ) )
{
throw new InitializationException( "Gac dependency scope must be specified as provided or system" );
}
Modified: incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java?rev=607803&r1=607802&r2=607803&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java (original)
+++ incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java Mon Dec 31 21:25:21 2007
@@ -58,8 +58,8 @@
Set<Artifact> dependencyArtifacts = new HashSet<Artifact>();
project.setDependencyArtifacts( dependencyArtifacts );
Artifact artifact = new DefaultArtifact( "groupId", "artifactId", VersionRange.createFromVersion( "1.0" ),
- "compile", "dotnet:module", null, new DefaultArtifactHandler( "dotnet:module" ),
- false );
+ "compile", "dotnet:module", null,
+ new DefaultArtifactHandler( "dotnet:module" ), false );
dependencyArtifacts.add( artifact );
Build build = new Build();
@@ -83,9 +83,9 @@
Set<Artifact> dependencyArtifacts = new HashSet<Artifact>();
project.setArtifacts( dependencyArtifacts );
Artifact artifact = new DefaultArtifact( "groupId", "artifactId", VersionRange.createFromVersion( "1.0" ),
- "compile", "dotnet:library", null, new DefaultArtifactHandler( "dotnet:library" ),
- false );
- artifact.setArtifactHandler( new DummyArtifactHandler());
+ "compile", "dotnet:library", null,
+ new DefaultArtifactHandler( "dotnet:library" ), false );
+ artifact.setArtifactHandler( new DummyArtifactHandler() );
dependencyArtifacts.add( artifact );
Build build = new Build();
@@ -95,7 +95,7 @@
ctx.turnOffCompilerExistsCheck();
ctx.init( project, getDefaultDotnetCompilerConfig() );
- Set<Artifact> libraries = ctx.getLibraryDependenciesFor( ArtifactScope.COMPILE);
+ Set<Artifact> libraries = ctx.getLibraryDependenciesFor( ArtifactScope.COMPILE );
assertThat( libraries.size(), equalTo( 1 ) );
}
@@ -109,8 +109,9 @@
Set<Artifact> dependencyArtifacts = new HashSet<Artifact>();
project.setArtifacts( dependencyArtifacts );
Artifact artifact = new DefaultArtifact( "groupId", "artifactId", VersionRange.createFromVersion( "1.0" ),
- "compile", "dotnet:exe", null, new DefaultArtifactHandler( "dotnet:exe" ), false );
- artifact.setArtifactHandler( new DummyArtifactHandler());
+ "compile", "dotnet:exe", null,
+ new DefaultArtifactHandler( "dotnet:exe" ), false );
+ artifact.setArtifactHandler( new DummyArtifactHandler() );
dependencyArtifacts.add( artifact );
Build build = new Build();
@@ -120,7 +121,7 @@
ctx.turnOffCompilerExistsCheck();
ctx.init( project, getDefaultDotnetCompilerConfig() );
- Set<Artifact> libraries = ctx.getLibraryDependenciesFor(ArtifactScope.COMPILE);
+ Set<Artifact> libraries = ctx.getLibraryDependenciesFor( ArtifactScope.COMPILE );
assertThat( libraries.size(), equalTo( 1 ) );
}
@@ -134,8 +135,9 @@
Set<Artifact> dependencyArtifacts = new HashSet<Artifact>();
project.setArtifacts( dependencyArtifacts );
Artifact artifact = new DefaultArtifact( "groupId", "artifactId", VersionRange.createFromVersion( "1.0" ),
- "provided", "dotnet:library", null, new DefaultArtifactHandler( "dotnet:library" ), false );
- artifact.setArtifactHandler( new DummyArtifactHandler());
+ "provided", "dotnet:library", null,
+ new DefaultArtifactHandler( "dotnet:library" ), false );
+ artifact.setArtifactHandler( new DummyArtifactHandler() );
dependencyArtifacts.add( artifact );
Build build = new Build();
@@ -145,9 +147,36 @@
ctx.turnOffCompilerExistsCheck();
ctx.init( project, getDefaultDotnetCompilerConfig() );
- Set<Artifact> libraries = ctx.getLibraryDependenciesFor(ArtifactScope.COMPILE);
+ Set<Artifact> libraries = ctx.getLibraryDependenciesFor( ArtifactScope.COMPILE );
assertThat( libraries.size(), equalTo( 1 ) );
}
+
+ @Test
+ public void testInit_WithSystemGacDependency()
+ throws InitializationException, IOException
+ {
+ DotnetCompilerContextImpl ctx = new DotnetCompilerContextImpl();
+ MavenProject project = new MavenProject();
+
+ Set<Artifact> dependencyArtifacts = new HashSet<Artifact>();
+ project.setArtifacts( dependencyArtifacts );
+ Artifact artifact = new DefaultArtifact( "groupId", "artifactId", VersionRange.createFromVersion( "1.0" ),
+ "system", "dotnet:gac_msil", null,
+ new DefaultArtifactHandler( "dotnet:gac_msil" ), false );
+ artifact.setArtifactHandler( new DummyArtifactHandler() );
+ dependencyArtifacts.add( artifact );
+
+ Build build = new Build();
+ build.setDirectory( "" );
+ project.setBuild( build );
+
+ ctx.turnOffCompilerExistsCheck();
+ ctx.init( project, getDefaultDotnetCompilerConfig() );
+
+ Set<Artifact> libraries = ctx.getLibraryDependenciesFor( ArtifactScope.COMPILE );
+ assertThat( libraries.size(), equalTo( 1 ) );
+ }
+
//@Test
public void testInit_WithGacGenericAndMicrosoft()
throws InitializationException, IOException
@@ -171,7 +200,7 @@
ctx.init( project, getDefaultDotnetCompilerConfig() );
- Set<Artifact> libraries = ctx.getLibraryDependenciesFor(ArtifactScope.COMPILE);
+ Set<Artifact> libraries = ctx.getLibraryDependenciesFor( ArtifactScope.COMPILE );
assertThat( libraries.size(), equalTo( 1 ) );
assertThat( ( (Artifact) libraries.toArray()[0] ).getFile().getAbsolutePath(),
CoreMatchers.allOf( new BaseMatcher()
@@ -191,10 +220,10 @@
} ) );
}
- // @Test
+ // @Test
public void testInit_WithGacGenericAndNovellAndPath()
throws InitializationException, IOException
- {
+ {
String monoRoot = Vendor.getDefaultVendorForOS().equals( Vendor.NOVELL ) ? "/Mono" : "C:\\Program Files\\Mono";
System.setProperty( "PATH", monoRoot + File.separator + "bin" );
@@ -219,13 +248,13 @@
ctx.turnOffCompilerExistsCheck();
ctx.init( project, compilerConfig );
- Set<Artifact> libraries = ctx.getLibraryDependenciesFor(ArtifactScope.COMPILE);
+ Set<Artifact> libraries = ctx.getLibraryDependenciesFor( ArtifactScope.COMPILE );
assertThat( libraries.size(), equalTo( 1 ) );
assertThat( ( (Artifact) libraries.toArray()[0] ).getFile().getAbsolutePath(), equalTo(
monoRoot + replaceFileSeparator( "\\lib\\mono\\gac\\artifactId\\1.0__dsfajkdsfajdfs\\artifactId.dll" ) ) );
}
- // @Test
+ // @Test
public void testInit_WithGacGenericAndNovellAndMonoRoot()
throws InitializationException, IOException
{
@@ -252,7 +281,7 @@
ctx.turnOffCompilerExistsCheck();
ctx.init( project, compilerConfig );
- Set<Artifact> libraries = ctx.getLibraryDependenciesFor(ArtifactScope.COMPILE);
+ Set<Artifact> libraries = ctx.getLibraryDependenciesFor( ArtifactScope.COMPILE );
assertThat( libraries.size(), equalTo( 1 ) );
assertThat( ( (Artifact) libraries.toArray()[0] ).getFile().getAbsolutePath(), equalTo(
monoRoot + replaceFileSeparator( "\\lib\\mono\\gac\\artifactId\\1.0__dsfajkdsfajdfs\\artifactId.dll" ) ) );
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=607803&r1=607802&r2=607803&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 Mon Dec 31 21:25:21 2007
@@ -33,10 +33,12 @@
suite.addTestSuite( MavenITmng0002CSharpCompileModule.class );
suite.addTestSuite( MavenITmng0003CSharpCompileWinexe.class );
suite.addTestSuite( MavenITmng0004CSharpCompileWithDependency.class );
- suite.addTestSuite( MavenITmng0005CSharpCompileWithTransitiveDependency.class );
+ suite.addTestSuite( MavenITmng0005CSharpCompileWithTransitiveDependency.class );
// suite.addTestSuite( MavenITmng0006NUnitTestExecution.class );
suite.addTestSuite( MavenITmng0007CSharpCompileTestLibrary.class );
+
suite.addTestSuite( MavenITmng0008CSharpCompileWithProvidedDependency.class );
+ // suite.addTestSuite( MavenITmng0009CSharpCompileWithProvidedGacDependency.class );
return suite;
}
}
Added: incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/MavenITmng0009CSharpCompileWithProvidedGacDependency.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/MavenITmng0009CSharpCompileWithProvidedGacDependency.java?rev=607803&view=auto
==============================================================================
--- incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/MavenITmng0009CSharpCompileWithProvidedGacDependency.java (added)
+++ incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/MavenITmng0009CSharpCompileWithProvidedGacDependency.java Mon Dec 31 21:25:21 2007
@@ -0,0 +1,25 @@
+package org.apache.maven.dotnet.integrationtests;
+
+import org.apache.maven.integrationtests.AbstractMavenIntegrationTestCase;
+import org.apache.maven.it.util.ResourceExtractor;
+import org.apache.maven.it.Verifier;
+import org.apache.maven.dotnet.BuildDirectories;
+
+import java.io.File;
+
+public class MavenITmng0009CSharpCompileWithProvidedGacDependency
+ extends AbstractMavenIntegrationTestCase
+{
+ public void testit0009()
+ throws Exception
+ {
+ File testDir =
+ ResourceExtractor.simpleExtractResources( getClass(), "/MavenITmng-0009-CSharpCompileWithProvidedGacDependency" );
+ Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+ verifier.executeGoal( "install" );
+ verifier.assertFilePresent( "target/" + BuildDirectories.BUILD_SOURCES.getBuildDirectoryName() + "/It0009.cs" );
+ verifier.assertFilePresent( "target/NMaven.It.It0009-1.0.0.dll" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+ }
+}
Propchange: incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/MavenITmng0009CSharpCompileWithProvidedGacDependency.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0009-CSharpCompileWithProvidedGacDependency/It0009.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0009-CSharpCompileWithProvidedGacDependency/It0009.cs?rev=607803&view=auto
==============================================================================
--- incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0009-CSharpCompileWithProvidedGacDependency/It0009.cs (added)
+++ incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0009-CSharpCompileWithProvidedGacDependency/It0009.cs Mon Dec 31 21:25:21 2007
@@ -0,0 +1,10 @@
+using System.Windows.Forms;
+
+namespace NMaven.IT {
+
+public class It0009 {
+ public static void Main () {
+
+ }
+}
+}
Added: incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0009-CSharpCompileWithProvidedGacDependency/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0009-CSharpCompileWithProvidedGacDependency/pom.xml?rev=607803&view=auto
==============================================================================
--- incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0009-CSharpCompileWithProvidedGacDependency/pom.xml (added)
+++ incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0009-CSharpCompileWithProvidedGacDependency/pom.xml Mon Dec 31 21:25:21 2007
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>NMaven.Its</groupId>
+ <artifactId>NMaven.It.It0009</artifactId>
+ <packaging>dotnet:library</packaging>
+ <version>1.0.0</version>
+ <name>NMaven.It.It0009</name>
+ <build>
+ <sourceDirectory>.</sourceDirectory>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.dotnet.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>System.Windows.Forms</groupId>
+ <artifactId>System.Windows.Forms</artifactId>
+ <version>2.0.0.0</version>
+ <type>dotnet:gac_msil</type>
+ <scope>system</scope>
+ <classifier>b77a5c561934e089</classifier>
+ <systemPath>${env.GAC_ROOT}\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll</systemPath>
+ </dependency>
+ </dependencies>
+</project>
Propchange: incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0009-CSharpCompileWithProvidedGacDependency/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml?rev=607803&r1=607802&r2=607803&view=diff
==============================================================================
--- incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml (original)
+++ incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml Mon Dec 31 21:25:21 2007
@@ -18,7 +18,7 @@
<compile>
org.apache.maven.dotnet.plugins:maven-compiler-plugin:compile
</compile>
- <test-compile>
+ <test-compile>
org.apache.maven.dotnet.plugins:maven-compiler-plugin:test-compile
</test-compile>
<test>
@@ -50,7 +50,7 @@
<compile>
org.apache.maven.dotnet.plugins:maven-compiler-plugin:compile
</compile>
- <test-compile>
+ <test-compile>
org.apache.maven.dotnet.plugins:maven-compiler-plugin:test-compile
</test-compile>
<test>
@@ -108,7 +108,7 @@
<process-sources>
org.apache.maven.dotnet.plugins:maven-compiler-plugin:process-sources
</process-sources>
- <process-test-sources>
+ <process-test-sources>
org.apache.maven.dotnet.plugins:maven-compiler-plugin:process-test-sources
</process-test-sources>
<compile>
@@ -178,6 +178,7 @@
<configuration>
<extension>dll</extension>
<type>dotnet:gac</type>
+ <addedToClasspath>true</addedToClasspath>
</configuration>
</component>
<component>
@@ -187,6 +188,7 @@
<configuration>
<extension>dll</extension>
<type>dotnet:gac_generic</type>
+ <addedToClasspath>true</addedToClasspath>
</configuration>
</component>
<component>
@@ -196,6 +198,7 @@
<configuration>
<extension>dll</extension>
<type>dotnet:gac_msil</type>
+ <addedToClasspath>true</addedToClasspath>
</configuration>
</component>
<component>
@@ -205,6 +208,7 @@
<configuration>
<extension>dll</extension>
<type>dotnet:gac_32</type>
+ <addedToClasspath>true</addedToClasspath>
</configuration>
</component>
<component>