incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r672974 - in /incubator/nmaven/branches/NMAVEN_0.14: assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/ assemblies/NMaven.Solution/ components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ components/dotnet-d...
Date Tue, 01 Jul 2008 02:14:46 GMT
Author: brett
Date: Mon Jun 30 19:14:46 2008
New Revision: 672974

URL: http://svn.apache.org/viewvc?rev=672974&view=rev
Log:
[NMAVEN-115] Using the systemPath element in a dependecy doesn't work
Submitted by: Napoleon Esmundo C. Ramirez 

Modified:
    incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/Artifact.cs
    incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.Solution/ProjectGeneratorImpl.cs
    incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java
    incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectDependency.java
    incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectFactory.java
    incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImpl.java

Modified: incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/Artifact.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/Artifact.cs?rev=672974&r1=672973&r2=672974&view=diff
==============================================================================
--- incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/Artifact.cs
(original)
+++ incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/Artifact.cs
Mon Jun 30 19:14:46 2008
@@ -40,6 +40,8 @@
 
         private String remotePath;
 
+        private string systemPath;
+
         public String RemotePath
         {
             get { return remotePath; }
@@ -81,5 +83,11 @@
             get { return artifactScope; }
             set { artifactScope = value; }
         }
+
+        public string SystemPath
+        {
+            get { return systemPath; }
+            set { systemPath = value; }
+        }
     }     
 }

