Skip to content

Commit

Permalink
[workloads] Allow disabling most parallelization (#7857) (#7867)
Browse files Browse the repository at this point in the history
The changes in 7168d63 did fix Android msi generation issues for me
locally, but CI attempts have still been failing.  A new `RunInParallel`
task parameter has been added to allow consumers to opt-out of most
parallelization until these issues are fixed.
  • Loading branch information
pjcollins authored Sep 9, 2021
1 parent d17fe1b commit 6885020
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,15 @@ public string SuppressIces
set;
}

/// <summary>
/// Generate msis in parallel.
/// </summary>
public bool RunInParallel
{
get;
set;
} = true;

/// <summary>
/// The paths of the generated .swixproj files.
/// </summary>
Expand Down Expand Up @@ -182,6 +191,7 @@ internal IEnumerable<ITaskItem> GenerateMsisFromManifests(ITaskItem[] workloadMa
IntermediateBaseOutputPath = this.IntermediateBaseOutputPath,
OutputPath = this.OutputPath,
PackagesPath = this.PackagesPath,
RunInParallel = this.RunInParallel,
ShortNames = this.ShortNames,
SuppressIces = this.SuppressIces,
WixToolsetPath = this.WixToolsetPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ public string PackagesPath
set;
}

/// <summary>
/// Generate msis in parallel.
/// </summary>
public bool RunInParallel
{
get;
set;
} = true;

/// <summary>
/// Gets the set of missing workload packs.
/// </summary>
Expand Down Expand Up @@ -90,14 +99,24 @@ public override bool Execute()
string swixPackageId = $"{pack.Id.ToString().Replace(ShortNames)}.{pack.Version}";

// Always select the pack ID for the VS MSI package, even when aliased.
packsToGenerate.Add(new(sourcePackage, swixPackageId, OutputPath, pack.Kind, platforms));
if (RunInParallel)
{
packsToGenerate.Add(new(sourcePackage, swixPackageId, OutputPath, pack.Kind, platforms));
}
else
{
msis.AddRange(Generate(sourcePackage, swixPackageId, OutputPath, pack.Kind, platforms));
}
}
}

System.Threading.Tasks.Parallel.ForEach(packsToGenerate, p =>
if (RunInParallel)
{
msis.AddRange(Generate(p.sourcePackage, p.swixPackageId, p.outputPath, p.kind, p.platforms));
});
System.Threading.Tasks.Parallel.ForEach(packsToGenerate, p =>
{
msis.AddRange(Generate(p.sourcePackage, p.swixPackageId, p.outputPath, p.kind, p.platforms));
});
}

Msis = msis.ToArray();
MissingPacks = missingPacks.ToArray();
Expand Down

0 comments on commit 6885020

Please sign in to comment.