incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r513884 - in /incubator/nmaven/branches/SI_IDE/assemblies: NMaven.Core/src/main/csharp/Core/ NMaven.Core/src/main/csharp/Core/Impl/ NMaven.Core/src/test/csharp/Core/Impl/ NMaven.Plugin.Solution/src/main/csharp/Plugin/Solution/
Date Fri, 02 Mar 2007 18:50:58 GMT
Author: sisbell
Date: Fri Mar  2 10:50:56 2007
New Revision: 513884

URL: http://svn.apache.org/viewvc?view=rev&rev=513884
Log:
Minor updates to follow .NET code conventions.

Modified:
    incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/IProjectGenerator.cs
    incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/Impl/ProjectGeneratorImpl.cs
    incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/test/csharp/Core/Impl/NMavenContextImplTest.cs
    incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Plugin.Solution/src/main/csharp/Plugin/Solution/SolutionPlugin.cs

Modified: incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/IProjectGenerator.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/IProjectGenerator.cs?view=diff&rev=513884&r1=513883&r2=513884
==============================================================================
--- incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/IProjectGenerator.cs
(original)
+++ incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/IProjectGenerator.cs
Fri Mar  2 10:50:56 2007
@@ -38,7 +38,7 @@
         /// <param name="projectFileName">the name of the project: usually corresponds
to the artifact id</param>
         /// <param name="projectReferences">references to other projects that this
project is dependent upon</param>
         /// <returns></returns>
-		IProjectReference generateProjectFor(NMaven.Model.Model model, 
+		IProjectReference GenerateProjectFor(NMaven.Model.Model model, 
 		                            DirectoryInfo sourceFileDirectory,
 		                            string projectFileName,
 		                            List<IProjectReference> projectReferences);
@@ -48,14 +48,14 @@
         /// </summary>
         /// <param name="fileInfo">the solution file</param>
         /// <param name="projectReferences">csproj references</param>
-		void generateSolutionFor(FileInfo fileInfo, List<IProjectReference> projectReferences);
+		void GenerateSolutionFor(FileInfo fileInfo, List<IProjectReference> projectReferences);
 		
         /// <summary>
         /// Creates a model from the pom.
         /// </summary>
         /// <param name="fileName">file name of the pom.xml file</param>
         /// <returns>a model binding of the pom file</returns>
-		NMaven.Model.Model createPomModelFor(string fileName);
+		NMaven.Model.Model CreatePomModelFor(string fileName);
 		
 	}
 }

Modified: incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/Impl/ProjectGeneratorImpl.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/Impl/ProjectGeneratorImpl.cs?view=diff&rev=513884&r1=513883&r2=513884
==============================================================================
--- incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/Impl/ProjectGeneratorImpl.cs
(original)
+++ incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/main/csharp/Core/Impl/ProjectGeneratorImpl.cs
Fri Mar  2 10:50:56 2007
@@ -42,7 +42,7 @@
 		{
 		}
 		
-	    public IProjectReference generateProjectFor(NMaven.Model.Model model, 
+	    public IProjectReference GenerateProjectFor(NMaven.Model.Model model, 
 		                                  DirectoryInfo sourceFileDirectory,
 		                                  string projectFileName,
 		                                  List<IProjectReference> projectReferences)
@@ -67,7 +67,7 @@
 			return projectReference;	    	
 	    }
 		
-		public void generateSolutionFor(FileInfo fileInfo, List<IProjectReference> projectReferences)
+		public void GenerateSolutionFor(FileInfo fileInfo, List<IProjectReference> projectReferences)
 		{
 			TextWriter writer = 
 				new StreamWriter(fileInfo.FullName, false, System.Text.Encoding.UTF8);
@@ -96,14 +96,14 @@
 			Console.WriteLine("NMAVEN-000-000: Generate solution file: File Name = " + fileInfo.FullName);
 		}
 					
-		public NMaven.Model.Model createPomModelFor(string fileName)
+		public NMaven.Model.Model CreatePomModelFor(string fileName)
 		{
 			TextReader reader = new StreamReader(fileName);
 		    XmlSerializer serializer = new XmlSerializer(typeof(NMaven.Model.Model));
 			return (NMaven.Model.Model) serializer.Deserialize(reader);	
 		}
 		
