You are viewing a plain text version of this content. The canonical link for it is here.
Posted to npanday-commits@incubator.apache.org by br...@apache.org on 2013/03/06 15:03:49 UTC

svn commit: r1453369 - in /incubator/npanday/trunk/dotnet/assemblies: NPanday.ProjectImporter/Engine/src/main/csharp/ NPanday.ProjectImporter/Engine/src/main/csharp/Digest/ NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/ NPanday.Visual...

Author: brett
Date: Wed Mar  6 15:03:48 2013
New Revision: 1453369

URL: http://svn.apache.org/r1453369
Log:
set VisualStudioVersion

Property introduced in Visual Studio 2012 is defaulted to the highest installed
version when called in this way and allowing imports, which causes incorrect
values under Visual Studio 2010

Modified:
    incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Digest/ProjectDigester.cs
    incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPandayImporter.cs
    incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/ProjectSolutionParser.cs
    incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/SolutionParser.cs
    incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPandayImportProjectForm.cs

Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Digest/ProjectDigester.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Digest/ProjectDigester.cs?rev=1453369&r1=1453368&r2=1453369&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Digest/ProjectDigester.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Digest/ProjectDigester.cs Wed Mar  6 15:03:48 2013
@@ -250,6 +250,8 @@ namespace NPanday.ProjectImporter.Digest
             Engine engine = new Engine(msBuildPath);
 
             Project project = new Project(engine);
+
+            // TODO: if we update to a .NET 3.5 minimum we can pass in ProjectLoadSettings.IgnoreMissingImports
             project.Load(projectFile);
 
             return project;

Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPandayImporter.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPandayImporter.cs?rev=1453369&r1=1453368&r2=1453369&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPandayImporter.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPandayImporter.cs Wed Mar  6 15:03:48 2013
@@ -123,8 +123,13 @@ namespace NPanday.ProjectImporter
 
         public static string[] ImportProject(string solutionFile, string groupId, string artifactId, string version, string scmTag, bool verifyTests, bool useMsDeploy, string configuration, string cloudConfig, DependencySearchConfiguration depSearchConfig, ref string warningMsg)
         {
+            return ImportProject(solutionFile, groupId, artifactId, version, scmTag, verifyTests, useMsDeploy, configuration, cloudConfig, depSearchConfig, null, ref warningMsg);
+        }
+
+        public static string[] ImportProject(string solutionFile, string groupId, string artifactId, string version, string scmTag, bool verifyTests, bool useMsDeploy, string configuration, string cloudConfig, DependencySearchConfiguration depSearchConfig, Dictionary<string, string> globalProperties, ref string warningMsg)
+        {
             VerifyProjectToImport method = verifyTests ? VerifyUnitTestsToUser.VerifyTests : (VerifyProjectToImport)null;
-            return ImportProject(solutionFile, groupId, artifactId, version, scmTag, method, useMsDeploy, configuration, cloudConfig, depSearchConfig, ref warningMsg);
+            return ImportProject(solutionFile, groupId, artifactId, version, scmTag, method, useMsDeploy, configuration, cloudConfig, depSearchConfig, globalProperties, ref warningMsg);
         }
 
         /// <summary>
@@ -169,7 +174,7 @@ namespace NPanday.ProjectImporter
         /// <returns>An array of generated pom.xml filenames</returns>
         public static string[] ImportProject(string solutionFile, string groupId, string artifactId, string version, string scmTag, VerifyProjectToImport verifyProjectToImport, ref string warningMsg)
         {
-            return ImportProject(solutionFile, groupId, artifactId, version, scmTag, verifyProjectToImport, false, null, null, null, ref warningMsg);
+            return ImportProject(solutionFile, groupId, artifactId, version, scmTag, verifyProjectToImport, false, null, null, null, null, ref warningMsg);
         }
 
         /// <summary>
@@ -184,7 +189,7 @@ namespace NPanday.ProjectImporter
         /// <param name="verifyProjectToImport">A delegate That will Accept a method for verifying Projects To Import</param>
         /// <param name="scmTag">adds scm tags to parent pom.xml if not string.empty or null</param>
         /// <returns>An array of generated pom.xml filenames</returns>
