Exemplo n.º 1
0
        private bool CheckDuplicate(TextWriter textWriter, out Dictionary <ProjectKey, SolutionProjectData> map)
        {
            map = new Dictionary <ProjectKey, SolutionProjectData>();
            var allGood = true;

            foreach (var projectEntry in SolutionUtil.ParseProjects(SolutionFilePath))
            {
                if (projectEntry.IsFolder)
                {
                    continue;
                }

                var projectFilePath = Path.Combine(SolutionPath, projectEntry.RelativeFilePath);
                var projectData     = new ProjectData(projectFilePath);
                if (map.ContainsKey(projectData.Key))
                {
                    textWriter.WriteLine($"Duplicate project detected {projectData.FileName}");
                    allGood = false;
                }
                else
                {
                    map.Add(projectData.Key, new SolutionProjectData(projectEntry, projectData));
                }
            }

            return(allGood);
        }
Exemplo n.º 2
0
        private static bool ProcessSolution(string solutionFilePath)
        {
            var solutionPath    = Path.GetDirectoryName(solutionFilePath);
            var projectDataList = SolutionUtil.ParseProjects(solutionFilePath);
            var map             = new Dictionary <ProjectKey, ProjectData>();

            foreach (var projectEntry in projectDataList)
            {
                if (projectEntry.IsFolder)
                {
                    continue;
                }

                var projectFilePath = Path.Combine(solutionPath, projectEntry.RelativeFilePath);
                var projectData     = new ProjectData(projectFilePath);
                map.Add(projectData.Key, projectData);
            }

            var allGood = true;
            var count   = 0;

            foreach (var projectData in map.Values.OrderBy(x => x.FileName))
            {
                allGood &= ProcessProject(solutionPath, projectData, map);
                count++;
            }

            var result = allGood ? "passed" : "FAILED";

            Console.WriteLine($"Processing {Path.GetFileName(solutionFilePath)} ... {result} ({count} projects processed)");
            return(allGood);
        }
Exemplo n.º 3
0
        public bool Check(TextWriter textWriter)
        {
            var solutionPath    = Path.GetDirectoryName(_solutionFilePath);
            var projectDataList = SolutionUtil.ParseProjects(_solutionFilePath);
            var map             = new Dictionary <ProjectKey, ProjectData>();
            var allGood         = true;

            foreach (var projectEntry in projectDataList)
            {
                if (projectEntry.IsFolder)
                {
                    continue;
                }

                // TODO: temporary work around util a cross cutting change can be sync'd up.
                if (Path.GetFileName(projectEntry.RelativeFilePath) == "CompilerPerfTest.vbproj")
                {
                    continue;
                }

                var projectFilePath = Path.Combine(solutionPath, projectEntry.RelativeFilePath);
                var projectData     = new ProjectData(projectFilePath);
                if (map.ContainsKey(projectData.Key))
                {
                    textWriter.WriteLine($"Duplicate project detected {projectData.FileName}");
                    allGood = false;
                }
                else
                {
                    map.Add(projectData.Key, projectData);
                }
            }

            var count = 0;

            foreach (var projectData in map.Values.OrderBy(x => x.FileName))
            {
                var projectWriter = new StringWriter();
                projectWriter.WriteLine($"Processing {projectData.Key.FileName}");
                var util = new ProjectCheckerUtil(projectData, map);
                if (!util.Check(projectWriter))
                {
                    allGood = false;
                    textWriter.WriteLine(projectWriter.ToString());
                }
                count++;
            }

            textWriter.WriteLine($"Processed {count} projects");
            return(allGood);
        }
Exemplo n.º 4
0
        private static bool ProcessSolution(string solutionFilePath)
        {
            var solutionPath    = Path.GetDirectoryName(solutionFilePath);
            var projectDataList = SolutionUtil.ParseProjects(solutionFilePath);
            var allGood         = true;
            var count           = 0;

            foreach (var projectData in projectDataList)
            {
                if (projectData.IsFolder)
                {
                    continue;
                }

                var projectFilePath = Path.Combine(solutionPath, projectData.RelativeFilePath);
                allGood &= ProcessProject(projectFilePath, projectData);
                count++;
            }

            var result = allGood ? "passed" : "FAILED";

            Console.WriteLine($"Processing {Path.GetFileName(solutionFilePath)} ... {result} ({count} projects processed)");
            return(allGood);
        }