You are viewing a plain text version of this content. The canonical link for it is here.
Posted to npanday-commits@incubator.apache.org by br...@apache.org on 2011/12/20 04:39:04 UTC

svn commit: r1221095 - in /incubator/npanday/branches/npanday-1.4.x: ./ plugins/maven-vsinstaller-plugin/src/main/java/npanday/plugin/vsinstaller/VsInstallerMojo.java

Author: brett
Date: Tue Dec 20 04:39:04 2011
New Revision: 1221095

URL: http://svn.apache.org/viewvc?rev=1221095&view=rev
Log:
no longer necessary to install artifacts in the GAC

Modified:
    incubator/npanday/branches/npanday-1.4.x/   (props changed)
    incubator/npanday/branches/npanday-1.4.x/plugins/maven-vsinstaller-plugin/src/main/java/npanday/plugin/vsinstaller/VsInstallerMojo.java

Propchange: incubator/npanday/branches/npanday-1.4.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Dec 20 04:39:04 2011
@@ -1,4 +1,4 @@
 /incubator/npanday/branches/NPANDAY-410:1210743-1210765
 /incubator/npanday/branches/npanday-uac-removed:1002005-1024539
 /incubator/npanday/branches/npanday-vs2010-support:1002029-1025477
-/incubator/npanday/trunk:1221092
+/incubator/npanday/trunk:1221087,1221092

Modified: incubator/npanday/branches/npanday-1.4.x/plugins/maven-vsinstaller-plugin/src/main/java/npanday/plugin/vsinstaller/VsInstallerMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/npanday-1.4.x/plugins/maven-vsinstaller-plugin/src/main/java/npanday/plugin/vsinstaller/VsInstallerMojo.java?rev=1221095&r1=1221094&r2=1221095&view=diff
==============================================================================
--- incubator/npanday/branches/npanday-1.4.x/plugins/maven-vsinstaller-plugin/src/main/java/npanday/plugin/vsinstaller/VsInstallerMojo.java (original)
+++ incubator/npanday/branches/npanday-1.4.x/plugins/maven-vsinstaller-plugin/src/main/java/npanday/plugin/vsinstaller/VsInstallerMojo.java Tue Dec 20 04:39:04 2011
@@ -19,26 +19,18 @@
 
 package npanday.plugin.vsinstaller;
 
-import npanday.PlatformUnsupportedException;
 import npanday.artifact.ArtifactContext;
 import npanday.artifact.ArtifactInstaller;
 import npanday.artifact.NPandayArtifactResolutionException;
 import npanday.artifact.NetDependenciesRepository;
-import npanday.artifact.NetDependencyMatchPolicy;
-import npanday.executable.ExecutionException;
-import npanday.executable.NetExecutable;
-import npanday.model.netdependency.NetDependency;
 import npanday.registry.NPandayRepositoryException;
 import npanday.registry.RepositoryRegistry;
-import npanday.vendor.Vendor;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.handler.ArtifactHandler;
 import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
-import org.apache.maven.model.Dependency;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.project.MavenProject;
 import org.apache.maven.settings.Settings;
 import org.apache.commons.io.filefilter.*;
 import org.apache.commons.io.FileUtils;
@@ -100,55 +92,17 @@ public class VsInstallerMojo
      */
     private npanday.NPandayRepositoryRegistry npandayRegistry;
 
-    /**
-     * Provides services to obtain executables.
-     *
-     * @component
-     */
-    private npanday.executable.NetExecutableFactory netExecutableFactory;
-
     /** @component role="org.apache.maven.artifact.handler.ArtifactHandler" */
     private List<ArtifactHandler> artifactHandlers;
 
     /** @component */
     private ArtifactHandlerManager artifactHandlerManager;
 
-    /**
-     * @parameter expression="${settings}"
-     */
-    private Settings settings;
-
     private FileSystemView filesystemView = FileSystemView.getFileSystemView();
 
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
-
-        File logs = new File( localRepository, "embedder-logs" );
-        if ( !logs.exists() )
-        {
-            logs.mkdir();
-        }
-
-        RepositoryRegistry repositoryRegistry;
-        try
-        {
-            repositoryRegistry = npandayRegistry.createRepositoryRegistry();
-        }
-        catch ( IOException e )
-        {
-            throw new MojoExecutionException(
-                "NPANDAY-1600-000: Failed to create the repository registry for this plugin", e );
-        }
-        catch( NPandayRepositoryException e )
-        {
-            throw new MojoExecutionException(
-                "NPANDAY-1600-007: Failed to create the repository registry for this plugin", e );
-        }
-
-        NetDependenciesRepository netRepository = (NetDependenciesRepository) repositoryRegistry.find(
-            "net-dependencies" );
-
         artifactContext.init( null, mavenProject.getRemoteArtifactRepositories(), new File( localRepository ) );
         Map<String, ArtifactHandler> map = new HashMap<String, ArtifactHandler>();
 
@@ -176,34 +130,6 @@ public class VsInstallerMojo
             throw new MojoExecutionException( e.getMessage(), e );
         }
 
-        // GAC Installs
-        List<NetDependencyMatchPolicy> gacInstallPolicies = new ArrayList<NetDependencyMatchPolicy>();
-        gacInstallPolicies.add( new GacMatchPolicy( true ) );
-        List<Dependency> gacInstallDependencies = netRepository.getDependenciesFor( gacInstallPolicies );
-        for ( Dependency dependency : gacInstallDependencies )
-        {
-            List<Artifact> artifacts = artifactContext.getArtifactsFor( dependency.getGroupId(),
-                                                                        dependency.getArtifactId(),
-                                                                        dependency.getVersion(), dependency.getType() );
-            try
-            {
-                NetExecutable netExecutable = netExecutableFactory.getNetExecutableFor(
-                    Vendor.MICROSOFT.getVendorName(), "2.0.50727", "GACUTIL", getGacInstallCommandsFor( artifacts.get(
-                        0 ) ), null );
-                netExecutable.execute();
-                getLog().info( "NPANDAY-1600-004: Installed Assembly into GAC: Assembly = " + artifacts.get(
-                    0 ).getFile().getAbsolutePath() + ",  Vendor = " + netExecutable.getVendor().getVendorName() );
-            }
-            catch ( ExecutionException e )
-            {
-                throw new MojoExecutionException( "NPANDAY-1600-005: Unable to execute gacutil:", e );
-            }
-            catch ( PlatformUnsupportedException e )
-            {
-                throw new MojoExecutionException( "NPANDAY-1600-006: Platform Unsupported:", e );
-            }
-        }
-
         collectDefaultVSAddinDirectories();
 
         getInstallationLocation();
@@ -301,32 +227,6 @@ public class VsInstallerMojo
 
     }
 
-    private List<String> getGacInstallCommandsFor( Artifact artifact )
-    {
-        List<String> commands = new ArrayList<String>();
-        commands.add( "/nologo" );
-        commands.add( "/i" );
-        commands.add( artifact.getFile().getAbsolutePath() );
-        return commands;
-    }
-
-    private class GacMatchPolicy
-        implements NetDependencyMatchPolicy
-    {
-
-        private boolean isGacInstall;
-
-        public GacMatchPolicy( boolean isGacInstall )
-        {
-            this.isGacInstall = isGacInstall;
-        }
-
-        public boolean match( NetDependency netDependency )
-        {
-            return netDependency.isIsGacInstall() == isGacInstall;
-        }
-    }
-
     private void copyDependenciesToBin()
          throws MojoExecutionException
     {