Example #1
0
        private static BenchmarkReport CreateFailureReport(BenchmarkCase benchmark)
        {
            GenerateResult generateResult = GenerateResult.Failure(ArtifactsPaths.Empty, Array.Empty <string>());
            BuildResult    buildResult    = BuildResult.Failure(generateResult, string.Empty);

            // Null may be legitimately passed as metrics to BenchmarkReport ctor here:
            // https://github.com/dotnet/BenchmarkDotNet/blob/89255c9fceb1b27c475a93d08c152349be4199e9/src/BenchmarkDotNet/Running/BenchmarkRunner.cs#L197
            return(new BenchmarkReport(false, benchmark, generateResult, buildResult, default, default, default, default));
        public GenerateResult GenerateProject(Benchmark benchmark, ILogger logger, string rootArtifactsFolderPath, IConfig config, IResolver resolver)
        {
            if (!(benchmark is ExternalProcessBenchmark))
            {
                return(GenerateResult.Failure(null, Array.Empty <string>()));
            }

            return(GenerateResult.Success(_artifactsPaths, Array.Empty <string>()));
        }
Example #3
0
        public GenerateResult GenerateProject(
            BuildPartition buildPartition,
            ILogger logger,
            string rootArtifactsFolderPath)
        {
            var artifactsPaths = ArtifactsPaths.Empty;

            try
            {
                artifactsPaths = GetArtifactsPaths(buildPartition, rootArtifactsFolderPath);

                return(GenerateResult.Success(artifactsPaths, new List <string>()));
            }
            catch (Exception ex)
            {
                logger.WriteLineError($"Failed to generate partition: {ex}");
                return(GenerateResult.Failure(artifactsPaths, new List <string>()));
            }
        }
Example #4
0
        public GenerateResult GenerateProject(Benchmark benchmark, ILogger logger, string rootArtifactsFolderPath, IConfig config, IResolver resolver)
        {
            ArtifactsPaths artifactsPaths = null;

            try
            {
                artifactsPaths = GetArtifactsPaths(benchmark, config, rootArtifactsFolderPath);

                CopyAllRequiredFiles(benchmark, artifactsPaths);

                GenerateCode(benchmark, artifactsPaths);
                GenerateAppConfig(benchmark, artifactsPaths, resolver);
                GenerateProject(benchmark, artifactsPaths, resolver, logger);
                GenerateBuildScript(benchmark, artifactsPaths, resolver);

                return(GenerateResult.Success(artifactsPaths, GetArtifactsToCleanup(benchmark, artifactsPaths)));
            }
            catch (Exception ex)
            {
                return(GenerateResult.Failure(artifactsPaths, GetArtifactsToCleanup(benchmark, artifactsPaths), ex));
            }
        }
        public GenerateResult GenerateProject(BuildPartition buildPartition, ILogger logger, string rootArtifactsFolderPath)
        {
            var artifactsPaths = ArtifactsPaths.Empty;

            try
            {
                artifactsPaths = GetArtifactsPaths(buildPartition, rootArtifactsFolderPath);

                CopyAllRequiredFiles(artifactsPaths);

                GenerateCode(buildPartition, artifactsPaths);
                GenerateAppConfig(buildPartition, artifactsPaths);
                GenerateNuGetConfig(artifactsPaths);
                GenerateProject(buildPartition, artifactsPaths, logger);
                GenerateBuildScript(buildPartition, artifactsPaths);

                return(GenerateResult.Success(artifactsPaths, GetArtifactsToCleanup(artifactsPaths)));
            }
            catch (Exception ex)
            {
                return(GenerateResult.Failure(artifactsPaths, GetArtifactsToCleanup(artifactsPaths), ex));
            }
        }