Skip to content

Commit e4f2d88

Browse files
[build] Force cake to use our .NET SDK
1 parent e2dbfdf commit e4f2d88

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed

.github/workflows/run-tests.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ jobs:
1818
run: Set-MpPreference -DisableRealtimeMonitoring $true
1919
shell: powershell
2020
- uses: actions/checkout@v3
21+
- name: Run task 'sdk-check'
22+
shell: cmd
23+
run: ./build.cmd sdk-check
2124
- name: Run task 'build'
2225
shell: cmd
2326
run: |
@@ -40,6 +43,9 @@ jobs:
4043
run: Set-MpPreference -DisableRealtimeMonitoring $true
4144
shell: powershell
4245
- uses: actions/checkout@v3
46+
- name: Run task 'sdk-check'
47+
shell: cmd
48+
run: ./build.cmd sdk-check
4349
- name: Run task 'build'
4450
shell: cmd
4551
run: |
@@ -66,6 +72,8 @@ jobs:
6672
platform: x64
6773
- name: Set up zlib-static
6874
run: sudo apt-get install -y libkrb5-dev
75+
- name: Run task 'sdk-check'
76+
run: ./build.cmd sdk-check
6977
- name: Run task 'build'
7078
run: ./build.cmd build
7179
- name: Run task 'unit-tests'
@@ -83,6 +91,8 @@ jobs:
8391
runs-on: macos-13
8492
steps:
8593
- uses: actions/checkout@v3
94+
- name: Run task 'sdk-check'
95+
run: ./build.cmd sdk-check
8696
- name: Run task 'build'
8797
run: ./build.cmd build
8898
- name: Run task 'unit-tests'

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: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using BenchmarkDotNet.Build.Meta;
22
using BenchmarkDotNet.Build.Options;
33
using Cake.Common;
4+
using Cake.Common.Diagnostics;
5+
using Cake.Common.Tools.DotNet;
46
using Cake.Frosting;
57

68
namespace BenchmarkDotNet.Build;
@@ -16,6 +18,29 @@ public static int Main(string[] args)
1618
}
1719
}
1820

21+
[TaskName(Name)]
22+
[TaskDescription(".NET SDK Check")]
23+
public class SdkCheckTask : FrostingTask<BuildContext>, IHelpProvider
24+
{
25+
private const string Name = "sdk-check";
26+
27+
public override void Run(BuildContext context)
28+
{
29+
context.DotNetSDKCheck();
30+
}
31+
32+
public HelpInfo GetHelp()
33+
{
34+
return new HelpInfo
35+
{
36+
Examples = new[]
37+
{
38+
new Example(Name)
39+
}
40+
};
41+
}
42+
}
43+
1944
[TaskName(Name)]
2045
[TaskDescription("Restore NuGet packages")]
2146
public class RestoreTask : FrostingTask<BuildContext>, IHelpProvider

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

0 commit comments

Comments
 (0)