-		private Project createProjectFor(string fileName) 
+		private Project CreateProjectFor(string fileName) 
 		{
             Engine engine = new Engine(@"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727");
             Project project = new Project(engine);
@@ -148,7 +148,7 @@
             groupProject.AddNewProperty("RootNameSpace", model.groupId);
             groupProject.AddNewProperty("AssemblyName", assemblyName);
             groupProject.AddNewProperty("BaseIntermediateOutputPath", baseIntermediateOutputPath);
-            groupProject.AddNewProperty("OutputType", getOutputType(model.packaging));
+            groupProject.AddNewProperty("OutputType", GetOutputType(model.packaging));
             
             //Debug Properties
             groupProject = project.AddNewPropertyGroup(false);
@@ -168,15 +168,15 @@
             		}
             	}
             }
-            addProjectDependencies(project, model, sourceFileDirectory);
-            addFoldersToProject(project, null, sourceFileDirectory, sourceFileDirectory);
-            addClassFilesToProject(project, null, sourceFileDirectory, sourceFileDirectory);
-            addProjectReferences(project, assemblyName, projectReferences);
+            AddProjectDependencies(project, model, sourceFileDirectory);
+            AddFoldersToProject(project, null, sourceFileDirectory, sourceFileDirectory);
+            AddClassFilesToProject(project, null, sourceFileDirectory, sourceFileDirectory);
+            AddProjectReferences(project, assemblyName, projectReferences);
 			return project;
 			
 		}
 		
-		private void addProjectReferences(Project project, string projectName, List<IProjectReference>
projectReferences)
+		private void AddProjectReferences(Project project, string projectName, List<IProjectReference>
projectReferences)
 		{
 			BuildItemGroup itemGroup = project.AddNewItemGroup();
 			foreach(IProjectReference projectReference in projectReferences)
@@ -187,7 +187,7 @@
 			}
 		}
 				
-		private void addFoldersToProject(Project project, BuildItemGroup folderGroup, DirectoryInfo
rootDirectory, DirectoryInfo sourceFileDirectory) 
+		private void AddFoldersToProject(Project project, BuildItemGroup folderGroup, DirectoryInfo
rootDirectory, DirectoryInfo sourceFileDirectory) 
 		{
             DirectoryInfo[] directoryInfos = rootDirectory.GetDirectories();
             if(directoryInfos != null && directoryInfos.Length > 0)
@@ -199,12 +199,12 @@
               		if(di.FullName.Contains(".svn") || di.FullName.Contains(@"obj") || di.FullName.Contains(@"bin"))
     					continue;   
             		folderGroup.AddNewItem("Folder", di.FullName.Substring(sourceFileDirectory.FullName.Length));
-                	addFoldersToProject(project, folderGroup, di, sourceFileDirectory);
+                	AddFoldersToProject(project, folderGroup, di, sourceFileDirectory);
             	}           	
             }			
 		}
 		
-		private void addClassFilesToProject(Project project, BuildItemGroup compileGroup, DirectoryInfo
rootDirectory, DirectoryInfo sourceFileDirectory) 
+		private void AddClassFilesToProject(Project project, BuildItemGroup compileGroup, DirectoryInfo
rootDirectory, DirectoryInfo sourceFileDirectory) 
 		{
 	        DirectoryInfo[] directoryInfos = rootDirectory.GetDirectories();
             if(directoryInfos != null && directoryInfos.Length > 0)
@@ -221,19 +221,19 @@
 	            			compileGroup.AddNewItem("Compile", 
 	            			                        fileInfo.FullName.Substring(sourceFileDirectory.FullName.Length));
 	            	}            		
-                	addClassFilesToProject(project, compileGroup, di, sourceFileDirectory);
+                	AddClassFilesToProject(project, compileGroup, di, sourceFileDirectory);
             	}           	
             }				
 		}
 		
