Skip to content

Commit e903115

Browse files
update SDK to .NET 8 (#2462)
* [build] Bump .NET SDK: 7.0.401->8.0.100 * Fix tests after migration to .NET 8 * [build] Force cake to use our .NET SDK * [build] Bump Cake.Frosting: 3.0.0->3.2.0 * [build] Fix PATH setting in build.ps1 --------- Co-authored-by: Andrey Akinshin <[email protected]>
1 parent 1b39e8e commit e903115

File tree

28 files changed

+52
-46
lines changed

28 files changed

+52
-46
lines changed

.github/workflows/run-tests.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@ jobs:
2020
- uses: actions/checkout@v3
2121
- name: Run task 'build'
2222
shell: cmd
23-
run: |
24-
./build.cmd build
23+
run: ./build.cmd build
2524
- name: Run task 'in-tests-core'
2625
shell: cmd
27-
run: |
28-
./build.cmd in-tests-core -e
26+
run: ./build.cmd in-tests-core -e
2927
- name: Upload test results
3028
uses: actions/upload-artifact@v3
3129
if: always()
@@ -42,12 +40,10 @@ jobs:
4240
- uses: actions/checkout@v3
4341
- name: Run task 'build'
4442
shell: cmd
45-
run: |
46-
./build.cmd build
43+
run: ./build.cmd build
4744
- name: Run task 'in-tests-full'
4845
shell: cmd
49-
run: |
50-
./build.cmd in-tests-full -e
46+
run: ./build.cmd in-tests-full -e
5147
- name: Upload test results
5248
uses: actions/upload-artifact@v3
5349
if: always()

build/BenchmarkDotNet.Build/BenchmarkDotNet.Build.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
88
<ItemGroup>
9-
<PackageReference Include="Cake.Frosting" Version="3.0.0" />
9+
<PackageReference Include="Cake.Frosting" Version="3.2.0" />
1010
<PackageReference Include="Cake.FileHelpers" Version="6.1.3" />
1111
<PackageReference Include="Cake.Git" Version="3.0.0" />
1212
<PackageReference Include="Docfx.App" Version="2.71.1" />

build/BenchmarkDotNet.Build/BuildContext.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ public BuildContext(ICakeContext context)
5959
BuildDirectory = RootDirectory.Combine("build");
6060
ArtifactsDirectory = RootDirectory.Combine("artifacts");
6161

62+
var toolFileName = context.IsRunningOnWindows() ? "dotnet.exe" : "dotnet";
63+
var toolFilePath = RootDirectory.Combine(".dotnet").CombineWithFilePath(toolFileName);
64+
context.Tools.RegisterFile(toolFilePath);
6265

6366
SolutionFile = RootDirectory.CombineWithFilePath("BenchmarkDotNet.sln");
6467

build/BenchmarkDotNet.Build/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public class InTestsFullTask : FrostingTask<BuildContext>, IHelpProvider
9898
public class InTestsCoreTask : FrostingTask<BuildContext>, IHelpProvider
9999
{
100100
private const string Name = "in-tests-core";
101-
public override void Run(BuildContext context) => context.UnitTestRunner.RunInTests("net7.0");
101+
public override void Run(BuildContext context) => context.UnitTestRunner.RunInTests("net8.0");
102102
public HelpInfo GetHelp() => new();
103103
}
104104

build/BenchmarkDotNet.Build/Runners/BuildRunner.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public void Restore()
2424
context.DotNetRestore(context.SolutionFile.FullPath,
2525
new DotNetRestoreSettings
2626
{
27-
MSBuildSettings = context.MsBuildSettingsRestore
27+
MSBuildSettings = context.MsBuildSettingsRestore,
28+
Verbosity = DotNetVerbosity.Normal
2829
});
2930
}
3031

build/BenchmarkDotNet.Build/Runners/UnitTestRunner.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ private void RunTests(FilePath projectFile, string alias, string tfm)
6363
public void RunUnitTests()
6464
{
6565
var targetFrameworks = context.IsRunningOnWindows()
66-
? new[] { "net462", "net7.0" }
67-
: new[] { "net7.0" };
66+
? new[] { "net462", "net8.0" }
67+
: new[] { "net8.0" };
6868

6969
foreach (var targetFramework in targetFrameworks)
7070
RunUnitTests(targetFramework);

build/build.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,10 @@ if (!(Test-Path $InstallPath)) {
5858
$ScriptPath = Join-Path $InstallPath 'dotnet-install.ps1'
5959
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, $ScriptPath);
6060
& $ScriptPath -JSonFile $GlobalJsonPath -InstallDir $InstallPath;
61-
62-
Remove-PathVariable "$InstallPath"
63-
$env:PATH = "$InstallPath;$env:PATH"
6461
}
6562

63+
Remove-PathVariable "$InstallPath"
64+
$env:PATH = "$InstallPath;$env:PATH"
6665
$env:DOTNET_ROOT=$InstallPath
6766

6867
###########################################################################

build/sdk/global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "7.0.401",
3+
"version": "8.0.100",
44
"rollForward": "disable"
55
}
66
}

samples/BenchmarkDotNet.Samples.FSharp/BenchmarkDotNet.Samples.FSharp.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</PropertyGroup>
66
<PropertyGroup>
77
<OutputType>Exe</OutputType>
8-
<TargetFrameworks>net462;net7.0</TargetFrameworks>
8+
<TargetFrameworks>net462;net8.0</TargetFrameworks>
99
</PropertyGroup>
1010
<ItemGroup>
1111
<Compile Include="Program.fs" />

samples/BenchmarkDotNet.Samples/BenchmarkDotNet.Samples.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Import Project="..\..\build\common.props" />
33
<PropertyGroup>
44
<AssemblyTitle>BenchmarkDotNet.Samples</AssemblyTitle>
5-
<TargetFrameworks>net7.0;net462</TargetFrameworks>
5+
<TargetFrameworks>net8.0;net462</TargetFrameworks>
66
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
77
<AssemblyName>BenchmarkDotNet.Samples</AssemblyName>
88
<OutputType>Exe</OutputType>

0 commit comments

Comments
 (0)