You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2006/11/10 07:55:09 UTC

svn commit: r473211 - in /maven/sandbox/plugins/maven-vstudio-plugin: ./ src/main/java/org/apache/maven/plugin/vstudio/

Author: brett
Date: Thu Nov  9 22:55:08 2006
New Revision: 473211

URL: http://svn.apache.org/viewvc?view=rev&rev=473211
Log:
[MNG-2372] VStudio Project generated by CSharp VStudio Plugin doesn't support NUnit appropriately
Submitted by: James Carpenter

Added:
    maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/ExcludedDependency.java   (with props)
Modified:
    maven/sandbox/plugins/maven-vstudio-plugin/pom.xml   (contents, props changed)
    maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/Reference.java
    maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/VisualStudioMojo.java

Modified: maven/sandbox/plugins/maven-vstudio-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-vstudio-plugin/pom.xml?view=diff&rev=473211&r1=473210&r2=473211
==============================================================================
--- maven/sandbox/plugins/maven-vstudio-plugin/pom.xml (original)
+++ maven/sandbox/plugins/maven-vstudio-plugin/pom.xml Thu Nov  9 22:55:08 2006
@@ -13,14 +13,6 @@
   <name>Maven Visual Studio Plugin</name>
   <version>1.0-SNAPSHOT</version>
   <url>http://maven.apache.org/</url>
-  <build>
-    <plugins>
-      <plugin>
-        <artifactId>maven-site-plugin</artifactId>
-        <version>2.0-beta-4</version>
-      </plugin>
-    </plugins>
-  </build>
   <dependencies>
     <dependency>
       <groupId>junit</groupId>
@@ -60,24 +52,4 @@
       <scope>test</scope>
     </dependency>
   </dependencies>
-  <reporting>
-    <plugins>
-      <plugin>
-        <artifactId>maven-javadoc-plugin</artifactId>
-      </plugin>
-      <plugin>
-        <artifactId>maven-plugin-plugin</artifactId>
-        <version>2.0</version>
-      </plugin>
-      <plugin>
-        <artifactId>maven-site-plugin</artifactId>
-        <version>2.0-beta-3</version>
-      </plugin>
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>jxr-maven-plugin</artifactId>
-        <version>2.0-beta-1</version>
-      </plugin>
-    </plugins>
-  </reporting>
-</project>
\ No newline at end of file
+</project>

Propchange: maven/sandbox/plugins/maven-vstudio-plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/ExcludedDependency.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/ExcludedDependency.java?view=auto&rev=473211
==============================================================================
--- maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/ExcludedDependency.java (added)
+++ maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/ExcludedDependency.java Thu Nov  9 22:55:08 2006
@@ -0,0 +1,80 @@
+package org.apache.maven.plugin.vstudio;
+
+public class ExcludedDependency
+{
+
+    private String groupId;
+
+    private String artifactId;
+
+    public ExcludedDependency()
+    {
+    }
+
+    public ExcludedDependency( String groupId, String artifactId )
+    {
+        this.setGroupId( groupId );
+        this.setArtifactId( artifactId );
+    }
+
+    /**
+     * @return Returns the groupId of the excluded dependency
+     */
+    public String getGroupId()
+    {
+        return this.groupId;
+    }
+
+    /**
+     * @param groupId groupId of excluded dependency
+     */
+    public void setGroupId( String groupId )
+    {
+        this.groupId = groupId;
+    }
+
+    /**
+     * @return Returns the artifactId of the excluded dependency
+     */
+    public String getArtifactId()
+    {
+        return this.artifactId;
+    }
+
+    /**
+     * @param artifactId artifactId of excluded dependency
+     */
+    public void setArtifactId( String artifactId )
+    {
+        this.artifactId = artifactId;
+    }
+
+    public boolean equals( Object o )
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+        if ( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+
+        final ExcludedDependency that = (ExcludedDependency) o;
+
+        if ( artifactId != null ? !artifactId.equals( that.artifactId ) : that.artifactId != null )
+        {
+            return false;
+        }
+        return !( groupId != null ? !groupId.equals( that.groupId ) : that.groupId != null );
+    }
+
+    public int hashCode()
+    {
+        int result;
+        result = ( groupId != null ? groupId.hashCode() : 0 );
+        result = 29 * result + ( artifactId != null ? artifactId.hashCode() : 0 );
+        return result;
+    }
+
+}