-		private void addProjectDependencies(Project project, NMaven.Model.Model model, DirectoryInfo
sourceFileDirectory) 
+		private void AddProjectDependencies(Project project, NMaven.Model.Model model, DirectoryInfo
sourceFileDirectory) 
 		{
 			BuildItemGroup group = project.AddNewItemGroup();
 			group.AddNewItem("Reference", "System.Xml");
 			if(model.dependencies != null) 
 			{
 				foreach(Dependency dependency in model.dependencies) {
-					String artifactExtension = (dependency.type == "module") ? "dll" : getExtension(dependency.type);
+					String artifactExtension = (dependency.type == "module") ? "dll" : GetExtension(dependency.type);
 					if(dependency.type == "module")
 					{
 						
@@ -252,14 +252,15 @@
             
             ClassParser classParser = new ClassParser();
             List<FileInfo> fileInfos = new List<FileInfo>();
-            addFileInfosFromSourceDirectories(sourceFileDirectory, fileInfos);
-            List<string> dependencies = classParser.getDependencies(fileInfos);
+            AddFileInfosFromSourceDirectories(sourceFileDirectory, fileInfos);
+            List<string> dependencies = classParser.GetDependencies(fileInfos);
             foreach(string dependency in dependencies)
             {
             	try {
-            		DirectoryInfo fileInfo = new DirectoryInfo(@"C:\WINDOWS\assembly\GAC_MSIL\"
+ dependency);
+                    string assembly = GetAssemblyFor(dependency);
+            		DirectoryInfo fileInfo = new DirectoryInfo(@"C:\WINDOWS\assembly\GAC_MSIL\"
+ assembly);
             		if(fileInfo.Exists) {
-            			group.AddNewItem("Reference", dependency);	
+            			group.AddNewItem("Reference", assembly);	
             		} 
             	}
             	catch(Exception e) 
@@ -269,9 +270,14 @@
             	
             }
 		}
+
+        private string GetAssemblyFor(string dependency)
+        {
+            if(dependency.Equals("System.Resource")) return "System.Windows.Form";
+            return dependency;
+        }
 		
-		
-		private void addFileInfosFromSourceDirectories(DirectoryInfo sourceFileDirectory, List<FileInfo>
fileInfos ) 
+		private void AddFileInfosFromSourceDirectories(DirectoryInfo sourceFileDirectory, List<FileInfo>
fileInfos ) 
 		{
             DirectoryInfo[] directoryInfos = sourceFileDirectory.GetDirectories();
             if(directoryInfos != null && directoryInfos.Length > 0)
@@ -281,12 +287,12 @@
               		if(di.FullName.Contains(".svn") || di.FullName.Contains("obj") || di.FullName.Contains("bin"))
               			continue;
               		fileInfos.AddRange(di.GetFiles());
-              		addFileInfosFromSourceDirectories(di, fileInfos);
+              		AddFileInfosFromSourceDirectories(di, fileInfos);
             	}           	
             }
 		}
 		
-		private string getOutputType(String type)
+		private string GetOutputType(String type)
 		{
 			if (type.Equals("library")) return "Library";
 			else if (type.Equals("exe")) return "Exe";
@@ -295,7 +301,7 @@
 			return null;
 		}
 		
-		private string getExtension(String type)
+		private string GetExtension(String type)
 		{
 			if (type.Equals("library")) return "dll";
 			else if (type.Equals("exe")) return "exe";
@@ -306,7 +312,7 @@
 		
 		private class ClassParser {
 			
-			public List<string> getDependencies(List<FileInfo> fileInfos) 
+			public List<string> GetDependencies(List<FileInfo> fileInfos) 
 			{
 				List<string> dependencies = new List<string>();
 				foreach(FileInfo fileInfo in fileInfos) 

Modified: incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/test/csharp/Core/Impl/NMavenContextImplTest.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/test/csharp/Core/Impl/NMavenContextImplTest.cs?view=diff&rev=513884&r1=513883&r2=513884
==============================================================================
--- incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/test/csharp/Core/Impl/NMavenContextImplTest.cs
(original)
+++ incubator/nmaven/branches/SI_IDE/assemblies/NMaven.Core/src/test/csharp/Core/Impl/NMavenContextImplTest.cs
Fri Mar  2 10:50:56 2007
@@ -17,30 +17,24 @@
 	 {
 	 	IProjectGenerator projectGenerator = new ProjectGeneratorImpl();
 	 	
-	 	NMaven.Model.Model model = projectGenerator.createPomModelFor(@"..\..\..\NMaven.Plugin.Solution\pom.xml");
+	 	NMaven.Model.Model model = projectGenerator.CreatePomModelFor(@"..\..\..\NMaven.Plugin.Solution\pom.xml");
 	 	Console.WriteLine(model.artifactId);
 	 	
 	 	IProjectReference projectReference = 
-	 		projectGenerator.generateProjectFor(model,
+	 		projectGenerator.GenerateProjectFor(model,
 	 	                                    new DirectoryInfo(@"C:\Documents and Settings\shane\nmaven-apache\SI_IDE\assemblies\NMaven.Plugin.Solution\src\main\csharp\"),

 	 	                                    model.artifactId + "T1", null);
 	 	List<IProjectReference> projectReferences = new List<IProjectReference>();
 	 	projectReferences.Add(projectReference);
 	    
-	 	IProjectReference testReference = projectGenerator.generateProjectFor(model,
+	 	IProjectReference testReference = projectGenerator.GenerateProjectFor(model,
 	 	                                    new DirectoryInfo(@"C:\Documents and Settings\shane\nmaven-apache\SI_IDE\assemblies\NMaven.Core\src\test\csharp\"),

 	 	                                    model.artifactId + "-Test1", projectReferences);
 	 	projectReferences.Add(testReference);
 	 	
 	 	
-	 	projectGenerator.generateSolutionFor(new FileInfo(@"..\..\..\..\test.sln"), projectReferences);
+	 	projectGenerator.GenerateSolutionFor(new FileInfo(@"..\..\..\..\test.sln"), projectReferences);
 	
 	}
-	 
- [Test]
- public void TestA()
- {
-
- }
 }
 }

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=513884&r1=513883&r2=513884
==============================================================================
--- 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
Fri Mar  2 10:50:56 2007
@@ -58,7 +58,7 @@
 				foreach(String module in GetModulesForProfile(profile, model))
 				{
 					DirectoryInfo newDir = new DirectoryInfo(currentDirectory.FullName + @"\" + module );
-					NMaven.Model.Model m = projectGenerator.createPomModelFor(newDir.FullName + @"\pom.xml");
+					NMaven.Model.Model m = projectGenerator.CreatePomModelFor(newDir.FullName + @"\pom.xml");
 					projectReferences.AddRange(Execute(newDir, m, profile));
 				}					   	
 			} 
@@ -68,7 +68,7 @@
 				if(new DirectoryInfo(currentDirectory.FullName + @"\src\main\csharp\").Exists)
 				{
 					IProjectReference projectReference = 
-			 			projectGenerator.generateProjectFor(model,
+			 			projectGenerator.GenerateProjectFor(model,
 			 	                                    new DirectoryInfo(currentDirectory.FullName + @"\src\main\csharp\"),
 			 	                                    model.artifactId, null);
 					projectReferences.Add(projectReference);
@@ -76,7 +76,7 @@
 				if(new DirectoryInfo( @"src\test\csharp\").Exists)
 				{
 					IProjectReference projectReference = 
-			 			projectGenerator.generateProjectFor(model,
+			 			projectGenerator.GenerateProjectFor(model,
 			 	                                    new DirectoryInfo(currentDirectory.FullName + @"src\test\csharp\"),
 			 	                                    model.artifactId + "-Test", null);
 					Console.WriteLine("NMAVEN-000-000: Generated test project: File Name = "
@@ -96,14 +96,14 @@
             string profile = plugin.GetArgFor("profile", args); ;
 
 			IProjectGenerator projectGenerator = new ProjectGeneratorImpl();
-			NMaven.Model.Model rootPom = projectGenerator.createPomModelFor(@pomFile);
+			NMaven.Model.Model rootPom = projectGenerator.CreatePomModelFor(@pomFile);
 				
             FileInfo pomFileInfo = new FileInfo(pomFile);
 			List<IProjectReference> projectReferences = plugin.Execute(new DirectoryInfo(pomFileInfo.DirectoryName),
 			                                                           rootPom, profile);
 			String solutionFile = (profile == null) ? pomFileInfo.DirectoryName + @"\" + @rootPom.artifactId
 + ".sln" :
 			    pomFileInfo.DirectoryName + @"\" + @rootPom.artifactId + "." + profile + ".sln";
-		 	projectGenerator.generateSolutionFor(new FileInfo(solutionFile), projectReferences);
+		 	projectGenerator.GenerateSolutionFor(new FileInfo(solutionFile), projectReferences);
 		}
 		
 		private string GetArgFor(string name, string[] args)



Mime
View raw message