Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 65de55d

Browse files
[build] Force cake to use our .NET SDK
1 parent 3b1bf7a commit 65de55d

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

build/BenchmarkDotNet.Build/BuildContext.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public class BuildContext : FrostingContext
2929
public DirectoryPath BuildDirectory { get; }
3030
public DirectoryPath ArtifactsDirectory { get; }
3131

32+
public FilePath ToolPath { get; }
3233
public FilePath SolutionFile { get; }
3334
public FilePath TemplatesTestsProjectFile { get; }
3435
public FilePathCollection AllPackableSrcProjects { get; }
@@ -59,7 +60,8 @@ public BuildContext(ICakeContext context)
5960
BuildDirectory = RootDirectory.Combine("build");
6061
ArtifactsDirectory = RootDirectory.Combine("artifacts");
6162

62-
63+
var toolExecutable = context.IsRunningOnWindows() ? "dotnet.exe" : "dotnet";
64+
ToolPath = RootDirectory.Combine(".dotnet").CombineWithFilePath(toolExecutable);
6365
SolutionFile = RootDirectory.CombineWithFilePath("BenchmarkDotNet.sln");
6466

6567
TemplatesTestsProjectFile = RootDirectory.Combine("templates")

build/BenchmarkDotNet.Build/Runners/BuildRunner.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ 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,
29+
ToolPath = context.ToolPath
2830
});
2931
}
3032

@@ -37,7 +39,8 @@ public void Build()
3739
DiagnosticOutput = true,
3840
MSBuildSettings = context.MsBuildSettingsBuild,
3941
Configuration = context.BuildConfiguration,
40-
Verbosity = context.BuildVerbosity
42+
Verbosity = context.BuildVerbosity,
43+
ToolPath = context.ToolPath
4144
});
4245
}
4346

@@ -49,7 +52,8 @@ public void BuildProjectSilent(FilePath projectFile)
4952
DiagnosticOutput = false,
5053
MSBuildSettings = context.MsBuildSettingsBuild,
5154
Configuration = context.BuildConfiguration,
52-
Verbosity = DotNetVerbosity.Quiet
55+
Verbosity = DotNetVerbosity.Quiet,
56+
ToolPath = context.ToolPath
5357
});
5458
}
5559

@@ -62,7 +66,8 @@ public void Pack()
6266
OutputDirectory = context.ArtifactsDirectory,
6367
ArgumentCustomization = args => args.Append("--include-symbols").Append("-p:SymbolPackageFormat=snupkg"),
6468
MSBuildSettings = context.MsBuildSettingsPack,
65-
Configuration = context.BuildConfiguration
69+
Configuration = context.BuildConfiguration,
70+
ToolPath = context.ToolPath
6671
};
6772

6873
foreach (var project in context.AllPackableSrcProjects)
@@ -72,7 +77,8 @@ public void Pack()
7277
{
7378
OutputDirectory = context.ArtifactsDirectory,
7479
MSBuildSettings = context.MsBuildSettingsPack,
75-
Configuration = context.BuildConfiguration
80+
Configuration = context.BuildConfiguration,
81+
ToolPath = context.ToolPath
7682
};
7783
context.DotNetPack(context.TemplatesTestsProjectFile.FullPath, settingsTemplate);
7884
}

build/BenchmarkDotNet.Build/Runners/ReleaseRunner.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ private void PushNupkg()
112112
{
113113
ApiKey = nuGetToken,
114114
SymbolApiKey = nuGetToken,
115-
Source = "https://api.nuget.org/v3/index.json"
115+
Source = "https://api.nuget.org/v3/index.json",
116+
ToolPath = context.ToolPath
116117
};
117118

118119
foreach (var file in files)

build/BenchmarkDotNet.Build/Runners/UnitTestRunner.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ private DotNetTestSettings GetTestSettingsParameters(FilePath logFile, string tf
4242
EnvironmentVariables =
4343
{
4444
["Platform"] = "" // force the tool to not look for the .dll in platform-specific directory
45-
}
45+
},
46+
ToolPath = context.ToolPath
4647
};
4748
return settings;
4849
}

0 commit comments

Comments
 (0)