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 jf...@apache.org on 2011/08/20 01:12:41 UTC

svn commit: r1159830 - in /incubator/npanday/trunk: components/dotnet-core/src/main/resources/META-INF/npanday/ components/dotnet-executable/src/main/java/npanday/executable/compiler/ components/dotnet-executable/src/main/java/npanday/executable/compil...

Author: jfallows
Date: Sat Aug 20 01:12:41 2011
New Revision: 1159830

URL: http://svn.apache.org/viewvc?rev=1159830&view=rev
Log:
Resolve NPANDAY-462 by adding plugin support for ILMerge to NPanday

Added:
    incubator/npanday/trunk/plugins/maven-ilmerge-plugin/   (with props)
    incubator/npanday/trunk/plugins/maven-ilmerge-plugin/pom.xml
    incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/
    incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/
    incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/
    incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/
    incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/
    incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/
    incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/ArtifactId.java
    incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/ArtifactSelector.java
    incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/ArtifactSet.java
    incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/AssemblyMerger.java
    incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/site/
    incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/site/site.xml
Modified:
    incubator/npanday/trunk/components/dotnet-core/src/main/resources/META-INF/npanday/executable-plugins.xml
    incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/CompilerExecutable.java
    incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/BaseCompiler.java
    incubator/npanday/trunk/plugins/pom.xml

Modified: incubator/npanday/trunk/components/dotnet-core/src/main/resources/META-INF/npanday/executable-plugins.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-core/src/main/resources/META-INF/npanday/executable-plugins.xml?rev=1159830&r1=1159829&r2=1159830&view=diff
==============================================================================
--- incubator/npanday/trunk/components/dotnet-core/src/main/resources/META-INF/npanday/executable-plugins.xml (original)
+++ incubator/npanday/trunk/components/dotnet-core/src/main/resources/META-INF/npanday/executable-plugins.xml Sat Aug 20 01:12:41 2011
@@ -520,4 +520,67 @@ under the License.
       </platform>
     </platforms>
   </executablePlugin>
+  <executablePlugin>
+    <identifier>MS:ILMERGE</identifier>
+    <pluginClass>npanday.executable.impl.DefaultNetExecutable</pluginClass>
+    <vendor>MICROSOFT</vendor>
+    <executable>ilmerge</executable>
+    <profile>ILMERGE</profile>
+    <frameworkVersions>
+      <frameworkVersion>4.0</frameworkVersion>
+      <frameworkVersion>3.5</frameworkVersion>
+      <frameworkVersion>2.0.50727</frameworkVersion>
+    </frameworkVersions>
+    <platforms>
+      <platform>
+        <operatingSystem>Windows</operatingSystem>
+      </platform>
+    </platforms>
+  </executablePlugin>
+  <executablePlugin>
+    <identifier>MS:ILREPACK</identifier>
+    <pluginClass>npanday.executable.impl.DefaultNetExecutable</pluginClass>
+    <vendor>MICROSOFT</vendor>
+    <executable>ilrepack</executable>
+    <profile>ILREPACK</profile>
+    <frameworkVersions>
+      <frameworkVersion>4.0</frameworkVersion>
+      <frameworkVersion>3.5</frameworkVersion>
+      <frameworkVersion>2.0.50727</frameworkVersion>
+    </frameworkVersions>
+    <platforms>
+      <platform>
+        <operatingSystem>Windows</operatingSystem>
+      </platform>
+    </platforms>
+  </executablePlugin>
+  <executablePlugin>
+    <identifier>MONO:ILREPACK</identifier>
+    <pluginClass>npanday.executable.impl.DefaultNetExecutable</pluginClass>
+    <vendor>MONO</vendor>
+    <executable>ilrepack</executable>
+    <profile>ILREPACK</profile>
+    <frameworkVersions>
+      <frameworkVersion>4.0</frameworkVersion>
+      <frameworkVersion>3.5</frameworkVersion>
+      <frameworkVersion>2.0.50727</frameworkVersion>
+    </frameworkVersions>
+    <platforms>
+      <platform>
+        <operatingSystem>Windows</operatingSystem>
+      </platform>
+      <platform>      
+        <operatingSystem>Mac OS X</operatingSystem>
+      </platform>
+      <platform>
+        <operatingSystem>Linux</operatingSystem>
+      </platform>
+      <platform>
+        <operatingSystem>Solaris</operatingSystem>
+      </platform>
+      <platform>
+        <operatingSystem>FreeBSD</operatingSystem>
+      </platform>
+    </platforms>
+  </executablePlugin>
 </executablePlugins>

