Browse Source

Merge pull request #12738 from abpframework/cli-update-all-solutions

Cli: update command should update all solutions in sub-folders
pull/12741/head
Halil İbrahim Kalkan 4 years ago
committed by GitHub
parent
commit
3c6250aa22
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 25
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs

25
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
@ -56,22 +57,30 @@ public class UpdateCommand : IConsoleCommand, ITransientDependency
private async Task UpdateNugetPackages(CommandLineArgs commandLineArgs, string directory, string version)
{
var solution = commandLineArgs.Options.GetOrNull(Options.SolutionName.Short, Options.SolutionName.Long);
if (solution.IsNullOrWhiteSpace())
var solutions = new List<string>();
var givenSolution = commandLineArgs.Options.GetOrNull(Options.SolutionName.Short, Options.SolutionName.Long);
if (givenSolution.IsNullOrWhiteSpace())
{
solutions.AddRange(Directory.GetFiles(directory, "*.sln", SearchOption.AllDirectories));
}
else
{
solution = Directory.GetFiles(directory, "*.sln", SearchOption.AllDirectories).FirstOrDefault();
solutions.Add(givenSolution);
}
var checkAll = commandLineArgs.Options.ContainsKey(Options.CheckAll.Long);
if (solution != null)
if (solutions.Any())
{
var solutionName = Path.GetFileName(solution).RemovePostFix(".sln");
foreach (var solution in solutions)
{
var solutionName = Path.GetFileName(solution).RemovePostFix(".sln");
await _nugetPackagesVersionUpdater.UpdateSolutionAsync(solution, checkAll: checkAll, version: version);
await _nugetPackagesVersionUpdater.UpdateSolutionAsync(solution, checkAll: checkAll, version: version);
Logger.LogInformation($"Volo packages are updated in {solutionName} solution.");
Logger.LogInformation($"Volo packages are updated in {solutionName} solution.");
}
return;
}

Loading…
Cancel
Save