Modified: incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.Solution/ProjectGeneratorImpl.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.Solution/ProjectGeneratorImpl.cs?rev=672974&r1=672973&r2=672974&view=diff
==============================================================================
--- incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.Solution/ProjectGeneratorImpl.cs
(original)
+++ incubator/nmaven/branches/NMAVEN_0.14/assemblies/NMaven.Solution/ProjectGeneratorImpl.cs
Mon Jun 30 19:14:46 2008
@@ -34,20 +34,20 @@
 
 namespace NMaven.Solution.Impl
 {
-	/// <summary>
-	/// Implementation of the IProjectGenerator.
-	/// </summary>
-	internal sealed class ProjectGeneratorImpl : IProjectGenerator
-	{
+    /// <summary>
+    /// Implementation of the IProjectGenerator.
+    /// </summary>
+    internal sealed class ProjectGeneratorImpl : IProjectGenerator
+    {
         private Dictionary<String, String> directoryToFileNameExtensionMapping;
 
         private Dictionary<String, String> directoryToImportProject;
-		
+        
         /// <summary>
         /// Constructor
         /// </summary>
-		internal ProjectGeneratorImpl()
-		{
+        internal ProjectGeneratorImpl()
+        {
             directoryToFileNameExtensionMapping = new Dictionary<string,string>();
             directoryToFileNameExtensionMapping.Add("csharp", ".csproj");
             directoryToFileNameExtensionMapping.Add("vb", ".vbproj");
@@ -55,52 +55,52 @@
             directoryToImportProject = new Dictionary<string, string>();
             directoryToImportProject.Add("csharp", @"$(MSBuildBinPath)\Microsoft.CSharp.Targets");
             directoryToImportProject.Add("vb", @"$(MSBuildBinPath)\Microsoft.VisualBasic.Targets");
-		}
-		
-	    public IProjectReference GenerateProjectFor(NMaven.Model.Pom.Model model, 
-		                                  DirectoryInfo sourceFileDirectory,
-		                                  String projectFileName,
-		                                  ICollection<IProjectReference> projectReferences,
-		                                  DirectoryInfo localRepository)
-	    {		
-			Guid projectGuid = Guid.NewGuid();
+        }
+        
+        public IProjectReference GenerateProjectFor(NMaven.Model.Pom.Model model, 
+                                          DirectoryInfo sourceFileDirectory,
+                                          String projectFileName,
+                                          ICollection<IProjectReference> projectReferences,
+                                          DirectoryInfo localRepository)
+        {        
+            Guid projectGuid = Guid.NewGuid();
 
             if (projectReferences == null)
             {
                 projectReferences = new List<IProjectReference>();
             }
 
-			Project project = GetProjectFromPomModel(model, 
-			                                         sourceFileDirectory,
-			                                         projectFileName, 
-			                                         projectGuid,
-			                                         @"..\..\..\target\bin\Debug\", 
-			                                         @"..\..\..\target\obj\",
-			                                         projectReferences,
-			                                         localRepository);
+            Project project = GetProjectFromPomModel(model, 
+                                                     sourceFileDirectory,
+                                                     projectFileName, 
+                                                     projectGuid,
+                                                     @"..\..\..\target\bin\Debug\", 
+                                                     @"..\..\..\target\obj\",
+                                                     projectReferences,
+                                                     localRepository);
             String fileNameExtension = directoryToFileNameExtensionMapping[sourceFileDirectory.Name];
             FileInfo fileInfo = new FileInfo(sourceFileDirectory.FullName + @"\" + projectFileName
+ fileNameExtension);
-		    project.Save(fileInfo.FullName);
+            project.Save(fileInfo.FullName);
 
             IProjectReference projectReference = Factory.createDefaultProjectReference();
-		    projectReference.ProjectFile = fileInfo;
-		    projectReference.ProjectGuid = projectGuid;
-		    projectReference.ProjectName = projectFileName;
-			return projectReference;	    	
-	    }
+            projectReference.ProjectFile = fileInfo;
+            projectReference.ProjectGuid = projectGuid;
+            projectReference.ProjectName = projectFileName;
+            return projectReference;            
+        }
 
         public void GenerateSolutionFor(FileInfo fileInfo, ICollection<IProjectReference>
projectReferences)
-		{
-			TextWriter writer = 
-				new StreamWriter(fileInfo.FullName, false, System.Text.Encoding.UTF8);
-			writer.WriteLine("");
-			writer.WriteLine("Microsoft Visual Studio Solution File, Format Version 9.00");
-			writer.WriteLine("# Visual Studio 2005");
-			writer.WriteLine("# SharpDevelop 2.1.0.2376");
-
-			Guid solutionGuid = Guid.NewGuid();
-			foreach(IProjectReference projectReference in projectReferences) 
-			{
+        {
+            TextWriter writer = 
+                new StreamWriter(fileInfo.FullName, false, System.Text.Encoding.UTF8);
+            writer.WriteLine("");
+            writer.WriteLine("Microsoft Visual Studio Solution File, Format Version 9.00");
+            writer.WriteLine("# Visual Studio 2005");
+            writer.WriteLine("# SharpDevelop 2.1.0.2376");
+
+            Guid solutionGuid = Guid.NewGuid();
+            foreach(IProjectReference projectReference in projectReferences) 
+            {
                 string projectType = null;
                 string projectFileExtension = projectReference.ProjectFile.Extension;
                 if (projectFileExtension == ".csproj")
@@ -114,28 +114,28 @@
 
                 writer.Write("Project(\"{");
                 writer.Write(projectType);
-				writer.Write("}\") = \"");
-				writer.Write(projectReference.ProjectName);
-				writer.Write("\", \"");
-				writer.Write(projectReference.ProjectFile.FullName);
-				writer.Write("\", \"{");
-				writer.Write(projectReference.ProjectGuid.ToString());
-				writer.WriteLine("}\"");
-				writer.WriteLine("EndProject");
-				
-			}
-			writer.Flush();
-			writer.Close();
-			Console.WriteLine("NMAVEN-000-000: Generate solution file: File Name = " + fileInfo.FullName);
-		}
-					
-		public NMaven.Model.Pom.Model CreatePomModelFor(String fileName)
-		{
-			TextReader reader = new StreamReader(fileName);
-		    XmlSerializer serializer = new XmlSerializer(typeof(NMaven.Model.Pom.Model));
-			return (NMaven.Model.Pom.Model) serializer.Deserialize(reader);	
-		}
-		
+                writer.Write("}\") = \"");
+                writer.Write(projectReference.ProjectName);
+                writer.Write("\", \"");
+                writer.Write(projectReference.ProjectFile.FullName);
+                writer.Write("\", \"{");
+                writer.Write(projectReference.ProjectGuid.ToString());
+                writer.WriteLine("}\"");
+                writer.WriteLine("EndProject");
+                
+            }
+            writer.Flush();
+            writer.Close();
+            Console.WriteLine("NMAVEN-000-000: Generate solution file: File Name = " + fileInfo.FullName);
+        }
+                    
+        public NMaven.Model.Pom.Model CreatePomModelFor(String fileName)
+        {
+            TextReader reader = new StreamReader(fileName);
+            XmlSerializer serializer = new XmlSerializer(typeof(NMaven.Model.Pom.Model));
+            return (NMaven.Model.Pom.Model) serializer.Deserialize(reader);    
+        }
+        
         /// <summary>
         /// Returns a project binding (xmlns="http://schemas.microsoft.com/developer/msbuild/2003")
from the given model 
         /// (pom.xml) file
@@ -148,19 +148,19 @@
         /// <param name="baseIntermediateOutputPath">directory where the IDE output
files are placed</param>
         /// <param name="projectReferences">references to other projects that this
project is dependent upon</param>
         /// <returns>Returns a project binding for the specified model</returns>
-		private Project GetProjectFromPomModel(NMaven.Model.Pom.Model model, 
-		                                       DirectoryInfo sourceFileDirectory,
-		                                       String assemblyName,
-		                                       Guid projectGuid,
-		                                       String assemblyOutputPath,
-		                                       String baseIntermediateOutputPath,
+        private Project GetProjectFromPomModel(NMaven.Model.Pom.Model model, 
+                                               DirectoryInfo sourceFileDirectory,
+                                               String assemblyName,
+                                               Guid projectGuid,
+                                               String assemblyOutputPath,
+                                               String baseIntermediateOutputPath,
                                                ICollection<IProjectReference> projectReferences,
                                                DirectoryInfo localRepository)
-		{
-			if(model == null || sourceFileDirectory == null)
-			{
-				throw new ExecutionException("NMAVEN-000-000: Missing required parameter.");
-			}
+        {
+            if(model == null || sourceFileDirectory == null)
+            {
+                throw new ExecutionException("NMAVEN-000-000: Missing required parameter.");
+            }
             Engine engine = new Engine(Environment.GetEnvironmentVariable("SystemRoot") +
@"\Microsoft.NET\Framework\v2.0.50727");
             Project project = new Project(engine);
 
@@ -189,106 +189,111 @@
             DirectoryInfo configDirectory = new DirectoryInfo(Environment.CurrentDirectory
+ @"\src\main\config");
             if(configDirectory.Exists)
             {
-            	BuildItemGroup configGroup = project.AddNewItemGroup();
-            	foreach(FileInfo fileInfo in configDirectory.GetFiles())
-            	{
-            		if(fileInfo.Extension.Equals("exe.config"))
-            		{
-            			configGroup.AddNewItem("None", @"src\main\config\" + fileInfo.Name);
-            		}
-            	}
+                BuildItemGroup configGroup = project.AddNewItemGroup();
+                foreach(FileInfo fileInfo in configDirectory.GetFiles())
+                {
+                    if(fileInfo.Extension.Equals("exe.config"))
+                    {
+                        configGroup.AddNewItem("None", @"src\main\config\" + fileInfo.Name);
+                    }
+                }
             }
             AddProjectDependencies(project, model, sourceFileDirectory, localRepository);
             AddFoldersToProject(project, null, sourceFileDirectory, sourceFileDirectory);
             AddClassFilesToProject(project, null, sourceFileDirectory, sourceFileDirectory);
             AddProjectReferences(project, assemblyName, projectReferences);
-			return project;
-			
-		}
+            return project;
+            
+        }
 
         private void AddProjectReferences(Project project, String projectName, ICollection<IProjectReference>
projectReferences)
-		{
-			BuildItemGroup itemGroup = project.AddNewItemGroup();
-			foreach(IProjectReference projectReference in projectReferences)
-			{
-				BuildItem buildItem = itemGroup.AddNewItem("ProjectReference", projectReference.ProjectFile.FullName);
-				buildItem.SetMetadata("Project", "{" + projectReference.ProjectGuid.ToString() + "}");
-				buildItem.SetMetadata("Name", projectName);		
-			}
-		}
-				
-		private void AddFoldersToProject(Project project, BuildItemGroup folderGroup, DirectoryInfo
rootDirectory, 
+        {
+            BuildItemGroup itemGroup = project.AddNewItemGroup();
+            foreach(IProjectReference projectReference in projectReferences)
+            {
+                BuildItem buildItem = itemGroup.AddNewItem("ProjectReference", projectReference.ProjectFile.FullName);
+                buildItem.SetMetadata("Project", "{" + projectReference.ProjectGuid.ToString()
+ "}");
+                buildItem.SetMetadata("Name", projectName);        
+            }
+        }
+                
+        private void AddFoldersToProject(Project project, BuildItemGroup folderGroup, DirectoryInfo
rootDirectory, 
             DirectoryInfo sourceFileDirectory) 
-		{
+        {
             DirectoryInfo[] directoryInfos = rootDirectory.GetDirectories();
             if(directoryInfos != null && directoryInfos.Length > 0)
-            {              	
-            	if(folderGroup == null) folderGroup = project.AddNewItemGroup();
-            	
-            	foreach(DirectoryInfo di in directoryInfos) 
-            	{
-              		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);
-            	}           	
-            }			
-		}
-		
-		private void AddClassFilesToProject(Project project, BuildItemGroup compileGroup, DirectoryInfo
rootDirectory, 
+            {                  
+                if(folderGroup == null) folderGroup = project.AddNewItemGroup();
+                
+                foreach(DirectoryInfo di in directoryInfos) 
+                {
+                      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);
+                }               
+            }            
+        }
+        
+        private void AddClassFilesToProject(Project project, BuildItemGroup compileGroup,
DirectoryInfo rootDirectory, 
             DirectoryInfo sourceFileDirectory) 
-		{
-	        DirectoryInfo[] directoryInfos = rootDirectory.GetDirectories();
+        {
+            DirectoryInfo[] directoryInfos = rootDirectory.GetDirectories();
             if(directoryInfos != null && directoryInfos.Length > 0)
             {
                 if (compileGroup == null)
                 {
                     compileGroup = project.AddNewItemGroup();
                 }
-            	
-            	foreach(DirectoryInfo di in directoryInfos) 
-            	{
+                
+                foreach(DirectoryInfo di in directoryInfos) 
+                {
                     if (di.FullName.Contains(".svn") || di.FullName.Contains("obj") || di.FullName.Contains("bin"))
                     {
                         continue; 
-                    }					      			
-	            	foreach(FileInfo fileInfo in di.GetFiles()) 
-	            	{
-	            		BuildItem buildItem = 
-	            			compileGroup.AddNewItem("Compile", 
-	            			                        fileInfo.FullName.Substring(sourceFileDirectory.FullName.Length));
-	            	}            		
-                	AddClassFilesToProject(project, compileGroup, di, sourceFileDirectory);
-            	}           	
-            }				
-		}
-		
-		private void AddProjectDependencies(Project project, NMaven.Model.Pom.Model model, DirectoryInfo
sourceFileDirectory,
-		    DirectoryInfo localRepository)
-		{
-			BuildItemGroup group = project.AddNewItemGroup();
-			group.AddNewItem("Reference", "System.Xml");
-			if(model.dependencies != null) 
-			{
-			    ArtifactContext artifactContext = new ArtifactContext();
-				foreach(Dependency dependency in model.dependencies)
-				{
-					//String artifactExtension = (dependency.type == "module") ? "dll" : GetExtension(dependency.type);
-					NMaven.Artifact.Artifact dependencyArtifact = artifactContext.CreateArtifact(dependency.groupId,
-					    dependency.artifactId, dependency.version, dependency.type);
-
-					String repoPath = PathUtil.GetUserAssemblyCacheFileFor(dependencyArtifact, localRepository).FullName;
-					BuildItem buildItem = group.AddNewItem("Reference", dependency.artifactId);
-					//TODO: Fix this. Just because it is in the GAC on the system that builds the .csproj
does not mean 
-					//it is in the GAC on another system. 
-                    if (!dependency.GetType().Equals("gac") && !IsInGac(dependency.artifactId))
+                    }                                      
+                    foreach(FileInfo fileInfo in di.GetFiles()) 
+                    {
+                        BuildItem buildItem = 
+                            compileGroup.AddNewItem("Compile", 
+                                                    fileInfo.FullName.Substring(sourceFileDirectory.FullName.Length));
+                    }                    
+                    AddClassFilesToProject(project, compileGroup, di, sourceFileDirectory);
+                }               
+            }                
+        }
+        
+        private void AddProjectDependencies(Project project, NMaven.Model.Pom.Model model,
DirectoryInfo sourceFileDirectory,
+            DirectoryInfo localRepository)
+        {
+            BuildItemGroup group = project.AddNewItemGroup();
+            group.AddNewItem("Reference", "System.Xml");
+            if(model.dependencies != null) 
+            {
+                ArtifactContext artifactContext = new ArtifactContext();
+                foreach(Dependency dependency in model.dependencies)
+                {
+                    //String artifactExtension = (dependency.type == "module") ? "dll" :
GetExtension(dependency.type);
+                    NMaven.Artifact.Artifact dependencyArtifact = artifactContext.CreateArtifact(dependency.groupId,
+                        dependency.artifactId, dependency.version, dependency.type);
+
+                    String repoPath = PathUtil.GetUserAssemblyCacheFileFor(dependencyArtifact,
localRepository).FullName;
+                    BuildItem buildItem = group.AddNewItem("Reference", dependency.artifactId);
+                    //TODO: Fix this. Just because it is in the GAC on the system that builds
the .csproj does not mean 
+                    //it is in the GAC on another system. 
+                    
+                    if("system".Equals(dependency.scope))
+                    {
+                        buildItem.SetMetadata("HintPath", dependency.systemPath, false);
+                    }
+                    else if (!dependency.GetType().Equals("gac") && !IsInGac(dependency.artifactId))
                     {
                         buildItem.SetMetadata("HintPath", repoPath, false);
                     }
-				}				
-			}
+                }                
+            }
 
-	        DirectoryInfo[] directoryInfos = sourceFileDirectory.GetDirectories();
+            DirectoryInfo[] directoryInfos = sourceFileDirectory.GetDirectories();
             
             ClassParser classParser = new ClassParser();
             List<FileInfo> fileInfos = new List<FileInfo>();
@@ -296,48 +301,48 @@
             List<String> dependencies = classParser.GetDependencies(fileInfos);
             foreach(String dependency in dependencies)
             {
-            	try {
+                try {
                     String assembly = GetAssemblyFor(dependency);
                     if(IsInGac(assembly)) {
-            			group.AddNewItem("Reference", assembly);	
-            		} 
-            	}
-            	catch(Exception e) 
-            	{
-            		Console.WriteLine("NMAVEN-000-000: Could not find assembly dependency", e.Message);
-            	}
+                        group.AddNewItem("Reference", assembly);    
+                    } 
+                }
+                catch(Exception e) 
+                {
+                    Console.WriteLine("NMAVEN-000-000: Could not find assembly dependency",
e.Message);
+                }
             }
-		}
-		
-		private bool IsInGac(String assembly)
-		{
-			return new DirectoryInfo(Environment.GetEnvironmentVariable("SystemRoot")
-			    + @"\assembly\GAC_MSIL\" + assembly).Exists;		
-		}
+        }
+        
+        private bool IsInGac(String assembly)
+        {
+            return new DirectoryInfo(Environment.GetEnvironmentVariable("SystemRoot")
+                + @"\assembly\GAC_MSIL\" + assembly).Exists;        
+        }
 
         private String GetAssemblyFor(String dependency)
         {
             return (dependency.Trim().Equals("System.Resources")) ? "System.Windows.Forms"
: 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)
-            {  	
-            	foreach(DirectoryInfo di in directoryInfos) 
-            	{
+            {      
+                foreach(DirectoryInfo di in directoryInfos) 
+                {
                     if (di.FullName.Contains(".svn") || di.FullName.Contains("obj") || di.FullName.Contains("bin"))
                     {
                         continue;
                     }
-              		fileInfos.AddRange(di.GetFiles());
-              		AddFileInfosFromSourceDirectories(di, fileInfos);
-            	}           	
+                      fileInfos.AddRange(di.GetFiles());
+                      AddFileInfosFromSourceDirectories(di, fileInfos);
+                }               
             }
-		}
-		
-		private String GetOutputType(String type,bool isATest)
+        }
+        
+        private String GetOutputType(String type,bool isATest)
         {
             if (type.Equals("library") || type.Equals("netplugin") || type.Equals("visual-studio-addin")
                 || type.Equals("sharp-develop-addin") || type.Equals("nar")) return "Library";
@@ -346,49 +351,49 @@
             else if (type.Equals("module")) return "Module";
             return null;
         }
-		
-		private String GetExtension(String type)
-		{
-			if (type.Equals("library") || type.Equals("netplugin") ) return "dll";
-			else if (type.Equals("exe")) return "exe";
-			else if (type.Equals("winexe")) return "exe";
-			else if (type.Equals("module")) return "netmodule";
-			return null;
-		}				
-		
-		private class ClassParser {
-			
-			public List<String> GetDependencies(List<FileInfo> fileInfos) 
-			{
-				List<String> dependencies = new List<String>();
-				foreach(FileInfo fileInfo in fileInfos) 
-				{
-					try 
-			        {
-			            using (StreamReader sr = new StreamReader(fileInfo.FullName)) 
-			            {
-			                String line;
-			                while ((line = sr.ReadLine()) != null) 
-			                {
-			                	if (line.StartsWith("namespace")) break;
-			                	if (line.StartsWith("//")) continue;
-			                	if (line.StartsWith("using")) {
-			                		String[] tokens = line.Remove(line.Length - 1).Split(new char[1]{' '});
-			                		if(!dependencies.Contains(tokens[1]))
-			                		{
-			                			dependencies.Add(tokens[1]);
-			                		}			                		
-			                	}
-			                }
-			            }
-			        }
-			        catch (Exception e) 
-			        {
-			            Console.WriteLine(e.Message);
-			        }
-				}
-				return dependencies;
-			}		
-		}		
-	}
+        
+        private String GetExtension(String type)
+        {
+            if (type.Equals("library") || type.Equals("netplugin") ) return "dll";
+            else if (type.Equals("exe")) return "exe";
+            else if (type.Equals("winexe")) return "exe";
+            else if (type.Equals("module")) return "netmodule";
+            return null;
+        }                
+        
+        private class ClassParser {
+            
+            public List<String> GetDependencies(List<FileInfo> fileInfos) 
+            {
+                List<String> dependencies = new List<String>();
+                foreach(FileInfo fileInfo in fileInfos) 
+                {
+                    try 
+                    {
+                        using (StreamReader sr = new StreamReader(fileInfo.FullName)) 
+                        {
+                            String line;
+                            while ((line = sr.ReadLine()) != null) 
+                            {
+                                if (line.StartsWith("namespace")) break;
+                                if (line.StartsWith("//")) continue;
+                                if (line.StartsWith("using")) {
+                                    String[] tokens = line.Remove(line.Length - 1).Split(new
char[1]{' '});
+                                    if(!dependencies.Contains(tokens[1]))
+                                    {
+                                        dependencies.Add(tokens[1]);
+                                    }                                    
+                                }
+                            }
+                        }
+                    }
+                    catch (Exception e) 
+                    {
+                        Console.WriteLine(e.Message);
+                    }
+                }
+                return dependencies;
+            }        
+        }        
+    }
 }

Modified: incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java?rev=672974&r1=672973&r2=672974&view=diff
==============================================================================
--- incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java
(original)
+++ incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java
Mon Jun 30 19:14:46 2008
@@ -115,6 +115,8 @@
             projectDependency.setVersion( dependency.getVersion() );
             projectDependency.setPublicKeyTokenId( dependency.getClassifier() );
             projectDependency.setArtifactType( dependency.getType() );
+            projectDependency.setScope(dependency.getScope());
+            projectDependency.setSystemPath(dependency.getSystemPath());
             project.addProjectDependency( projectDependency );
         }
 

