You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ch...@apache.org on 2006/04/03 17:15:31 UTC
svn commit: r391065 [1/2] - in /maven/sandbox/plugins:
maven-csharp-helper-plugin/ maven-csharp-helper-plugin/src/
maven-csharp-helper-plugin/src/main/
maven-csharp-helper-plugin/src/main/java/
maven-csharp-helper-plugin/src/main/java/org/ maven-csharp...
Author: chrisjs
Date: Mon Apr 3 08:15:21 2006
New Revision: 391065
URL: http://svn.apache.org/viewcvs?rev=391065&view=rev
Log:
First version of all mvn csharp plugins going to apache.
Added:
maven/sandbox/plugins/maven-csharp-helper-plugin/
maven/sandbox/plugins/maven-csharp-helper-plugin/pom.xml
maven/sandbox/plugins/maven-csharp-helper-plugin/src/
maven/sandbox/plugins/maven-csharp-helper-plugin/src/main/
maven/sandbox/plugins/maven-csharp-helper-plugin/src/main/java/
maven/sandbox/plugins/maven-csharp-helper-plugin/src/main/java/org/
maven/sandbox/plugins/maven-csharp-helper-plugin/src/main/java/org/apache/
maven/sandbox/plugins/maven-csharp-helper-plugin/src/main/java/org/apache/maven/
maven/sandbox/plugins/maven-csharp-helper-plugin/src/main/java/org/apache/maven/plugin/
maven/sandbox/plugins/maven-csharp-helper-plugin/src/main/java/org/apache/maven/plugin/csharp/
maven/sandbox/plugins/maven-csharp-helper-plugin/src/main/java/org/apache/maven/plugin/csharp/helper/
maven/sandbox/plugins/maven-csharp-helper-plugin/src/main/java/org/apache/maven/plugin/csharp/helper/PackagingHelper.java
maven/sandbox/plugins/maven-csharp-lifecycle-plugin/
maven/sandbox/plugins/maven-csharp-lifecycle-plugin/pom.xml
maven/sandbox/plugins/maven-csharp-lifecycle-plugin/src/
maven/sandbox/plugins/maven-csharp-lifecycle-plugin/src/main/
maven/sandbox/plugins/maven-csharp-lifecycle-plugin/src/main/java/
maven/sandbox/plugins/maven-csharp-lifecycle-plugin/src/main/java/org/
maven/sandbox/plugins/maven-csharp-lifecycle-plugin/src/main/java/org/apache/
maven/sandbox/plugins/maven-csharp-lifecycle-plugin/src/main/java/org/apache/maven/
maven/sandbox/plugins/maven-csharp-lifecycle-plugin/src/main/java/org/apache/maven/plugin/
maven/sandbox/plugins/maven-csharp-lifecycle-plugin/src/main/java/org/apache/maven/plugin/csharp/
maven/sandbox/plugins/maven-csharp-lifecycle-plugin/src/main/java/org/apache/maven/plugin/csharp/lifecycle/
maven/sandbox/plugins/maven-csharp-lifecycle-plugin/src/main/resources/
maven/sandbox/plugins/maven-csharp-lifecycle-plugin/src/main/resources/META-INF/
maven/sandbox/plugins/maven-csharp-lifecycle-plugin/src/main/resources/META-INF/plexus/
maven/sandbox/plugins/maven-csharp-lifecycle-plugin/src/main/resources/META-INF/plexus/components.xml
maven/sandbox/plugins/maven-csharp-package-plugin/
maven/sandbox/plugins/maven-csharp-package-plugin/pom.xml
maven/sandbox/plugins/maven-csharp-package-plugin/src/
maven/sandbox/plugins/maven-csharp-package-plugin/src/main/
maven/sandbox/plugins/maven-csharp-package-plugin/src/main/java/
maven/sandbox/plugins/maven-csharp-package-plugin/src/main/java/org/
maven/sandbox/plugins/maven-csharp-package-plugin/src/main/java/org/apache/
maven/sandbox/plugins/maven-csharp-package-plugin/src/main/java/org/apache/maven/
maven/sandbox/plugins/maven-csharp-package-plugin/src/main/java/org/apache/maven/plugin/
maven/sandbox/plugins/maven-csharp-package-plugin/src/main/java/org/apache/maven/plugin/csharppackage/
maven/sandbox/plugins/maven-csharp-package-plugin/src/main/java/org/apache/maven/plugin/csharppackage/PackageMojo.java
maven/sandbox/plugins/maven-csharp-package-plugin/src/main/java/org/codehaus/
maven/sandbox/plugins/maven-csharp-package-plugin/src/main/java/org/codehaus/mojo/
maven/sandbox/plugins/maven-csharp-source-plugin/
maven/sandbox/plugins/maven-csharp-source-plugin/pom.xml
maven/sandbox/plugins/maven-csharp-source-plugin/src/
maven/sandbox/plugins/maven-csharp-source-plugin/src/main/
maven/sandbox/plugins/maven-csharp-source-plugin/src/main/java/
maven/sandbox/plugins/maven-csharp-source-plugin/src/main/java/org/
maven/sandbox/plugins/maven-csharp-source-plugin/src/main/java/org/apache/
maven/sandbox/plugins/maven-csharp-source-plugin/src/main/java/org/apache/maven/
maven/sandbox/plugins/maven-csharp-source-plugin/src/main/java/org/apache/maven/plugin/
maven/sandbox/plugins/maven-csharp-source-plugin/src/main/java/org/apache/maven/plugin/csharp/
maven/sandbox/plugins/maven-csharp-source-plugin/src/main/java/org/apache/maven/plugin/csharp/source/
maven/sandbox/plugins/maven-csharp-source-plugin/src/main/java/org/apache/maven/plugin/csharp/source/ProcessClassesMojo.java
maven/sandbox/plugins/maven-nunit-plugin/
maven/sandbox/plugins/maven-nunit-plugin/pom.xml
maven/sandbox/plugins/maven-nunit-plugin/src/
maven/sandbox/plugins/maven-nunit-plugin/src/main/
maven/sandbox/plugins/maven-nunit-plugin/src/main/java/
maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/
maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/
maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/
maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/
maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/
maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitEnvironment.java
maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitMojo.java
maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/codehaus/
maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/codehaus/mojo/
maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/codehaus/mojo/csharp/
maven/sandbox/plugins/maven-vstudio-plugin/
maven/sandbox/plugins/maven-vstudio-plugin/pom.xml
maven/sandbox/plugins/maven-vstudio-plugin/src/
maven/sandbox/plugins/maven-vstudio-plugin/src/main/
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/studio/
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/BuildAction.java
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/DependentUpon.java
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/ProjectSettings.java
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/References.java
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/SubType.java
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/VisualStudioFile.java
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/VisualStudioMojo.java
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/VisualStudioUtil.java
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/xml/
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/xml/VisualStudio2003CSharpWriter.java
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/xml/VisualStudio2003ConfigWriter.java
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/xml/VisualStudio2003FileWriter.java
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/xml/VisualStudio2003ReferenceWriter.java
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/xml/VisualStudio2003SettingsWriter.java
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/xml/VisualStudio2003WebInfoWriter.java
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/xml/VisualStudio2003Writer.java
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/codehause/
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/codehause/mojo/
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/codehause/mojo/csharp/
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/codehause/mojo/csharp/plugins/
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/codehause/mojo/csharp/plugins/studio/
maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/codehause/mojo/csharp/studio/
Added: maven/sandbox/plugins/maven-csharp-helper-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-csharp-helper-plugin/pom.xml?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-csharp-helper-plugin/pom.xml (added)
+++ maven/sandbox/plugins/maven-csharp-helper-plugin/pom.xml Mon Apr 3 08:15:21 2006
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?><project>
+
+ <parent>
+ <artifactId>maven-plugin-parent</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>2.0</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-csharp-helper-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Maven CSharp Helper 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>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-container-default</artifactId>
+ <version>1.0-alpha-8</version>
+ <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
Added: maven/sandbox/plugins/maven-csharp-helper-plugin/src/main/java/org/apache/maven/plugin/csharp/helper/PackagingHelper.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-csharp-helper-plugin/src/main/java/org/apache/maven/plugin/csharp/helper/PackagingHelper.java?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-csharp-helper-plugin/src/main/java/org/apache/maven/plugin/csharp/helper/PackagingHelper.java (added)
+++ maven/sandbox/plugins/maven-csharp-helper-plugin/src/main/java/org/apache/maven/plugin/csharp/helper/PackagingHelper.java Mon Apr 3 08:15:21 2006
@@ -0,0 +1,56 @@
+package org.apache.maven.plugin.csharp.helper;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.codehaus.plexus.util.StringUtils;
+
+public class PackagingHelper {
+
+
+ public static String getExtension(String packaging) throws MojoExecutionException {
+
+ String extension = getExtensionForPackaging( packaging );
+
+ if(StringUtils.isEmpty( extension) )
+ throw new MojoExecutionException("Unknown packaging type:" + packaging );
+
+ return extension;
+ }
+
+
+ private static String getExtensionForPackaging(String packaging){
+
+ String extension = null;
+
+ if( packaging.toLowerCase().equals( "dotnet-library" ) ) extension = "dll";
+ else if( packaging.toLowerCase().equals( "dotnet-exe" ) ) extension = "exe";
+ else if( packaging.toLowerCase().equals( "dotnet-winexe" ) ) extension = "exe";
+ else if( packaging.toLowerCase().equals( "dotnet-module" ) ) extension = "dll";
+ else if( packaging.toLowerCase().equals( "dotnet-webapp" ) ) extension = "dll";
+
+ return extension;
+ }
+
+
+ private static String getPackagingForExtension(String extension){
+
+ String packaging = null;
+
+ if( extension.toLowerCase().equals( "dll" ) ) packaging = "dotnet-library" ;
+ else if( extension.toLowerCase().equals( "exe") ) packaging = "dotnet-exe" ;
+ else if( extension.toLowerCase().equals( "exe" ) ) packaging = "dotnet-winexe" ;
+ else if( extension.toLowerCase().equals( "dll") ) packaging = "dotnet-module" ;
+ else if( extension.toLowerCase().equals( "dll") ) packaging = "dotnet-webapp" ;
+
+ return packaging;
+ }
+
+ public static boolean isDotnetPackaging(String packaging){
+
+ String extension = getExtensionForPackaging( packaging );
+
+ if(StringUtils.isEmpty( extension ) ){
+ return false;
+ }else
+ return true;
+ }
+}
Added: maven/sandbox/plugins/maven-csharp-lifecycle-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-csharp-lifecycle-plugin/pom.xml?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-csharp-lifecycle-plugin/pom.xml (added)
+++ maven/sandbox/plugins/maven-csharp-lifecycle-plugin/pom.xml Mon Apr 3 08:15:21 2006
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?><project>
+
+ <parent>
+ <artifactId>maven-plugin-parent</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>2.0</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-csharp-lifecycle-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Maven CSharp Lifecycle Plugin</name>
+ <version>1.0-SNAPSHOT</version>
+ <url>http://maven.apache.org</url>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </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
Added: maven/sandbox/plugins/maven-csharp-lifecycle-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-csharp-lifecycle-plugin/src/main/resources/META-INF/plexus/components.xml?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-csharp-lifecycle-plugin/src/main/resources/META-INF/plexus/components.xml (added)
+++ maven/sandbox/plugins/maven-csharp-lifecycle-plugin/src/main/resources/META-INF/plexus/components.xml Mon Apr 3 08:15:21 2006
@@ -0,0 +1,131 @@
+ <component-set>
+
+ <components>
+
+ <component>
+ <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+ <role-hint>dotnet-library</role-hint>
+ <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+ <configuration>
+ <phases>
+ <process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
+ <!-- compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile -->
+ <process-classes>org.apache.maven.plugins:maven-csharp-source-plugin:process-classes</process-classes>
+ <process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
+ <!-- test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile -->
+ <test>org.apache.maven.plugins:maven-nunit-plugin:test</test>
+ <package>org.apache.maven.plugins:maven-csharp-package-plugin:package</package>
+ <install>org.apache.maven.plugins:maven-install-plugin:install</install>
+ <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
+ </phases>
+ </configuration>
+ </component>
+
+ <component>
+ <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
+ <role-hint>dotnet-library</role-hint>
+ <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
+ <configuration>
+ <type>dotnet-library</type>
+ <extension>dll</extension>
+ <packaging>dotnet-library</packaging>
+ <addedToClasspath>true</addedToClasspath>
+ </configuration>
+ </component>
+
+ <!-- Configuration for dotnet web projects -->
+ <component>
+ <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+ <role-hint>dotnet-webapp</role-hint>
+ <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+ <configuration>
+ <phases>
+ <process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
+ <process-classes>org.apache.maven.plugins:maven-csharp-source-plugin:process-classes</process-classes>
+ <process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
+ <!-- test>org.apache.maven.plugins:maven-nunit-plugin:test</test -->
+ <package>org.codehaus.mojo.csharp:dotnetassembly-maven-plugin:package</package>
+ <install>org.apache.maven.plugins:maven-install-plugin:install</install>
+ <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
+ </phases>
+ </configuration>
+ </component>
+
+ <component>
+ <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
+ <role-hint>dotnet-webapp</role-hint>
+ <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
+ <configuration>
+ <type>dotnet-web</type>
+ <extension>dll</extension>
+ <packaging>dotnet-webapp</packaging>
+ <addedToClasspath>true</addedToClasspath>
+ </configuration>
+ </component>
+
+ <component>
+ <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+ <role-hint>dotnet-exe</role-hint>
+ <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+ <configuration>
+ <phases>
+ <process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
+ <!-- compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile -->
+ <process-classes>org.apache.maven.plugins:maven-csharp-source-plugin:process-classes</process-classes>
+ <process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
+ <!-- test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile -->
+ <test>org.apache.maven.plugins:maven-nunit-plugin:test</test>
+ <package>org.apache.maven.plugins:maven-csharp-package-plugin:package</package>
+ <install>org.apache.maven.plugins:maven-install-plugin:install</install>
+ <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
+ </phases>
+ </configuration>
+ </component>
+
+ <component>
+ <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
+ <role-hint>dotnet-exe</role-hint>
+ <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
+ <configuration>
+ <type>dotnet-exe</type>
+ <extension>exe</extension>
+ <packaging>dotnet-exe</packaging>
+ <addedToClasspath>true</addedToClasspath>
+ </configuration>
+ </component>
+
+
+ <component>
+ <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+ <role-hint>dotnet-winexe</role-hint>
+ <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+ <configuration>
+ <phases>
+ <process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
+ <!-- compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile -->
+ <process-classes>org.apache.maven.plugins:maven-csharp-source-plugin:process-classes</process-classes>
+ <process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
+ <!-- test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile -->
+ <test>org.apache.maven.plugins:maven-nunit-plugin:test</test>
+ <package>org.apache.maven.plugins:maven-csharp-package-plugin:package</package>
+ <install>org.apache.maven.plugins:maven-install-plugin:install</install>
+ <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
+ </phases>
+ </configuration>
+ </component>
+
+ <component>
+ <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
+ <role-hint>dotnet-winexe</role-hint>
+ <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
+ <configuration>
+ <type>dotnet-winexe</type>
+ <extension>exe</extension>
+ <packaging>dotnet-winexe</packaging>
+ <addedToClasspath>true</addedToClasspath>
+ </configuration>
+ </component>
+
+ </components>
+
+</component-set>
\ No newline at end of file
Added: maven/sandbox/plugins/maven-csharp-package-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-csharp-package-plugin/pom.xml?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-csharp-package-plugin/pom.xml (added)
+++ maven/sandbox/plugins/maven-csharp-package-plugin/pom.xml Mon Apr 3 08:15:21 2006
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?><project>
+
+ <parent>
+ <artifactId>maven-plugin-parent</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>2.0</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-csharp-package-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Maven CSharp Package Plugin</name>
+ <version>1.0-SNAPSHOT</version>
+ <url>http://maven.apache.org</url>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-csharp-helper-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </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
Added: maven/sandbox/plugins/maven-csharp-package-plugin/src/main/java/org/apache/maven/plugin/csharppackage/PackageMojo.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-csharp-package-plugin/src/main/java/org/apache/maven/plugin/csharppackage/PackageMojo.java?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-csharp-package-plugin/src/main/java/org/apache/maven/plugin/csharppackage/PackageMojo.java (added)
+++ maven/sandbox/plugins/maven-csharp-package-plugin/src/main/java/org/apache/maven/plugin/csharppackage/PackageMojo.java Mon Apr 3 08:15:21 2006
@@ -0,0 +1,72 @@
+package org.apache.maven.plugin.csharppackage;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * This Mojo just sets the artifact to the result of the
+ * compile step, which is the actual dll/exe
+ * (doesn't need to jar up like the java compilers).
+ *
+ * @goal package
+ * @phase package
+ */
+public class PackageMojo extends AbstractMojo {
+
+ /**
+ * Name of the generated JAR.
+ *
+ * @parameter alias="jarName" expression="${project.build.finalName}"
+ * @required
+ */
+ private String finalName;
+
+ /**
+ * The maven project.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ /**
+ * Directory containing the classes.
+ *
+ * @parameter expression="${project.build.outputDirectory}"
+ * @required
+ * @readonly
+ */
+ private File outputDirectory;
+
+ public void execute() throws MojoExecutionException {
+
+ String builddirname = project.getBuild().getDirectory();
+
+ File builddir = new File(builddirname);
+
+ if( builddir.exists() ){
+
+ this.getLog().info("Copying artifact to build directory [" + builddir.getAbsolutePath() + "]");
+ this.getLog().debug("nb. this is to allow the create bundle functionality in csharp projects");
+
+ try{
+
+ FileUtils.copyFileToDirectory( outputDirectory, builddir );
+ project.getArtifact().setFile( outputDirectory );
+
+ }catch(IOException ioex){
+ this.getLog().error("Exception occurred copying file [" + outputDirectory.getAbsolutePath() + "] to [" + builddir.getAbsoluteFile() + "]", ioex);
+ throw new MojoExecutionException(ioex.getMessage(), ioex);
+ }
+ }else {
+ this.getLog().warn("BuildDirectory [" + builddir.getAbsolutePath() + "] doesn't exist, something strange has happened");
+ }
+ }
+}
Added: maven/sandbox/plugins/maven-csharp-source-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-csharp-source-plugin/pom.xml?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-csharp-source-plugin/pom.xml (added)
+++ maven/sandbox/plugins/maven-csharp-source-plugin/pom.xml Mon Apr 3 08:15:21 2006
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?><project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>maven-plugin-parent</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>2.0</version>
+ </parent>
+
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-csharp-source-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Maven CSharp Source 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>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-csharp-helper-plugin</artifactId>
+ <version>1.0.RC6-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-container-default</artifactId>
+ <version>1.0-alpha-8</version>
+ <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
Added: maven/sandbox/plugins/maven-csharp-source-plugin/src/main/java/org/apache/maven/plugin/csharp/source/ProcessClassesMojo.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-csharp-source-plugin/src/main/java/org/apache/maven/plugin/csharp/source/ProcessClassesMojo.java?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-csharp-source-plugin/src/main/java/org/apache/maven/plugin/csharp/source/ProcessClassesMojo.java (added)
+++ maven/sandbox/plugins/maven-csharp-source-plugin/src/main/java/org/apache/maven/plugin/csharp/source/ProcessClassesMojo.java Mon Apr 3 08:15:21 2006
@@ -0,0 +1,86 @@
+package org.apache.maven.plugin.csharp.source;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.csharp.helper.PackagingHelper;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * This Mojo adds the result of the compile to the classpath elements
+ * This is required by the NUnitMojo.
+ *
+ * @goal process-classes
+ * @phase process-classes
+ *
+ * @author <a href="mailto:chris.stevenson@gmail.com">Chris Stevenson</a>
+ */
+public class ProcessClassesMojo extends AbstractMojo {
+
+ /**
+ * Name of the generated assembly
+ *
+ * @parameter alias="jarName" expression="${project.build.finalName}"
+ * @required
+ */
+ private String finalName;
+
+ /**
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ protected MavenProject project;
+
+ /**
+ * Directory containing the classes.
+ *
+ * @parameter expression="${project.build.outputDirectory}"
+ * @required
+ * @readonly
+ */
+ private File outputDirectory;
+
+ /**
+ * The classpath elements of the project being tested.
+ *
+ * @parameter expression="${project.testClasspathElements}"
+ * @required
+ * @readonly
+ */
+ private List classpathElements;
+
+ /**
+ * @parameter expression="${component.org.apache.maven.artifact.factory.ArtifactFactory}"
+ * @required
+ * @readonly
+ */
+ private ArtifactFactory artifactFactory;
+
+ public void execute() throws MojoExecutionException, MojoFailureException {
+
+ File mainAssembly = getFile( outputDirectory, finalName, project.getPackaging() );
+
+ project.getBuild().setOutputDirectory( mainAssembly.getAbsolutePath() );
+
+ this.getLog().info("Setting [" + mainAssembly.getAbsolutePath() + "] to as output folder.");
+ }
+
+ public File getFile(File directory, String fileName, String packaging) throws MojoExecutionException{
+
+ String fileAbsolutePath = directory.getAbsolutePath() + File.separator + fileName + "." + PackagingHelper.getExtension( packaging );
+
+ this.getLog().debug("Looking for file[" + fileAbsolutePath + "]");
+
+ File f = new File(fileAbsolutePath);
+
+ if( ! f.exists() ) throw new MojoExecutionException("Cannot find file[" + fileAbsolutePath + "]");
+
+ return f;
+ }
+
+}
Added: maven/sandbox/plugins/maven-nunit-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-nunit-plugin/pom.xml?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-nunit-plugin/pom.xml (added)
+++ maven/sandbox/plugins/maven-nunit-plugin/pom.xml Mon Apr 3 08:15:21 2006
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?><project>
+
+ <parent>
+ <artifactId>maven-plugin-parent</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>2.0</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-nunit-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Maven NUnit 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>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-csharp-helper-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </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
Added: maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitEnvironment.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitEnvironment.java?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitEnvironment.java (added)
+++ maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitEnvironment.java Mon Apr 3 08:15:21 2006
@@ -0,0 +1,250 @@
+package org.apache.maven.plugin.nunit;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.csharp.helper.PackagingHelper;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+import org.codehaus.plexus.util.cli.StreamConsumer;
+import org.codehaus.plexus.util.cli.WriterStreamConsumer;
+
+/**
+* NUNIT-CONSOLE [inputfiles] [options]
+ *
+ * Runs a set of NUnit tests from the console.
+ *
+ * You may specify one or more assemblies or a single
+ *project file of type .nunit.
+ *
+ *Options:
+ * \/fixture=STR Fixture to test
+ * \/config=STR Project configuration to load
+ * \/xml=STR Name of XML output file
+ *\/transform=STR Name of transform file
+ *\/xmlConsole Display XML to the console
+ *\/output=STR File to receive test output (Sho
+ *\/err=STR File to receive test error outpu
+ *\/labels Label each test in stdOut
+ *\/include=STR List of categories to include
+ *\/exclude=STR List of categories to exclude
+ *\/noshadow Disable shadow copy
+ *\/thread Run tests on a separate thread
+ *\/wait Wait for input before closing co
+ *\/nologo Do not display the logo
+ *\/help Display help (Short format: /?)
+*/
+
+public class NUnitEnvironment {
+
+ private Log log = null;
+ private static String directoryName = ".nunit";
+ private static String argumentsName = "nunit-arguments";
+
+ private static String nunitOutputPrefix = "[NUNIT] ";
+
+ private File directory = null;
+ private File outputDir = null;
+ private File mainAssembly = null;
+ private File testAssembly = null;
+ private File nunitConsoleFile = null;
+ private File unitTestConfig = null;
+ private String runtime = null;
+
+ private List artifacts = null;
+
+ public NUnitEnvironment(Log log, File outputDir, List artifacts, File mainAssembly, File testAssembly, File unitTestConfig, String runtime){
+ this.log = log;
+ this.outputDir = outputDir;
+ this.artifacts = artifacts;
+ this.mainAssembly = mainAssembly;
+ this.testAssembly = testAssembly;
+ this.unitTestConfig = unitTestConfig;
+ this.runtime = runtime;
+ }
+
+ public void create() throws MojoExecutionException {
+
+ try {
+
+ directory = new File( outputDir.getAbsolutePath() + File.separator + directoryName );
+
+ if( directory.exists() ){
+
+ FileUtils.deleteDirectory( directory );
+ }
+
+ FileUtils.forceMkdir( directory );
+
+ copyDependencies( directory, artifacts );
+
+ } catch(IOException ioex){
+ throw new MojoExecutionException("IOException occurred while trying to create local copy of nunit [" + outputDir.getAbsolutePath() + File.separator + ".nunit]", ioex );
+ }
+ }
+
+ public Log getLog() {
+ return log;
+ }
+
+ public void setLog(Log log) {
+ this.log = log;
+ }
+
+
+ private void copyDependencies(File directory, List artifacts) throws MojoExecutionException, IOException {
+
+ for ( Iterator i = artifacts.iterator(); i.hasNext(); ){
+
+ Artifact a = (Artifact) i.next();
+
+ if( ! a.getFile().exists() )
+ throw new MojoExecutionException("Artifact file:" + a.getFile() + " does not exist, path provided:" + a.getFile().getAbsolutePath() );
+
+ //only copy non-syetem deps to directory (system deps you get for free.. :-)
+ if( ! a.getFile().isDirectory() && (! a.getScope().equals( Artifact.SCOPE_SYSTEM ) ) ){
+ //if reference is a non csharp (could be java for an integration test, then ignore it.
+ if( PackagingHelper.isDotnetPackaging( a.getType() ) )
+ FileUtils.copyFileToDirectory( a.getFile(), outputDir );
+ }
+
+
+ if( a.getArtifactId().equals("nunit-console") ) nunitConsoleFile = new File( outputDir + File.separator + a.getFile().getName() );
+ }
+
+ if( nunitConsoleFile == null )
+ throw new MojoExecutionException("Cannot find dependency with id:nunit.console, cannot execute NUnit Plugin without this.");
+
+ FileUtils.copyFileToDirectory( this.mainAssembly, outputDir );
+
+ if( unitTestConfig == null ){
+ this.getLog().info(nunitOutputPrefix +"\t No config file specified.");
+ }
+ else if( unitTestConfig.exists() && unitTestConfig.isFile() ) {
+ FileUtils.copyFile( unitTestConfig, new File( outputDir , this.testAssembly.getName() + ".config" ) );
+ this.getLog().info(nunitOutputPrefix +"\t Copying config [" + unitTestConfig.getAbsolutePath() + "] to [" + new File( directory, this.testAssembly.getName() + ".config" ).getAbsolutePath() );
+ }else
+ this.getLog().info(nunitOutputPrefix +"\t Config file doesn't exist or is not a file [" + unitTestConfig.getAbsolutePath() + "]");
+
+ }
+
+ public void run() throws MojoExecutionException {
+
+
+ Commandline cli = new Commandline();
+ try {
+ cli.setWorkingDirectory(outputDir.getCanonicalPath());
+ } catch (IOException e1) {
+ throw new MojoExecutionException("Could not set working directory to: "+outputDir);
+ }
+
+ File executable = nunitConsoleFile;
+
+ if( executable == null ) throw new MojoExecutionException("Cannot find dependency with id:nunit.console, cannot execute NUnit Plugin without this.");
+
+ if( StringUtils.isEmpty( runtime ) ){
+ cli.setExecutable( nunitConsoleFile.getName() );
+ } else {
+ cli.setExecutable( runtime );
+ cli.createArgument().setValue( nunitConsoleFile.getName() );
+ }
+ cli.createArgument().setValue( testAssembly.getName() );
+
+ try
+ {
+ logEnvironment(cli);
+
+ Writer outWriter = new OutputStreamWriter(System.out);
+
+ Writer errWriter = new OutputStreamWriter(System.err);
+
+ StreamConsumer out = new WriterStreamConsumer( outWriter );
+
+ StreamConsumer err = new WriterStreamConsumer( errWriter );
+
+ System.out.println("-------------------------------------------------------");
+ System.out.println("T E S T S ");
+ System.out.println("-------------------------------------------------------");
+
+ int result = CommandLineUtils.executeCommandLine( cli, out, err );
+
+// try {
+// //writeNUnitOutputToLog( new BufferedReader( new StringReader( stringWriter.toString() ) ) );
+// }catch(IOException ioex){
+// throw new MojoExecutionException(ioex.getMessage(), ioex);
+// }
+
+ if ( result != 0 )
+ {
+ throw new MojoExecutionException("Result of execution is: \'" + result + "\'. NUnit failed." );
+ }
+ }
+ catch ( CommandLineException e )
+ {
+ throw new MojoExecutionException( e.getMessage(), e );
+ }
+ }
+
+ public void delete() throws MojoExecutionException {
+ if(directory != null && directory.exists()){
+ try {
+ FileUtils.deleteDirectory(directory);
+ } catch(IOException ioex){
+ throw new MojoExecutionException("Could not delete temporary nunit dir:" + directory.getAbsolutePath(), ioex );
+ }
+ }
+ }
+
+// private void writeNUnitOutputToLog(BufferedReader reader) throws IOException {
+//
+// String line = reader.readLine();
+//
+// while( line != null )
+// {
+// log.info(nunitOutputPrefix + line);
+//
+// line = reader.readLine();
+// }
+// }
+
+ private void logEnvironment(Commandline cli) throws MojoExecutionException {
+
+ getLog().info( nunitOutputPrefix + "NUnit config:" );
+ getLog().info( nunitOutputPrefix + "\t nunit binary [" + nunitConsoleFile.getAbsolutePath() + "]" );
+ getLog().info( nunitOutputPrefix + "\t test assembly [" + testAssembly.getAbsolutePath() + "]" );
+ getLog().info( nunitOutputPrefix + "\t main assembly [" + mainAssembly.getAbsolutePath() + "]");
+
+ getLog().info( nunitOutputPrefix + "\t (nb. All references copied locally [" + directory.getAbsolutePath() + "])");
+
+ for( Iterator i = artifacts.iterator(); i.hasNext(); ){
+ Artifact a = (Artifact) i.next();
+ if( PackagingHelper.isDotnetPackaging( a.getType() ) )
+ getLog().info(nunitOutputPrefix +"\t reference:" + a.getFile().getName() );
+ }
+
+ try {
+ File f = new File( outputDir, "nunit-arguments" );
+ f.createNewFile();
+ //params are: 1=file to write to,2=data to write, 3=encoding (null for platform default
+ FileUtils.writeStringToFile(f, cli.toString(), null );
+
+ getLog().info(nunitOutputPrefix + "\t nunit command line written to [" + f.getAbsolutePath() + "]");
+ } catch( IOException ioex ){
+ throw new MojoExecutionException("Could not create nunit-argumnets file @" + outputDir.getAbsolutePath() + File.separator + argumentsName );
+ }
+ }
+}
Added: maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitMojo.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitMojo.java?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitMojo.java (added)
+++ maven/sandbox/plugins/maven-nunit-plugin/src/main/java/org/apache/maven/plugin/nunit/NUnitMojo.java Mon Apr 3 08:15:21 2006
@@ -0,0 +1,181 @@
+package org.apache.maven.plugin.nunit;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.csharp.helper.PackagingHelper;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.Os;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ *
+ * @requiresDependencyResolution test
+ * @goal test
+ * @phase test
+ * @description Run tests in project using NUnit
+ * @author <a href="mailto:chris.stevenson@gmail.com">Chris Stevenson</a>
+ *
+ */
+public class NUnitMojo extends AbstractMojo {
+
+ /**
+ * Name of the generated assembly
+ *
+ * @parameter alias="jarName" expression="${project.build.finalName}"
+ * @required
+ */
+ private String finalName;
+
+ /**
+ * Set this to 'true' to bypass unit tests entirely.
+ * Its use is NOT RECOMMENDED, but quite convenient on occasion.
+ *
+ * @parameter expression="${maven.test.skip}"
+ */
+ private boolean skip;
+
+ /**
+ * The configuration file for the assembly, if required.
+ * @parameter
+ */
+ private File configFile;
+
+ /**
+ * The directory containing generated test classes of the project being tested.
+ *
+ * @parameter expression="${project.build.testOutputDirectory}"
+ * @required
+ */
+ private File testOutputDirectory;
+
+ /**
+ * The file name for the unit-tests library. Defaults to unit-tests.dll
+ *
+ * @parameter
+ */
+ private String testOutputFileName;
+
+ /**
+ * This is the filename to invoke the runtime environment. On windows
+ * using csc & MS dotnet this should be null.
+ *
+ * On Windows/*nix using mono this should be mono
+ *
+ * Using "default" will detect the current platform and use the
+ * the default value for the platform.
+ *
+ * @parameter expression="${nunit.runtime}" default-value="default"
+ */
+ private String runtime;
+
+ /**
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ protected MavenProject project;
+
+ /**
+ * Directory containing the classes.
+ *
+ * @parameter expression="${project.build.outputDirectory}"
+ * @required
+ * @readonly
+ */
+ private File outputDirectory;
+
+ public void execute() throws MojoExecutionException {
+
+ if(skip){
+ this.getLog().warn("Skipping Unit Tests!!");
+ return;
+ }
+
+ this.getLog().info("Creating NUnit environment....");
+
+ List dependencyartifacts = project.getTestArtifacts();
+
+ String runtimeExecutable = getRuntimeExecutable( this.runtime );
+
+ //this is a dirty firkle that is provided by the packaging class :-)
+ File mainAssembly = outputDirectory;
+
+ File testAssembly = null;
+
+ if( ! StringUtils.isEmpty( testOutputFileName) )
+ testAssembly = getFile(testOutputDirectory, testOutputFileName );
+ else
+ testAssembly = getFile(testOutputDirectory, "unit-tests", "dotnet-library" );
+
+ this.getLog().info("Looking for test assembly at:" + testAssembly.getAbsolutePath() );
+
+ if( ! testAssembly.exists() )
+ this.getLog().warn("SKIPPING TESTS as no test assembly found. ");
+
+
+ NUnitEnvironment env = new NUnitEnvironment( this.getLog(), testOutputDirectory,
+ dependencyartifacts, mainAssembly,
+ testAssembly, configFile,
+ runtimeExecutable );
+
+ env.create();
+
+ //execute Nunit tests.
+ env.run();
+
+ //if everything works then delete environment (else leave around for debugging)
+ env.delete();
+
+ }
+
+ public File getFile(File directory, String fileName, String packaging) throws MojoExecutionException{
+
+ String fileAbsolutePath = directory.getAbsolutePath() + File.separator + fileName + "." + PackagingHelper.getExtension( packaging );
+
+ this.getLog().debug("Looking for file[" + fileAbsolutePath + "]");
+
+ File f = new File(fileAbsolutePath);
+
+ if( ! f.exists() ) throw new MojoExecutionException("Cannot find file[" + fileAbsolutePath + "]");
+
+ return f;
+ }
+
+ public File getFile(File directory, String fileName) throws MojoExecutionException{
+
+ String fileAbsolutePath = directory.getAbsolutePath() + File.separator + fileName;
+
+ this.getLog().debug("Looking for file[" + fileAbsolutePath + "]");
+
+ File f = new File(fileAbsolutePath);
+
+ if( ! f.exists() ) throw new MojoExecutionException("Cannot find file[" + fileAbsolutePath + "]");
+
+ return f;
+ }
+
+ private String getRuntimeExecutable(String param) {
+
+ String exe = null;
+
+ if( "default".equals( param ) ){
+ //if running windows leave null
+ if ( Os.isFamily("windows") ){
+ exe = null;
+ this.getLog().info("OS Appears to be windows, leaving runtimeExecutable as null");
+ }else {
+ //pop in mono by default.
+ exe = "mono";
+ this.getLog().info("OS Appears to be *nix, setting runtimeExecutable to be \"mono\"");
+ }
+ }else{
+ exe = param;
+ this.getLog().info("User specified runtimeExecutable as:" + param);
+ }
+
+ return exe;
+ }
+}
Added: maven/sandbox/plugins/maven-vstudio-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-vstudio-plugin/pom.xml?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-vstudio-plugin/pom.xml (added)
+++ maven/sandbox/plugins/maven-vstudio-plugin/pom.xml Mon Apr 3 08:15:21 2006
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?><project>
+ <parent>
+ <artifactId>maven-plugin-parent</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>2.0</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-vstudio-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <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>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-container-default</artifactId>
+ <version>1.0-alpha-8</version>
+ <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
Added: maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/BuildAction.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/BuildAction.java?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/BuildAction.java (added)
+++ maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/BuildAction.java Mon Apr 3 08:15:21 2006
@@ -0,0 +1,32 @@
+package org.apache.maven.plugin.vstudio;
+
+public class BuildAction {
+
+ private String type = null;
+
+ private BuildAction(String type){
+ this.type = type;
+ }
+
+ private static String __BuildActionNone = "None";
+ private static String __BuildActionCompile = "Compile";
+ private static String __BuildActionContent = "Content";
+ private static String __BuildActionEmbeddedResources = "EmbeddedResource";
+
+ public static BuildAction None = new BuildAction( __BuildActionNone );
+ public static BuildAction Compile = new BuildAction( __BuildActionCompile );
+ public static BuildAction Content = new BuildAction( __BuildActionContent );
+ public static BuildAction EmbeddedResources = new BuildAction( __BuildActionEmbeddedResources );
+
+ public String toString() {
+ return type;
+ }
+
+ public boolean equals(Object arg0) {
+ if(arg0 instanceof BuildAction && ((BuildAction)arg0).type.equals( this.type ) )return true;
+ return false;
+ }
+
+
+
+}
Added: maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/DependentUpon.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/DependentUpon.java?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/DependentUpon.java (added)
+++ maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/DependentUpon.java Mon Apr 3 08:15:21 2006
@@ -0,0 +1,18 @@
+package org.apache.maven.plugin.vstudio;
+
+public class DependentUpon {
+
+ private String fileName = null;
+
+ public DependentUpon( String fileName ){
+ this.fileName = fileName;
+ }
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public String toString() {
+ return fileName;
+ }
+}
Added: maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/ProjectSettings.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/ProjectSettings.java?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/ProjectSettings.java (added)
+++ maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/ProjectSettings.java Mon Apr 3 08:15:21 2006
@@ -0,0 +1,159 @@
+package org.apache.maven.plugin.vstudio;
+
+public class ProjectSettings {
+
+ /* Settings inside the build element */
+ private String rootNamespace = "";
+ private String applicationIcon = "";
+ private String assemblyKeyContainerName = "";
+ private String assemblyName = "";
+ private String assemblyOriginatorKeyFile = "";
+ private String defaultClientScript = "JScript";
+ private String defaultHTMLPageLayout = "Grid";
+ private String defaultTargetSchema = "IE50";
+ private String delaySign = "false";
+ private String outputType = "Library";
+ private String preBuildEvent = "";
+ private String postBuildEvent = "";
+ private String runPostBuildEvent = "OnBuildSuccess";
+ private String startupObject= "";
+ private String projectName = "";
+
+ private String projectType = "Local";
+ private String productVersion = "7.10.3077";
+ private String schemaVersion = "2.0";
+ private String projectGuid = "{E6E60F5C-A28D-4B3F-A01C-A334F848B9BE}";
+
+ /**
+ * if this project has a packaging type dotnet-web
+ * then this parameter must be supplied so that the system can write out the
+ * .csproj.webinfo file as well as the .csproj file.
+ */
+ private String webProjectUrlPath = null;
+
+
+ public ProjectSettings(){}
+
+
+ public String getProductVersion() {
+ return productVersion;
+ }
+ public void setProductVersion(String productVersion) {
+ this.productVersion = productVersion;
+ }
+ public String getProjectGuid() {
+ return projectGuid;
+ }
+ public void setProjectGuid(String projectGuid) {
+ this.projectGuid = projectGuid;
+ }
+ public String getProjectType() {
+ return projectType;
+ }
+ public void setProjectType(String projectType) {
+ this.projectType = projectType;
+ }
+ public String getSchemaVersion() {
+ return schemaVersion;
+ }
+ public void setSchemaVersion(String schemaVersion) {
+ this.schemaVersion = schemaVersion;
+ }
+ public String getProjectName() {
+ return projectName;
+ }
+ public void setProjectName(String projectName) {
+ this.projectName = projectName;
+ }
+ public String getApplicationIcon() {
+ return applicationIcon;
+ }
+ public void setApplicationIcon(String applicationIcon) {
+ this.applicationIcon = applicationIcon;
+ }
+ public String getAssemblyKeyContainerName() {
+ return assemblyKeyContainerName;
+ }
+ public void setAssemblyKeyContainerName(String assemblyKeyContainerName) {
+ this.assemblyKeyContainerName = assemblyKeyContainerName;
+ }
+ public String getAssemblyName() {
+ return assemblyName;
+ }
+ public void setAssemblyName(String assemblyName) {
+ this.assemblyName = assemblyName;
+ }
+ public String getAssemblyOriginatorKeyFile() {
+ return assemblyOriginatorKeyFile;
+ }
+ public void setAssemblyOriginatorKeyFile(String assemblyOriginatorKeyFile) {
+ this.assemblyOriginatorKeyFile = assemblyOriginatorKeyFile;
+ }
+ public String getDefaultClientScript() {
+ return defaultClientScript;
+ }
+ public void setDefaultClientScript(String defaultClientScript) {
+ this.defaultClientScript = defaultClientScript;
+ }
+ public String getDefaultHTMLPageLayout() {
+ return defaultHTMLPageLayout;
+ }
+ public void setDefaultHTMLPageLayout(String defaultHTMLPageLayout) {
+ this.defaultHTMLPageLayout = defaultHTMLPageLayout;
+ }
+ public String getDefaultTargetSchema() {
+ return defaultTargetSchema;
+ }
+ public void setDefaultTargetSchema(String defaultTargetSchema) {
+ this.defaultTargetSchema = defaultTargetSchema;
+ }
+ public String getDelaySign() {
+ return delaySign;
+ }
+ public void setDelaySign(String delaySign) {
+ this.delaySign = delaySign;
+ }
+ public String getOutputType() {
+ return outputType;
+ }
+ public void setOutputType(String outputType) {
+ this.outputType = outputType;
+ }
+ public String getPostBuildEvent() {
+ return postBuildEvent;
+ }
+ public void setPostBuildEvent(String postBuildEvent) {
+ this.postBuildEvent = postBuildEvent;
+ }
+ public String getPreBuildEvent() {
+ return preBuildEvent;
+ }
+ public void setPreBuildEvent(String preBuildEvent) {
+ this.preBuildEvent = preBuildEvent;
+ }
+ public String getRootNamespace() {
+ return rootNamespace;
+ }
+ public void setRootNamespace(String rootNamespace) {
+ this.rootNamespace = rootNamespace;
+ }
+ public String getRunPostBuildEvent() {
+ return runPostBuildEvent;
+ }
+ public void setRunPostBuildEvent(String runPostBuildEvent) {
+ this.runPostBuildEvent = runPostBuildEvent;
+ }
+ public String getStartupObject() {
+ return startupObject;
+ }
+ public void setStartupObject(String startupObject) {
+ this.startupObject = startupObject;
+ }
+ public String getWebProjectUrlPath() {
+ return webProjectUrlPath;
+ }
+ public void setWebProjectUrlPath(String webProjectUrlPath) {
+ this.webProjectUrlPath = webProjectUrlPath;
+ }
+}
+
Added: maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/Reference.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/Reference.java?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/Reference.java (added)
+++ maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/Reference.java Mon Apr 3 08:15:21 2006
@@ -0,0 +1,39 @@
+package org.apache.maven.plugin.vstudio;
+
+import java.io.File;
+
+public class Reference {
+
+ private String path = null;
+ private boolean gac = false;
+
+ /**
+ * @return Returns the gac.
+ */
+ public boolean getGac() {
+ return gac;
+ }
+ /**
+ * @param gac The gac to set.
+ */
+ public void setGac(boolean gac) {
+ this.gac = gac;
+ }
+ /**
+ * @return Returns the path.
+ */
+ public String getPath() {
+ return path;
+ }
+ /**
+ * @param path The path to set.
+ */
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+
+
+
+
+}
Added: maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/References.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/References.java?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/References.java (added)
+++ maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/References.java Mon Apr 3 08:15:21 2006
@@ -0,0 +1,28 @@
+package org.apache.maven.plugin.vstudio;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class References {
+
+ private List references = new ArrayList();
+
+ /**
+ * @return Returns the references.
+ */
+ public List getReferences() {
+ return references;
+ }
+
+ /**
+ * @param references The references to set.
+ */
+ public void setReferences(List references) {
+ this.references = references;
+ }
+
+ public void addReference(Reference ref){
+ this.references.add( ref );
+ }
+
+}
Added: maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/SubType.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/SubType.java?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/SubType.java (added)
+++ maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/SubType.java Mon Apr 3 08:15:21 2006
@@ -0,0 +1,32 @@
+package org.apache.maven.plugin.vstudio;
+
+public class SubType {
+
+ private static String __SubTypeCode = "Code";
+ private static String __SubTypeNull = "";
+ private static String __SubTypeForm = "Form";
+ private static String __SubTypeComponent = "Component";
+ private static String __SubTypeAspxCodeBehind = "ASPXCodeBehind";
+
+ private String _type = null;
+
+ private SubType(String subtype){
+ _type = subtype;
+ }
+
+ public static final SubType Code = new SubType( __SubTypeCode );
+ public static final SubType Null = new SubType( __SubTypeNull );
+ public static final SubType Form = new SubType( __SubTypeForm );
+ public static final SubType AspxCodeBehind = new SubType( __SubTypeAspxCodeBehind );
+ public static final SubType Component = new SubType( __SubTypeComponent );
+
+ public String toString() {
+ return _type;
+ }
+
+ public boolean equals(Object arg0) {
+ if(arg0 instanceof SubType && ((SubType)arg0)._type.equals( this._type ) )return true;
+ else if (arg0 instanceof SubType && ((SubType)arg0)._type.equals( "" ) && this._type.equals("") ) return true;
+ return false;
+ }
+}
Added: maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/VisualStudioFile.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/VisualStudioFile.java?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/VisualStudioFile.java (added)
+++ maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/VisualStudioFile.java Mon Apr 3 08:15:21 2006
@@ -0,0 +1,59 @@
+package org.apache.maven.plugin.vstudio;
+
+import java.io.File;
+
+public class VisualStudioFile {
+
+ private File file = null;
+ private BuildAction action = null;
+ private String relativePath = null;
+ private SubType sub = null;
+ private DependentUpon dependent = null;
+
+ public VisualStudioFile(File file, BuildAction action, String relativePath, SubType sub){
+ this.file = file;
+ this.action = action;
+ this.relativePath = relativePath;
+ this.sub = sub;
+ }
+
+ public VisualStudioFile(File file, BuildAction action, String relativePath, SubType sub, DependentUpon dependent){
+ this.file = file;
+ this.action = action;
+ this.relativePath = relativePath;
+ this.sub = sub;
+ this.dependent = dependent;
+ }
+
+ public VisualStudioFile(File file, BuildAction action, String relativePath, DependentUpon dependent){
+ this.file = file;
+ this.action = action;
+ this.relativePath = relativePath;
+ this.dependent = dependent;
+ }
+
+ public BuildAction getAction() {
+ return action;
+ }
+
+ public File getFile() {
+ return file;
+ }
+
+ public String getRelativePath() {
+ return relativePath;
+ }
+
+ public SubType getSub() {
+ return sub;
+ }
+
+ public DependentUpon getDependent() {
+ return dependent;
+ }
+
+
+ public String toString() {
+ return "VSFile[@rel="+relativePath+",@path="+file.getAbsolutePath()+",@action="+action+",@subtype="+sub+",@dep="+dependent+"]";
+ }
+}
Added: maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/VisualStudioMojo.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/VisualStudioMojo.java?rev=391065&view=auto
==============================================================================
--- maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/VisualStudioMojo.java (added)
+++ maven/sandbox/plugins/maven-vstudio-plugin/src/main/java/org/apache/maven/plugin/vstudio/VisualStudioMojo.java Mon Apr 3 08:15:21 2006
@@ -0,0 +1,325 @@
+package org.apache.maven.plugin.vstudio;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.vstudio.xml.VisualStudio2003WebInfoWriter;
+import org.apache.maven.plugin.vstudio.xml.VisualStudio2003Writer;
+import org.apache.maven.project.MavenProject;
+
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
+import org.codehaus.plexus.util.xml.XMLWriter;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Generates a Visual Studio Project
+ * file from the pom.xml
+ *
+ * @requiresDependencyResolution test
+ * @goal vstudio
+ *
+ */
+public class VisualStudioMojo extends AbstractMojo
+{
+ /**
+ * Location of the file.
+ * @parameter expression="${project.build.directory}"
+ * @required
+ */
+ private File outputDirectory;
+
+ /**
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ protected MavenProject project;
+
+ /**
+ * The source directories containing the sources to be compiled.
+ *
+ * @parameter expression="${project.compileSourceRoots}"
+ * @required
+ * @readonly
+ */
+ private List compileSourceRoots;
+
+ /**
+ * The list of resources we want to transfer.
+ *
+ * @parameter expression="${project.resources}"
+ * @required
+ */
+ private List resources;
+
+ /**
+ * This value is the path to the framework firectory
+ * on your local machine. Please see the <a href="/getting-started.html">Getting Started</a>.
+ * guide on how to do this.
+ *
+ *
+ * @parameter
+ * @required
+ */
+ private String frameworkHome;
+
+ /**
+ * This is all the stuff that can be set up about a vs project. It is a big object.
+ * Most of which is optional. See the java doc and your own project for details.
+ *
+ * @parameter
+ */
+ private ProjectSettings projectSettings;
+
+ /**
+ * A list of inclusion filters for the .csproj.
+ * ex.
+ *
+ * **\/*.cs
+ * **\/*.xslt
+ * (ignore back slash)
+ *
+ * @parameter
+ */
+ private Set includes = new HashSet();
+
+ /**
+ * A list of exclusion filters for the .csproj.
+ *
+ * @parameter
+ */
+ private Set excludes = 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
+ * a) compile through the addition of MS Core Lib
+ * or
+ * b) runtime through the bootstrapper function is MS dotnet or the mono
+ * runtime exe for mono.
+ *
+ * @parameter
+ */
+ private List references = new ArrayList();
+
+ /**
+ * @parameter expression="${component.org.apache.maven.artifact.factory.ArtifactFactory}"
+ * @required
+ * @readonly
+ */
+ protected ArtifactFactory factory;
+
+ public void execute()throws MojoExecutionException
+ {
+ this.getLog().info("framework.home=" + frameworkHome);
+
+ //if its null use the defaults.
+ if(projectSettings == null) projectSettings = new ProjectSettings();
+
+ projectSettings.setRootNamespace( project.getGroupId() );
+ projectSettings.setAssemblyName( project.getBuild().getFinalName() );
+ projectSettings.setOutputType( getOutputTypeFromType(project.getArtifact().getType() ) );
+ projectSettings.setProjectType( getProjectTypeFromType( project.getArtifact().getType() ) );
+
+ if( project.getArtifact().getType().equals( "dotnet-web" ) && ( projectSettings.getWebProjectUrlPath() == null || StringUtils.isEmpty( projectSettings.getWebProjectUrlPath() ) ) )
+ throw new MojoExecutionException("if you are creating a project of type dotnet-web you need to provide the parameter projectSettings/webProjectUrlPath");
+
+ for( Iterator i = project.getCompileSourceRoots().iterator(); i.hasNext(); ){
+ this.getLog().info("source root:" + i.next() );
+ }
+
+ for( Iterator i = project.getTestCompileSourceRoots().iterator(); i.hasNext(); ){
+ this.getLog().info("source root:" + i.next() );
+ }
+
+ for( Iterator i= project.getResources().iterator();i.hasNext();){
+ getLog().info("res:" + i.next() );
+ }
+
+ VisualStudioFile[] mainsource = VisualStudioUtil.getSourceFiles( project.getBasedir(), project.getCompileSourceRoots(), includes, excludes );
+ VisualStudioFile[] testsource = VisualStudioUtil.getSourceFiles( project.getBasedir(), project.getTestCompileSourceRoots(), includes, excludes );
+ VisualStudioFile[] resources = VisualStudioUtil.getResourceFiles( project.getBasedir(), project.getResources() );
+ VisualStudioFile pom = VisualStudioUtil.getPom( project );
+
+ File projectFile = new File( project.getBasedir(), project.getArtifactId() + ".csproj");
+
+ try {
+
+ this.getLog().info("Creating project file ["+projectFile.getAbsolutePath()+"]");
+
+ projectFile.createNewFile();
+
+ FileWriter filewriter = new FileWriter( projectFile );
+
+ XMLWriter writer = new PrettyPrintXMLWriter(filewriter);
+
+ File frameworkDir = new File( frameworkHome );
+
+ if(! frameworkDir.exists() || ! frameworkDir.isDirectory() )throw new MojoExecutionException(
+ "\nframeworkHome is null or incorrect" + frameworkHome +
+ "\nframeworkHome needs to be set in your settings.xml and passed to plugin via pom.xml\n" + getUsage() );
+
+ this.getLog().info("Creating dependencies from references... ");
+
+ Set referenceArtifacts = createReferenceArtifacts( references );
+
+ this.getLog().info("Created " + referenceArtifacts.size() + " dependencies.");
+
+ new VisualStudio2003Writer( this.getLog() ).write( writer, projectSettings, mainsource, testsource, resources, project.getArtifacts(), frameworkDir, pom, referenceArtifacts );
+
+ this.getLog().info("Created project file ["+projectFile.getAbsolutePath()+"]");
+
+ filewriter.close();
+
+ if( project.getArtifact().getType().equals( "dotnet-web" ) )
+ createWebInfoFile( new File( project.getBasedir(), project.getArtifactId() + ".csproj.webinfo" ), projectSettings );
+
+ }catch(IOException ioex){
+ throw new MojoExecutionException(ioex.getMessage(), ioex);
+ }
+ }
+
+ private void createWebInfoFile(File webInfoFile, ProjectSettings settings) throws IOException {
+
+ if( webInfoFile.exists() ) {
+ FileUtils.copyFile( webInfoFile, new File( webInfoFile.getAbsoluteFile() + ".backup" ) );
+ webInfoFile.delete();
+ }
+
+ webInfoFile.createNewFile();
+
+ FileWriter filewriter = new FileWriter( webInfoFile );
+
+ XMLWriter writer = new PrettyPrintXMLWriter(filewriter);
+
+ new VisualStudio2003WebInfoWriter( this.getLog() ).write( writer, settings.getWebProjectUrlPath() );
+
+ filewriter.close();
+ }
+
+
+ private static String getUsage(){
+
+ String usage = "To configure this plugin you should add an entry to your local settings like so:\n" +
+ "....\n" +
+ "<profiles>\n" +
+ "<profile>\n" +
+ "<id>default</id>\n" +
+ "<properties>\n" +
+ "<dotnet.home>C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322</dotnet.home>\n" +
+ "</properties>\n"+
+ "....\n" +
+ "</profile>\n" +
+ "</profiles>\n" +
+ "<activeProfiles>\n" +
+ "<activeProfile>default</activeProfile>\n" +
+ "</activeProfiles>\n";
+
+ usage = usage + "\n";
+
+ usage = usage + "Add pass this into the plgin in this manner:\n";
+
+ usage = usage + "<plugin>\n" +
+ "<groupId>org.apache.maven.plugins</groupId>\n" +
+ "<artifactId>maven-studio-plugin</artifactId>\n" +
+ "<configuration>\n" +
+ "<frameworkHome>${dotnet.home}</frameworkHome>\n" +
+ "</configuration>\n" +
+ "</plugin>\n";
+
+ return usage;
+ }
+
+ private String getOutputTypeFromType(String type) throws MojoExecutionException {
+
+ String outputType = "Library";
+
+ if( type.equals("dotnet-library") ) outputType = "Library";
+ else if( type.equals("dotnet-exe") ) outputType = "Exe";
+ else if( type.equals("dotnet-winexe") ) outputType = "Exe";
+ else if( type.equals("dotnet-webapp") ) outputType = "Web";
+ else throw new MojoExecutionException("No Visual Studio output type defined for type:" + type);
+
+ return outputType;
+ }
+
+ private String getProjectTypeFromType(String type) throws MojoExecutionException {
+ String outputType = "Local";
+ if( type.equals("dotnet-webapp") ) outputType = "Web";
+ return outputType;
+ }
+
+ private Set createReferenceArtifacts(List references) throws MojoExecutionException {
+
+ Set artifacts = new HashSet();
+
+ for(Iterator i=references.iterator();i.hasNext();){
+ Reference ref = (Reference)i.next();
+ Artifact a = createArtifact( ref );
+ if( a != null ) artifacts.add( a );
+ }
+
+ return artifacts;
+ }
+
+ private Artifact createArtifact(Reference ref) throws MojoExecutionException{
+
+ File f = new File( this.frameworkHome, ref.getPath() );
+
+ if( (! f.exists() ) || f.isDirectory() ) throw new MojoExecutionException("File [" + f.getAbsolutePath() + "] doesn't appear to exist.");
+
+ String name = FilenameUtils.getBaseName( f.getName() );
+ String packaging = getPackagingForExtension( FilenameUtils.getExtension( f.getName() ) );
+
+ Artifact a = factory.createDependencyArtifact( "system", name, VersionRange.createFromVersion("1.0"), packaging, null, Artifact.SCOPE_SYSTEM, null, false );
+
+ a.setFile( f );
+
+ return a;
+ }
+
+
+ private static String getPackagingForExtension(String extension){
+
+ String packaging = null;
+
+ if( extension.toLowerCase().equals( "dll" ) ) packaging = "dotnet-library" ;
+ else if( extension.toLowerCase().equals( "exe") ) packaging = "dotnet-exe" ;
+ else if( extension.toLowerCase().equals( "exe" ) ) packaging = "dotnet-winexe" ;
+ else if( extension.toLowerCase().equals( "dll") ) packaging = "dotnet-module" ;
+ else if( extension.toLowerCase().equals( "dll") ) packaging = "dotnet-webapp" ;
+
+ return packaging;
+ }
+}