Modified: incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/CompilerExecutable.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/CompilerExecutable.java?rev=1159830&r1=1159829&r2=1159830&view=diff
==============================================================================
--- incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/CompilerExecutable.java (original)
+++ incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/CompilerExecutable.java Sat Aug 20 01:12:41 2011
@@ -33,6 +33,13 @@ public interface CompilerExecutable
 {
 
     /**
+     * Returns the assembly path for this executable.
+     *
+     * @return the assembly path for this executable
+     */
+    String getAssemblyPath();
+
+    /**
      * Returns the target framework for this compiler executable.
      * 
      * @return  the target framework for this compiler executable

Modified: incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/BaseCompiler.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/BaseCompiler.java?rev=1159830&r1=1159829&r2=1159830&view=diff
==============================================================================
--- incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/BaseCompiler.java (original)
+++ incubator/npanday/trunk/components/dotnet-executable/src/main/java/npanday/executable/compiler/impl/BaseCompiler.java Sat Aug 20 01:12:41 2011
@@ -69,6 +69,14 @@ abstract class BaseCompiler implements C
     /**
      * @see npanday.executable.compiler.CompilerExecutable#getCompiledArtifact()
      */
+    public String getAssemblyPath()
+    {
+        return compilerContext.getCompilerCapability().getAssemblyPath();
+    }
+
+    /**
+     * @see npanday.executable.compiler.CompilerExecutable#getCompiledArtifact()
+     */
     public File getCompiledArtifact()
         throws InvalidArtifactException
     {
@@ -134,9 +142,13 @@ abstract class BaseCompiler implements C
             compilerContext.getCompilerRequirement().getVendor() + ", Assembly Name = " +
             compilerContext.getArtifact().getAbsolutePath() );
 
+	// commands are executed relative to working directory in Windows, but not all platforms
+        File executionPath = getExecutionPath();
+        String executable = new File(executionPath, getExecutable()).toString();
+
         CommandExecutor commandExecutor = CommandExecutor.Factory.createDefaultCommmandExecutor();
         commandExecutor.setLogger( logger );
-        commandExecutor.executeCommand( getExecutable(), getCommands(), getExecutionPath(), failOnErrorOutput() );
+        commandExecutor.executeCommand( executable, getCommands(), executionPath, failOnErrorOutput() );
     }
 
     public Vendor getVendor()

Propchange: incubator/npanday/trunk/plugins/maven-ilmerge-plugin/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Aug 20 01:12:41 2011
@@ -0,0 +1,5 @@
+target
+*.ipr
+*.iws
+
+maven-ilmerge-plugin.iml

Added: incubator/npanday/trunk/plugins/maven-ilmerge-plugin/pom.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-ilmerge-plugin/pom.xml?rev=1159830&view=auto
==============================================================================
--- incubator/npanday/trunk/plugins/maven-ilmerge-plugin/pom.xml (added)
+++ incubator/npanday/trunk/plugins/maven-ilmerge-plugin/pom.xml Sat Aug 20 01:12:41 2011
@@ -0,0 +1,39 @@
+<?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
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+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">
+  <parent> 
+    <groupId>org.apache.npanday.plugins</groupId>
+    <version>1.4.1-incubating-SNAPSHOT</version>  
+    <artifactId>maven-dotnet-plugins</artifactId> 
+  </parent>  
+  <modelVersion>4.0.0</modelVersion>  
+  <artifactId>maven-ilmerge-plugin</artifactId>  
+  <packaging>maven-plugin</packaging>  
+  <name>NPanday :: ILMerge Maven Plugin</name>  
+  <description>Maven Plugin for .NET: Merges assemblies</description>
+  <dependencies>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>${plexus.utils.version}</version>
+    </dependency>
+  </dependencies>
+</project>