Modified: incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectDependency.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectDependency.java?rev=672974&r1=672973&r2=672974&view=diff
==============================================================================
--- incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectDependency.java
(original)
+++ incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectDependency.java
Mon Jun 30 19:14:46 2008
@@ -28,6 +28,7 @@
      * The scope: runtime, compile, test
      */
     private String scope;
+    private String systemPath;
 
     /**
      * Returns the scope:  runtime, compile, test
@@ -48,5 +49,16 @@
     {
         this.scope = scope;
     }
+    
+    
+    public String getSystemPath()
+    {
+        return systemPath;
+    }
+    
+    public void setSystemPath(String systemPath)
+    {
+        this.systemPath = systemPath;
+    }
 
 }

Modified: incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectFactory.java?rev=672974&r1=672973&r2=672974&view=diff
==============================================================================
--- incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectFactory.java
(original)
+++ incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectFactory.java
Mon Jun 30 19:14:46 2008
@@ -68,6 +68,8 @@
             dependency.setVersion( projectDependency.getVersion() );
             dependency.setType( projectDependency.getArtifactType() );
             dependency.setClassifier( projectDependency.getPublicKeyTokenId() );
+            dependency.setScope(projectDependency.getScope());
+            dependency.setSystemPath(projectDependency.getSystemPath());
             dependencies.add( dependency );
         }
         model.setDependencies( dependencies );
@@ -137,6 +139,11 @@
         projectDependency.setVersion( dependency.getVersion() );
         projectDependency.setPublicKeyTokenId( dependency.getClassifier() );
         projectDependency.setArtifactType( dependency.getType() );
+        projectDependency.setScope(dependency.getScope());
+        projectDependency.setSystemPath(dependency.getSystemPath());
+        
+        projectDependency.setScope(dependency.getScope());
+        projectDependency.setSystemPath(dependency.getSystemPath());
 
         logAndVerifyProjectParameters( projectDependency );
 
@@ -159,6 +166,8 @@
         dependency.setVersion( projectDependency.getVersion() );
         dependency.setType( projectDependency.getArtifactType() );
         dependency.setClassifier( projectDependency.getPublicKeyTokenId() );
+        dependency.setScope(projectDependency.getScope());
+        dependency.setSystemPath(projectDependency.getSystemPath());
         return dependency;
     }
 

Modified: incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImpl.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImpl.java?rev=672974&r1=672973&r2=672974&view=diff
==============================================================================
--- incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImpl.java
(original)
+++ incubator/nmaven/branches/NMAVEN_0.14/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImpl.java
Mon Jun 30 19:14:46 2008
@@ -471,7 +471,54 @@
                         projectDependency.setResolved( false );
                     }
                 }
+                
+                // resolve system scope dependencies
+                if(projectDependency.getScope() != null
+                        &&  projectDependency.getScope().equals("system"))
+                {
+                    if(projectDependency.getSystemPath() == null)
+                    {
+                        throw new IOException(
+                                "systemPath required for System Scoped dependencies " +
+                                        "in Group ID = "
+                                 + projectDependency.getGroupId()
+                                 + ", Artiract ID = "
+                                 + projectDependency.getArtifactId()
+                                 );
+                    }
 
+                    File f = new File(projectDependency.getSystemPath());
+
+                    if(!f.exists())
+                    {
+                        throw new IOException(
+                                "Dependency systemPath File not found:"
+                                 + projectDependency.getSystemPath()
+                                 + "in Group ID = "
+                                 + projectDependency.getGroupId()
+                                 + ", Artiract ID = "
+                                 + projectDependency.getArtifactId()
+                                 );
+                    }
+
+                    Artifact assembly = ProjectFactory.createArtifactFrom( projectDependency,
artifactFactory );
+                    assembly.setFile(f);
+                    assembly.setResolved(true);
+                    artifactDependencies.add(assembly);
+                    
+                    projectDependency.setResolved(true);
+
+                    logger.info( "NMAVEN-180-011.1: Project Dependency Resolved: Artifact
ID = " +
+                                        projectDependency.getArtifactId() + ", Group ID =
" + projectDependency.getGroupId() +
+                                        ", Version = " + projectDependency.getVersion() +
", Scope = " +
+                                        projectDependency.getScope() +
+                                        "SystemPath = " +
+                                        projectDependency.getSystemPath()
+                    );
+                    
+                    continue;
+                }
+                
                 if ( !projectDependency.isResolved() )
                 {
                     if ( projectDependency.getArtifactType().startsWith( "gac" ) )



Mime
View raw message