Skip to content

Feature Request: Add options to disable build in parallel. #2721

Closed
@filzrev

Description

@filzrev

When running benchmark with multiple Jobs that use WithCustomBuildConfiguration.
Parallel build is failed. and switching to sequential build.

logger.WriteLineHeader($"// ***** Building {buildPartitions.Length} exe(s) in Parallel: Start *****");
var buildLogger = buildPartitions.Length == 1 ? logger : NullLogger.Instance; // when we have just one partition we can print to std out
var beforeParallelBuild = globalChronometer.GetElapsed();
var buildResults = buildPartitions
.AsParallel()
.Select(buildPartition => (Partition: buildPartition, Result: Build(buildPartition, rootArtifactsFolderPath, buildLogger)))
.AsSequential() // Ensure that build completion events are processed sequentially
.Select(build =>
{
// If the generation was successful, but the build was not, we will try building sequentially
// so don't send the OnBuildComplete event yet.
if (buildPartitions.Length <= 1 || !build.Result.IsGenerateSuccess || build.Result.IsBuildSuccess)
eventProcessor.OnBuildComplete(build.Partition, build.Result);
return build;
})
.ToDictionary(build => build.Partition, build => build.Result);
var afterParallelBuild = globalChronometer.GetElapsed();
logger.WriteLineHeader($"// ***** Done, took {GetFormattedDifference(beforeParallelBuild, afterParallelBuild)} *****");
if (buildPartitions.Length <= 1 || !buildResults.Values.Any(result => result.IsGenerateSuccess && !result.IsBuildSuccess))
return buildResults;
logger.WriteLineHeader("// ***** Failed to build in Parallel, switching to sequential build *****");

I though parallel build failure is caused because obj\project.assets.json is shared between build configurations.
And wrong dependencies are used for parallel build.

Is is able to add options to disable parallel build?
And If it can disable parallel build. It will be a workaround for #2425 also.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions