From nmaven-commits-return-273-apmail-incubator-nmaven-commits-archive=incubator.apache.org@incubator.apache.org Wed May 09 16:31:32 2007 Return-Path: Delivered-To: apmail-incubator-nmaven-commits-archive@locus.apache.org Received: (qmail 31563 invoked from network); 9 May 2007 16:31:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 May 2007 16:31:32 -0000 Received: (qmail 38235 invoked by uid 500); 9 May 2007 16:31:38 -0000 Delivered-To: apmail-incubator-nmaven-commits-archive@incubator.apache.org Received: (qmail 38218 invoked by uid 500); 9 May 2007 16:31:38 -0000 Mailing-List: contact nmaven-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: nmaven-dev@incubator.apache.org Delivered-To: mailing list nmaven-commits@incubator.apache.org Received: (qmail 38209 invoked by uid 99); 9 May 2007 16:31:38 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2007 09:31:38 -0700 X-ASF-Spam-Status: No, hits=-98.6 required=10.0 tests=ALL_TRUSTED,INFO_TLD,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2007 09:31:30 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id EA1431A9838; Wed, 9 May 2007 09:31:09 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r536577 - in /incubator/nmaven/branches/SI_XPT: ./ archetypes/maven-archetype-netexecutable/src/main/resources/archetype-resources/src/main/java/ assemblies/NMaven.Core/src/main/csharp/Core/Impl/ components/dotnet-artifact/src/main/java/org... Date: Wed, 09 May 2007 16:30:48 -0000 To: nmaven-commits@incubator.apache.org From: sisbell@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070509163109.EA1431A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sisbell Date: Wed May 9 09:30:40 2007 New Revision: 536577 URL: http://svn.apache.org/viewvc?view=rev&rev=536577 Log: Fixed issues: 1) artifacts not downloading remotely; 2) dependent artifacts now install into exe/plugin directory after resolving; 3) changed the remote .NET artifact format to the standard java default; NMaven will do a file copy after resolving the artifact. Modified: incubator/nmaven/branches/SI_XPT/archetypes/maven-archetype-netexecutable/src/main/resources/archetype-resources/src/main/java/NetExecutableMojo.java incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Core/src/main/csharp/Core/Impl/ProjectGeneratorImpl.cs incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactContext.java incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactInstaller.java incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/AssemblyResolver.java incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactContextImpl.java incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/resources/META-INF/plexus/components.xml incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/ExecutableContext.java incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/DefaultNetExecutable.java incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/ExecutableContextImpl.java incubator/nmaven/branches/SI_XPT/components/dotnet-model/netdependency/netdependency.mdo incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/VendorInfoRepository.java incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/SettingsRepository.java incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/VendorInfoRepositoryImpl.java incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/test/java/org/apache/maven/dotnet/vendor/impl/VendorInfoRepositoryTestStub.java incubator/nmaven/branches/SI_XPT/maven-dotnet.iml incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/SourceProcessorMojo.java incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/TestSourceProcessorMojo.java incubator/nmaven/branches/SI_XPT/plugins/maven-resolver-plugin/src/main/java/org/apache/maven/dotnet/plugin/resolver/NetDependencyResolverMojo.java Modified: incubator/nmaven/branches/SI_XPT/archetypes/maven-archetype-netexecutable/src/main/resources/archetype-resources/src/main/java/NetExecutableMojo.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/archetypes/maven-archetype-netexecutable/src/main/resources/archetype-resources/src/main/java/NetExecutableMojo.java?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/archetypes/maven-archetype-netexecutable/src/main/resources/archetype-resources/src/main/java/NetExecutableMojo.java (original) +++ incubator/nmaven/branches/SI_XPT/archetypes/maven-archetype-netexecutable/src/main/resources/archetype-resources/src/main/java/NetExecutableMojo.java Wed May 9 09:30:40 2007 @@ -82,7 +82,7 @@ } catch ( ExecutionException e ) { - throw new MojoExecutionException( "NMAVEN-xxx-000: Unable to execute gacutil: Vendor " + vendor + + throw new MojoExecutionException( "NMAVEN-xxx-000: Unable to execute: Vendor " + vendor + ", frameworkVersion = " + frameworkVersion + ", Profile = " + profile, e ); } catch ( PlatformUnsupportedException e ) Modified: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Core/src/main/csharp/Core/Impl/ProjectGeneratorImpl.cs URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Core/src/main/csharp/Core/Impl/ProjectGeneratorImpl.cs?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Core/src/main/csharp/Core/Impl/ProjectGeneratorImpl.cs (original) +++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Core/src/main/csharp/Core/Impl/ProjectGeneratorImpl.cs Wed May 9 09:30:40 2007 @@ -26,6 +26,7 @@ using System.Collections.Generic; using System.Reflection; using System.Text; +using test; namespace NMaven.Core.Impl { Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactContext.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactContext.java?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactContext.java (original) +++ incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactContext.java Wed May 9 09:30:40 2007 @@ -114,6 +114,15 @@ File getLocalRepository(); /** + * Returns a list of .NET artifacts that reside within the specified repository. + * + * @param repository the local repository directory. If value is null, the localRepository reference will default to + * the specified localRepository passed to the init method of the context. + * @return list of .NET artifacts that reside within the specified repository. + */ + List getAllNetArtifactsFromRepository( File repository ); + + /** * Initializes this artifact context. Neither parameter value should be null. * * @param mavenProject the maven project Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactInstaller.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactInstaller.java?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactInstaller.java (original) +++ incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactInstaller.java Wed May 9 09:30:40 2007 @@ -19,6 +19,7 @@ package org.apache.maven.dotnet.artifact; import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.resolver.ArtifactNotFoundException; import org.apache.maven.artifact.installer.ArtifactInstallationException; import org.apache.maven.project.MavenProject; import org.apache.maven.model.Dependency; @@ -93,6 +94,19 @@ */ void installLibraryDependencies( Artifact artifact, List dependencies ) throws ArtifactInstallationException; + + /** + * Resolves the specified artifact (and its dependencies) and installs the artifact's dependencies into the + * artifact's directory within the local repository. This method should be used for exe, winexe and + * netplugins. + * + * @param artifact the artifact to resolve + * @param pomFile + * @throws ArtifactInstallationException + * @throws ArtifactNotFoundException + */ + void resolveAndInstallLibraryDependenciesFor( Artifact artifact, File pomFile ) + throws ArtifactInstallationException , ArtifactNotFoundException; /** * Copies .netmodules, that the project is dependenct upon, from the local repo to the project's target directory. Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/AssemblyResolver.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/AssemblyResolver.java?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/AssemblyResolver.java (original) +++ incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/AssemblyResolver.java Wed May 9 09:30:40 2007 @@ -60,6 +60,4 @@ void resolveTransitivelyFor( MavenProject project, Artifact sourceArtifact, List dependencies, File pomFile, String localRepositoryPath, boolean addResolvedDependenciesToProject ) throws ArtifactResolutionException, ArtifactNotFoundException; - - } Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactContextImpl.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactContextImpl.java?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactContextImpl.java (original) +++ incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactContextImpl.java Wed May 9 09:30:40 2007 @@ -262,6 +262,11 @@ return getDirectDependenciesFor( artifact, matchPolicies ); } + public List getAllNetArtifactsFromRepository( File repository ) + { + return null; + } + /** * @see ArtifactContext#init(org.apache.maven.project.MavenProject, java.io.File) */ Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java (original) +++ incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java Wed May 9 09:30:40 2007 @@ -25,7 +25,15 @@ import org.apache.maven.dotnet.artifact.ArtifactType; import org.apache.maven.project.MavenProject; import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.versioning.VersionRange; +import org.apache.maven.artifact.resolver.filter.ArtifactFilter; +import org.apache.maven.artifact.resolver.ArtifactResolutionResult; +import org.apache.maven.artifact.resolver.ResolutionNode; +import org.apache.maven.artifact.resolver.ArtifactResolver; +import org.apache.maven.artifact.resolver.ArtifactNotFoundException; +import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.metadata.ArtifactMetadata; +import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.installer.ArtifactInstallationException; import org.apache.maven.artifact.repository.ArtifactRepository; @@ -46,6 +54,8 @@ import java.io.FileReader; import java.util.List; import java.util.ArrayList; +import java.util.Set; +import java.util.HashSet; /** * Provides an implementation of the ArtifactInstaller interface. @@ -98,6 +108,17 @@ private Logger logger; /** + * An artifact resolver component for locating artifacts and pulling them into the local repo if they do not + * already exist. + */ + private ArtifactResolver resolver; + + /** + * Metadata component used by the ArtifactResolver. + */ + private ArtifactMetadataSource metadata; + + /** * Constructor. This method is intended to by invoked by the plexus-container, not by the application developer. */ public ArtifactInstallerImpl() @@ -315,6 +336,47 @@ } } + public void resolveAndInstallLibraryDependenciesFor( Artifact sourceArtifact, File pomFile ) + throws ArtifactInstallationException, ArtifactNotFoundException + { + ArtifactMetadataImpl meta = new ArtifactMetadataImpl( sourceArtifact, pomFile ); + sourceArtifact.addMetadata( meta ); + + Set artifactDependencies = new HashSet(); + artifactDependencies.add( sourceArtifact ); + ArtifactRepository localArtifactRepository = + new DefaultArtifactRepository( "local", "file://" + localRepository, new AssemblyRepositoryLayout() ); + ArtifactResolutionResult result; + try + { + result = resolver.resolveTransitively( artifactDependencies, project.getArtifact(), localArtifactRepository, + project.getRemoteArtifactRepositories(), metadata, null ); + } + catch ( ArtifactResolutionException e ) + { + throw new ArtifactNotFoundException( "", sourceArtifact ); + } + + AssemblyRepositoryLayout layout = new AssemblyRepositoryLayout(); + Set artifacts = result.getArtifacts(); + File destDir = new File( localRepository, layout.pathOf( sourceArtifact ) ).getParentFile(); + for ( Artifact artifact : artifacts ) + { + File destFile = new File( destDir, artifact.getFile().getName() ); + if ( !destFile.exists() || destFile.lastModified() < artifact.getFile().lastModified() ) + { + try + { + FileUtils.copyFileToDirectory( artifact.getFile(), destDir ); + } + catch ( IOException e ) + { + e.printStackTrace(); + } + } + } + } + /** * @see org.apache.maven.dotnet.artifact.ArtifactInstaller#installNetModulesToTargetDirectory(org.apache.maven.artifact.Artifact) */ @@ -344,7 +406,11 @@ targetDirectory + File.separator + artifact.getFile().getName() ); try { - FileUtils.copyFileToDirectory( artifact.getFile(), new File( targetDirectory ) ); + File targetDirectoryFile = new File( targetDirectory ); + if ( targetDirectoryFile.lastModified() < artifact.getFile().lastModified() ) + { + FileUtils.copyFileToDirectory( artifact.getFile(), targetDirectoryFile ); + } } catch ( IOException e ) { Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java (original) +++ incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java Wed May 9 09:30:40 2007 @@ -20,6 +20,7 @@ import org.apache.maven.dotnet.artifact.AssemblyResolver; import org.apache.maven.dotnet.artifact.AssemblyRepositoryLayout; +import org.apache.maven.dotnet.artifact.ArtifactType; import org.apache.maven.project.MavenProject; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; @@ -28,20 +29,25 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.resolver.ArtifactNotFoundException; import org.apache.maven.artifact.resolver.ArtifactResolver; +import org.apache.maven.artifact.resolver.ResolutionNode; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.DefaultArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.model.Dependency; + import org.codehaus.plexus.logging.LogEnabled; import org.codehaus.plexus.logging.Logger; +import org.codehaus.plexus.util.FileUtils; import java.util.Set; import java.util.HashSet; import java.util.List; import java.util.ArrayList; + import java.io.File; +import java.io.IOException; /** * Provides a way to resolve transitive assemblies that do not have versions within their file name. @@ -117,39 +123,136 @@ dependency.getClassifier(), scope, null ); if ( artifact.getType().startsWith( "gac" ) ) { - logger.debug( "NMAVEN-000-000: GAC Dependency = " + artifact.getType() + ", ID = " + artifact.getArtifactId() ); + logger.debug( + "NMAVEN-000-000: GAC Dependency = " + artifact.getType() + ", ID = " + artifact.getArtifactId() ); gacDependencies.add( artifact ); } else { - logger.debug( "NMAVEN-000-000: Dependency = " + artifact.getType() + ", ID = " + artifact.getArtifactId() ); + logger.info( + "NMAVEN-000-000: Dependency = " + artifact.getType() + ", ID = " + artifact.getArtifactId() ); artifactDependencies.add( artifact ); } } ArtifactRepository localArtifactRepository = new DefaultArtifactRepository( "local", "file://" + localRepositoryPath, new AssemblyRepositoryLayout() ); - - List newArtifactRepositories = new ArrayList(); - List artifactRepositories = project.getRemoteArtifactRepositories(); - for ( ArtifactRepository artifactRepository : artifactRepositories ) - { - ArtifactRepository repo = artifactRepositoryFactory.createArtifactRepository( artifactRepository.getId(), - artifactRepository.getUrl(), - new AssemblyRepositoryLayout(), - artifactRepository.getSnapshots(), - artifactRepository.getReleases() ); - newArtifactRepositories.add( repo ); - } ArtifactResolutionResult result = resolver.resolveTransitively( artifactDependencies, sourceArtifact, localArtifactRepository, - newArtifactRepositories, metadata, gacFilter ); + project.getRemoteArtifactRepositories(), + metadata, gacFilter ); + Set resolvedDependencies = result.getArtifacts(); + AssemblyRepositoryLayout layout = new AssemblyRepositoryLayout(); +/* + Set resolvedDependencies = result.getArtifacts(); + Set nodes = result.getArtifactResolutionNodes(); + for(ResolutionNode node : nodes) + { + logger.info( "Node = " + node.getArtifact().getArtifactId()); + List ss = node.getDependencyTrail(); + for(String s : ss) + { + logger.info( "Dependency Node = " + s); + } + } + + artifactDependencies.addAll( resolvedDependencies ); + AssemblyRepositoryLayout layout = new AssemblyRepositoryLayout(); + for ( Artifact artifact : artifactDependencies ) + { + if ( artifact.getType().equals( ArtifactType.EXE.getPackagingType() ) || + artifact.getType().equals( ArtifactType.NETPLUGIN.getPackagingType() ) ) + { + installDependentArtifacts( artifact, artifactDependencies, localRepositoryPath ); + } + } + */ if ( addResolvedDependenciesToProject ) { - Set resolvedDependencies = result.getArtifacts(); + for ( Artifact artifact : resolvedDependencies ) + { + File orginalFileWithVersion = artifact.getFile(); + orginalFileWithVersion.renameTo( new File( localRepositoryPath + "/" + layout.pathOf( artifact ) ) ); + } + resolvedDependencies.addAll( gacDependencies ); project.setDependencyArtifacts( resolvedDependencies ); } + } + + private void installDependentArtifacts( Artifact sourceArtifact, Set resolvedDependencies, + String localRepositoryPath ) + throws ArtifactResolutionException + { + List executableDependencies = getDependenciesForExecutable( sourceArtifact, resolvedDependencies ); + File sourceFileDirectory = + new File( localRepositoryPath, new AssemblyRepositoryLayout().pathOf( sourceArtifact ) ).getParentFile(); + logger.info( "NMAVEN-xxx-000: Destination Artifact: " + sourceArtifact.getGroupId() + ":" + + sourceArtifact.getArtifactId() + ":" + sourceArtifact.getVersion() ); + for ( Artifact executableDependency : executableDependencies ) + { + + if ( executableDependency.getFile() == null ) + { + logger.info( "File is null: Artifact ID = " + executableDependency.getArtifactId() ); + continue; + } + File destFile = new File( sourceFileDirectory, executableDependency.getFile().getName() ); + + logger.info( "Destination File = " + destFile.getAbsolutePath() ); + logger.info( "Conditions : " + !destFile.exists() + ":" + + ( destFile.lastModified() < executableDependency.getFile().lastModified() ) ); + if ( !destFile.exists() || destFile.lastModified() < executableDependency.getFile().lastModified() ) + { + try + { + logger.info( "NMAVEN-xxx-000: Copying: File = " + executableDependency.getFile().getName() ); + FileUtils.copyFileToDirectory( executableDependency.getFile(), sourceFileDirectory ); + + } + catch ( IOException e ) + { + throw new ArtifactResolutionException( + "NMAVEN-xxx-000: Unable to install all dependent files for executable or plugin", + sourceArtifact ); + } + } + } + logger.info( "------------------------------------------------------" ); + } + + private List getDependentIdsFor( Artifact executable, Set resolvedDependencies ) + { + for ( Artifact artifact : resolvedDependencies ) + { + logger.info("Checking IDs: " + artifact.getId() + " : " + executable.getId()); + logger.info("SIZE = " + artifact.getDependencyTrail()); + if ( artifact.getId().equals( executable.getId() ) ) + { + logger.info("MATCH"); + return artifact.getDependencyTrail(); + } + } + return new ArrayList(); + } + + private List getDependenciesForExecutable( Artifact executable, Set resolvedDependencies ) + { + List artifacts = new ArrayList(); + logger.info( "EXE ID = " + executable.getId() ); + for ( String id : getDependentIdsFor( executable, resolvedDependencies ) ) + { + logger.info("Dependent ID = " + id); + for ( Artifact artifact : resolvedDependencies ) + { + if ( artifact.getId().equals( id ) ) + { + logger.info("Adding ID = " + id); + artifacts.add( artifact ); + } + } + } + return artifacts; } private static class GacFilter Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/resources/META-INF/plexus/components.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/resources/META-INF/plexus/components.xml?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/resources/META-INF/plexus/components.xml (original) +++ incubator/nmaven/branches/SI_XPT/components/dotnet-artifact/src/main/resources/META-INF/plexus/components.xml Wed May 9 09:30:40 2007 @@ -35,6 +35,12 @@ org.apache.maven.artifact.installer.ArtifactInstaller + + org.apache.maven.artifact.resolver.ArtifactResolver + + + org.apache.maven.artifact.metadata.ArtifactMetadataSource + Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/ExecutableContext.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/ExecutableContext.java?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/ExecutableContext.java (original) +++ incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/ExecutableContext.java Wed May 9 09:30:40 2007 @@ -20,7 +20,10 @@ import org.apache.maven.dotnet.NMavenContext; import org.apache.maven.dotnet.PlatformUnsupportedException; +import org.apache.maven.dotnet.vendor.Vendor; import org.apache.maven.project.MavenProject; + +import java.io.File; /** * Provides services for executables. Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/DefaultNetExecutable.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/DefaultNetExecutable.java?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/DefaultNetExecutable.java (original) +++ incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/DefaultNetExecutable.java Wed May 9 09:30:40 2007 @@ -37,7 +37,7 @@ implements NetExecutable { - private ExecutableContext executableContext; + protected ExecutableContext executableContext; private MavenProject project; Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/ExecutableContextImpl.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/ExecutableContextImpl.java?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/ExecutableContextImpl.java (original) +++ incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/ExecutableContextImpl.java Wed May 9 09:30:40 2007 @@ -24,8 +24,13 @@ import org.apache.maven.dotnet.registry.RepositoryRegistry; import org.apache.maven.dotnet.PlatformUnsupportedException; import org.apache.maven.dotnet.RepositoryNotFoundException; +import org.apache.maven.dotnet.vendor.Vendor; +import org.apache.maven.dotnet.vendor.VendorFactory; +import org.apache.maven.dotnet.vendor.impl.SettingsRepository; import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.logging.LogEnabled; + +import java.io.File; /** * Provides an implementation of the executable context. Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-model/netdependency/netdependency.mdo URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-model/netdependency/netdependency.mdo?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/components/dotnet-model/netdependency/netdependency.mdo (original) +++ incubator/nmaven/branches/SI_XPT/components/dotnet-model/netdependency/netdependency.mdo Wed May 9 09:30:40 2007 @@ -63,6 +63,12 @@ + publicKeyToken + 1.0.0 + String + The public key of the assembly. + + isGacInstall 1.0.0 boolean Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/VendorInfoRepository.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/VendorInfoRepository.java?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/VendorInfoRepository.java (original) +++ incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/VendorInfoRepository.java Wed May 9 09:30:40 2007 @@ -88,12 +88,13 @@ * @param vendorInfo the vendor info * @return file pointing to the .NET framework installation root used for compiling artifacts * @throws org.apache.maven.dotnet.PlatformUnsupportedException + * */ File getInstallRootFor( VendorInfo vendorInfo ) throws PlatformUnsupportedException; /** - * Returns file pointing to the .NET SDK installation root used for compiling artifacts. + * Returns file pointing to the .NET SDK installation root used for compiling artifacts. * * @param vendorInfo the vendor info * @return file pointing to the .NET SDK installation root used for compiling artifacts @@ -108,5 +109,17 @@ * @return true if this repository exists (and can be used), otherwise returns false */ boolean exists(); + + /** + * + * + * @param vendor + * @param frameworkVersion + * @param artifactType + * @return + * @throws PlatformUnsupportedException + */ + File getGlobalAssemblyCacheDirectoryFor( Vendor vendor, String frameworkVersion, String artifactType ) + throws PlatformUnsupportedException; } Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/SettingsRepository.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/SettingsRepository.java?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/SettingsRepository.java (original) +++ incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/SettingsRepository.java Wed May 9 09:30:40 2007 @@ -175,7 +175,7 @@ * @return the install root for the .NET framework * @throws org.apache.maven.dotnet.PlatformUnsupportedException if there is no install root found for the specified parameters */ - File getInstallRootFor( String vendor, String vendorVersion, String frameworkVersion ) + public File getInstallRootFor( String vendor, String vendorVersion, String frameworkVersion ) throws PlatformUnsupportedException { if ( vendor == null || vendorVersion == null || frameworkVersion == null ) Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/VendorInfoRepositoryImpl.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/VendorInfoRepositoryImpl.java?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/VendorInfoRepositoryImpl.java (original) +++ incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/impl/VendorInfoRepositoryImpl.java Wed May 9 09:30:40 2007 @@ -22,6 +22,7 @@ import org.apache.maven.dotnet.vendor.VendorInfo; import org.apache.maven.dotnet.vendor.VendorInfoMatchPolicy; import org.apache.maven.dotnet.vendor.InvalidVersionFormatException; +import org.apache.maven.dotnet.vendor.Vendor; import org.apache.maven.dotnet.registry.RepositoryRegistry; import org.apache.maven.dotnet.PlatformUnsupportedException; @@ -29,6 +30,7 @@ import java.util.Collections; import java.util.ArrayList; import java.util.Set; +import java.util.HashSet; import java.io.File; import org.codehaus.plexus.logging.LogEnabled; @@ -92,7 +94,8 @@ { SettingsRepository settingsRepository = (SettingsRepository) repositoryRegistry.find( "nmaven-settings" ); return settingsRepository.getSdkInstallRootFor( vendorInfo.getVendor().getVendorName(), - vendorInfo.getVendorVersion(), vendorInfo.getFrameworkVersion() ); + vendorInfo.getVendorVersion(), + vendorInfo.getFrameworkVersion() ); } /** @@ -182,5 +185,72 @@ } } return true; + } + + public File getGlobalAssemblyCacheDirectoryFor( Vendor vendor, String frameworkVersion, String artifactType ) + throws PlatformUnsupportedException + { + if ( artifactType.equals( "gac_generic" ) ) + { + if ( vendor.equals( Vendor.MICROSOFT ) && + ( frameworkVersion.equals( "2.0.50727" ) || frameworkVersion.equals( "3.0" ) ) ) + { + return new File( "C:\\WINDOWS\\assembly\\GAC_MSIL\\" ); + } + else if ( vendor.equals( Vendor.MICROSOFT ) && frameworkVersion.equals( "1.1.4322" ) ) + { + return new File( "C:\\WINDOWS\\assembly\\GAC\\" ); + } + else if ( vendor.equals( Vendor.MONO ) && exists() ) + { + List vendorInfos = + getVendorInfosFor( vendor.getVendorName(), null, frameworkVersion, true ); + Set vendorVersions = new HashSet(); + for ( VendorInfo vendorInfo : vendorInfos ) + { + vendorVersions.add( vendorInfo.getVendorVersion() ); + } + String maxVersion; + try + { + maxVersion = getMaxVersion( vendorVersions ); + } + catch ( InvalidVersionFormatException e ) + { + throw new PlatformUnsupportedException( "NMAVEN-xxx-000: Invalid version format", e ); + } + + for ( VendorInfo vendorInfo : vendorInfos ) + { + if ( vendorInfo.getVendorVersion().equals( maxVersion ) ) + { + File sdkInstallRoot = getSdkInstallRootFor( vendorInfo ); + File gacRoot = new File( sdkInstallRoot.getParentFile().getAbsolutePath() + "/lib/mono/gac" ); + if ( !gacRoot.exists() ) + { + throw new PlatformUnsupportedException( + "NMAVEN-xxx-000: The Mono GAC path does not exist: Path = " + + gacRoot.getAbsolutePath() ); + } + return gacRoot; + } + } + + //TODO: MONO Support for Linux (Separate file containg installs) + } + } + else if ( artifactType.equals( "gac" ) ) + { + return new File( "C:\\WINDOWS\\assembly\\GAC\\" ); + } + else if ( artifactType.equals( "gac_32" ) ) + { + return new File( "C:\\WINDOWS\\assembly\\GAC_32\\" ); + } + else if ( artifactType.equals( "gac_msil" ) ) + { + return new File( "C:\\WINDOWS\\assembly\\GAC_MSIL\\" ); + } + throw new PlatformUnsupportedException("NMAVEN-xxx-000: Could not locate a valid GAC"); } } Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/test/java/org/apache/maven/dotnet/vendor/impl/VendorInfoRepositoryTestStub.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/test/java/org/apache/maven/dotnet/vendor/impl/VendorInfoRepositoryTestStub.java?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/test/java/org/apache/maven/dotnet/vendor/impl/VendorInfoRepositoryTestStub.java (original) +++ incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/test/java/org/apache/maven/dotnet/vendor/impl/VendorInfoRepositoryTestStub.java Wed May 9 09:30:40 2007 @@ -3,6 +3,7 @@ import org.apache.maven.dotnet.vendor.VendorInfoRepository; import org.apache.maven.dotnet.vendor.VendorInfo; import org.apache.maven.dotnet.vendor.InvalidVersionFormatException; +import org.apache.maven.dotnet.vendor.Vendor; import org.apache.maven.dotnet.PlatformUnsupportedException; @@ -20,6 +21,12 @@ public boolean exists() { return true; + } + + public File getGlobalAssemblyCacheDirectoryFor( Vendor vendor, String frameworkVersion, String artifactType ) + throws PlatformUnsupportedException + { + return null; } public File getInstallRootFor( VendorInfo vendorInfo ) Modified: incubator/nmaven/branches/SI_XPT/maven-dotnet.iml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/maven-dotnet.iml?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/maven-dotnet.iml (original) +++ incubator/nmaven/branches/SI_XPT/maven-dotnet.iml Wed May 9 09:30:40 2007 @@ -8,9 +8,6 @@ - - - @@ -61,11 +58,10 @@ - - + @@ -73,8 +69,6 @@ - - @@ -453,15 +447,6 @@ - - - - - - - - - Modified: incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/SourceProcessorMojo.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/SourceProcessorMojo.java?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/SourceProcessorMojo.java (original) +++ incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/SourceProcessorMojo.java Wed May 9 09:30:40 2007 @@ -86,7 +86,7 @@ throws MojoExecutionException { long startTime = System.currentTimeMillis(); - + if ( !new File( sourceDirectory ).exists() ) { getLog().info( "NMAVEN-904-001: No source files to copy" ); @@ -121,13 +121,17 @@ directoryScanner.scan(); String[] files = directoryScanner.getIncludedFiles(); getLog().info( "NMAVEN-904-002: Copying source files: From = " + sourceDirectory + ", To = " + - outputDirectory + ", File Count = " + files.length); + outputDirectory + ", File Count = " + files.length ); for ( String file : files ) { try { - FileUtils.copyFile( new File( sourceDirectory + File.separator + file ), - new File( outputDirectory + File.separator + file ) ); + File sourceFile = new File( sourceDirectory + File.separator + file ); + File targetFile = new File( outputDirectory + File.separator + file ); + if ( sourceFile.lastModified() > targetFile.lastModified() ) + { + FileUtils.copyFile( sourceFile, targetFile ); + } } catch ( IOException e ) { Modified: incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/TestSourceProcessorMojo.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/TestSourceProcessorMojo.java?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/TestSourceProcessorMojo.java (original) +++ incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/TestSourceProcessorMojo.java Wed May 9 09:30:40 2007 @@ -84,8 +84,12 @@ { try { - FileUtils.copyFile( new File( sourceDirectory + File.separator + file ), - new File( outputDirectory + File.separator + file ) ); + File sourceFile = new File( sourceDirectory + File.separator + file ); + File targetFile = new File( outputDirectory + File.separator + file ); + if ( sourceFile.lastModified() > targetFile.lastModified() ) + { + FileUtils.copyFile( sourceFile, targetFile ); + } } catch ( IOException e ) { Modified: incubator/nmaven/branches/SI_XPT/plugins/maven-resolver-plugin/src/main/java/org/apache/maven/dotnet/plugin/resolver/NetDependencyResolverMojo.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/maven-resolver-plugin/src/main/java/org/apache/maven/dotnet/plugin/resolver/NetDependencyResolverMojo.java?view=diff&rev=536577&r1=536576&r2=536577 ============================================================================== --- incubator/nmaven/branches/SI_XPT/plugins/maven-resolver-plugin/src/main/java/org/apache/maven/dotnet/plugin/resolver/NetDependencyResolverMojo.java (original) +++ incubator/nmaven/branches/SI_XPT/plugins/maven-resolver-plugin/src/main/java/org/apache/maven/dotnet/plugin/resolver/NetDependencyResolverMojo.java Wed May 9 09:30:40 2007 @@ -23,6 +23,8 @@ import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.model.Dependency; import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.installer.ArtifactInstaller; +import org.apache.maven.artifact.installer.ArtifactInstallationException; import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.resolver.ArtifactNotFoundException; import org.apache.maven.artifact.factory.ArtifactFactory; @@ -37,6 +39,7 @@ import org.apache.maven.dotnet.artifact.NetDependenciesRepository; import org.apache.maven.dotnet.artifact.NetDependencyMatchPolicy; import org.apache.maven.dotnet.artifact.ArtifactContext; +import org.apache.maven.dotnet.artifact.ArtifactType; import org.apache.maven.dotnet.model.netdependency.NetDependency; import org.apache.maven.dotnet.executable.NetExecutable; import org.apache.maven.dotnet.executable.ExecutionException; @@ -110,6 +113,11 @@ /** * @component */ + private ArtifactInstaller artifactInstaller; + + /** + * @component + */ private ArtifactContext artifactContext; public void execute() @@ -157,7 +165,7 @@ matchPolicies.add( new ProfileMatchPolicy( profile ) ); dependencies.addAll( repository.getDependenciesFor( matchPolicies ) ); getLog().info( "NMAVEN-1600-001: Found net dependencies: Number = " + dependencies.size() ); - + if ( localRepository == null ) { localRepository = new File( System.getProperty( "user.home" ), ".m2/repository" ).getAbsolutePath(); @@ -177,6 +185,32 @@ throw new MojoExecutionException( "NMAVEN-1600-003: Unable to resolve assemblies", e ); } + //Do Library Installs for Net Dependencies + artifactContext.init( project, new File( localRepository ) ); + matchPolicies = new ArrayList(); + matchPolicies.add( new ProfileMatchPolicy( profile ) ); + matchPolicies.add( new ExecutableAndNetPluginMatchPolicy() ); + for ( Dependency dependency : repository.getDependenciesFor( matchPolicies ) ) + { + Artifact artifact = artifactFactory.createBuildArtifact( dependency.getGroupId(), + dependency.getArtifactId(), + dependency.getVersion(), dependency.getType() ); + + try + { + artifactContext.getArtifactInstaller().resolveAndInstallLibraryDependenciesFor( artifact, pomFile ); + + } + catch ( ArtifactNotFoundException e ) + { + throw new MojoExecutionException( "", e ); + } + catch ( ArtifactInstallationException e ) + { + throw new MojoExecutionException( "", e ); + } + } + //Do GAC Install, if needed //TODO: Add in the dependencies from the MOJO config artifactContext.init( project, new File( localRepository ) ); @@ -226,7 +260,6 @@ return commands; } - private class GacMatchPolicy implements NetDependencyMatchPolicy { @@ -241,6 +274,16 @@ public boolean match( NetDependency netDependency ) { return netDependency.isIsGacInstall() == isGacInstall; + } + } + + private class ExecutableAndNetPluginMatchPolicy + implements NetDependencyMatchPolicy + { + public boolean match( NetDependency netDependency ) + { + return netDependency.getType().equals( ArtifactType.EXE.getPackagingType() ) || + netDependency.getType().equals( ArtifactType.NETPLUGIN.getPackagingType() ); } }