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 2007/04/24 06:38:45 UTC

svn commit: r531784 - in /incubator/nmaven/branches/SI_XPT: components/dotnet-core/src/main/resources/META-INF/nmaven/ components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/ components/dotnet-executable/src/main/java/org/apache/...

Author: sisbell
Date: Mon Apr 23 23:38:43 2007
New Revision: 531784

URL: http://svn.apache.org/viewvc?view=rev&rev=531784
Log:
Added support for installing an assembly into the GAC.

Added:
    incubator/nmaven/branches/SI_XPT/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/GacInstallerMojo.java   (with props)
Modified:
    incubator/nmaven/branches/SI_XPT/components/dotnet-core/src/main/resources/META-INF/nmaven/executable-plugins.xml
    incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/NetExecutable.java
    incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/BaseCompiler.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/DefaultRepositoryNetExecutable.java
    incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/ThreadedNetExecutable.java
    incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/Vendor.java
    incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/resources/META-INF/plexus/components.xml
    incubator/nmaven/branches/SI_XPT/plugins/maven-solution-plugin/src/main/java/org/apache/maven/dotnet/plugin/solution/SolutionMojo.java
    incubator/nmaven/branches/SI_XPT/plugins/pom.xml

Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-core/src/main/resources/META-INF/nmaven/executable-plugins.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-core/src/main/resources/META-INF/nmaven/executable-plugins.xml?view=diff&rev=531784&r1=531783&r2=531784
==============================================================================
--- incubator/nmaven/branches/SI_XPT/components/dotnet-core/src/main/resources/META-INF/nmaven/executable-plugins.xml (original)
+++ incubator/nmaven/branches/SI_XPT/components/dotnet-core/src/main/resources/META-INF/nmaven/executable-plugins.xml Mon Apr 23 23:38:43 2007
@@ -171,6 +171,22 @@
     </platforms>
   </executablePlugin>
   <executablePlugin>
+    <identifier>MS:GACUTIL</identifier>
+    <pluginClass>org.apache.maven.dotnet.executable.impl.DefaultNetExecutable</pluginClass>
+    <vendor>MICROSOFT</vendor>
+    <executable>gacutil</executable>
+    <profile>GACUTIL</profile>
+    <frameworkVersions>
+      <frameworkVersion>2.0.50727</frameworkVersion>
+      <frameworkVersion>1.1.4322</frameworkVersion>
+    </frameworkVersions>
+    <platforms>
+      <platform>
+        <operatingSystem>Windows</operatingSystem>
+      </platform>
+    </platforms>
+  </executablePlugin>
+  <executablePlugin>
     <identifier>MONO:RESGEN</identifier>
     <pluginClass>org.apache.maven.dotnet.executable.impl.DefaultNetExecutable</pluginClass>
     <vendor>MONO</vendor>

Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/NetExecutable.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/NetExecutable.java?view=diff&rev=531784&r1=531783&r2=531784
==============================================================================
--- incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/NetExecutable.java (original)
+++ incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/NetExecutable.java Mon Apr 23 23:38:43 2007
@@ -19,6 +19,7 @@
 package org.apache.maven.dotnet.executable;
 
 import org.apache.maven.dotnet.NMavenContext;
+import org.apache.maven.dotnet.vendor.Vendor;
 
 import java.util.List;
 import java.io.File;
@@ -75,5 +76,12 @@
      * @param nmavenContext
      */
     void init( NMavenContext nmavenContext );
+
+    /**
+     * Returns vendor framework used to run executable.
+     *
+     * @return vendor vendor framework used to run executable
+     */
+    Vendor getVendor();
 
 }

Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/BaseCompiler.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/BaseCompiler.java?view=diff&rev=531784&r1=531783&r2=531784
==============================================================================
--- incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/BaseCompiler.java (original)
+++ incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/BaseCompiler.java Mon Apr 23 23:38:43 2007
@@ -24,6 +24,7 @@
 import org.apache.maven.dotnet.executable.ExecutionException;
 import org.apache.maven.dotnet.executable.CommandExecutor;
 import org.apache.maven.dotnet.NMavenContext;
