@@ -76,7 +76,7 @@ internal static Summary[] Run(BenchmarkRunInfo[] benchmarkRunInfos)
76
76
var globalChronometer = Chronometer . Start ( ) ;
77
77
78
78
var buildPartitions = BenchmarkPartitioner . CreateForBuild ( supportedBenchmarks , resolver ) ;
79
- var buildResults = BuildInParallel ( compositeLogger , rootArtifactsFolderPath , buildPartitions , in globalChronometer ) ;
79
+ var buildResults = Build ( compositeLogger , rootArtifactsFolderPath , buildPartitions , in globalChronometer ) ;
80
80
var allBuildsHaveFailed = buildResults . Values . All ( buildResult => ! buildResult . IsBuildSuccess ) ;
81
81
82
82
try
@@ -347,35 +347,19 @@ private static ImmutableArray<ValidationError> Validate(params BenchmarkRunInfo[
347
347
return validationErrors . ToImmutableArray ( ) ;
348
348
}
349
349
350
- private static Dictionary < BuildPartition , BuildResult > BuildInParallel ( ILogger logger , string rootArtifactsFolderPath , BuildPartition [ ] buildPartitions , in StartedClock globalChronometer )
350
+ private static Dictionary < BuildPartition , BuildResult > Build ( ILogger logger , string rootArtifactsFolderPath , BuildPartition [ ] buildPartitions , in StartedClock globalChronometer )
351
351
{
352
- logger . WriteLineHeader ( $ "// ***** Building { buildPartitions . Length } exe(s) in Parallel : Start *****") ;
352
+ logger . WriteLineHeader ( $ "// ***** Building { buildPartitions . Length } exe(s): Start *****") ;
353
353
354
- var buildLogger = buildPartitions . Length == 1 ? logger : NullLogger . Instance ; // when we have just one partition we can print to std out
355
-
356
- var beforeParallelBuild = globalChronometer . GetElapsed ( ) ;
354
+ var beforeBuild = globalChronometer . GetElapsed ( ) ;
357
355
358
356
var buildResults = buildPartitions
359
- . AsParallel ( )
360
- . Select ( buildPartition => ( buildPartition , buildResult : Build ( buildPartition , rootArtifactsFolderPath , buildLogger ) ) )
357
+ . Select ( buildPartition => ( buildPartition , buildResult : Build ( buildPartition , rootArtifactsFolderPath , logger ) ) )
361
358
. ToDictionary ( result => result . buildPartition , result => result . buildResult ) ;
362
359
363
- var afterParallelBuild = globalChronometer . GetElapsed ( ) ;
364
-
365
- logger . WriteLineHeader ( $ "// ***** Done, took { GetFormattedDifference ( beforeParallelBuild , afterParallelBuild ) } *****") ;
366
-
367
- if ( buildPartitions . Length <= 1 || ! buildResults . Values . Any ( result => result . IsGenerateSuccess && ! result . IsBuildSuccess ) )
368
- return buildResults ;
369
-
370
- logger . WriteLineHeader ( "// ***** Failed to build in Parallel, switching to sequential build *****" ) ;
371
-
372
- foreach ( var buildPartition in buildPartitions )
373
- if ( buildResults [ buildPartition ] . IsGenerateSuccess && ! buildResults [ buildPartition ] . IsBuildSuccess && ! buildResults [ buildPartition ] . TryToExplainFailureReason ( out string _ ) )
374
- buildResults [ buildPartition ] = Build ( buildPartition , rootArtifactsFolderPath , buildLogger ) ;
375
-
376
- var afterSequentialBuild = globalChronometer . GetElapsed ( ) ;
360
+ var afterBuild = globalChronometer . GetElapsed ( ) ;
377
361
378
- logger . WriteLineHeader ( $ "// ***** Done, took { GetFormattedDifference ( afterParallelBuild , afterSequentialBuild ) } *****") ;
362
+ logger . WriteLineHeader ( $ "// ***** Done, took { GetFormattedDifference ( beforeBuild , afterBuild ) } *****") ;
379
363
380
364
return buildResults ;
381
365
0 commit comments