예제 #1
0
파일: Program.cs 프로젝트: znatz/roslyn
        private static int MainCore(string[] args)
        {
            if (args.Length == 0)
            {
                Usage();
                return(1);
            }

            var allGood = true;

            foreach (var arg in args)
            {
                if (SharedUtil.IsSolutionFile(arg))
                {
                    allGood &= ProcessSolution(arg);
                }
                else if (Path.GetExtension(arg) == ".xml")
                {
                    allGood &= ProcessStructuredLog(arg);
                }
                else
                {
                    allGood &= ProcessTargets(arg);
                }
            }

            if (!allGood)
            {
                Console.WriteLine("Failed");
            }

            return(allGood ? 0 : 1);
        }
예제 #2
0
        internal bool CheckAll(TextWriter textWriter)
        {
            var allGood = true;

            foreach (var filePath in Directory.GetFiles(_targetDir))
            {
                var fileName = Path.GetFileName(filePath);
                if (fileName == "README.md")
                {
                    continue;
                }

                textWriter.WriteLine($"Checking {fileName}");
                if (SharedUtil.IsPropsFile(filePath))
                {
                    allGood &= CheckProps(new ProjectUtil(filePath), textWriter);
                }
                else if (SharedUtil.IsTargetsFile(filePath))
                {
                    allGood &= CheckTargets(new ProjectUtil(filePath), textWriter);
                }
                else if (SharedUtil.IsXslt(filePath))
                {
                    // Nothing to verify
                }
                else
                {
                    textWriter.WriteLine("Unrecognized file type");
                    allGood = false;
                }
            }

            return(allGood);
        }
예제 #3
0
        internal static int Main(string[] args)
        {
            if (args.Length == 0)
            {
                Usage();
                return(1);
            }

            var allGood = true;

            foreach (var arg in args)
            {
                if (SharedUtil.IsSolutionFile(arg))
                {
                    allGood &= ProcessSolution(arg);
                }
                else if (Path.GetExtension(arg) == ".xml")
                {
                    allGood &= ProcessStructuredLog(arg);
                }
                else
                {
                    allGood &= ProcessTargets(arg);
                }
            }

            return(allGood ? 0 : 1);
        }
예제 #4
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);
        }
예제 #5
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);
        }