+import org.apache.maven.dotnet.vendor.Vendor;
 import org.codehaus.plexus.logging.Logger;
 
 import java.io.File;
@@ -132,5 +133,10 @@
         CommandExecutor commandExecutor = CommandExecutor.Factory.createDefaultCommmandExecutor();
         commandExecutor.setLogger( logger );
         commandExecutor.executeCommand( getExecutable(), getCommands(), getExecutionPath(), failOnErrorOutput() );
+    }
+
+    public Vendor getVendor()
+    {
+        return compilerContext.getCompilerCapability().getVendor();
     }
 }

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=531784&r1=531783&r2=531784
==============================================================================
--- 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 Mon Apr 23 23:38:43 2007
@@ -21,6 +21,7 @@
 import org.apache.maven.dotnet.executable.ExecutionException;
 import org.apache.maven.dotnet.executable.*;
 import org.apache.maven.dotnet.NMavenContext;
+import org.apache.maven.dotnet.vendor.Vendor;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.logging.Logger;
 
@@ -107,6 +108,11 @@
             throw new ExecutionException( "NMAVEN-063-002: Executable has not been initialized with a context" );
         }
         return executableContext.getExecutableCapability().getExecutable();
+    }
+
+    public Vendor getVendor()
+    {
+        return executableContext.getExecutableCapability().getVendor();
     }
 
     public void init( NMavenContext nmavenContext )

Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/DefaultRepositoryNetExecutable.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/DefaultRepositoryNetExecutable.java?view=diff&rev=531784&r1=531783&r2=531784
==============================================================================
--- incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/DefaultRepositoryNetExecutable.java (original)
+++ incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/DefaultRepositoryNetExecutable.java Mon Apr 23 23:38:43 2007
@@ -22,6 +22,7 @@
 import org.apache.maven.dotnet.executable.CommandExecutor;
 import org.apache.maven.dotnet.executable.*;
 import org.apache.maven.dotnet.NMavenContext;
+import org.apache.maven.dotnet.vendor.Vendor;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.logging.Logger;
 
@@ -126,6 +127,17 @@
         throw new ExecutionException( "NMAVEN-063-003: Executable path has not been set or is invalid" );
     }
 
+    public Vendor getVendor()
+    {
+        try
+        {
+            return executableContext.getNetExecutable().getVendor();
+        }
+        catch ( ExecutionException e )
+        {
+            return Vendor.NULL;
+        }
+    }
 
     public void init( NMavenContext nmavenContext )
     {

Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/ThreadedNetExecutable.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/ThreadedNetExecutable.java?view=diff&rev=531784&r1=531783&r2=531784
==============================================================================
--- incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/ThreadedNetExecutable.java (original)
+++ incubator/nmaven/branches/SI_XPT/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/ThreadedNetExecutable.java Mon Apr 23 23:38:43 2007
@@ -24,6 +24,7 @@
 import org.apache.maven.dotnet.executable.CommandFilter;
 import org.apache.maven.dotnet.executable.CommandExecutor;
 import org.apache.maven.dotnet.NMavenContext;
+import org.apache.maven.dotnet.vendor.Vendor;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.logging.Logger;
 
@@ -118,7 +119,11 @@
         return executableContext.getExecutableCapability().getExecutable();
     }
 
