Author: sisbell Date: Sun Feb 18 15:39:21 2007 New Revision: 509030 URL: http://svn.apache.org/viewvc?view=rev&rev=509030 Log: JIRA NMAVEN-5: This fix allows the adding of a GAC dependency within a build file. The only tricky part is that artifact resolution comes prior to NMaven becoming platform-aware. For GAC dependencies, NMaven waits until the construction of the CompilerContext to add the GAC file location to GAC artifacts. This fix only supports MS framework. For Mono/Linux may need to mandate use of nmaven-settings.xml file so we know the location of the GAC.
Modified: incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/AssemblyRepositoryLayout.java incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactContextImpl.java incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CompilerContextImpl.java incubator/nmaven/branches/SI_IDE/plugins/maven-compile-plugin/src/main/resources/META-INF/plexus/components.xml incubator/nmaven/branches/SI_IDE/plugins/pom-java-bootstrap.xml incubator/nmaven/branches/SI_IDE/plugins/pom.xml Modified: incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/AssemblyRepositoryLayout.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/AssemblyRepositoryLayout.java?view=diff&rev=509030&r1=509029&r2=509030 ============================================================================== --- incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/AssemblyRepositoryLayout.java (original) +++ incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/AssemblyRepositoryLayout.java Sun Feb 18 15:39:21 2007 @@ -104,7 +104,4 @@ */ public String pathOfRemoteRepositoryMetadata( ArtifactMetadata metadata ) { - System.out.println( "CALLING REMOTE : " + metadata.getRemoteFilename() ); - return ""; - } -} + C \ No newline at end of file Modified: incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactContextImpl.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactContextImpl.java?view=diff&rev=509030&r1=509029&r2=509030 ============================================================================== --- incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactContextImpl.java (original) +++ incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactContextImpl.java Sun Feb 18 15:39:21 2007 @@ -177,7 +177,7 @@ dependency.getVersion() ), dependency.getType(), dependency.getClassifier(), scope, null ); - depSet.add( art ); + if(!art.getType().equals( "gac")) depSet.add( art ); } try Modified: incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java?view=diff&rev=509030&r1=509029&r2=509030 ============================================================================== --- incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java (original) +++ incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java Sun Feb 18 15:39:21 2007 @@ -103,6 +103,7 @@ sourceArtifact.addMetadata( meta ); Set<Artifact> artifactDependencies = new HashSet<Artifact>(); + Set<Artifact> gacDependencies = new HashSet<Artifact>(); for ( Dependency dependency : dependencies ) { String scope = ( dependency.getScope() == null ) ? Artifact.SCOPE_COMPILE : dependency.getScope(); @@ -112,7 +113,14 @@ dependency.getVersion() ), dependency.getType(), dependency.getClassifier(), scope, null ); - artifactDependencies.add( artifact ); + if ( artifact.getType().equals( "gac" ) ) + { + gacDependencies.add( artifact ); + } + else + { + artifactDependencies.add( artifact ); + } } ArtifactRepository localArtifactRepository = @@ -134,7 +142,9 @@ localArtifactRepository, metadata ); if ( addResolvedDependenciesToProject ) { - project.setDependencyArtifacts( result.getArtifacts() ); + Set<Artifact> resolvedDependencies = result.getArtifacts(); + resolvedDependencies.addAll( gacDependencies ); + project.setDependencyArtifacts( resolvedDependencies ); } } Modified: incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CompilerContextImpl.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CompilerContextImpl.java?view=diff&rev=509030&r1=509029&r2=509030 ============================================================================== --- incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CompilerContextImpl.java (original) +++ incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CompilerContextImpl.java Sun Feb 18 15:39:21 2007 @@ -136,11 +136,15 @@ return artifacts; } - public KeyInfo getKeyInfo() { - if((compilerRequirement.getVendor().equals( Vendor.MICROSOFT ) - && compilerRequirement.getFrameworkVersion().equals("1.1.4322")) || config.getKeyInfo() == null) { + public KeyInfo getKeyInfo() + { + if ( ( compilerRequirement.getVendor().equals( Vendor.MICROSOFT ) && + compilerRequirement.getFrameworkVersion().equals( "1.1.4322" ) ) || config.getKeyInfo() == null ) + { return KeyInfo.Factory.createDefaultKeyInfo(); - } else { + } + else + { return config.getKeyInfo(); } } @@ -254,6 +258,41 @@ { libraries.add( artifact ); } + //Resolving here since the GAC path is vendor and framework aware + //TODO: Add support for 32/64 bit GACs + else if ( type.equals( "gac" ) ) + { + String gacRoot = null; + if ( compilerRequirement.getVendor().equals( Vendor.MICROSOFT ) && ( + compilerRequirement.getFrameworkVersion().equals( "2.0.50727" ) || + compilerRequirement.getFrameworkVersion().equals( "3.0" ) ) ) + { + gacRoot = "C:\\WINDOWS\\assembly\\GAC_MSIL\\"; + } + else if ( compilerRequirement.getVendor().equals( Vendor.MICROSOFT ) && + compilerRequirement.getFrameworkVersion().equals( "1.1.4322" ) ) + { + gacRoot = "C:\\WINDOWS\\assembly\\GAC\\"; + } + else if ( compilerRequirement.getVendor().equals( Vendor.MONO ) ) + { + //TODO: MONO Support + } + if ( gacRoot != null ) + { + File gacFile = new File( gacRoot + artifact.getArtifactId() + File.separator + + artifact.getVersion() + File.separator + artifact.getArtifactId() + ".dll" ); + if ( !gacFile.exists() ) + { + throw new PlatformUnsupportedException( + "NMAVEN-000-000: Could not find GAC dependency: File = " + gacFile.getAbsolutePath() ); + } + artifact.setFile( gacFile ); + libraries.add( artifact ); + } + } + + } compilerCapability = capabilityMatcher.matchCompilerCapabilityFor( compilerRequirement ); Modified: incubator/nmaven/branches/SI_IDE/plugins/maven-compile-plugin/src/main/resources/META-INF/plexus/components.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/plugins/maven-compile-plugin/src/main/resources/META-INF/plexus/components.xml?view=diff&rev=509030&r1=509029&r2=509030 ============================================================================== --- incubator/nmaven/branches/SI_IDE/plugins/maven-compile-plugin/src/main/resources/META-INF/plexus/components.xml (original) +++ incubator/nmaven/branches/SI_IDE/plugins/maven-compile-plugin/src/main/resources/META-INF/plexus/components.xml Sun Feb 18 15:39:21 2007 @@ -196,6 +196,15 @@ </component> <component> <role>org.apache.maven.artifact.handler.ArtifactHandler</role> + <role-hint>gac</role-hint> + <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation> + <configuration> + <extension>dll</extension> + <type>gac</type> + </configuration> + </component> + <component> + <role>org.apache.maven.artifact.handler.ArtifactHandler</role> <role-hint>nar</role-hint> <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation> <configuration> Modified: incubator/nmaven/branches/SI_IDE/plugins/pom-java-bootstrap.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/plugins/pom-java-bootstrap.xml?view=diff&rev=509030&r1=509029&r2=509030 ============================================================================== --- incubator/nmaven/branches/SI_IDE/plugins/pom-java-bootstrap.xml (original) +++ incubator/nmaven/branches/SI_IDE/plugins/pom-java-bootstrap.xml Sun Feb 18 15:39:21 2007 @@ -1,50 +1,51 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>org.apache.maven.dotnet.plugins</groupId> - <artifactId>maven-dotnet-plugins</artifactId> - <packaging>pom</packaging> - <version>0.14-SNAPSHOT</version> - <name>maven-dotnet-plugins</name> - <modules> - <module>maven-compile-plugin</module> - <module>maven-test-plugin</module> - <module>maven-webapp-plugin</module> - <module>maven-xsd-plugin</module> - <module>maven-wsdl-plugin</module> - <module>maven-install-plugin</module> - <module>maven-resgen-plugin</module> - <module>maven-resolver-plugin</module> - <module>maven-settings-plugin</module> - </modules> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.dotnet.plugins</groupId> + <artifactId>maven-dotnet-plugins</artifactId> + <packaging>pom</packaging> + <version>0.14-SNAPSHOT</version> + <name>maven-dotnet-plugins</name> + <modules> + <module>maven-compile-plugin</module> + <module>maven-test-plugin</module> + <module>maven-webapp-plugin</module> + <module>maven-xsd-plugin</module> + <module>maven-wsdl-plugin</module> + <module>maven-install-plugin</module> + <module>maven-resgen-plugin</module> + <module>maven-resolver-plugin</module> + <module>maven-settings-plugin</module> + <module>maven-vstudio-plugin</module> + </modules> - <dependencies> - <dependency> - <groupId>org.apache.maven.dotnet</groupId> - <artifactId>dotnet-assembler</artifactId> - <version>0.14-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.apache.maven.dotnet</groupId> - <artifactId>dotnet-executable</artifactId> - <version>0.14-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.apache.maven.dotnet</groupId> - <artifactId>dotnet-artifact</artifactId> - <version>0.14-SNAPSHOT</version> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.5</source> - <target>1.5</target> - </configuration> - </plugin> - </plugins> - </build> + <dependencies> + <dependency> + <groupId>org.apache.maven.dotnet</groupId> + <artifactId>dotnet-assembler</artifactId> + <version>0.14-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.maven.dotnet</groupId> + <artifactId>dotnet-executable</artifactId> + <version>0.14-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.maven.dotnet</groupId> + <artifactId>dotnet-artifact</artifactId> + <version>0.14-SNAPSHOT</version> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + </plugins> + </build> </project> Modified: incubator/nmaven/branches/SI_IDE/plugins/pom.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/plugins/pom.xml?view=diff&rev=509030&r1=509029&r2=509030 ============================================================================== --- incubator/nmaven/branches/SI_IDE/plugins/pom.xml (original) +++ incubator/nmaven/branches/SI_IDE/plugins/pom.xml Sun Feb 18 15:39:21 2007 @@ -18,6 +18,7 @@ <module>maven-resgen-plugin</module> <module>maven-resolver-plugin</module> <module>maven-settings-plugin</module> + <module>maven-vstudio-plugin</module> <module>nmaven-utility-resx</module> <module>nmaven-utility-settings</module> </modules>