diff --git a/build/Targets/Packages.props b/build/Targets/Packages.props index b7617021c2ed0eda37161d86ef28c1cf2fc8f4fe..70ef45e98fba7c1cb162329538d108450fedc45d 100644 --- a/build/Targets/Packages.props +++ b/build/Targets/Packages.props @@ -32,7 +32,7 @@ 1.0.0-beta1-63310-01 0.9.3 - 0.11.0 + 0.11.1 2.0.273-beta 8.0.2 8.0.0 diff --git a/src/Tools/CompilerBenchmarks/CompilerBenchmarks.csproj b/src/Tools/CompilerBenchmarks/CompilerBenchmarks.csproj index 9533be52272d3913d68f12fd7cc4e6f9d8e0635a..1984dad566ff493c8e4c7bfa6d4fd59d9cc2b913 100644 --- a/src/Tools/CompilerBenchmarks/CompilerBenchmarks.csproj +++ b/src/Tools/CompilerBenchmarks/CompilerBenchmarks.csproj @@ -6,6 +6,7 @@ Exe netcoreapp2.1 false + AnyCpu diff --git a/src/Tools/CompilerBenchmarks/FixedCsProjGenerator.cs b/src/Tools/CompilerBenchmarks/FixedCsProjGenerator.cs deleted file mode 100644 index c7b7117f2f50823d661c4b1736ba8def510d9cc6..0000000000000000000000000000000000000000 --- a/src/Tools/CompilerBenchmarks/FixedCsProjGenerator.cs +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.IO; -using System.Text; -using BenchmarkDotNet.Environments; -using BenchmarkDotNet.Loggers; -using BenchmarkDotNet.Running; -using BenchmarkDotNet.Toolchains; -using BenchmarkDotNet.Toolchains.CsProj; -using BenchmarkDotNet.Toolchains.DotNetCli; - -namespace CompilerBenchmarks -{ - public class FixedCsProjGenerator : CsProjGenerator - { - private const string Template = @" - - - false - false - - - - - - $PROGRAMNAME$ - $TFM$ - true - $PLATFORM$ - $PROGRAMNAME$ - Exe - bin\$CONFIGURATIONNAME$ - False - pdbonly - true - $COPIEDSETTINGS$ - - - - - - - - - - $RUNTIMESETTINGS$ - - -"; - - public FixedCsProjGenerator(string targetFrameworkMoniker, Func platformProvider, string runtimeFrameworkVersion = null) - : base(targetFrameworkMoniker, platformProvider, runtimeFrameworkVersion) - { } - - protected override string GetBuildArtifactsDirectoryPath(BuildPartition buildPartition, string programName) - { - string directoryName = Path.GetDirectoryName(buildPartition.AssemblyLocation) - ?? throw new DirectoryNotFoundException(buildPartition.AssemblyLocation); - return Path.Combine(directoryName, programName); - } - - public new static string PlatformProvider(Platform p) => p.ToString(); - - public static IToolchain Default => new Toolchain( - "FixedCsProjToolchain", - new FixedCsProjGenerator("netcoreapp2.0", PlatformProvider), - new DotNetCliBuilder("netcoreapp2.0"), - new DotNetCliExecutor(null)); - - protected override void GenerateProject(BuildPartition buildPartition, ArtifactsPaths artifactsPaths, ILogger logger) - { - string template = Template; - var benchmark = buildPartition.RepresentativeBenchmarkCase; - var projectFile = GetProjectFilePath(benchmark.Descriptor.Type, logger); - - string platform = PlatformProvider(buildPartition.Platform); - string content = SetPlatform(template, platform); - content = SetCodeFileName(content, Path.GetFileName(artifactsPaths.ProgramCodePath)); - content = content.Replace("$CSPROJPATH$", projectFile.FullName); - content = SetTargetFrameworkMoniker(content, TargetFrameworkMoniker); - content = content.Replace("$PROGRAMNAME$", artifactsPaths.ProgramName); - content = content.Replace("$RUNTIMESETTINGS$", GetRuntimeSettings(benchmark.Job.Environment.Gc, buildPartition.Resolver)); - content = content.Replace("$COPIEDSETTINGS$", GetSettingsThatNeedsToBeCopied(projectFile)); - content = content.Replace("$CONFIGURATIONNAME$", buildPartition.BuildConfiguration); - - File.WriteAllText(artifactsPaths.ProjectFilePath, content); - } - - // the host project or one of the .props file that it imports might contain some custom settings that needs to be copied, sth like - // 2.0.0-beta-001607-00 - // 2.0.0-beta-001607-00 - private string GetSettingsThatNeedsToBeCopied(FileInfo projectFile) - { - if (!string.IsNullOrEmpty(RuntimeFrameworkVersion)) // some power users knows what to configure, just do it and copy nothing more - return $"{RuntimeFrameworkVersion}"; - - var customSettings = new StringBuilder(); - using (var file = new StreamReader(File.OpenRead(projectFile.FullName))) - { - string line; - while ((line = file.ReadLine()) != null) - { - if (line.Contains("NetCoreAppImplicitPackageVersion") || line.Contains("RuntimeFrameworkVersion") || line.Contains("PackageTargetFallback") || line.Contains("LangVersion")) - { - customSettings.Append(line); - } - else if (line.Contains(" - var directoryName = projectFile.DirectoryName ?? throw new DirectoryNotFoundException(projectFile.DirectoryName); - string absolutePath = File.Exists(propsFilePath) - ? propsFilePath // absolute path or relative to current dir - : Path.Combine(directoryName, propsFilePath); // relative to csproj - - if (File.Exists(absolutePath)) - { - customSettings.Append(GetSettingsThatNeedsToBeCopied(new FileInfo(absolutePath))); - } - } - } - } - - return customSettings.ToString(); - } - } -} diff --git a/src/Tools/CompilerBenchmarks/Program.cs b/src/Tools/CompilerBenchmarks/Program.cs index 3b17819d9851455ed7c9a70dda02be90b174f4f8..01d0ae2f08a1ef5b97a9264e44f6fffd701f31ed 100644 --- a/src/Tools/CompilerBenchmarks/Program.cs +++ b/src/Tools/CompilerBenchmarks/Program.cs @@ -22,10 +22,7 @@ public IgnoreReleaseOnly() Add(DefaultConfig.Instance.GetExporters().ToArray()); Add(DefaultConfig.Instance.GetColumnProviders().ToArray()); Add(MemoryDiagnoser.Default); - Add(new Job - { - Infrastructure = { Toolchain = FixedCsProjGenerator.Default } - }); + Add(Job.Core); } }