-
+    public Vendor getVendor()
+    {
+        return executableContext.getExecutableCapability().getVendor();
+    }
+    
     public void init( NMavenContext nmavenContext )
     {
         this.executableContext = (ExecutableContext) nmavenContext;

Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/Vendor.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/Vendor.java?view=diff&rev=531784&r1=531783&r2=531784
==============================================================================
--- incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/Vendor.java (original)
+++ incubator/nmaven/branches/SI_XPT/components/dotnet-vendor/src/main/java/org/apache/maven/dotnet/vendor/Vendor.java Mon Apr 23 23:38:43 2007
@@ -32,7 +32,10 @@
     MONO( "MONO" ),
 
     /**DotGNU Vendor*/
-    DOTGNU( "DotGNU" );
+    DOTGNU( "DotGNU" ),
+
+    /**NULL Vendor*/
+    NULL("NULL");
 
     /**
      * The vendor name

Modified: incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/resources/META-INF/plexus/components.xml?view=diff&rev=531784&r1=531783&r2=531784
==============================================================================
--- incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/resources/META-INF/plexus/components.xml (original)
+++ incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/resources/META-INF/plexus/components.xml Mon Apr 23 23:38:43 2007
@@ -37,7 +37,7 @@
           </process-classes>
           <test>org.apache.maven.dotnet.plugins:maven-test-plugin:test</test>
           <install>
-            org.apache.maven.dotnet.plugins:maven-install-plugin:install,
+            org.apache.maven.dotnet.plugins:maven-install-plugin:install
           </install>
           <package>org.apache.maven.dotnet.plugins:maven-webapp-plugin:package</package>
           <deploy>org.apache.maven.dotnet.plugins:maven-webapp-plugin:deploy</deploy>
@@ -75,7 +75,7 @@
           <test>org.apache.maven.dotnet.plugins:maven-test-plugin:test</test>
           <package>org.apache.maven.dotnet.plugins:maven-link-plugin:package</package>
           <install>
-            org.apache.maven.dotnet.plugins:maven-install-plugin:install,
+            org.apache.maven.dotnet.plugins:maven-install-plugin:install
           </install>
         </phases>
       </configuration>
@@ -114,6 +114,7 @@
           <test>org.apache.maven.dotnet.plugins:maven-test-plugin:test</test>
           <install>
             org.apache.maven.dotnet.plugins:maven-install-plugin:install,
+            org.apache.maven.dotnet.plugins:maven-install-plugin:gac-install
           </install>
         </phases>
       </configuration>
@@ -190,6 +191,7 @@
           <test>org.apache.maven.dotnet.plugins:maven-test-plugin:test</test>
           <install>
             org.apache.maven.dotnet.plugins:maven-install-plugin:install,
+            org.apache.maven.dotnet.plugins:maven-install-plugin:gac-install
           </install>
         </phases>
       </configuration>

Added: incubator/nmaven/branches/SI_XPT/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/GacInstallerMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/GacInstallerMojo.java?view=auto&rev=531784
==============================================================================
--- incubator/nmaven/branches/SI_XPT/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/GacInstallerMojo.java (added)
+++ incubator/nmaven/branches/SI_XPT/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/GacInstallerMojo.java Mon Apr 23 23:38:43 2007
@@ -0,0 +1,99 @@
+package org.apache.maven.dotnet.plugin.install;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.dotnet.executable.ExecutionException;
+import org.apache.maven.dotnet.executable.NetExecutable;
+import org.apache.maven.dotnet.PlatformUnsupportedException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.artifact.Artifact;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @goal gac-install
+ * @phase install
+ */
+public class GacInstallerMojo
+    extends AbstractMojo
+{
+    /**
+     * @component
+     */
+    private org.apache.maven.dotnet.executable.NetExecutableFactory netExecutableFactory;
+
+    /**
+     * The maven project.
+     *
+     * @parameter expression="${project}"
+     * @required
+     */
+    private MavenProject project;
+
+    /**
+     * The Vendor for the executable.
+     *
+     * @parameter expression="${vendor}"
+     */
+    private String vendor;
+
+    /**
+     * @parameter expression = "${frameworkVersion}"
+     */
+    private String frameworkVersion;
+
+    /**
+     * The profile that the executable should use.
+     *
+     * @parameter expression = "${profile}" default-value = "GACUTIL"
+     */
+    private String profile;
+
+    /**
+     * Install into the GAC?
+     *
+     * @parameter expression="${isGacInstall}" default-value = "false"
+     */
+    private boolean isGacInstall;
+
+    public void execute()
+        throws MojoExecutionException
+    {
+        if ( !isGacInstall )
+        {
+            getLog().info( "NMAVEN-xxx-004: Skipping GAC Install.");
+            return;
+        }
+
+        try
+        {
+            NetExecutable netExecutable = netExecutableFactory.getNetExecutableFor( vendor, frameworkVersion, profile,
+                                                                                    project, getCommands(), null );
+            netExecutable.execute();
+            getLog().info( "NMAVEN-xxx-003: Installed Assembly into GAC: Assembly = " +
+                project.getArtifact().getFile() + ",  Vendor = " + netExecutable.getVendor().getVendorName() );
+        }
+        catch ( ExecutionException e )
+        {
+            throw new MojoExecutionException( "NMAVEN-1400-000: Unable to execute gacutil: Vendor " + vendor +
+                ", frameworkVersion = " + frameworkVersion + ", Profile = " + profile, e );
+        }
+        catch ( PlatformUnsupportedException e )
+        {
+            throw new MojoExecutionException( "NMAVEN-1400-001: Platform Unsupported: Vendor " + vendor +
+                ", frameworkVersion = " + frameworkVersion + ", Profile = " + profile, e );
+        }
+    }
+
+    public List<String> getCommands()
+        throws MojoExecutionException
+    {
+        List<String> commands = new ArrayList<String>();
+        Artifact artifact = project.getArtifact();
+        commands.add( "/i");
+        commands.add(artifact.getFile().getAbsolutePath() );
+        return commands;
+    }
+
+}

Propchange: incubator/nmaven/branches/SI_XPT/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/GacInstallerMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/nmaven/branches/SI_XPT/plugins/maven-solution-plugin/src/main/java/org/apache/maven/dotnet/plugin/solution/SolutionMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/maven-solution-plugin/src/main/java/org/apache/maven/dotnet/plugin/solution/SolutionMojo.java?view=diff&rev=531784&r1=531783&r2=531784
==============================================================================
--- incubator/nmaven/branches/SI_XPT/plugins/maven-solution-plugin/src/main/java/org/apache/maven/dotnet/plugin/solution/SolutionMojo.java (original)
+++ incubator/nmaven/branches/SI_XPT/plugins/maven-solution-plugin/src/main/java/org/apache/maven/dotnet/plugin/solution/SolutionMojo.java Mon Apr 23 23:38:43 2007
@@ -2,31 +2,14 @@
 
 import org.apache.maven.dotnet.plugin.AbstractMojo;
 import org.apache.maven.dotnet.executable.NetExecutableFactory;
-import org.apache.maven.dotnet.executable.ExecutionException;
-import org.apache.maven.dotnet.vendor.VendorInfo;
-import org.apache.maven.dotnet.vendor.VendorFactory;
-import org.apache.maven.dotnet.PlatformUnsupportedException;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
-import org.apache.maven.model.Model;
-import org.apache.maven.plugin.MojoExecutionException;
 import org.w3c.dom.Node;
 import org.w3c.dom.Element;
 import org.w3c.dom.Document;
 import org.codehaus.plexus.util.IOUtil;
 
 import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.Source;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.FileWriter;
 import java.io.File;
 import java.io.IOException;
 import java.io.StringWriter;

Modified: incubator/nmaven/branches/SI_XPT/plugins/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/pom.xml?view=diff&rev=531784&r1=531783&r2=531784
==============================================================================
--- incubator/nmaven/branches/SI_XPT/plugins/pom.xml (original)
+++ incubator/nmaven/branches/SI_XPT/plugins/pom.xml Mon Apr 23 23:38:43 2007
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?><!--
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
@@ -15,9 +16,7 @@
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
--->
-<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">
+--><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>