/// <summary> /// Imports a specified Visual Studio Projects in a Solution to an NPanday Pom, /// This is the Project-Importer Entry Method, /// This method accepts a delegate to use as A project Verifier algorithm /// </summary> /// <param name="solutionFile">Path to your Visual Studio Solution File *.sln </param> /// <param name="groupId">Project Group ID, for maven groupId</param> /// <param name="artifactId">Project Parent Pom Artifact ID, used as a maven artifact ID for the parent pom.xml</param> /// <param name="version">Project version, used as a maven version for the entire pom.xmls</param> /// <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, ref string warningMsg) { return(ImportProject(solutionFile, groupId, artifactId, version, scmTag, verifyProjectToImport, false, ref warningMsg)); }
/// <summary> /// Imports a specified Visual Studio Projects in a Solution to an NPanday Pom, /// This is the Project-Importer Entry Method, /// This method accepts a delegate to use as A project Verifier algorithm /// </summary> /// <param name="solutionFile">Path to your Visual Studio Solution File *.sln </param> /// <param name="groupId">Project Group ID, for maven groupId</param> /// <param name="artifactId">Project Parent Pom Artifact ID, used as a maven artifact ID for the parent pom.xml</param> /// <param name="version">Project version, used as a maven version for the entire pom.xmls</param> /// <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, ref string warningMsg) { string[] result = null; FileInfo solutionFileInfo = new FileInfo(solutionFile); List <Dictionary <string, object> > list = ParseSolution(solutionFileInfo, ref warningMsg); //Checks for Invalid folder structure HasValidFolderStructure(list); ProjectDigest[] prjDigests = DigestProjects(list, ref warningMsg); ProjectStructureType structureType = GetProjectStructureType(solutionFile, prjDigests); // Filtering of unsupported project types. String UnsupportedProjectsMessage = string.Empty; List <ProjectDigest> filteredPrjDigests = new List <ProjectDigest>(); foreach (ProjectDigest pDigest in prjDigests) { if (PomConverter.__converterAlgorithms.ContainsKey(pDigest.ProjectType)) { // set the project flag so that converters can look at it later pDigest.UseMsDeploy = useMsDeploy; filteredPrjDigests.Add(pDigest); } else { if (UnsupportedProjectsMessage == string.Empty) { UnsupportedProjectsMessage += pDigest.FullFileName; } else { UnsupportedProjectsMessage += ", " + pDigest.FullFileName; } } } if (!string.Empty.Equals(UnsupportedProjectsMessage)) { warningMsg = string.Format("{0}\n Unsupported Projects: {1}", warningMsg, UnsupportedProjectsMessage); } prjDigests = filteredPrjDigests.ToArray(); if (verifyProjectToImport != null && filteredPrjDigests.Count > 0) { verifyProjectToImport(ref prjDigests, structureType, solutionFile, ref groupId, ref artifactId, ref version); } List <Reference> missingReferences = new List <Reference>(); result = ImportProjectType(structureType, filteredPrjDigests.ToArray(), solutionFile, groupId, artifactId, version, scmTag, missingReferences); if (missingReferences.Count > 0) { warningMsg += "\nThe following references could not be resolved from Maven or the GAC:"; foreach (Reference missingReference in missingReferences) { warningMsg += "\n\t" + missingReference.Name + " (" + missingReference.Version + ")"; } warningMsg += "\nPlease update the defaults in pom.xml and re-sync references, or re-add them using 'Add Maven Artifact'."; } return(result); }
/// <summary> /// Imports a specified Visual Studio Projects in a Solution to an NPanday Pom, /// This is the Project-Importer Entry Method /// </summary> /// <param name="solutionFile">Path to your Visual Studio Solution File *.sln </param> /// <param name="groupId">Project Group ID, for maven groupId</param> /// <param name="artifactId">Project Parent Pom Artifact ID, used as a maven artifact ID for the parent pom.xml</param> /// <param name="version">Project version, used as a maven version for the entire pom.xmls</param> /// <param name="verifyTests">if true, a dialog box for verifying tests will show up and requires user interaction</param> /// <param name="scmTag">generates scm tags if txtboxfield is not 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, bool verifyTests, bool useMsDeploy, ref string warningMsg) { VerifyProjectToImport method = verifyTests ? VerifyUnitTestsToUser.VerifyTests : (VerifyProjectToImport)null; return(ImportProject(solutionFile, groupId, artifactId, version, scmTag, method, useMsDeploy, ref warningMsg)); }
/// <summary> /// Imports a specified Visual Studio Projects in a Solution to an NPanday Pom, /// This is the Project-Importer Entry Method, /// This method accepts a delegate to use as A project Verifier algorithm /// </summary> /// <param name="solutionFile">Path to your Visual Studio Solution File *.sln </param> /// <param name="groupId">Project Group ID, for maven groupId</param> /// <param name="artifactId">Project Parent Pom Artifact ID, used as a maven artifact ID for the parent pom.xml</param> /// <param name="version">Project version, used as a maven version for the entire pom.xmls</param> /// <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, Dictionary <string, string> globalProperties, ref string warningMsg) { string[] result = null; if (depSearchConfig == null) { depSearchConfig = new DependencySearchConfiguration(); } FileInfo solutionFileInfo = new FileInfo(solutionFile); List <Dictionary <string, object> > list = ParseSolution(solutionFileInfo, globalProperties, ref warningMsg); if (configuration != null) { foreach (Dictionary <string, object> projectMap in list) { projectMap.Add("Configuration", configuration); } } //Checks for Invalid folder structure HasValidFolderStructure(list); ProjectDigest[] prjDigests = DigestProjects(list, depSearchConfig, ref warningMsg); ProjectStructureType structureType = GetProjectStructureType(solutionFile, prjDigests); // Filtering of unsupported project types. String UnsupportedProjectsMessage = string.Empty; List <ProjectDigest> filteredPrjDigests = new List <ProjectDigest>(); foreach (ProjectDigest pDigest in prjDigests) { if (PomConverter.__converterAlgorithms.ContainsKey(pDigest.ProjectType)) { // set the project flag so that converters can look at it later pDigest.UseMsDeploy = useMsDeploy; pDigest.CloudConfig = cloudConfig; pDigest.DependencySearchConfig = depSearchConfig; filteredPrjDigests.Add(pDigest); } else { if (UnsupportedProjectsMessage == string.Empty) { UnsupportedProjectsMessage += pDigest.FullFileName; } else { UnsupportedProjectsMessage += ", " + pDigest.FullFileName; } } } if (!string.Empty.Equals(UnsupportedProjectsMessage)) { warningMsg = string.Format("{0}\n Unsupported Projects: {1}", warningMsg, UnsupportedProjectsMessage); } prjDigests = filteredPrjDigests.ToArray(); if (verifyProjectToImport != null && filteredPrjDigests.Count > 0) { verifyProjectToImport(ref prjDigests, structureType, solutionFile, ref groupId, ref artifactId, ref version); } List <Reference> missingReferences = new List <Reference>(); List <string> nonPortableReferences = new List <string>(); result = ImportProjectType(structureType, filteredPrjDigests.ToArray(), solutionFile, groupId, artifactId, version, scmTag, missingReferences, nonPortableReferences); if (missingReferences.Count > 0) { warningMsg += "\nThe following references could not be resolved from Maven or the GAC:"; foreach (Reference missingReference in missingReferences) { warningMsg += "\n\t" + missingReference.Name + " (" + missingReference.Version + ")"; } warningMsg += "\nPlease update the defaults in pom.xml and re-sync references, or re-add them using 'Add Maven Artifact'."; } if (nonPortableReferences.Count > 0) { if (depSearchConfig.CopyToMaven) { warningMsg += "The following artifacts were copied to the local Maven repository:"; } else { warningMsg += "\nThe build may not be portable if local references are used:"; } warningMsg += "\n\t" + string.Join("\n\t", nonPortableReferences.ToArray()) + "\nDeploying the reference to a Repository will make the code portable to other machines."; } return(result); }
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, globalProperties, ref warningMsg)); }
/// <summary> /// Imports a specified Visual Studio Projects in a Solution to an NPanday Pom, /// This is the Project-Importer Entry Method, /// This method accepts a delegate to use as A project Verifier algorithm /// </summary> /// <param name="solutionFile">Path to your Visual Studio Solution File *.sln </param> /// <param name="groupId">Project Group ID, for maven groupId</param> /// <param name="artifactId">Project Parent Pom Artifact ID, used as a maven artifact ID for the parent pom.xml</param> /// <param name="version">Project version, used as a maven version for the entire pom.xmls</param> /// <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, Dictionary<string, string> globalProperties, ref string warningMsg) { string[] result = null; if (depSearchConfig == null) depSearchConfig = new DependencySearchConfiguration(); FileInfo solutionFileInfo = new FileInfo(solutionFile); List<Dictionary<string, object>> list = ParseSolution(solutionFileInfo, globalProperties, ref warningMsg); if (configuration != null) { foreach (Dictionary<string, object> projectMap in list) { projectMap.Add("Configuration", configuration); } } //Checks for Invalid folder structure HasValidFolderStructure(list); ProjectDigest[] prjDigests = DigestProjects(list, depSearchConfig, ref warningMsg); ProjectStructureType structureType = GetProjectStructureType(solutionFile, prjDigests); // Filtering of unsupported project types. String UnsupportedProjectsMessage = string.Empty; List<ProjectDigest> filteredPrjDigests = new List<ProjectDigest>(); foreach (ProjectDigest pDigest in prjDigests) { if (PomConverter.__converterAlgorithms.ContainsKey(pDigest.ProjectType)) { // set the project flag so that converters can look at it later pDigest.UseMsDeploy = useMsDeploy; pDigest.CloudConfig = cloudConfig; pDigest.DependencySearchConfig = depSearchConfig; filteredPrjDigests.Add(pDigest); } else { if (UnsupportedProjectsMessage == string.Empty) { UnsupportedProjectsMessage += pDigest.FullFileName; } else { UnsupportedProjectsMessage += ", " + pDigest.FullFileName; } } } if (!string.Empty.Equals(UnsupportedProjectsMessage)) { warningMsg = string.Format("{0}\n Unsupported Projects: {1}", warningMsg, UnsupportedProjectsMessage); } prjDigests = filteredPrjDigests.ToArray(); if (verifyProjectToImport != null && filteredPrjDigests.Count > 0) { verifyProjectToImport(ref prjDigests, structureType, solutionFile, ref groupId, ref artifactId, ref version); } List<Reference> missingReferences = new List<Reference>(); List<string> nonPortableReferences = new List<string>(); result = ImportProjectType(structureType, filteredPrjDigests.ToArray(), solutionFile, groupId, artifactId, version, scmTag, missingReferences, nonPortableReferences); if (missingReferences.Count > 0) { warningMsg += "\nThe following references could not be resolved from Maven or the GAC:"; foreach (Reference missingReference in missingReferences) { warningMsg += "\n\t" + missingReference.Name + " (" + missingReference.Version + ")"; } warningMsg += "\nPlease update the defaults in pom.xml and re-sync references, or re-add them using 'Add Maven Artifact'."; } if (nonPortableReferences.Count > 0) { if (depSearchConfig.CopyToMaven) { warningMsg += "The following artifacts were copied to the local Maven repository:"; } else { warningMsg += "\nThe build may not be portable if local references are used:"; } warningMsg += "\n\t" + string.Join("\n\t", nonPortableReferences.ToArray()) + "\nDeploying the reference to a Repository will make the code portable to other machines."; } return result; }
/// <summary> /// Imports a specified Visual Studio Projects in a Solution to an NPanday Pom, /// This is the Project-Importer Entry Method, /// This method accepts a delegate to use as A project Verifier algorithm /// </summary> /// <param name="solutionFile">Path to your Visual Studio Solution File *.sln </param> /// <param name="groupId">Project Group ID, for maven groupId</param> /// <param name="artifactId">Project Parent Pom Artifact ID, used as a maven artifact ID for the parent pom.xml</param> /// <param name="version">Project version, used as a maven version for the entire pom.xmls</param> /// <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, ref string warningMsg) { return ImportProject(solutionFile, groupId, artifactId, version, scmTag, verifyProjectToImport, false, null, null, null, null, ref warningMsg); }