예제 #1
0
        public override bool Execute()
        {
            var logger = new MsBuildLogger(Log);

            global::NDepCheck.Log.Logger = logger;
            global::NDepCheck.Log.SetLevel(
                Verbose ? global::NDepCheck.Log.Level.Verbose : global::NDepCheck.Log.Level.Standard);

            var args = new List <string>();

            if (Verbose)
            {
                args.Add("/v");
            }

            if (ShowUnusedQuestionableRules)
            {
                args.Add("/q");
            }

            args.Add("/n " + (MaxCpuCount == 0 || MaxCpuCount < -1 ? Environment.ProcessorCount : MaxCpuCount));

            if (DefaultRuleSet != null)
            {
                args.Add("/x " + DefaultRuleSet.ItemSpec);
            }

            //Directories?.Select(GetDirectoryOptionFromTaskItem).AddTo(options.Directories);

            var program = new Program();

            ExitCode = program.Run(args.ToArray(), new string[0], new GlobalContext(), null, logCommands: false);

            return(ExitCode == 0);
        }
예제 #2
0
        public override bool Execute()
        {
            var logger = new MsBuildLogger(Log);

            global::NDepCheck.Log.Logger           = logger;
            global::NDepCheck.Log.IsVerboseEnabled = false;
            global::NDepCheck.Log.IsDebugEnabled   = Debug;

            var options = new Options {
                Debug                       = false,
                Verbose                     = Verbose,
                DotFilename                 = DotFilename,
                ShowTransitiveEdges         = ShowTransitiveEdges,
                ShowUnusedQuestionableRules = ShowUnusedQuestionableRules,
                MaxCpuCount                 = MaxCpuCount == 0 || MaxCpuCount < -1 ? Environment.ProcessorCount : MaxCpuCount,
                XmlOutput                   = XmlOutput,
            };

            Assemblies
            .Select(item => new AssemblyOption(item.ItemSpec, null))
            .AddTo(options.Assemblies);

            if (DefaultRuleSet != null)
            {
                options.DefaultRuleSetFile = DefaultRuleSet.ItemSpec;
            }
            if (Directories != null)
            {
                Directories
                .Select(GetDirectoryOptionFromTaskItem)
                .AddTo(options.Directories);
            }

            var main = new Program(options);

            ExitCode = main.Run();

            return(ExitCode == 0);
        }