コード例 #1
0
        private static bool EnsureDotCoverIsAvailable(
            ITaskContext context,
            out string dotCoverExeFileName)
        {
            const string DotCoverCmdLineToolsPackageId
                = "JetBrains.dotCover.CommandLineTools";

            DownloadNugetPackageInUserRepositoryTask downloadPackageTask =
                new DownloadNugetPackageInUserRepositoryTask(
                    DotCoverCmdLineToolsPackageId);

            downloadPackageTask.Execute(context);

            dotCoverExeFileName = Path.Combine(
                downloadPackageTask.PackageDirectory,
                "tools/dotCover.exe");

            if (!File.Exists(dotCoverExeFileName))
            {
                context.Fail(
                    "R# dotCover is not present in the expected location ('{0}'), cannot run test coverage analysis",
                    dotCoverExeFileName);
                return(false);
            }

            return(true);
        }
コード例 #2
0
        private string RunDupFinder(ITaskContext context)
        {
            DownloadNugetPackageInUserRepositoryTask downloadPackageTask = new DownloadNugetPackageInUserRepositoryTask(
                ResharperCmdLineToolsPackageId);

            downloadPackageTask.Execute(context);

            string dupFinderExeFileName = Path.Combine(downloadPackageTask.PackageDirectory, "tools/dupfinder.exe");

            if (!File.Exists(dupFinderExeFileName))
            {
                context.WriteMessage(
                    TaskMessageLevel.Warn,
                    "R# dupfinder is not present in the expected location ('{0}'), cannot run source code duplicates analysis",
                    dupFinderExeFileName);
                return(null);
            }

            string buildsDir = context.Properties[BuildProps.BuildDir];
            string dupFinderXmlReportFileName = Path.Combine(buildsDir, "dupfinder-report.xml");

            IRunProgramTask task = new RunProgramTask(
                dupFinderExeFileName)
                                   .AddArgument("--output={0}", dupFinderXmlReportFileName)
                                   .AddArgument("--show-text");

            if (exclude != null)
            {
                task.AddArgument("--exclude={0}", exclude);
            }
            if (excludeByComment != null)
            {
                task.AddArgument("--exclude-by-comment={0}", excludeByComment);
            }
            if (excludeCodeRegions != null)
            {
                task.AddArgument("--exclude-code-regions={0}", excludeCodeRegions);
            }

            task
            .AddArgument(context.Properties[BuildProps.SolutionFileName])
            .Execute(context);

            return(dupFinderXmlReportFileName);
        }