-        public static string[] ImportProject(string solutionFile, string groupId, string artifactId, string version, string scmTag, VerifyProjectToImport verifyProjectToImport, bool useMsDeploy, string configuration, string cloudConfig, DependencySearchConfiguration depSearchConfig, ref string warningMsg)
+        public static string[] ImportProject(string solutionFile, string groupId, string artifactId, string version, string scmTag, VerifyProjectToImport verifyProjectToImport, bool useMsDeploy, string configuration, string cloudConfig, DependencySearchConfiguration depSearchConfig, Dictionary<string, string> globalProperties, ref string warningMsg)
         {
             string[] result = null;
 
@@ -193,7 +198,7 @@ namespace NPanday.ProjectImporter
 
             FileInfo solutionFileInfo = new FileInfo(solutionFile);
 
-            List<Dictionary<string, object>> list = ParseSolution(solutionFileInfo, ref warningMsg);
+            List<Dictionary<string, object>> list = ParseSolution(solutionFileInfo, globalProperties, ref warningMsg);
 
             if (configuration != null)
             {
@@ -303,9 +308,9 @@ namespace NPanday.ProjectImporter
         /// </summary>
         /// <param name="solutionFile">the full path of the *.sln (visual studio solution) file you want to parse</param>
         /// <returns></returns>
-        public static List<Dictionary<string, object>> ParseSolution(FileInfo solutionFile, ref string warningMsg)
+        public static List<Dictionary<string, object>> ParseSolution(FileInfo solutionFile, Dictionary<string, string> globalProperties, ref string warningMsg)
         {
-            return SolutionParser.ParseSolution(solutionFile, ref warningMsg);
+            return SolutionParser.ParseSolution(solutionFile, globalProperties, ref warningMsg);
         }
 
         /// <summary>
@@ -330,10 +335,5 @@ namespace NPanday.ProjectImporter
         {
             return ProjectValidator.GetProjectStructureType(solutionFile, projectDigests);
         }
-
-
-
-       
-
     }
 }

Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/ProjectSolutionParser.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/ProjectSolutionParser.cs?rev=1453369&r1=1453368&r2=1453369&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/ProjectSolutionParser.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/ProjectSolutionParser.cs Wed Mar  6 15:03:48 2013
@@ -52,7 +52,7 @@ namespace NPanday.ProjectImporter.Parser
             BUILD_ENGINE = new Engine(msBuildPath);
         }
 
-        public List<Dictionary<string, object>> Parse(FileInfo solutionFile, ref string warningMsg)
+        public List<Dictionary<string, object>> Parse(FileInfo solutionFile, Dictionary<string, string> globalProperties, ref string warningMsg)
         {
             NPanday.ProjectImporter.Parser.SlnParser.Model.Solution solution;
 
@@ -143,6 +143,14 @@ namespace NPanday.ProjectImporter.Parser
 
                     try
                     {
+                        // TODO: if we update to a .NET 3.5 minimum we can pass in ProjectLoadSettings.IgnoreMissingImports, and ignore the visualstudioversion
+                        if (globalProperties != null)
+                        {
+                            foreach (KeyValuePair<string, string> entry in globalProperties)
+                            {
+                                prj.GlobalProperties.SetProperty(entry.Key, entry.Value);
+                            }
+                        }
                         prj.Load(fullpath);
                     }
                     catch (Exception e)
@@ -259,6 +267,7 @@ namespace NPanday.ProjectImporter.Parser
 
                     try
                     {
+                        // TODO: if we update to a .NET 3.5 minimum we can pass in ProjectLoadSettings.IgnoreMissingImports
                         prj.Load(projectReferenceFullPath);
                     }
                     catch (Exception e)

Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/SolutionParser.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/SolutionParser.cs?rev=1453369&r1=1453368&r2=1453369&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/SolutionParser.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/Parser/SlnParser/SolutionParser.cs Wed Mar  6 15:03:48 2013
@@ -30,7 +30,7 @@ namespace NPanday.ProjectImporter.Parser
 {
     public sealed class SolutionParser
     {
-        public delegate List<Dictionary<string, object>> ParserAlgoDelegate(System.IO.FileInfo solutionFile, ref string warningMsg);
+        public delegate List<Dictionary<string, object>> ParserAlgoDelegate(System.IO.FileInfo solutionFile, Dictionary<string, string> globalProperties, ref string warningMsg);
 
         static ParserAlgoDelegate[] ALGORITHMS = 
         {
@@ -38,13 +38,13 @@ namespace NPanday.ProjectImporter.Parser
         };
 
 
-        public static List<Dictionary<string, object>> ParseSolution(FileInfo solutionFile, ref string warningMsg)
+        public static List<Dictionary<string, object>> ParseSolution(FileInfo solutionFile, Dictionary<string, string> globalProperties, ref string warningMsg)
         {
             List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
 
             foreach (ParserAlgoDelegate algo in ALGORITHMS)
             {
-               list.AddRange(algo(solutionFile, ref warningMsg));
+               list.AddRange(algo(solutionFile, globalProperties, ref warningMsg));
             }
 
             return list;

Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPandayImportProjectForm.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPandayImportProjectForm.cs?rev=1453369&r1=1453368&r2=1453369&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPandayImportProjectForm.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPandayImportProjectForm.cs Wed Mar  6 15:03:48 2013
@@ -361,7 +361,9 @@ namespace NPanday.VisualStudio.Addin
                 validateSolutionStructure();
                 resyncAllArtifacts();
                 // TODO: nicer to have some sort of structure / flags for the Msdeploy bit, or this dialog will get out of control over time - perhaps a "project configuration" dialog can replace the test popup
-                string[] generatedPoms = ProjectImporter.NPandayImporter.ImportProject(file.FullName, groupId, artifactId, version, scmTag, true, useMsDeploy, configuration, cloudConfig, depSearchConfig, ref warningMsg);
+                Dictionary<string, string> globalProperties = new Dictionary<string, string>();
+                globalProperties.Add("VisualStudioVersion", applicationObject.Version);
+                string[] generatedPoms = ProjectImporter.NPandayImporter.ImportProject(file.FullName, groupId, artifactId, version, scmTag, true, useMsDeploy, configuration, cloudConfig, depSearchConfig, globalProperties, ref warningMsg);
                 string str = string.Format("NPanday Import Project has Successfully Generated Pom Files!\n");
 
                 foreach (string pom in generatedPoms)