Author: sisbell
Date: Sun Feb 25 16:49:45 2007
New Revision: 511679

URL: http://svn.apache.org/viewvc?view=rev&rev=511679
Log:
Initial import of the solution plugin. This executable recusively goes through 
the pom.xml files generating project and soltuion files. This executable will 
be executed by a maven plugin.

Added:
    incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/
    incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/pom.xml  
 (with props)
    incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/src/
    incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/src/main/
    
incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/src/main/csharp/
    
incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/src/main/csharp/Plugin/
    
incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/src/main/csharp/Plugin/Solution/
    
incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/src/main/csharp/Plugin/Solution/SolutionPlugin.cs

Added: 
incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/pom.xml?view=auto&rev=511679
==============================================================================
--- incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/pom.xml 
(added)
+++ incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/pom.xml 
Sun Feb 25 16:49:45 2007
@@ -0,0 +1,39 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0";>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>NMaven.Plugin.Solution</groupId>
+    <artifactId>SolutionPlugin</artifactId>
+    <packaging>exe</packaging>
+    <version>0.14</version>
+    <name>NMaven.Plugin.Solution</name>
+    <dependencies>
+        <dependency>
+            <groupId>org.nunit</groupId>
+            <artifactId>nunit.framework</artifactId>
+            <version>2.2.8.0</version>
+            <type>library</type>
+        </dependency>
+        <dependency>
+            <groupId>NMaven.Core</groupId>
+            <artifactId>NMaven.Core</artifactId>
+            <version>0.14</version>
+            <type>library</type>
+        </dependency>
+    <dependency>
+      <groupId>NMaven.Model</groupId>
+      <artifactId>NMaven.Model.Pom</artifactId>
+      <type>library</type>
+      <version>0.14</version>
+    </dependency>
+    </dependencies>
+    <build>
+        <sourceDirectory>src/main/csharp</sourceDirectory>
+        <testSourceDirectory>src/test/csharp</testSourceDirectory>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.dotnet.plugins</groupId>
+                <artifactId>maven-compile-plugin</artifactId>
+                <extensions>true</extensions>
+            </plugin>            
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

Propchange: 
incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/src/main/csharp/Plugin/Solution/SolutionPlugin.cs
URL: 
http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/src/main/csharp/Plugin/Solution/SolutionPlugin.cs?view=auto&rev=511679
==============================================================================
--- 
incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/src/main/csharp/Plugin/Solution/SolutionPlugin.cs
 (added)
+++ 
incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/src/main/csharp/Plugin/Solution/SolutionPlugin.cs
 Sun Feb 25 16:49:45 2007
@@ -0,0 +1,85 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using NMaven.Core;
+using NMaven.Core.Impl;
+
+namespace NMaven.Plugin.Solution
+{
+       /// <summary>
+       /// Description
+       /// </summary>
+       public class SolutionPlugin
+       {
+               public SolutionPlugin()
+               {
+               }
+               
+               public List<IProjectReference> execute(DirectoryInfo 
currentDirectory, NMaven.Model.Model model)
+               {       
+                       if(model == null)
+                       {
+                               throw new ExecutionException("NMAVEN-000-000: 
Model is null");
+                       }
+                       
+                       if(currentDirectory == null)
+                       {
+                               throw new ExecutionException("NMAVEN-000-000: 
Current directory is null");
+                       }
+                       if(!currentDirectory.Exists)
+                       {
+                               throw new ExecutionException("NMAVEN-000-000: 
Could not find current directory: Path = " + currentDirectory.FullName);
+                       }
+                       
+                       List<IProjectReference> projectReferences = new 
List<IProjectReference>();
+                       IProjectGenerator projectGenerator = new 
ProjectGeneratorImpl();
+                       if(model.packaging.Equals("pom"))
+                       {
+                               foreach(String module in model.modules)
+                               {
+                                       DirectoryInfo newDir = new 
DirectoryInfo(currentDirectory.FullName + @"\" + module );
+                                       Console.WriteLine("NMAVEN-000-000: 
Generating model for pom: File Name = " + newDir.FullName + @"\pom.xml");
+                                       NMaven.Model.Model m = 
projectGenerator.createPomModelFor(newDir.FullName + @"\pom.xml");
+                                       
projectReferences.AddRange(execute(newDir, m));
+                               }                                               
+                       } 
+                       else
+                       {
+                               Console.WriteLine(currentDirectory.FullName + 
@"\src\main\csharp\");
+                               if(new DirectoryInfo(currentDirectory.FullName 
+ @"\src\main\csharp\").Exists)
+                               {
+                                       IProjectReference projectReference = 
+                                               
projectGenerator.generateProjectFor(model,
+                                                                   new 
DirectoryInfo(currentDirectory.FullName + @"\src\main\csharp\"),
+                                                                   
model.artifactId + "T1", null);
+                                       Console.WriteLine("NMAVEN-000-000: 
Generated project: File Name = " 
+                                                         + 
projectReference.CsProjFile.FullName);
+                                       projectReferences.Add(projectReference);
+                               }
+                               if(new DirectoryInfo( 
@"src\test\csharp\").Exists)
+                               {                                       
+                                       Console.WriteLine("NMAVEN-000-000: 
Found test directory");
+                                       IProjectReference projectReference = 
+                                               
projectGenerator.generateProjectFor(model,
+                                                                   new 
DirectoryInfo(currentDirectory.FullName + @"src\test\csharp\"),
+                                                                   
model.artifactId + "-Test1", null);
+                                       Console.WriteLine("NMAVEN-000-000: 
Generated project: File Name = " 
+                                                         + 
projectReference.CsProjFile.FullName);                                      
+                                       
projectReferences.Add(projectReference);                                        
+                               }
+                       }       
+                       return projectReferences;
+               }
+               
+               public static void Main()
+               {
+                       IProjectGenerator projectGenerator = new 
ProjectGeneratorImpl();
+                       NMaven.Model.Model rootPom = 
projectGenerator.createPomModelFor("pom.xml");     
+                       
+                       SolutionPlugin plugin = new SolutionPlugin();
+                       List<IProjectReference> projectReferences = 
plugin.execute(new DirectoryInfo(Environment.CurrentDirectory), 
+                                                                               
   rootPom);
+                       projectGenerator.generateSolutionFor(new 
FileInfo(@"test-1.sln"), projectReferences);                   
+               }
+       }
+}


Reply via email to