Ejemplo n.º 1
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;
        }
Ejemplo n.º 2
0
        private static bool ProcessProject(string solutionPath, ProjectData projectData, Dictionary<ProjectKey, ProjectData> map)
        {
            var util = new ProjectCheckerUtil(projectData, map);
            var textWriter = new StringWriter();
            if (!util.CheckAll(textWriter))
            {
                Console.WriteLine($"Checking {projectData.FilePath} failed");
                Console.WriteLine(textWriter.ToString());
                return false;
            }

            return true;
        }
Ejemplo n.º 3
0
        public bool Check(TextWriter textWriter)
        {
            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;
                }

                // 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);
                map.Add(projectData.Key, projectData);
            }

            var allGood = true;
            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;
        }
Ejemplo n.º 4
0
 internal ProjectCheckerUtil(ProjectData data, Dictionary <ProjectKey, ProjectData> solutionMap)
 {
     _data        = data;
     _projectUtil = data.ProjectUtil;
     _solutionMap = solutionMap;
 }
Ejemplo n.º 5
0
 internal ProjectCheckerUtil(ProjectData data, Dictionary<ProjectKey, ProjectData> solutionMap)
 {
     _data = data;
     _projectUtil = data.ProjectUtil;
     _solutionMap = solutionMap;
 }
Ejemplo n.º 6
0
 // Local functions
 static string GetAssemblyName(ProjectData projectData)
 {
     return(projectData.ProjectUtil.FindSingleProperty("AssemblyName")?.Value.Trim()
            ?? Path.GetFileNameWithoutExtension(projectData.FileName));
 }
Ejemplo n.º 7
0
 internal SolutionProjectData(ProjectEntry entry, ProjectData data)
 {
     ProjectEntry = entry;
     ProjectData  = data;
 }