@@ -219,7 +219,7 @@ private void GenerateSourceFilesFromWebViews(List<FileInfo> allFiles)
219219 }
220220 }
221221
222- public DependencyManager ( string srcDir ) : this ( srcDir , DependencyOptions . Default , new ConsoleLogger ( Verbosity . Info ) ) { }
222+ public DependencyManager ( string srcDir ) : this ( srcDir , DependencyOptions . Default , new ConsoleLogger ( Verbosity . Info , logThreadId : true ) ) { }
223223
224224 private IEnumerable < FileInfo > GetAllFiles ( )
225225 {
@@ -430,8 +430,8 @@ private void AnalyseProject(FileInfo project)
430430
431431 }
432432
433- private bool RestoreProject ( string project , out string stdout , string ? pathToNugetConfig = null ) =>
434- dotnet . RestoreProjectToDirectory ( project , packageDirectory . DirInfo . FullName , out stdout , pathToNugetConfig ) ;
433+ private bool RestoreProject ( string project , string ? pathToNugetConfig = null ) =>
434+ dotnet . RestoreProjectToDirectory ( project , packageDirectory . DirInfo . FullName , pathToNugetConfig ) ;
435435
436436 private bool RestoreSolution ( string solution , out IEnumerable < string > projects ) =>
437437 dotnet . RestoreSolutionToDirectory ( solution , packageDirectory . DirInfo . FullName , out projects ) ;
@@ -454,25 +454,14 @@ private IEnumerable<string> RestoreSolutions(IEnumerable<string> solutions) =>
454454 /// <summary>
455455 /// Executes `dotnet restore` on all projects in projects.
456456 /// This is done in parallel for performance reasons.
457- /// To ensure that output is not interleaved, the output of each
458- /// restore is collected and printed.
459457 /// </summary>
460458 /// <param name="projects">A list of paths to project files.</param>
461459 private void RestoreProjects ( IEnumerable < string > projects )
462460 {
463- var stdoutLines = projects
464- . AsParallel ( )
465- . WithDegreeOfParallelism ( options . Threads )
466- . Select ( project =>
467- {
468- RestoreProject ( project , out var stdout ) ;
469- return stdout ;
470- } )
471- . ToList ( ) ;
472- foreach ( var line in stdoutLines )
461+ Parallel . ForEach ( projects , new ParallelOptions { MaxDegreeOfParallelism = options . Threads } , project =>
473462 {
474- Console . WriteLine ( line ) ;
475- }
463+ RestoreProject ( project ) ;
464+ } ) ;
476465 }
477466
478467 private void DownloadMissingPackages ( List < FileInfo > allFiles )
@@ -499,30 +488,30 @@ private void DownloadMissingPackages(List<FileInfo> allFiles)
499488 var alreadyDownloadedPackages = Directory . GetDirectories ( packageDirectory . DirInfo . FullName )
500489 . Select ( d => Path . GetFileName ( d ) . ToLowerInvariant ( ) ) ;
501490 var notYetDownloadedPackages = fileContent . AllPackages . Except ( alreadyDownloadedPackages ) ;
502- foreach ( var package in notYetDownloadedPackages )
491+
492+ Parallel . ForEach ( notYetDownloadedPackages , new ParallelOptions { MaxDegreeOfParallelism = options . Threads } , package =>
503493 {
504494 progressMonitor . NugetInstall ( package ) ;
505- using var tempDir = new TemporaryDirectory ( GetTemporaryWorkingDirectory ( package ) ) ;
495+ using var tempDir = new TemporaryDirectory ( ComputeTempDirectory ( package ) ) ;
506496 var success = dotnet . New ( tempDir . DirInfo . FullName ) ;
507497 if ( ! success )
508498 {
509- continue ;
499+ return ;
510500 }
501+
511502 success = dotnet . AddPackage ( tempDir . DirInfo . FullName , package ) ;
512503 if ( ! success )
513504 {
514- continue ;
505+ return ;
515506 }
516507
517- success = RestoreProject ( tempDir . DirInfo . FullName , out var stdout , nugetConfig ) ;
518- Console . WriteLine ( stdout ) ;
519-
508+ success = RestoreProject ( tempDir . DirInfo . FullName , nugetConfig ) ;
520509 // TODO: the restore might fail, we could retry with a prerelease (*-* instead of *) version of the package.
521510 if ( ! success )
522511 {
523512 progressMonitor . FailedToRestoreNugetPackage ( package ) ;
524513 }
525- }
514+ } ) ;
526515 }
527516
528517 private void AnalyseSolutions ( IEnumerable < string > solutions )
0 commit comments