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

                yield return(project);
            }
        }
        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;
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
        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;
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #12
0
 internal ProjectCheckerUtil(ProjectData data, Dictionary <ProjectKey, ProjectData> solutionMap)
 {
     _data        = data;
     _projectUtil = data.ProjectUtil;
     _solutionMap = solutionMap;
 }
        private static IEnumerable<string> GetImportProjects(ProjectUtil util)
        {
            foreach (var project in util.GetImportProjects())
            {
                if (IsReplacedValue(project))
                {
                    continue;
                }

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