private void resyncAllArtifacts()
        {
            if (applicationObject.Solution != null)
            {
                Solution2 solution = (Solution2)applicationObject.Solution;
                IList <IReferenceManager> refManagers = new List <IReferenceManager>();
                foreach (Project project in Connect.GetAllProjects(solution.Projects))
                {
                    if (!isWebProject(project) && !isFolder(project) && project.Object != null)
                    {
                        IReferenceManager mgr = new ReferenceManager();
                        try
                        {
                            mgr.Initialize((VSLangProj80.VSProject2)project.Object);
                            refManagers.Add(mgr);
                        }
                        catch
                        {
                            // suppressing...
                        }
                    }
                }

                // if POM file exists in any of the projects, commence resync
                if (refManagers.Count > 0)
                {
                    refManagerHasError = false;
                    log.Info("Re-syncing artifacts... ");
                    try
                    {
                        foreach (IReferenceManager mgr in refManagers)
                        {
                            mgr.OnError += new EventHandler <ReferenceErrorEventArgs>(refmanager_OnError);
                            mgr.ResyncArtifacts();
                        }

                        if (!refManagerHasError)
                        {
                            log.InfoFormat("done [{0}]", DateTime.Now.ToString("hh:mm tt"));
                        }
                    }
                    catch (Exception ex)
                    {
                        if (refManagerHasError)
                        {
                            log.Warn(ex.Message, ex);
                        }
                        else
                        {
                            log.Fatal(ex.Message, ex);
                        }
                    }
                }
            }
        }
示例#2
0
        private void resyncAllArtifacts()
        {
            if (applicationObject.Solution != null)
            {
                Solution2 solution = (Solution2)applicationObject.Solution;
                IList <IReferenceManager> refManagers = new List <IReferenceManager>();
                foreach (Project project in solution.Projects)
                {
                    if (!isWebProject(project) && !isFolder(project) && project.Object != null)
                    {
                        IReferenceManager mgr = new ReferenceManager();
                        try
                        {
                            mgr.Initialize((VSLangProj80.VSProject2)project.Object);
                            refManagers.Add(mgr);
                        }
                        catch
                        {
                            // suppressing...
                        }
                    }
                }

                // if POM file exists in any of the projects, commence resync
                if (refManagers.Count > 0)
                {
                    refManagerHasError = false;
                    logger.Log(Level.INFO, "Re-syncing artifacts... ");
                    try
                    {
                        foreach (IReferenceManager mgr in refManagers)
                        {
                            mgr.OnError += new EventHandler <ReferenceErrorEventArgs>(refmanager_OnError);
                            mgr.ResyncArtifacts(logger);
                        }

                        if (!refManagerHasError)
                        {
                            logger.Log(Level.INFO, string.Format("done [{0}]", DateTime.Now.ToString("hh:mm tt")));
                        }
                    }
                    catch (Exception ex)
                    {
                        if (refManagerHasError)
                        {
                            logger.Log(Level.WARNING, string.Format("{0}\n\n{1}\n\n", ex.Message, ex.StackTrace));
                        }
                        else
                        {
                            logger.Log(Level.SEVERE, (string.Format("failed: {0}\n\n{1}\n\n", ex.Message, ex.StackTrace)));
                        }
                    }
                }
            }
        }
        public void artifactSetUp()
        {
            ReferenceManager refMngr = new ReferenceManager();
            Artifact.Artifact artifact = new Artifact.Artifact();

            artifact.GroupId = "npanday.artifact";
            artifact.Version = "1.1-SNAPSHOT";
            artifact.ArtifactId = "NPanday.Artifact";
            artifact.Extension = "dll";

            refMngr.CopyArtifact(artifact);
        }
        public void TestSetUp()
        {
            FileUtils.CopyDirectory(testProject, testProjectCopy);
            FileUtils.CopyDirectory(repo, repoCopy);

            refManager = new ReferenceManager();
            refManager.ReferenceFolder = testProjectCopy.FullName + "\\TestProject\\.references";

            testArtifact = new Artifact.Artifact();
            testArtifact.GroupId = "npanday.test";
            testArtifact.ArtifactId = "NPanday.Test";
            testArtifact.Version = "1.0";
            testArtifact.Extension = "dll";
        }
        private void resyncAllArtifacts()
        {
            if (applicationObject.Solution != null)
            {
                Solution2 solution = (Solution2)applicationObject.Solution;
                IList<IReferenceManager> refManagers = new List<IReferenceManager>();
                foreach (Project project in Connect.GetAllProjects(solution.Projects))
                {
                    if (!isWebProject(project) && !isFolder(project) && project.Object != null)
                    {
                        IReferenceManager mgr = new ReferenceManager();
                        try
                        {
                            mgr.Initialize((VSLangProj80.VSProject2)project.Object);
                            refManagers.Add(mgr);
                        }
                        catch
                        {
                            // suppressing...
                        }
                    }
                }

                // if POM file exists in any of the projects, commence resync
                if (refManagers.Count > 0)
                {
                    refManagerHasError = false;
                    log.Info("Re-syncing artifacts... ");
                    try
                    {
                        foreach (IReferenceManager mgr in refManagers)
                        {
                            mgr.OnError += new EventHandler<ReferenceErrorEventArgs>(refmanager_OnError);
                            mgr.ResyncArtifacts();
                        }

                        if (!refManagerHasError)
                        {
                            log.InfoFormat("done [{0}]", DateTime.Now.ToString("hh:mm tt"));
                        }
                    }
                    catch (Exception ex)
                    {
                        if (refManagerHasError)
                        {
                            log.Warn(ex.Message, ex);
                        }
                        else
                        {
                            log.Fatal(ex.Message, ex);
                        }
                    }
                }
            }
        }