incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r512444 - /incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/src/main/csharp/Plugin/Solution/SolutionPlugin.cs
Date Tue, 27 Feb 2007 22:14:12 GMT
Author: sisbell
Date: Tue Feb 27 14:14:11 2007
New Revision: 512444

URL: http://svn.apache.org/viewvc?view=rev&rev=512444
Log:
The solution plugin now handles building a .NET solution specific to maven profile.

Modified:
    incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/src/main/csharp/Plugin/Solution/SolutionPlugin.cs

Modified: 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=diff&rev=512444&r1=512443&r2=512444
==============================================================================
--- incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/src/main/csharp/Plugin/Solution/SolutionPlugin.cs
(original)
+++ incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/src/main/csharp/Plugin/Solution/SolutionPlugin.cs
Tue Feb 27 14:14:11 2007
@@ -14,8 +14,25 @@
 		public SolutionPlugin()
 		{
 		}
+
+		private string[] getModulesForProfile(string profile,  NMaven.Model.Model model)
+		{
+			NMaven.Model.Profile[] profiles = model.profiles;
+			if(profiles == null)
+				return model.modules;
+			
+			foreach(NMaven.Model.Profile p in profiles)
+			{
+				Console.WriteLine( p.activation.property.name.ToString() );
+				if(p.activation.property.name.Equals(profile))
+				{
+					return p.modules;
+				}
+			}
+			return model.modules;
+        }
 		
-		public List<IProjectReference> execute(DirectoryInfo currentDirectory, NMaven.Model.Model
model)
+		public List<IProjectReference> execute(DirectoryInfo currentDirectory, NMaven.Model.Model
model, string profile)
 		{	
 			if(model == null)
 			{
@@ -35,12 +52,12 @@
 			IProjectGenerator projectGenerator = new ProjectGeneratorImpl();
 			if(model.packaging.Equals("pom"))
 			{
-				foreach(String module in model.modules)
+				foreach(String module in getModulesForProfile(profile, model))
 				{
 					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));
+					projectReferences.AddRange(execute(newDir, m, profile));
 				}					   	
 			} 
 			else
@@ -71,14 +88,14 @@
 			return projectReferences;
 		}
 		
-		public static void Main()
+		public static void Main(string[] args)
 		{
 			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);
+			                                                           rootPom, "withIde");
 		 	projectGenerator.generateSolutionFor(new FileInfo(@"test-1.sln"), projectReferences);
		
 		}
 	}



Mime
View raw message