Author: sisbell Date: Fri Nov 30 09:49:01 2007 New Revision: 599883 URL: http://svn.apache.org/viewvc?rev=599883&view=rev Log: Fixed bug: now fails int if gac entry does not contain classifier. Added direct compile dependencies to pom.
Modified: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/pom.xml incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/pom.xml Modified: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/pom.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/pom.xml?rev=599883&r1=599882&r2=599883&view=diff ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/pom.xml (original) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/pom.xml Fri Nov 30 09:49:01 2007 @@ -35,11 +35,31 @@ <mavenVersion>2.0.8</mavenVersion> </properties> - <dependencies> + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-artifact</artifactId> + <version>${mavenVersion}</version> + </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-core</artifactId> <version>${mavenVersion}</version> </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-project</artifactId> + <version>${mavenVersion}</version> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-utils</artifactId> + <version>1.4.6</version> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-container-default</artifactId> + <version>1.0-alpha-40</version> + </dependency> </dependencies> </project> Modified: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java?rev=599883&r1=599882&r2=599883&view=diff ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java (original) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java Fri Nov 30 09:49:01 2007 @@ -15,12 +15,12 @@ import org.apache.maven.dotnet.compiler.Vendor; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.logging.Logger; +import org.codehaus.plexus.util.StringUtils; public final class DotnetCompilerContextImpl implements DotnetCompilerContext { - /** * The maven project */ @@ -125,67 +125,75 @@ libraryDependencies = new HashSet<Artifact>(); moduleDependencies = new HashSet<Artifact>(); - Set<Artifact> dependenctArtifacts = project.getDependencyArtifacts(); - if ( dependenctArtifacts != null ) + Set<Artifact> dependentArtifacts = project.getDependencyArtifacts(); + if ( dependentArtifacts != null ) { - for ( Artifact dependenctArtifact : dependenctArtifacts ) + for ( Artifact dependentArtifact : dependentArtifacts ) { - String type = dependenctArtifact.getType(); + String type = dependentArtifact.getType(); if ( type.equals( "module" ) ) { - moduleDependencies.add( dependenctArtifact ); + moduleDependencies.add( dependentArtifact ); } else if ( type.equals( "library" ) || type.equals( "exe" ) ) { - libraryDependencies.add( dependenctArtifact ); + libraryDependencies.add( dependentArtifact ); } - else if ( type.equals( "gac_generic" ) ) + else if ( type.startsWith( "gac" ) ) { - String gacRoot = null; - if ( netCompilerConfig.getVendor().equals( Vendor.MICROSOFT ) && - ( netCompilerConfig.getCompilerPlatformVersion().compareTo( - DotnetCompilerPlatformVersion.VERSION_2_0_50727 ) >= 0 ) ) + if ( StringUtils.isEmpty( dependentArtifact.getClassifier() ) ) { - gacRoot = System.getenv( "SystemRoot" ) + "\\assembly\\GAC_MSIL\\"; + throw new IllegalArgumentException( "classifier" ); } - else if ( netCompilerConfig.getVendor().equals( Vendor.MICROSOFT ) && - netCompilerConfig.equals( DotnetCompilerPlatformVersion.VERSION_1_1_4322 ) ) + if ( type.equals( "gac_generic" ) ) { - gacRoot = System.getenv( "SystemRoot" ) + "\\assembly\\GAC\\"; + String gacRoot = null; + if ( netCompilerConfig.getVendor().equals( Vendor.MICROSOFT ) && + ( netCompilerConfig.getCompilerPlatformVersion().compareTo( + DotnetCompilerPlatformVersion.VERSION_2_0_50727 ) >= 0 ) ) + { + gacRoot = System.getenv( "SystemRoot" ) + "\\assembly\\GAC_MSIL\\"; + } + else if ( netCompilerConfig.getVendor().equals( Vendor.MICROSOFT ) && + netCompilerConfig.equals( DotnetCompilerPlatformVersion.VERSION_1_1_4322 ) ) + { + gacRoot = System.getenv( "SystemRoot" ) + "\\assembly\\GAC\\"; + } + else if ( netCompilerConfig.getVendor().equals( Vendor.NOVELL ) ) + { + gacRoot = getGacRootForMono(); + } + + if ( gacRoot != null ) + { + System.out.println( gacRoot ); + setArtifactGacFile( gacRoot, dependentArtifact ); + libraryDependencies.add( dependentArtifact ); + } } - else if ( netCompilerConfig.getVendor().equals( Vendor.NOVELL ) ) + else if ( type.equals( "gac" ) ) { - gacRoot = getGacRootForMono(); + String gacRoot = ( netCompilerConfig.getVendor().equals( Vendor.NOVELL ) ) ? getGacRootForMono() + : System.getenv( "SystemRoot" ) + "\\assembly\\GAC\\"; + setArtifactGacFile( gacRoot, dependentArtifact ); + libraryDependencies.add( dependentArtifact ); } - - if ( gacRoot != null ) + else if ( type.equals( "gac_32" ) ) { - setArtifactGacFile( gacRoot, dependenctArtifact ); - libraryDependencies.add( dependenctArtifact ); + String gacRoot = ( netCompilerConfig.getVendor().equals( Vendor.NOVELL ) ) ? getGacRootForMono() + : System.getenv( "SystemRoot" ) + "\\assembly\\GAC_32\\"; + setArtifactGacFile( gacRoot, dependentArtifact ); + libraryDependencies.add( dependentArtifact ); + } + else if ( type.equals( "gac_msil" ) ) + { + String gacRoot = ( netCompilerConfig.getVendor().equals( Vendor.NOVELL ) ) ? getGacRootForMono() + : System.getenv( "SystemRoot" ) + "\\assembly\\GAC_MSIL\\"; + setArtifactGacFile( gacRoot, dependentArtifact ); + libraryDependencies.add( dependentArtifact ); } } - else if ( type.equals( "gac" ) ) - { - String gacRoot = ( netCompilerConfig.getVendor().equals( Vendor.NOVELL ) ) ? getGacRootForMono() - : System.getenv( "SystemRoot" ) + "\\assembly\\GAC\\"; - setArtifactGacFile( gacRoot, dependenctArtifact ); - libraryDependencies.add( dependenctArtifact ); - } - else if ( type.equals( "gac_32" ) ) - { - String gacRoot = ( netCompilerConfig.getVendor().equals( Vendor.NOVELL ) ) ? getGacRootForMono() - : System.getenv( "SystemRoot" ) + "\\assembly\\GAC_32\\"; - setArtifactGacFile( gacRoot, dependenctArtifact ); - libraryDependencies.add( dependenctArtifact ); - } - else if ( type.equals( "gac_msil" ) ) - { - String gacRoot = ( netCompilerConfig.getVendor().equals( Vendor.NOVELL ) ) ? getGacRootForMono() - : System.getenv( "SystemRoot" ) + "\\assembly\\GAC_MSIL\\"; - setArtifactGacFile( gacRoot, dependenctArtifact ); - libraryDependencies.add( dependenctArtifact ); - } - } + }//end for loop } /* String className = compilerCapability.getPluginClassName(); Modified: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java?rev=599883&r1=599882&r2=599883&view=diff ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java (original) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java Fri Nov 30 09:49:01 2007 @@ -129,7 +129,7 @@ Set<Artifact> dependencyArtifacts = new HashSet<Artifact>(); project.setDependencyArtifacts( dependencyArtifacts ); Artifact artifact = new DefaultArtifact( "groupId", "artifactId", VersionRange.createFromVersion( "1.0" ), - "compile", "gac_generic", null, + "compile", "gac_generic", "dsfajkdsfajdfs", new DefaultArtifactHandler( "library" ), false ); dependencyArtifacts.add( artifact ); @@ -146,7 +146,8 @@ assertThat( ( (Artifact) libraries.toArray()[0] ).getFile().getAbsolutePath(), CoreMatchers.allOf( new BaseMatcher() { - private String containsString = "assembly\\GAC_MSIL\\artifactId\\1.0__null\\artifactId.dll"; + private String containsString = + "assembly\\GAC_MSIL\\artifactId\\1.0__dsfajkdsfajdfs\\artifactId.dll"; public boolean matches( Object object ) { @@ -155,7 +156,7 @@ public void describeTo( org.hamcrest.Description description ) { - description.appendText( "Start With = " + containsString ); + description.appendText( "Contains = " + containsString ); } } ) ); } Modified: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/pom.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/pom.xml?rev=599883&r1=599882&r2=599883&view=diff ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/pom.xml (original) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/pom.xml Fri Nov 30 09:49:01 2007 @@ -39,6 +39,7 @@ <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.4</version> + <scope>test</scope> </dependency> </dependencies> <build>