示例#1
0
 internal ProjectCheckerUtil(ProjectData data, Dictionary <ProjectKey, ProjectData> solutionMap, bool isPrimarySolution)
 {
     _data              = data;
     _projectUtil       = data.ProjectUtil;
     _solutionMap       = solutionMap;
     _isPrimarySolution = isPrimarySolution;
 }
示例#2
0
 internal ProjectData(string filePath)
 {
     Key = new ProjectKey(filePath);
     FilePath = Key.FilePath;
     Document = XDocument.Load(FilePath);
     ProjectUtil = new ProjectUtil(Key, Document);
 }
示例#3
0
 internal ProjectData(string filePath)
 {
     Key         = new ProjectKey(filePath);
     FilePath    = Key.FilePath;
     Document    = XDocument.Load(FilePath);
     ProjectUtil = new ProjectUtil(Key, Document);
 }
示例#4
0
        private static IEnumerable <string> GetImportProjects(ProjectUtil util)
        {
            foreach (var project in util.GetImportProjects())
            {
                if (IsReplacedValue(project))
                {
                    continue;
                }

                yield return(project);
            }
        }
示例#5
0
        private bool CheckTargets(ProjectUtil util, TextWriter textWriter)
        {
            var allGood = true;
            foreach (var project in GetImportProjects(util))
            {
                if (SharedUtil.IsPropsFile(project))
                {
                    textWriter.WriteLine($"Targets files should not Import props files");
                    allGood = false;
                }
            }

            return allGood;
        }
示例#6
0
        private static bool ProcessProject(string solutionPath, ProjectData projectData, Dictionary <ProjectKey, ProjectData> map)
        {
            var util       = new ProjectUtil(projectData, map);
            var textWriter = new StringWriter();

            if (!util.CheckAll(textWriter))
            {
                Console.WriteLine($"Checking {projectData.FilePath} failed");
                Console.WriteLine(textWriter.ToString());
                return(false);
            }

            return(true);
        }
示例#7
0
        private bool CheckTargets(ProjectUtil util, TextWriter textWriter)
        {
            var allGood = true;

            foreach (var project in GetImportProjects(util))
            {
                if (SharedUtil.IsPropsFile(project))
                {
                    textWriter.WriteLine($"Targets files should not Import props files");
                    allGood = false;
                }
            }

            return(allGood);
        }
示例#8
0
        private static bool ProcessProject(string projectFilePath, ProjectData projectData)
        {
            var doc         = XDocument.Load(projectFilePath);
            var projectType = projectData.ProjectType;
            var util        = new ProjectUtil(projectType, projectFilePath, doc);
            var textWriter  = new StringWriter();

            if (!util.CheckAll(textWriter))
            {
                Console.WriteLine($"Checking {projectData.RelativeFilePath} failed");
                Console.WriteLine(textWriter.ToString());
                return(false);
            }

            return(true);
        }
示例#9
0
        private bool CheckProps(ProjectUtil util, TextWriter textWriter)
        {
            var allGood = true;
            foreach (var project in GetImportProjects(util))
            {
                if (!SharedUtil.IsPropsFile(project))
                {
                    textWriter.WriteLine($"Props files should only Import other props files");
                    allGood = false;
                }
            }

            if (util.GetTargets().Any())
            {
                textWriter.WriteLine($"Props files should not contain <Target> elements");
                allGood = false;
            }

            return allGood;
        }
示例#10
0
        private bool CheckProps(ProjectUtil util, TextWriter textWriter)
        {
            var allGood = true;

            foreach (var project in GetImportProjects(util))
            {
                if (!SharedUtil.IsPropsFile(project))
                {
                    textWriter.WriteLine($"Props files should only Import other props files");
                    allGood = false;
                }
            }

            if (util.GetTargets().Any())
            {
                textWriter.WriteLine($"Props files should not contain <Target> elements");
                allGood = false;
            }

            return(allGood);
        }
示例#11
0
        internal static int Main(string[] args)
        {
            string sourcePath;
            string configPath;

            if (!ParseArgs(args, out sourcePath, out configPath))
            {
                Usage();
                return(1);
            }

            var config  = JsonConvert.DeserializeObject <BuildBossConfig>(File.ReadAllText(configPath));
            var allGood = true;
            var list    = new List <string>();

            foreach (var projectPath in Directory.EnumerateFiles(sourcePath, "*proj", SearchOption.AllDirectories))
            {
                var relativePath = GetRelativePath(sourcePath, projectPath);
                if (Exclude(config, relativePath))
                {
                    continue;
                }

                var doc         = XDocument.Load(projectPath);
                var projectType = GetProjectType(projectPath);
                var util        = new ProjectUtil(projectType, projectPath, doc);
                var textWriter  = new StringWriter();
                if (!util.CheckAll(textWriter))
                {
                    Console.WriteLine($"Checking {relativePath} failed");
                    Console.WriteLine(textWriter.ToString());
                    list.Add(relativePath);
                    allGood = false;
                }
            }

            return(allGood ? 0 : 1);
        }
示例#12
0
 internal ProjectCheckerUtil(ProjectData data, Dictionary <ProjectKey, ProjectData> solutionMap)
 {
     _data        = data;
     _projectUtil = data.ProjectUtil;
     _solutionMap = solutionMap;
 }
示例#13
0
        private static IEnumerable<string> GetImportProjects(ProjectUtil util)
        {
            foreach (var project in util.GetImportProjects())
            {
                if (IsReplacedValue(project))
                {
                    continue;
                }

                yield return project;
            }
        }
示例#14
0
 internal ProjectCheckerUtil(ProjectData data, Dictionary<ProjectKey, ProjectData> solutionMap)
 {
     _data = data;
     _projectUtil = data.ProjectUtil;
     _solutionMap = solutionMap;
 }
示例#15
0
 internal ProjectData(string filePath)
 {
     FilePath    = filePath;
     ProjectUtil = new ProjectUtil(FilePath);
 }