From f90131a8e28071e42c31852147f71636d8401c68 Mon Sep 17 00:00:00 2001 From: Nikolay Pianikov Date: Fri, 30 Aug 2024 12:15:11 +0300 Subject: [PATCH] Parallel compatibility checks --- build/CompatibilityCheckTarget.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/build/CompatibilityCheckTarget.cs b/build/CompatibilityCheckTarget.cs index dce341d80..b50bbb8f6 100644 --- a/build/CompatibilityCheckTarget.cs +++ b/build/CompatibilityCheckTarget.cs @@ -56,20 +56,18 @@ public async Task> RunAsync(CancellationToken cance "net20" ]; - foreach (var framework in frameworks.Reverse()) - { - await CompatibilityCheckAsync(generatorPackage.Path, framework, cancellationToken); - } - - var packages = new List { generatorPackage }; - + var tasks = new List(); + tasks.AddRange(frameworks.Reverse().Select(framework => CompatibilityCheckAsync(generatorPackage.Path, framework, cancellationToken))); + // Libraries + var packages = new List { generatorPackage }; foreach (var library in libraries) { - await CompatibilityCheckAsync(generatorPackage.Path, library, cancellationToken); + tasks.Add(CompatibilityCheckAsync(generatorPackage.Path, library, cancellationToken)); packages.Add(library.Package); } + await Task.WhenAll(tasks); return packages; } @@ -119,7 +117,7 @@ private async Task CompatibilityCheckAsync( settings.NextVersion.ToString(), "-s", Path.GetDirectoryName(generatorPackage)!) - .WithShortName($"add the package {generatorPackage} for {framework}") + .WithShortName($"add the package {Path.GetFileName(generatorPackage)} for {framework}") .RunAsync(cancellationToken: cancellationToken).EnsureSuccess(); await new DotNetBuild().WithWorkingDirectory(tempDirectory) @@ -169,7 +167,7 @@ private async Task CompatibilityCheckAsync(string generatorPackage, Library libr framework, "-s", Path.GetDirectoryName(generatorPackage)!) - .WithShortName($"add package Pure.DI for the {templateName} template for {framework}") + .WithShortName($"add package {Path.GetFileName(generatorPackage)} for the {templateName} template for {framework}") .RunAsync(cancellationToken: cancellationToken).EnsureSuccess(); var libraryPackageDir = Path.GetDirectoryName(library.Package.Path)!;