Propchange: maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/ExcludedDependency.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/ExcludedDependency.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/Reference.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/Reference.java?view=diff&rev=473211&r1=473210&r2=473211
==============================================================================
--- maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/Reference.java (original)
+++ maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/Reference.java Thu Nov  9 22:55:08 2006
@@ -7,6 +7,8 @@
 
     private boolean gac = false;
 
+    private boolean isAbsolute = false;
+
     /**
      * @return Returns the gac.
      */
@@ -21,6 +23,22 @@
     public void setGac( boolean gac )
     {
         this.gac = gac;
+    }
+
+    /**
+     * @return Returns whether the path expected to be an absolute path
+     */
+    public boolean getAbsolute()
+    {
+        return this.isAbsolute;
+    }
+
+    /**
+     * @param abs Specifies whether the path is expected to be an absolute path
+     */
+    public void setAbsolute( boolean abs )
+    {
+        this.isAbsolute = abs;
     }
 
     /**

Modified: maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/VisualStudioMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/VisualStudioMojo.java?view=diff&rev=473211&r1=473210&r2=473211
==============================================================================
--- maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/VisualStudioMojo.java (original)
+++ maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/VisualStudioMojo.java Thu Nov  9 22:55:08 2006
@@ -119,6 +119,13 @@
     private Set excludes = new HashSet();
 
     /**
+     * A list of excluded dependencies for the .csproj.
+     *
+     * @parameter
+     */
+    private Set excludedDependencies = new HashSet();
+
+    /**
      * A list of System references with paths to resolve for IDE.
      * These are required for the IDE's intellisense but are added
      * to the classpath (;o) at
@@ -215,8 +222,10 @@
 
             this.getLog().info( "Created " + referenceArtifacts.size() + " dependencies." );
 
+            Set projectArtifacts = this.getFilteredProjectArtifacts();
+
             new VisualStudio2003Writer( this.getLog() ).write( writer, projectSettings, mainsource, testsource,
-                                                               resources, project.getArtifacts(), frameworkDir, pom,
+                                                               resources, projectArtifacts, frameworkDir, pom,
                                                                referenceArtifacts );
 
             this.getLog().info( "Created project file [" + projectFile.getAbsolutePath() + "]" );
@@ -236,6 +245,26 @@
         }
     }
 
+    private Set getFilteredProjectArtifacts()
+    {
+        Set filteredProjectArtifacts = new HashSet();
+        for ( Iterator i = this.project.getArtifacts().iterator(); i.hasNext(); )
+        {
+            Artifact artifact = (Artifact) i.next();
+            ExcludedDependency artifactAsExDep =
+                new ExcludedDependency( artifact.getGroupId(), artifact.getArtifactId() );
+            if ( !this.excludedDependencies.contains( artifactAsExDep ) )
+            {
+                filteredProjectArtifacts.add( artifact );
+            }
+            else
+            {
+                this.getLog().info( "Excluding artifact from vstudio project: " + artifact.toString() );
+            }
+        }
+        return filteredProjectArtifacts;
+    }
+
     private void createWebInfoFile( File webInfoFile, ProjectSettings settings )
         throws IOException
     {
@@ -342,7 +371,15 @@
         throws MojoExecutionException
     {
 
-        File f = new File( this.frameworkHome, ref.getPath() );
+        File f;
+        if ( ref.getAbsolute() )
+        {
+            f = new File( ref.getPath() );
+        }
+        else
+        {
+            f = new File( this.frameworkHome, ref.getPath() );
+        }
 
         if ( ( !f.exists() ) || f.isDirectory() )
         {