Added: incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/ArtifactId.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/ArtifactId.java?rev=1159830&view=auto
==============================================================================
--- incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/ArtifactId.java (added)
+++ incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/ArtifactId.java Sat Aug 20 01:12:41 2011
@@ -0,0 +1,119 @@
+/*
+ * 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
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package npanday.plugin.ilmerge;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Dependency;
+import org.codehaus.plexus.util.SelectorUtils;
+
+class ArtifactId
+{
+
+    private final String groupId;
+
+    private final String artifactId;
+
+    private final String type;
+
+    private final String classifier;
+
+    public ArtifactId( Dependency dependency )
+    {
+        this( dependency.getGroupId(), dependency.getArtifactId(), dependency.getType(), dependency.getClassifier() );
+    }
+
+    public ArtifactId( Artifact artifact )
+    {
+        this( artifact.getGroupId(), artifact.getArtifactId(), artifact.getType(), artifact.getClassifier() );
+    }
+
+    public ArtifactId( String groupId, String artifactId, String type, String classifier )
+    {
+        this.groupId = ( groupId != null ) ? groupId : "";
+        this.artifactId = ( artifactId != null ) ? artifactId : "";
+        this.type = ( type != null ) ? type : "";
+        this.classifier = ( classifier != null ) ? classifier : "";
+    }
+
+    public ArtifactId( String id )
+    {
+        String[] tokens = new String[0];
+        if ( id != null && id.length() > 0 )
+        {
+            tokens = id.split( ":", -1 );
+        }
+        groupId = ( tokens.length > 0 ) ? tokens[0] : "";
+        artifactId = ( tokens.length > 1 ) ? tokens[1] : "*";
+        type = ( tokens.length > 3 ) ? tokens[2] : "*";
+        classifier = ( tokens.length > 3 ) ? tokens[3] : ( ( tokens.length > 2 ) ? tokens[2] : "*" );
+    }
+
+    public String getGroupId()
+    {
+        return groupId;
+    }
+
+    public String getArtifactId()
+    {
+        return artifactId;
+    }
+
+    public String getType()
+    {
+        return type;
+    }
+
+    public String getClassifier()
+    {
+        return classifier;
+    }
+
+    public boolean matches( ArtifactId pattern )
+    {
+        if ( pattern == null )
+        {
+            return false;
+        }
+        if ( !match( getGroupId(), pattern.getGroupId() ) )
+        {
+            return false;
+        }
+        if ( !match( getArtifactId(), pattern.getArtifactId() ) )
+        {
+            return false;
+        }
+        if ( !match( getType(), pattern.getType() ) )
+        {
+            return false;
+        }
+        if ( !match( getClassifier(), pattern.getClassifier() ) )
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    private boolean match( String str, String pattern )
+    {
+        return SelectorUtils.match( pattern, str );
+    }
+
+}
\ No newline at end of file

Added: incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/ArtifactSelector.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/ArtifactSelector.java?rev=1159830&view=auto
==============================================================================
--- incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/ArtifactSelector.java (added)
+++ incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/ArtifactSelector.java Sat Aug 20 01:12:41 2011
@@ -0,0 +1,103 @@
+/*
+ * 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
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package npanday.plugin.ilmerge;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import org.apache.maven.artifact.Artifact;
+
+class ArtifactSelector
+{
+
+    private Collection includes;
+
+    private Collection excludes;
+
+    public ArtifactSelector( ArtifactSet artifactSet, String groupPrefix )
+    {
+        this( ( artifactSet != null ) ? artifactSet.getIncludes() : null,
+              ( artifactSet != null ) ? artifactSet.getExcludes() : null, groupPrefix );
+    }
+
+
+    // TODO: remove?
+    public ArtifactSelector( Artifact projectArtifact, ArtifactSet artifactSet, String groupPrefix )
+    {
+        this( ( artifactSet != null ) ? artifactSet.getIncludes() : null,
+              ( artifactSet != null ) ? artifactSet.getExcludes() : null, groupPrefix );
+
+        if ( projectArtifact != null && !this.includes.isEmpty() )
+        {
+            this.includes.add( new ArtifactId( projectArtifact ) );
+        }
+    }
+
+    public ArtifactSelector( Collection includes, Collection excludes, String groupPrefix )
+    {
+        this.includes = toIds( includes );
+        this.excludes = toIds( excludes );
+
+        if ( groupPrefix != null && groupPrefix.length() > 0 )
+        {
+            this.includes.add( new ArtifactId( groupPrefix + "*", "*", "*", "*" ) );
+        }
+    }
+
+    private static Collection toIds( Collection patterns )
+    {
+        Collection result = new HashSet();
+
+        if ( patterns != null )
+        {
+            for ( Iterator it = patterns.iterator(); it.hasNext(); )
+            {
+                String pattern = (String) it.next();
+                result.add( new ArtifactId( pattern ) );
+            }
+        }
+
+        return result;
+    }
+
+    public boolean isSelected( Artifact artifact )
+    {
+        return ( artifact != null ) ? isSelected( new ArtifactId( artifact ) ) : false;
+    }
+
+    boolean isSelected( ArtifactId id )
+    {
+        return ( includes.isEmpty() || matches( includes, id ) ) && !matches( excludes, id );
+    }
+
+    private boolean matches( Collection patterns, ArtifactId id )
+    {
+        for ( Iterator it = patterns.iterator(); it.hasNext(); )
+        {
+            ArtifactId pattern = (ArtifactId) it.next();
+            if ( id.matches( pattern ) )
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+
+}
\ No newline at end of file

Added: incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/ArtifactSet.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/ArtifactSet.java?rev=1159830&view=auto
==============================================================================
--- incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/ArtifactSet.java (added)
+++ incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/ArtifactSet.java Sat Aug 20 01:12:41 2011
@@ -0,0 +1,38 @@
+/*
+* 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
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package npanday.plugin.ilmerge;
+
+import java.util.Set;
+
+public class ArtifactSet
+{
+    private Set includes;
+
+    private Set excludes;
+
+    public Set getIncludes()
+    {
+        return includes;
+    }
+ 
+    public Set getExcludes()
+    {
+        return excludes;
+    }
+}
\ No newline at end of file

Added: incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/AssemblyMerger.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/AssemblyMerger.java?rev=1159830&view=auto
==============================================================================
--- incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/AssemblyMerger.java (added)
+++ incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/AssemblyMerger.java Sat Aug 20 01:12:41 2011
@@ -0,0 +1,452 @@
+/*
+* 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
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package npanday.plugin.ilmerge;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import npanday.ArtifactType;
+import npanday.ArtifactTypeHelper;
+import npanday.PlatformUnsupportedException;
+import npanday.executable.ExecutionException;
+import npanday.executable.compiler.KeyInfo;
+import npanday.executable.compiler.CompilerCapability;
+import npanday.executable.compiler.CompilerConfig;
+import npanday.executable.compiler.CompilerExecutable;
+import npanday.executable.compiler.CompilerRequirement;
+import npanday.vendor.VendorFactory;
+import org.apache.maven.artifact.Artifact;
+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.project.MavenProjectHelper;
+import org.codehaus.plexus.util.DirectoryScanner;
+import org.codehaus.plexus.util.FileUtils;
+
+
+/**
+ * Merges assemblies into unified assembly.
+ *
+ * @phase package
+ * @goal merge-assemblies
+ * @requiresDependencyResolution runtime
+ */
+public class AssemblyMerger extends AbstractMojo
+{
+    /**
+     * The maven project.
+     *
+     * @parameter expression="${project}"
+     * @required
+     */
+    private MavenProject project;
+    
+    /**
+     * The Vendor for the executable. Supports MONO and MICROSOFT: the default value is <code>MICROSOFT</code>. Not
+     * case or white-space sensitive.
+     *
+     * @parameter expression="${vendor}"
+     */
+    private String vendor;
+    
+    /**
+     * @component
+     */
+    private npanday.executable.NetExecutableFactory netExecutableFactory;
+    
+    /**
+     * @component
+     */
+    private MavenProjectHelper projectHelper;
+
+    /**
+     * @parameter expression = "${frameworkVersion}"
+     */
+    private String frameworkVersion;
+    
+    /**
+     * Specify a strong name key file.
+     *
+     * @parameter expression = "${keyfile}"
+     */
+    private File keyfile;
+
+    /**
+     * Specifies a strong name key container. (not currently supported)
+     *
+     * @parameter expression = "${keycontainer}"
+     */
+    private String keycontainer;
+
+    /**
+     * The profile that the compiler should use to compile classes: FULL, COMPACT, (or a custom one specified in a
+     * compiler-plugins.xml).
+     *
+     * @parameter expression = "${profile}" default-value = "FULL"
+     */
+    private String profile;
+
+
+    /**
+     * .NET Language. The default value is <code>C_SHARP</code>. Not case or white-space sensitive.
+     *
+     * @parameter expression="${language}" default-value = "C_SHARP"
+     * @required
+     */
+    private String language;
+
+    /**
+     * @parameter expression = "${vendorVersion}"
+     */
+    private String vendorVersion;
+
+    /**
+     * The home directory of your .NET SDK.
+     *
+     * @parameter expression="${netHome}"
+     */
+    private File netHome;
+    
+    /**
+     * @parameter expression = "${ilmergeCommand}"  default-value="ilmerge"
+     */
+    private String executable;
+    
+    /**
+     * This overrides the defaultAssemblyPath for the compiler.
+     *
+     * @parameter expression = "${profileAssemblyPath}
+     */
+    private File profileAssemblyPath;
+
+    /**
+     * The directory for the compilated web application
+     *
+     * @parameter  expression = "${project.build.directory}/merged"
+     */
+    private File outputDirectory;
+
+    /**
+     * The location of the local Maven repository.
+     *
+     * @parameter expression="${settings.localRepository}"
+     */
+    private File localRepository;
+
+    /**
+     * @parameter 
+     */
+    private ArtifactSet artifactSet;
+
+    /**
+     * @parameter 
+     */
+    private ArtifactSet internalizeSet;
+
+    /**
+     * @parameter default-value="true"
+     */
+    private boolean mergeDebugSymbols;
+
+    /**
+     * Defines whether the merged artifact should be attached as classifier to
+     * the original artifact.  If false, the merged assembly will be the main artifact
+     * of the project
+     *
+     * @parameter expression="${mergedArtifactAttached}" default-value="false"
+     */
+    private boolean mergedArtifactAttached;
+
+    /**
+     * The name of the classifier used in case the merged artifact is attached.
+     *
+     * @parameter expression="${mergedClassifierName}" default-value="merged"
+     */
+    private String mergedClassifierName;
+
+    /**
+     * If specified, this will include only artifacts which have groupIds which
+     * start with this.
+     *
+     * @parameter expression="${mergedGroupFilter}"
+     */
+    private String mergedGroupFilter;
+
+    /**
+     *
+     * @parameter default-value="true"
+     */
+    private boolean mergedArtifactReplacesProjectArtifact;
+
+    /**  
+     * Merges the specified assemblies into a primary assembly with classifier "merged".
+     */
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        try
+        {
+            // ilmerge.exe
+            // determine how to set /lib:[assemblyPath]
+            CompilerExecutable compilerExecutable = netExecutableFactory.getCompilerExecutableFor(getCompilerRequirement(),
+                    getCompilerConfig(),
+                    project,
+                    profileAssemblyPath);
+
+            String assemblyPath = compilerExecutable.getAssemblyPath();
+            if ( assemblyPath == null )
+            {
+                 throw new MojoExecutionException( "NPANDAY-1501-007: Unable to determine assembly path, perhaps missing profileAssemblyPath?" );
+            }
+
+            Set artifacts = new LinkedHashSet();
+
+            ArtifactSelector artifactSelector =
+                new ArtifactSelector( artifactSet, mergedGroupFilter );
+
+            Artifact projectArtifact = project.getArtifact();
+
+            if ( artifactSelector.isSelected( projectArtifact ) && !"pom".equals( projectArtifact.getType() ) )
+            {
+
+                if ( projectArtifact.getFile() == null )
+                {
+                    getLog().error( "The project main artifact does not exist. This could have the following" );
+                    getLog().error( "reasons:" );
+                    getLog().error( "- You have invoked the goal directly from the command line. This is not" );
+                    getLog().error( "  supported. Please add the goal to the default lifecycle via an" );
+                    getLog().error( "  <execution> element in your POM and use \"mvn package\" to have it run." );
+                    getLog().error( "- You have bound the goal to a lifecycle phase before \"package\". Please" );
+                    getLog().error( "  remove this binding from your POM such that the goal will be run in" );
+                    getLog().error( "  the proper phase." );
+                    throw new MojoExecutionException( "Failed to create shaded artifact, "
+                        + "project main artifact does not exist." );
+                }
+
+                getLog().info( "Including " + projectArtifact.getId() + " in the merged assembly." );
+
+                artifacts.add( projectArtifact.getFile() );
+            }
+            else
+            {
+                getLog().info( "Excluding " + projectArtifact.getId() + " from the merged assembly." );
+
+            }
+
+
+            ArtifactType packagingType = ArtifactType.getArtifactTypeForPackagingName(project.getPackaging());
+            File mergedArtifactFile = new File(outputDirectory, project.getArtifactId() + "." + packagingType.getExtension());
+
+            // TODO: /target defaults to same kind as first assembly
+            Set candidateArtifacts = new HashSet();
+            candidateArtifacts.addAll(project.getArtifacts());
+            candidateArtifacts.addAll(project.getAttachedArtifacts());
+
+            ArtifactSelector internalizeArtifactSelector = new ArtifactSelector( internalizeSet, null );
+            
+            Set internalizeArtifacts = new HashSet();
+
+            for ( Iterator it = candidateArtifacts.iterator(); it.hasNext(); )
+            {
+                Artifact artifact = (Artifact) it.next();
+
+                if ( !artifactSelector.isSelected( artifact ) )
+                {
+                    getLog().info( "Excluding " + artifact.getId() + " from the merged assembly." );
+
+                    continue;
+                }
+
+                if ( "pom".equals( artifact.getType() ) )
+                {
+                    getLog().info( "Skipping pom dependency " + artifact.getId() + " in the merged assembly." );
+                    continue;
+                }
+
+                boolean internalize = internalizeArtifactSelector.isSelected( artifact );
+
+                getLog().info( "Including " + artifact.getId() + " in the merged assembly." + (internalize ? " (internalize)" : ""));
+
+                artifacts.add( artifact.getFile() );
+
+                if ( internalize )
+                {
+                    internalizeArtifacts.add( artifact.getFile() );
+                }
+            }
+
+            // TODO: support multple non-internalized artifacts by executing ilmerge twice
+            //         * first merge all the public assemblies together
+            //         * then internalizing the rest using the previous result as the primary assembly
+            if ( artifacts.removeAll( internalizeArtifacts ) )
+            {
+                if ( !internalizeArtifacts.isEmpty() && artifacts.size() > 1 )
+                {
+                    throw new MojoExecutionException( "NPANDAY-1501-011: Multiple non-internalized assemblies after applying internalizeSet filter to artifactSet" );
+                }
+            }
+
+    
+            List commands = new ArrayList();
+            commands.add("/lib:" + assemblyPath);
+            commands.add("/out:" + mergedArtifactFile);
+
+            // TODO: workaround bug in ILMerge when merged .pdb output would overwrite an input .pdb
+            // Note: ILRepack does not have this issue
+            if (!mergeDebugSymbols)
+            {
+                commands.add("/ndebug");
+            }
+
+            for ( Iterator it = artifacts.iterator(); it.hasNext(); )
+            {
+                File artifact = (File)it.next();
+                commands.add( artifact.getAbsolutePath() );
+            }
+
+            for ( Iterator it = internalizeArtifacts.iterator(); it.hasNext(); )
+            {
+                File internalizeArtifact = (File)it.next();
+                commands.add( internalizeArtifact.getAbsolutePath() );
+            }
+
+            outputDirectory.mkdirs();
+            netExecutableFactory.getNetExecutableFor( vendor, frameworkVersion, executable, commands,
+                                                      netHome ).execute();
+
+            if ( mergedArtifactAttached )
+            {
+                getLog().info( "Attaching merged artifact." );
+		projectHelper.attachArtifact(project, projectArtifact.getType(), mergedClassifierName, mergedArtifactFile);
+            }
+            else if ( mergedArtifactReplacesProjectArtifact )
+            {
+                getLog().info( "Replacing project artifact with merged artifact." );
+                File projectArtifactFile = projectArtifact.getFile();
+                FileUtils.rename( mergedArtifactFile, projectArtifactFile );
+            }
+        }
+        catch ( ExecutionException e )
+        {
+            throw new MojoExecutionException( "NPANDAY-1501-002: Unable to execute " + executable + ": Vendor = " + vendor +
+                ", frameworkVersion = " + frameworkVersion, e );
+        }
+        catch ( PlatformUnsupportedException e )
+        {
+            throw new MojoExecutionException( "NPANDAY-1501-003: Platform Unsupported", e );
+        }        
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "NPANDAY-1501-004: Unable to overwrite default artifact file", e );
+        }        
+    }
+    
+    private String getFileNameMinusExtension(File file)
+    {
+        if (file==null) return null;
+        
+        String name = file.getName();
+        int lastIndex = name.lastIndexOf( '.' );
+                
+        return name.substring( 0, lastIndex );
+    }
+
+    protected void initializeDefaults()  throws MojoExecutionException
+    {
+
+
+        if ( profileAssemblyPath != null && !profileAssemblyPath.exists() )
+        {
+            throw new MojoExecutionException( "NPANDAY-900-000: Profile Assembly Path does not exist: Path = " +
+                profileAssemblyPath.getAbsolutePath() );
+        }
+
+    }
+
+    protected CompilerRequirement getCompilerRequirement() throws MojoExecutionException
+    {
+         //Requirement
+        CompilerRequirement compilerRequirement = CompilerRequirement.Factory.createDefaultCompilerRequirement();
+        compilerRequirement.setLanguage( language );
+        compilerRequirement.setFrameworkVersion( frameworkVersion );
+        compilerRequirement.setProfile( profile );
+        compilerRequirement.setVendorVersion( vendorVersion );
+        try
+        {
+            if ( vendor != null )
+            {
+                compilerRequirement.setVendor( VendorFactory.createVendorFromName( vendor ) );
+            }
+        }
+        catch ( PlatformUnsupportedException e )
+        {
+            throw new MojoExecutionException( "NPANDAY-900-001: Unknown Vendor: Vendor = " + vendor, e );
+        }
+
+        return compilerRequirement;
+
+
+    }
+
+    protected CompilerConfig getCompilerConfig()  throws MojoExecutionException
+    {
+
+          //Config
+        CompilerConfig compilerConfig = (CompilerConfig) CompilerConfig.Factory.createDefaultExecutableConfig();
+        compilerConfig.setLocalRepository( localRepository );
+
+
+        if ( keyfile != null )
+        {
+            KeyInfo keyInfo = KeyInfo.Factory.createDefaultKeyInfo();
+            keyInfo.setKeyFileUri( keyfile.getAbsolutePath() );
+            compilerConfig.setKeyInfo( keyInfo );
+        }
+
+        if(outputDirectory != null)
+        {
+            if(!outputDirectory.exists())
+            {
+                outputDirectory.mkdirs();
+            }
+            compilerConfig.setOutputDirectory(outputDirectory);
+        }
+
+        String artifactTypeName = project.getArtifact().getType();
+        ArtifactType artifactType = ArtifactType.getArtifactTypeForPackagingName( artifactTypeName );
+        if ( artifactType.equals( ArtifactType.NULL ) )
+        {
+            throw new MojoExecutionException( "NPANDAY-900-002: Unrecognized artifact type: Language = " + language +
+                ", Vendor = " + vendor + ", ArtifactType = " + artifactTypeName );
+        }
+        compilerConfig.setArtifactType( artifactType );
+
+
+        return compilerConfig;
+    }
+}

Added: incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/site/site.xml?rev=1159830&view=auto
==============================================================================
--- incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/site/site.xml (added)
+++ incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/site/site.xml Sat Aug 20 01:12:41 2011
@@ -0,0 +1,31 @@
+<?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
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+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/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <menu ref="parent" />
+
+    <menu name="Overview">
+      <item name="About" href="index.html"/>
+      <item name="Goals" href="plugin-info.html"/>
+    </menu>
+
+    <menu ref="reports" />
+  </body>
+</project>

Modified: incubator/npanday/trunk/plugins/pom.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/pom.xml?rev=1159830&r1=1159829&r2=1159830&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/pom.xml (original)
+++ incubator/npanday/trunk/plugins/pom.xml Sat Aug 20 01:12:41 2011
@@ -40,6 +40,7 @@ under the License.
     <module>maven-aspx-plugin</module>
     <module>maven-fxcop-plugin</module>  
     <module>maven-install-plugin</module>  
+    <module>maven-ilmerge-plugin</module>  
     <module>maven-link-plugin</module>  
     <module>maven-mojo-generator-plugin</module>  
     <module>maven-resgen-plugin</module>