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

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

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