Esempio n. 1
0
 public void CheckedProject(ref ProjectDigest[] projectDigests, ProjectStructureType structureType, string solutionFile, ref string groupId, ref string artifactId, ref string version)
 {
     foreach (ProjectDigest pDigest in projectDigests)
     {
         pDigest.UnitTest = true;
     }
 }
Esempio n. 2
0
 public void CheckedProject(ref ProjectDigest[] projectDigests, ProjectStructureType structureType, string solutionFile, ref string groupId, ref string artifactId, ref string version)
 {
     foreach (ProjectDigest pDigest in projectDigests)
     {
         pDigest.UnitTest = true;
     }
 }
        public static void SyncronizePomValues(ref ProjectDigest[] projectDigests, ProjectStructureType structureType, string solutionFile, ref string groupId, ref string artifactId, ref string version)
        {
            // sync parent values
            if (structureType != ProjectStructureType.FlatSingleModuleProject)
            {
                SyncParentValues(structureType, solutionFile, ref groupId, ref artifactId, ref version);
            }
            else
            {
                // get the group id from the solution file
                if (projectDigests[0].ExistingPom != null)
                {
                    groupId = projectDigests[0].ExistingPom.groupId;
                    version = projectDigests[0].ExistingPom.version;
                }
                else
                {
                    throw new Exception("Project Must be Imported atleast once before Re-Importing!");
                }
            }

            // syncronize each project to existing poms
            for (int i=0; i<projectDigests.Length; i++)
            {
                SyncProjectValues(ref projectDigests[i]);
            }

            // show test verification if there is a new project added
            if (IsProjectHavingANewImportedProject(projectDigests))
            {
                VerifyUnitTestsForm verifyForm = new VerifyUnitTestsForm(projectDigests);
                verifyForm.ShowDialog();
            }
        }
        static void SyncParentValues(ProjectStructureType structureType, string solutionFile, ref string groupId, ref string artifactId, ref string version)
        {
            string parentPomFileName = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(solutionFile), "pom.xml"));

            if (structureType == ProjectStructureType.FlatMultiModuleProject)
            {
                parentPomFileName = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(solutionFile), @"parent-pom.xml"));
            }

            FileInfo parentPomFile = new FileInfo(parentPomFileName);

            if (!parentPomFile.Exists)
            {
                throw new Exception("Project Must be Imported Atleast once before Re-Importing!");
            }

            NPanday.Model.Pom.Model model = NPanday.Utils.PomHelperUtility.ReadPomAsModel(parentPomFile);

            groupId    = model.groupId;
            artifactId = model.artifactId;
            version    = model.version;
        }
        public static void SyncronizePomValues(ref ProjectDigest[] projectDigests, ProjectStructureType structureType, string solutionFile, ref string groupId, ref string artifactId, ref string version)
        {
            // sync parent values
            if (structureType != ProjectStructureType.FlatSingleModuleProject)
            {
                SyncParentValues(structureType, solutionFile, ref groupId, ref artifactId, ref version);
            }
            else
            {
                // get the group id from the solution file
                if (projectDigests[0].ExistingPom != null)
                {
                    groupId = projectDigests[0].ExistingPom.groupId;
                    version = projectDigests[0].ExistingPom.version;
                }
                else
                {
                    throw new Exception("Project Must be Imported atleast once before Re-Importing!");
                }
            }


            // syncronize each project to existing poms
            for (int i = 0; i < projectDigests.Length; i++)
            {
                SyncProjectValues(ref projectDigests[i]);
            }


            // show test verification if there is a new project added
            if (IsProjectHavingANewImportedProject(projectDigests))
            {
                VerifyUnitTestsForm verifyForm = new VerifyUnitTestsForm(projectDigests);
                verifyForm.ShowDialog();
            }
        }
Esempio n. 6
0
        public static void VerifyTests(ref ProjectDigest[] projectDigests, ProjectStructureType structureType, string solutionFile, ref string groupId, ref string artifactId, ref string version)
        {
            VerifyUnitTestsForm verifyForm = new VerifyUnitTestsForm(projectDigests);

            verifyForm.ShowDialog();
        }
Esempio n. 7
0
 public static string[] ImportProjectType(ProjectStructureType structureType, ProjectDigest[] prjDigests, string solutionFile, string groupId, string artifactId, string version, string scmTag, List <Reference> missingReferences)
 {
     return(_importProject[structureType](prjDigests, solutionFile, groupId, artifactId, version, scmTag, true, missingReferences));
 }
Esempio n. 8
0
        /// <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);
        }
Esempio n. 9
0
        /// <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);
        }
Esempio n. 10
0
 public static void VerifyTests(ref ProjectDigest[] projectDigests, ProjectStructureType structureType, string solutionFile, ref string groupId, ref string artifactId, ref string version)
 {
     VerifyUnitTestsForm verifyForm = new VerifyUnitTestsForm(projectDigests);
     verifyForm.ShowDialog();
 }
        static void SyncParentValues(ProjectStructureType structureType, string solutionFile, ref string groupId, ref string artifactId, ref string version)
        {
            string parentPomFileName = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(solutionFile), "pom.xml"));
            if (structureType == ProjectStructureType.FlatMultiModuleProject)
            {
                parentPomFileName = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(solutionFile), @"parent-pom.xml"));
            }

            FileInfo parentPomFile = new FileInfo(parentPomFileName);

            if (!parentPomFile.Exists)
            {
                throw new Exception("Project Must be Imported Atleast once before Re-Importing!");
            }

            NPanday.Model.Pom.Model model = NPanday.Utils.PomHelperUtility.ReadPomAsModel(parentPomFile);

            groupId = model.groupId;
            artifactId = model.artifactId;
            version = model.version;
        }
Esempio n. 12
0
 public static string[] ImportProjectType(ProjectStructureType structureType, ProjectDigest[] prjDigests, string solutionFile, string groupId, string artifactId, string version, string scmTag, List<Reference> missingReferences, List<string> nonPortableReferences)
 {
     return _importProject[structureType](prjDigests, solutionFile, groupId, artifactId, version, scmTag, true, missingReferences, nonPortableReferences);
 }