Skip to content

Commit 2a3c9a4

Browse files
committed
Include output paths for restore command.
1 parent d9dc060 commit 2a3c9a4

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommand.cs

+16-8
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,29 @@ public BuildResult RestoreThenBuild()
6565
if (BuildPartition.IsCustomBuildConfiguration)
6666
return Build().ToBuildResult(GenerateResult);
6767

68-
var restoreResult = Restore();
69-
if (!restoreResult.IsSuccess)
70-
return BuildResult.Failure(GenerateResult, restoreResult.AllInformation);
71-
7268
// On our CI, Integration tests take too much time, because each benchmark run rebuilds BenchmarkDotNet itself.
7369
// To reduce the total duration of the CI workflows, we build all the projects without dependencies
7470
if (BuildPartition.ForcedNoDependenciesForIntegrationTests)
7571
{
72+
var restoreResult = DotNetCliCommandExecutor.Execute(WithArguments(
73+
GetRestoreCommand(GenerateResult.ArtifactsPaths, BuildPartition, $"{Arguments} --no-dependencies", "restore-no-deps", excludeOutput: true)));
74+
if (!restoreResult.IsSuccess)
75+
return BuildResult.Failure(GenerateResult, restoreResult.AllInformation);
76+
7677
return DotNetCliCommandExecutor.Execute(WithArguments(
7778
GetBuildCommand(GenerateResult.ArtifactsPaths, BuildPartition, $"{Arguments} --no-restore --no-dependencies", "build-no-restore-no-deps", excludeOutput: true)))
7879
.ToBuildResult(GenerateResult);
7980
}
81+
else
82+
{
83+
var restoreResult = Restore();
84+
if (!restoreResult.IsSuccess)
85+
return BuildResult.Failure(GenerateResult, restoreResult.AllInformation);
8086

81-
// We no longer retry with --no-dependencies, because it fails with --output set at the same time,
82-
// and the artifactsPaths.BinariesDirectoryPath is set before we try to build, so we cannot overwrite it.
83-
return BuildNoRestore().ToBuildResult(GenerateResult);
87+
// We no longer retry with --no-dependencies, because it fails with --output set at the same time,
88+
// and the artifactsPaths.BinariesDirectoryPath is set before we try to build, so we cannot overwrite it.
89+
return BuildNoRestore().ToBuildResult(GenerateResult);
90+
}
8491
}
8592

8693
[PublicAPI]
@@ -144,14 +151,15 @@ public DotNetCliCommandResult PublishNoRestore()
144151
internal static IEnumerable<string> GetAddPackagesCommands(BuildPartition buildPartition)
145152
=> GetNuGetAddPackageCommands(buildPartition.RepresentativeBenchmarkCase, buildPartition.Resolver);
146153

147-
internal static string GetRestoreCommand(ArtifactsPaths artifactsPaths, BuildPartition buildPartition, string extraArguments = null, string binLogSuffix = null)
154+
internal static string GetRestoreCommand(ArtifactsPaths artifactsPaths, BuildPartition buildPartition, string extraArguments = null, string binLogSuffix = null, bool excludeOutput = false)
148155
=> new StringBuilder()
149156
.AppendArgument("restore")
150157
.AppendArgument(string.IsNullOrEmpty(artifactsPaths.PackagesDirectoryName) ? string.Empty : $"--packages \"{artifactsPaths.PackagesDirectoryName}\"")
151158
.AppendArgument(GetCustomMsBuildArguments(buildPartition.RepresentativeBenchmarkCase, buildPartition.Resolver))
152159
.AppendArgument(extraArguments)
153160
.AppendArgument(GetMandatoryMsBuildSettings(buildPartition.BuildConfiguration))
154161
.AppendArgument(GetMsBuildBinLogArgument(buildPartition, binLogSuffix))
162+
.MaybeAppendOutputPaths(artifactsPaths, excludeOutput)
155163
.ToString();
156164

157165
internal static string GetBuildCommand(ArtifactsPaths artifactsPaths, BuildPartition buildPartition, string extraArguments = null, string binLogSuffix = null, bool excludeOutput = false)

0 commit comments

Comments
 (0)