@@ -53,7 +53,7 @@ public DotNetCliCommand WithCliPath(string cliPath)
53
53
=> new ( cliPath , Arguments , GenerateResult , Logger , BuildPartition , EnvironmentVariables , Timeout , logOutput : LogOutput ) ;
54
54
55
55
[ PublicAPI ]
56
- public BuildResult RestoreThenBuild ( )
56
+ public BuildResult RestoreThenBuild ( bool useArtifactsPathIfSupported = true )
57
57
{
58
58
DotNetCliCommandExecutor . LogEnvVars ( WithArguments ( null ) ) ;
59
59
@@ -65,35 +65,35 @@ public BuildResult RestoreThenBuild()
65
65
// so when users go with custom build configuration, we must perform full build
66
66
// which will internally restore for the right configuration
67
67
if ( BuildPartition . IsCustomBuildConfiguration )
68
- return Build ( ) . ToBuildResult ( GenerateResult ) ;
68
+ return Build ( useArtifactsPathIfSupported ) . ToBuildResult ( GenerateResult ) ;
69
69
70
70
// On our CI, Integration tests take too much time, because each benchmark run rebuilds BenchmarkDotNet itself.
71
71
// To reduce the total duration of the CI workflows, we build all the projects without dependencies
72
72
if ( BuildPartition . ForcedNoDependenciesForIntegrationTests )
73
73
{
74
74
var restoreResult = DotNetCliCommandExecutor . Execute ( WithArguments (
75
- GetRestoreCommand ( GenerateResult . ArtifactsPaths , BuildPartition , GetWithArtifactsPath ( ) , $ "{ Arguments } --no-dependencies", "restore-no-deps" , excludeOutput : true ) ) ) ;
75
+ GetRestoreCommand ( GenerateResult . ArtifactsPaths , BuildPartition , GetWithArtifactsPath ( useArtifactsPathIfSupported ) , $ "{ Arguments } --no-dependencies", "restore-no-deps" , excludeOutput : true ) ) ) ;
76
76
if ( ! restoreResult . IsSuccess )
77
77
return BuildResult . Failure ( GenerateResult , restoreResult . AllInformation ) ;
78
78
79
79
return DotNetCliCommandExecutor . Execute ( WithArguments (
80
- GetBuildCommand ( GenerateResult . ArtifactsPaths , BuildPartition , GetWithArtifactsPath ( ) , $ "{ Arguments } --no-restore --no-dependencies", "build-no-restore-no-deps" , excludeOutput : true ) ) )
80
+ GetBuildCommand ( GenerateResult . ArtifactsPaths , BuildPartition , GetWithArtifactsPath ( useArtifactsPathIfSupported ) , $ "{ Arguments } --no-restore --no-dependencies", "build-no-restore-no-deps" , excludeOutput : true ) ) )
81
81
. ToBuildResult ( GenerateResult ) ;
82
82
}
83
83
else
84
84
{
85
- var restoreResult = Restore ( ) ;
85
+ var restoreResult = Restore ( useArtifactsPathIfSupported ) ;
86
86
if ( ! restoreResult . IsSuccess )
87
87
return BuildResult . Failure ( GenerateResult , restoreResult . AllInformation ) ;
88
88
89
89
// We no longer retry with --no-dependencies, because it fails with --output set at the same time,
90
90
// and the artifactsPaths.BinariesDirectoryPath is set before we try to build, so we cannot overwrite it.
91
- return BuildNoRestore ( ) . ToBuildResult ( GenerateResult ) ;
91
+ return BuildNoRestore ( useArtifactsPathIfSupported ) . ToBuildResult ( GenerateResult ) ;
92
92
}
93
93
}
94
94
95
95
[ PublicAPI ]
96
- public BuildResult RestoreThenBuildThenPublish ( )
96
+ public BuildResult RestoreThenBuildThenPublish ( bool useArtifactsPathIfSupported = true )
97
97
{
98
98
DotNetCliCommandExecutor . LogEnvVars ( WithArguments ( null ) ) ;
99
99
@@ -105,14 +105,14 @@ public BuildResult RestoreThenBuildThenPublish()
105
105
// so when users go with custom build configuration, we must perform full publish
106
106
// which will internally restore and build for the right configuration
107
107
if ( BuildPartition . IsCustomBuildConfiguration )
108
- return Publish ( ) . ToBuildResult ( GenerateResult ) ;
108
+ return Publish ( useArtifactsPathIfSupported ) . ToBuildResult ( GenerateResult ) ;
109
109
110
- var restoreResult = Restore ( ) ;
110
+ var restoreResult = Restore ( useArtifactsPathIfSupported ) ;
111
111
if ( ! restoreResult . IsSuccess )
112
112
return BuildResult . Failure ( GenerateResult , restoreResult . AllInformation ) ;
113
113
114
114
// We use the implicit build in the publish command. We stopped doing a separate build step because we set the --output.
115
- return PublishNoRestore ( ) . ToBuildResult ( GenerateResult ) ;
115
+ return PublishNoRestore ( useArtifactsPathIfSupported ) . ToBuildResult ( GenerateResult ) ;
116
116
}
117
117
118
118
public DotNetCliCommandResult AddPackages ( )
@@ -129,28 +129,28 @@ public DotNetCliCommandResult AddPackages()
129
129
return DotNetCliCommandResult . Success ( executionTime , stdOutput . ToString ( ) ) ;
130
130
}
131
131
132
- private bool GetWithArtifactsPath ( ) => DotNetCliCommandExecutor . DotNetSdkSupportsArtifactsPath ( CliPath ) ;
132
+ private bool GetWithArtifactsPath ( bool useArtifactsPathIfSupported ) => useArtifactsPathIfSupported && DotNetCliCommandExecutor . DotNetSdkSupportsArtifactsPath ( CliPath ) ;
133
133
134
- public DotNetCliCommandResult Restore ( )
134
+ public DotNetCliCommandResult Restore ( bool useArtifactsPathIfSupported = true )
135
135
=> DotNetCliCommandExecutor . Execute ( WithArguments (
136
- GetRestoreCommand ( GenerateResult . ArtifactsPaths , BuildPartition , GetWithArtifactsPath ( ) , Arguments , "restore" ) ) ) ;
136
+ GetRestoreCommand ( GenerateResult . ArtifactsPaths , BuildPartition , GetWithArtifactsPath ( useArtifactsPathIfSupported ) , Arguments , "restore" ) ) ) ;
137
137
138
- public DotNetCliCommandResult Build ( )
138
+ public DotNetCliCommandResult Build ( bool useArtifactsPathIfSupported = true )
139
139
=> DotNetCliCommandExecutor . Execute ( WithArguments (
140
- GetBuildCommand ( GenerateResult . ArtifactsPaths , BuildPartition , GetWithArtifactsPath ( ) , Arguments , "build" ) ) ) ;
140
+ GetBuildCommand ( GenerateResult . ArtifactsPaths , BuildPartition , GetWithArtifactsPath ( useArtifactsPathIfSupported ) , Arguments , "build" ) ) ) ;
141
141
142
- public DotNetCliCommandResult BuildNoRestore ( )
142
+ public DotNetCliCommandResult BuildNoRestore ( bool useArtifactsPathIfSupported = true )
143
143
=> DotNetCliCommandExecutor . Execute ( WithArguments (
144
- GetBuildCommand ( GenerateResult . ArtifactsPaths , BuildPartition , GetWithArtifactsPath ( ) , $ "{ Arguments } --no-restore", "build-no-restore" ) ) ) ;
144
+ GetBuildCommand ( GenerateResult . ArtifactsPaths , BuildPartition , GetWithArtifactsPath ( useArtifactsPathIfSupported ) , $ "{ Arguments } --no-restore", "build-no-restore" ) ) ) ;
145
145
146
- public DotNetCliCommandResult Publish ( )
146
+ public DotNetCliCommandResult Publish ( bool useArtifactsPathIfSupported = true )
147
147
=> DotNetCliCommandExecutor . Execute ( WithArguments (
148
- GetPublishCommand ( GenerateResult . ArtifactsPaths , BuildPartition , GetWithArtifactsPath ( ) , Arguments , "publish" ) ) ) ;
148
+ GetPublishCommand ( GenerateResult . ArtifactsPaths , BuildPartition , GetWithArtifactsPath ( useArtifactsPathIfSupported ) , Arguments , "publish" ) ) ) ;
149
149
150
150
// PublishNoBuildAndNoRestore was removed because we set --output in the build step. We use the implicit build included in the publish command.
151
- public DotNetCliCommandResult PublishNoRestore ( )
151
+ public DotNetCliCommandResult PublishNoRestore ( bool useArtifactsPathIfSupported = true )
152
152
=> DotNetCliCommandExecutor . Execute ( WithArguments (
153
- GetPublishCommand ( GenerateResult . ArtifactsPaths , BuildPartition , GetWithArtifactsPath ( ) , $ "{ Arguments } --no-restore", "publish-no-restore" ) ) ) ;
153
+ GetPublishCommand ( GenerateResult . ArtifactsPaths , BuildPartition , GetWithArtifactsPath ( useArtifactsPathIfSupported ) , $ "{ Arguments } --no-restore", "publish-no-restore" ) ) ) ;
154
154
155
155
internal static IEnumerable < string > GetAddPackagesCommands ( BuildPartition buildPartition )
156
156
=> GetNuGetAddPackageCommands ( buildPartition . RepresentativeBenchmarkCase , buildPartition . Resolver ) ;
0 commit comments