From 276d6338941226da7e026338de2b84ca48b61c54 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Thu, 11 Jun 2020 07:43:44 +0300 Subject: [PATCH 0001/1120] (new-cli) - Initial commit --- new-cli/.gitignore | 2 + new-cli/.idea/.idea.Cli/.idea/.gitignore | 13 ++++ new-cli/.idea/.idea.Cli/.idea/encodings.xml | 4 ++ new-cli/.idea/.idea.Cli/.idea/indexLayout.xml | 8 +++ new-cli/.idea/.idea.Cli/.idea/misc.xml | 6 ++ new-cli/.idea/.idea.Cli/.idea/vcs.xml | 6 ++ new-cli/.idea/.idea.Cli/riderModule.iml | 7 ++ new-cli/Calculate/Calculate.csproj | 15 ++++ new-cli/Calculate/CalculateCommand.cs | 20 ++++++ new-cli/Calculate/CalculateModule.cs | 14 ++++ new-cli/Calculate/CalculateOptions.cs | 11 +++ new-cli/Cli.sln | 34 +++++++++ new-cli/Cli/Cli.csproj | 18 +++++ new-cli/Cli/GitVersionApp.cs | 30 ++++++++ new-cli/Cli/Program.cs | 42 +++++++++++ new-cli/Core/Core.csproj | 11 +++ new-cli/Core/GlobalOptions.cs | 10 +++ new-cli/Core/IGitVersionModule.cs | 9 +++ new-cli/Core/OptionAttribute.cs | 28 ++++++++ new-cli/Core/ServiceCollectionExtensions.cs | 20 ++++++ new-cli/Output/BaseOutputCommand.cs | 69 +++++++++++++++++++ new-cli/Output/Output.csproj | 15 ++++ new-cli/Output/OutputModule.cs | 16 +++++ new-cli/Output/OutputOptions.cs | 14 ++++ new-cli/README.md | 1 + 25 files changed, 423 insertions(+) create mode 100644 new-cli/.gitignore create mode 100644 new-cli/.idea/.idea.Cli/.idea/.gitignore create mode 100644 new-cli/.idea/.idea.Cli/.idea/encodings.xml create mode 100644 new-cli/.idea/.idea.Cli/.idea/indexLayout.xml create mode 100644 new-cli/.idea/.idea.Cli/.idea/misc.xml create mode 100644 new-cli/.idea/.idea.Cli/.idea/vcs.xml create mode 100644 new-cli/.idea/.idea.Cli/riderModule.iml create mode 100644 new-cli/Calculate/Calculate.csproj create mode 100644 new-cli/Calculate/CalculateCommand.cs create mode 100644 new-cli/Calculate/CalculateModule.cs create mode 100644 new-cli/Calculate/CalculateOptions.cs create mode 100644 new-cli/Cli.sln create mode 100644 new-cli/Cli/Cli.csproj create mode 100644 new-cli/Cli/GitVersionApp.cs create mode 100644 new-cli/Cli/Program.cs create mode 100644 new-cli/Core/Core.csproj create mode 100644 new-cli/Core/GlobalOptions.cs create mode 100644 new-cli/Core/IGitVersionModule.cs create mode 100644 new-cli/Core/OptionAttribute.cs create mode 100644 new-cli/Core/ServiceCollectionExtensions.cs create mode 100644 new-cli/Output/BaseOutputCommand.cs create mode 100644 new-cli/Output/Output.csproj create mode 100644 new-cli/Output/OutputModule.cs create mode 100644 new-cli/Output/OutputOptions.cs create mode 100644 new-cli/README.md diff --git a/new-cli/.gitignore b/new-cli/.gitignore new file mode 100644 index 0000000000..6a22e2bbe1 --- /dev/null +++ b/new-cli/.gitignore @@ -0,0 +1,2 @@ +[Bb]in +[Oo]bj \ No newline at end of file diff --git a/new-cli/.idea/.idea.Cli/.idea/.gitignore b/new-cli/.idea/.idea.Cli/.idea/.gitignore new file mode 100644 index 0000000000..f9b810d570 --- /dev/null +++ b/new-cli/.idea/.idea.Cli/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/projectSettingsUpdater.xml +/modules.xml +/.idea.Cli.iml +/contentModel.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/new-cli/.idea/.idea.Cli/.idea/encodings.xml b/new-cli/.idea/.idea.Cli/.idea/encodings.xml new file mode 100644 index 0000000000..df87cf951f --- /dev/null +++ b/new-cli/.idea/.idea.Cli/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/new-cli/.idea/.idea.Cli/.idea/indexLayout.xml b/new-cli/.idea/.idea.Cli/.idea/indexLayout.xml new file mode 100644 index 0000000000..27ba142e96 --- /dev/null +++ b/new-cli/.idea/.idea.Cli/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/new-cli/.idea/.idea.Cli/.idea/misc.xml b/new-cli/.idea/.idea.Cli/.idea/misc.xml new file mode 100644 index 0000000000..28a804d893 --- /dev/null +++ b/new-cli/.idea/.idea.Cli/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/new-cli/.idea/.idea.Cli/.idea/vcs.xml b/new-cli/.idea/.idea.Cli/.idea/vcs.xml new file mode 100644 index 0000000000..94a25f7f4c --- /dev/null +++ b/new-cli/.idea/.idea.Cli/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/new-cli/.idea/.idea.Cli/riderModule.iml b/new-cli/.idea/.idea.Cli/riderModule.iml new file mode 100644 index 0000000000..1a4e0d95f0 --- /dev/null +++ b/new-cli/.idea/.idea.Cli/riderModule.iml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/new-cli/Calculate/Calculate.csproj b/new-cli/Calculate/Calculate.csproj new file mode 100644 index 0000000000..3ea3b415a4 --- /dev/null +++ b/new-cli/Calculate/Calculate.csproj @@ -0,0 +1,15 @@ + + + + netstandard2.0 + + + + + + + + + + + diff --git a/new-cli/Calculate/CalculateCommand.cs b/new-cli/Calculate/CalculateCommand.cs new file mode 100644 index 0000000000..0b52ca171c --- /dev/null +++ b/new-cli/Calculate/CalculateCommand.cs @@ -0,0 +1,20 @@ +using System; +using System.CommandLine; +using System.CommandLine.Invocation; + +namespace Calculate +{ + public class CalculateCommand : Command + { + public CalculateCommand(): base("calculate", "Calculates the version object from the git history.") + { + AddOption(new Option("--work-dir", "The working directory with the git repository")); + Handler = CommandHandler.Create(Calculate); + } + + private void Calculate(CalculateOptions o) + { + Console.WriteLine($"Command : 'calculate', LogFile : '{o.LogFile}', WorkDir : '{o.WorkDir}' "); + } + } +} \ No newline at end of file diff --git a/new-cli/Calculate/CalculateModule.cs b/new-cli/Calculate/CalculateModule.cs new file mode 100644 index 0000000000..2f154f472c --- /dev/null +++ b/new-cli/Calculate/CalculateModule.cs @@ -0,0 +1,14 @@ +using System.CommandLine; +using Core; +using Microsoft.Extensions.DependencyInjection; + +namespace Calculate +{ + public class CalculateModule : IGitVersionModule + { + public void RegisterTypes(IServiceCollection services) + { + services.AddSingleton(); + } + } +} \ No newline at end of file diff --git a/new-cli/Calculate/CalculateOptions.cs b/new-cli/Calculate/CalculateOptions.cs new file mode 100644 index 0000000000..05bc1bff1a --- /dev/null +++ b/new-cli/Calculate/CalculateOptions.cs @@ -0,0 +1,11 @@ +using System.IO; +using Core; + +namespace Calculate +{ + public class CalculateOptions : GlobalOptions + { + [Option("--work-dir", "The working directory with the git repository")] + public DirectoryInfo WorkDir { get; set; } + } +} \ No newline at end of file diff --git a/new-cli/Cli.sln b/new-cli/Cli.sln new file mode 100644 index 0000000000..e2fa82a73e --- /dev/null +++ b/new-cli/Cli.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cli", "Cli\Cli.csproj", "{E2520F2D-A6FF-4079-85A4-584AA0CC8594}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "Core\Core.csproj", "{02332393-1F38-4819-8D6F-3D1968B38919}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Calculate", "Calculate\Calculate.csproj", "{8F6D4830-B870-4365-9662-457F1A13894B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Output", "Output\Output.csproj", "{9543A475-06BA-4C8D-A3CE-E2792FE663DA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E2520F2D-A6FF-4079-85A4-584AA0CC8594}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E2520F2D-A6FF-4079-85A4-584AA0CC8594}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E2520F2D-A6FF-4079-85A4-584AA0CC8594}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E2520F2D-A6FF-4079-85A4-584AA0CC8594}.Release|Any CPU.Build.0 = Release|Any CPU + {02332393-1F38-4819-8D6F-3D1968B38919}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {02332393-1F38-4819-8D6F-3D1968B38919}.Debug|Any CPU.Build.0 = Debug|Any CPU + {02332393-1F38-4819-8D6F-3D1968B38919}.Release|Any CPU.ActiveCfg = Release|Any CPU + {02332393-1F38-4819-8D6F-3D1968B38919}.Release|Any CPU.Build.0 = Release|Any CPU + {8F6D4830-B870-4365-9662-457F1A13894B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8F6D4830-B870-4365-9662-457F1A13894B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8F6D4830-B870-4365-9662-457F1A13894B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8F6D4830-B870-4365-9662-457F1A13894B}.Release|Any CPU.Build.0 = Release|Any CPU + {9543A475-06BA-4C8D-A3CE-E2792FE663DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9543A475-06BA-4C8D-A3CE-E2792FE663DA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9543A475-06BA-4C8D-A3CE-E2792FE663DA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9543A475-06BA-4C8D-A3CE-E2792FE663DA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/new-cli/Cli/Cli.csproj b/new-cli/Cli/Cli.csproj new file mode 100644 index 0000000000..9a21c63113 --- /dev/null +++ b/new-cli/Cli/Cli.csproj @@ -0,0 +1,18 @@ + + + + Exe + netcoreapp3.1 + + + + + + + + + + + + + diff --git a/new-cli/Cli/GitVersionApp.cs b/new-cli/Cli/GitVersionApp.cs new file mode 100644 index 0000000000..3f6b9222c7 --- /dev/null +++ b/new-cli/Cli/GitVersionApp.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using System.CommandLine; +using System.CommandLine.Builder; +using System.CommandLine.Parsing; +using System.IO; +using System.Threading.Tasks; + +namespace Cli +{ + internal class GitVersionApp : RootCommand + { + public GitVersionApp(IEnumerable commands) + { + AddGlobalOption(new Option(new[] { "--log-file", "-l" }, "The log file")); + + foreach (var command in commands) + { + AddCommand(command); + } + } + + public Task RunAsync(string[] args) + { + return new CommandLineBuilder(this) + .UseDefaults() + .Build() + .InvokeAsync(args); + } + } +} \ No newline at end of file diff --git a/new-cli/Cli/Program.cs b/new-cli/Cli/Program.cs new file mode 100644 index 0000000000..10902aba7f --- /dev/null +++ b/new-cli/Cli/Program.cs @@ -0,0 +1,42 @@ +using System; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; +using Calculate; +using Core; +using Microsoft.Extensions.DependencyInjection; +using Output; + +namespace Cli +{ + internal static class Program + { + private static async Task Main(string[] args) + { + NewMethod(); + await using var serviceProvider = new ServiceCollection() + .AddSingleton() + .AddModule(new CalculateModule()) // dynamically load the modules (maybe using Assembly.Load) + .AddModule(new OutputModule()) + .BuildServiceProvider(); + + var app = serviceProvider.GetService(); + + var result = await app.RunAsync(args); + Console.ReadKey(); + + return result; + } + + private static void NewMethod() + { + var propertyInfos = typeof(GlobalOptions).GetProperties(); + foreach (var propertyInfo in propertyInfos) + { + var optionAttr = propertyInfo.GetCustomAttributes().Cast().Single(); + var aliases = optionAttr.Aliases; + var description = optionAttr.Description; + } + } + } +} \ No newline at end of file diff --git a/new-cli/Core/Core.csproj b/new-cli/Core/Core.csproj new file mode 100644 index 0000000000..70ee7649d2 --- /dev/null +++ b/new-cli/Core/Core.csproj @@ -0,0 +1,11 @@ + + + + netstandard2.0 + + + + + + + diff --git a/new-cli/Core/GlobalOptions.cs b/new-cli/Core/GlobalOptions.cs new file mode 100644 index 0000000000..ccad39595f --- /dev/null +++ b/new-cli/Core/GlobalOptions.cs @@ -0,0 +1,10 @@ +using System.IO; + +namespace Core +{ + public class GlobalOptions + { + [Option(new[] { "--log-file", "-l" }, "The log file")] + public FileInfo LogFile { get; set; } + } +} \ No newline at end of file diff --git a/new-cli/Core/IGitVersionModule.cs b/new-cli/Core/IGitVersionModule.cs new file mode 100644 index 0000000000..08636f9616 --- /dev/null +++ b/new-cli/Core/IGitVersionModule.cs @@ -0,0 +1,9 @@ +using Microsoft.Extensions.DependencyInjection; + +namespace Core +{ + public interface IGitVersionModule + { + void RegisterTypes(IServiceCollection services); + } +} \ No newline at end of file diff --git a/new-cli/Core/OptionAttribute.cs b/new-cli/Core/OptionAttribute.cs new file mode 100644 index 0000000000..af0e2a215a --- /dev/null +++ b/new-cli/Core/OptionAttribute.cs @@ -0,0 +1,28 @@ +using System; + +namespace Core +{ + [AttributeUsage(AttributeTargets.Property)] + public class OptionAttribute : Attribute + { + public string[] Aliases { get; } + public string Description { get; } + + public OptionAttribute(string alias, string description = "") + : this(new[] { alias }, description) + { + } + + public OptionAttribute(string[] aliases, string description = "") + { + Aliases = aliases; + Description = description; + } + } + + public class GitVersionCommand + { + public string[] Aliases { get; } + public string Description { get; } + } +} \ No newline at end of file diff --git a/new-cli/Core/ServiceCollectionExtensions.cs b/new-cli/Core/ServiceCollectionExtensions.cs new file mode 100644 index 0000000000..10a5f465e9 --- /dev/null +++ b/new-cli/Core/ServiceCollectionExtensions.cs @@ -0,0 +1,20 @@ +using System; +using System.Linq; +using Microsoft.Extensions.DependencyInjection; + +namespace Core +{ + public static class ServiceCollectionExtensions + { + public static IServiceCollection AddModule(this IServiceCollection serviceCollection, IGitVersionModule gitVersionModule) + { + gitVersionModule.RegisterTypes(serviceCollection); + return serviceCollection; + } + + public static TService GetServiceForType(this IServiceProvider serviceProvider) + { + return serviceProvider.GetServices().SingleOrDefault(t => t.GetType() == typeof(TType)); + } + } +} \ No newline at end of file diff --git a/new-cli/Output/BaseOutputCommand.cs b/new-cli/Output/BaseOutputCommand.cs new file mode 100644 index 0000000000..939be3a81d --- /dev/null +++ b/new-cli/Output/BaseOutputCommand.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.CommandLine; +using System.CommandLine.Invocation; +using Core; + +namespace Output +{ + public class OutputCommand : Command + { + public OutputCommand(IEnumerable outputCommands): base("output", "Outputs the version object.") + { + AddGlobalOption(new Option("--output-dir", "The output directory with the git repository")); + AddGlobalOption(new Option("--input-file", "The input version file")); + + foreach (var command in outputCommands) + { + AddCommand(command); + } + } + } + + public abstract class BaseOutputCommand : Command + { + protected BaseOutputCommand(string name, string description = null) : base(name, description) + { + } + } + + public class OutputAssemblyInfoCommand : BaseOutputCommand + { + public OutputAssemblyInfoCommand() : base("assemblyinfo", "Outputs version to assembly") + { + AddOption(new Option("--assemblyinfo-file", "The assembly file")); + Handler = CommandHandler.Create(Output); + } + + private void Output(OutputAssemblyInfoOptions o) + { + Console.WriteLine($"Command : 'output assemblyinfo', LogFile : '{o.LogFile}', WorkDir : '{o.OutputDir}', InputFile: '{o.InputFile}', AssemblyInfo: '{o.AssemblyinfoFile}' "); + } + } + + public class OutputProjectCommand : BaseOutputCommand + { + public OutputProjectCommand() : base("project", "Outputs version to project") + { + AddOption(new Option("--project-file", "The project file")); + Handler = CommandHandler.Create(Output); + } + + private void Output(OutputProjectOptions o) + { + Console.WriteLine($"Command : 'output assemblyinfo', LogFile : '{o.LogFile}', WorkDir : '{o.OutputDir}', InputFile: '{o.InputFile}', Project: '{o.ProjectFile}' "); + } + } + + public class OutputAssemblyInfoOptions : OutputOptions + { + [Option("--assemblyinfo-file", "The assembly file")] + public string AssemblyinfoFile { get; set; } + } + + public class OutputProjectOptions : OutputOptions + { + [Option("--project-file", "The project file")] + public string ProjectFile { get; set; } + } +} \ No newline at end of file diff --git a/new-cli/Output/Output.csproj b/new-cli/Output/Output.csproj new file mode 100644 index 0000000000..68b2caeff1 --- /dev/null +++ b/new-cli/Output/Output.csproj @@ -0,0 +1,15 @@ + + + + netstandard2.0 + + + + + + + + + + + diff --git a/new-cli/Output/OutputModule.cs b/new-cli/Output/OutputModule.cs new file mode 100644 index 0000000000..1cba609208 --- /dev/null +++ b/new-cli/Output/OutputModule.cs @@ -0,0 +1,16 @@ +using System.CommandLine; +using Core; +using Microsoft.Extensions.DependencyInjection; + +namespace Output +{ + public class OutputModule : IGitVersionModule + { + public void RegisterTypes(IServiceCollection services) + { + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + } + } +} \ No newline at end of file diff --git a/new-cli/Output/OutputOptions.cs b/new-cli/Output/OutputOptions.cs new file mode 100644 index 0000000000..e2b2fdf953 --- /dev/null +++ b/new-cli/Output/OutputOptions.cs @@ -0,0 +1,14 @@ +using System.IO; +using Core; + +namespace Output +{ + public class OutputOptions : GlobalOptions + { + [Option("--input-file", "The input version file")] + public FileInfo InputFile { get; set; } + + [Option("--output-dir", "The output directory with the git repository")] + public DirectoryInfo OutputDir { get; set; } + } +} \ No newline at end of file diff --git a/new-cli/README.md b/new-cli/README.md new file mode 100644 index 0000000000..a17d05dfb4 --- /dev/null +++ b/new-cli/README.md @@ -0,0 +1 @@ +Cli From bcf59251fc4072e5e6dc168b8951613dbc924c05 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Mon, 15 Jun 2020 17:53:32 +0300 Subject: [PATCH 0002/1120] (new-cli) - re-work the modules --- .../.idea/.idea.Cli/.idea/contentModel.xml | 90 +++ new-cli/.idea/.idea.Cli/.idea/modules.xml | 9 + .../.idea/projectSettingsUpdater.xml | 6 + new-cli/.idea/.idea.Cli/.idea/workspace.xml | 542 ++++++++++++++++++ new-cli/Calculate/Calculate.csproj | 4 - new-cli/Calculate/CalculateCommand.cs | 20 - new-cli/Calculate/CalculateCommandHandler.cs | 23 + new-cli/Calculate/CalculateModule.cs | 5 +- new-cli/Calculate/CalculateOptions.cs | 3 +- new-cli/Cli/Cli.csproj | 2 +- new-cli/Cli/Extensions/CommandExtensions.cs | 46 ++ .../ServiceCollectionExtensions.cs | 0 new-cli/Cli/GitVersionApp.cs | 9 +- new-cli/Cli/Program.cs | 18 +- new-cli/Core/Core.csproj | 3 +- ...{GlobalOptions.cs => GitVersionOptions.cs} | 2 +- new-cli/Core/IService.cs | 7 + .../Core/Infrastructure/CommandAttribute.cs | 17 + new-cli/Core/Infrastructure/CommandHandler.cs | 16 + .../Core/Infrastructure/ICommandHandler.cs | 15 + .../{ => Infrastructure}/IGitVersionModule.cs | 0 .../{ => Infrastructure}/OptionAttribute.cs | 6 - new-cli/Core/Service.cs | 10 + .../OutputAssemblyInfoCommandHandler.cs | 23 + .../AssemblyInfo/OutputAssemblyInfoOptions.cs | 11 + new-cli/Output/BaseOutputCommand.cs | 69 --- new-cli/Output/IOutputCommandHandler.cs | 8 + new-cli/Output/Output.csproj | 4 - new-cli/Output/OutputCommandHandler.cs | 26 + new-cli/Output/OutputModule.cs | 10 +- new-cli/Output/OutputOptions.cs | 3 +- .../Project/OutputProjectCommandHandler.cs | 23 + .../Output/Project/OutputProjectOptions.cs | 11 + new-cli/Output/Wix/OutputWixCommandHandler.cs | 23 + new-cli/Output/Wix/OutputWixOptions.cs | 11 + 35 files changed, 939 insertions(+), 136 deletions(-) create mode 100644 new-cli/.idea/.idea.Cli/.idea/contentModel.xml create mode 100644 new-cli/.idea/.idea.Cli/.idea/modules.xml create mode 100644 new-cli/.idea/.idea.Cli/.idea/projectSettingsUpdater.xml create mode 100644 new-cli/.idea/.idea.Cli/.idea/workspace.xml delete mode 100644 new-cli/Calculate/CalculateCommand.cs create mode 100644 new-cli/Calculate/CalculateCommandHandler.cs create mode 100644 new-cli/Cli/Extensions/CommandExtensions.cs rename new-cli/{Core => Cli/Extensions}/ServiceCollectionExtensions.cs (100%) rename new-cli/Core/{GlobalOptions.cs => GitVersionOptions.cs} (82%) create mode 100644 new-cli/Core/IService.cs create mode 100644 new-cli/Core/Infrastructure/CommandAttribute.cs create mode 100644 new-cli/Core/Infrastructure/CommandHandler.cs create mode 100644 new-cli/Core/Infrastructure/ICommandHandler.cs rename new-cli/Core/{ => Infrastructure}/IGitVersionModule.cs (100%) rename new-cli/Core/{ => Infrastructure}/OptionAttribute.cs (79%) create mode 100644 new-cli/Core/Service.cs create mode 100644 new-cli/Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs create mode 100644 new-cli/Output/AssemblyInfo/OutputAssemblyInfoOptions.cs delete mode 100644 new-cli/Output/BaseOutputCommand.cs create mode 100644 new-cli/Output/IOutputCommandHandler.cs create mode 100644 new-cli/Output/OutputCommandHandler.cs create mode 100644 new-cli/Output/Project/OutputProjectCommandHandler.cs create mode 100644 new-cli/Output/Project/OutputProjectOptions.cs create mode 100644 new-cli/Output/Wix/OutputWixCommandHandler.cs create mode 100644 new-cli/Output/Wix/OutputWixOptions.cs diff --git a/new-cli/.idea/.idea.Cli/.idea/contentModel.xml b/new-cli/.idea/.idea.Cli/.idea/contentModel.xml new file mode 100644 index 0000000000..9ee9acf93b --- /dev/null +++ b/new-cli/.idea/.idea.Cli/.idea/contentModel.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/new-cli/.idea/.idea.Cli/.idea/modules.xml b/new-cli/.idea/.idea.Cli/.idea/modules.xml new file mode 100644 index 0000000000..b1fc8c6d3b --- /dev/null +++ b/new-cli/.idea/.idea.Cli/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/new-cli/.idea/.idea.Cli/.idea/projectSettingsUpdater.xml b/new-cli/.idea/.idea.Cli/.idea/projectSettingsUpdater.xml new file mode 100644 index 0000000000..4bb9f4d2a0 --- /dev/null +++ b/new-cli/.idea/.idea.Cli/.idea/projectSettingsUpdater.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/new-cli/.idea/.idea.Cli/.idea/workspace.xml b/new-cli/.idea/.idea.Cli/.idea/workspace.xml new file mode 100644 index 0000000000..df404de771 --- /dev/null +++ b/new-cli/.idea/.idea.Cli/.idea/workspace.xml @@ -0,0 +1,542 @@ + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1589691943411 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/7EAE45F1-4528-418E-AB86-202DA29445AC/8/Host.cs - 43 - - - - - - - - - file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/7EAE45F1-4528-418E-AB86-202DA29445AC/8/Host.cs - 56 - - - - - - - - - file://$PROJECT_DIR$/Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs - 16 - - - - - - \ No newline at end of file diff --git a/new-cli/Cli/Extensions/CommandExtensions.cs b/new-cli/Cli/Extensions/CommandExtensions.cs index 82b7bdb785..37fd570080 100644 --- a/new-cli/Cli/Extensions/CommandExtensions.cs +++ b/new-cli/Cli/Extensions/CommandExtensions.cs @@ -32,8 +32,9 @@ public static Command GetCommand(this ICommandHandler commandHandler) }; command.AddOption(option); } - var methodInfo = handlerType.GetMethod("InvokeAsync", new []{ commandType }); - command.Handler = CommandHandler.Create(methodInfo, commandHandler); + + var handlerMethod = handlerType.GetMethod(nameof(CommandHandler.InvokeAsync), new []{ commandType }); + command.Handler = CommandHandler.Create(handlerMethod, commandHandler); foreach (var subCommandHandler in commandHandler.GetSubCommands()) { diff --git a/new-cli/Cli/Program.cs b/new-cli/Cli/Program.cs index 92347d5d05..8784839e8a 100644 --- a/new-cli/Cli/Program.cs +++ b/new-cli/Cli/Program.cs @@ -20,7 +20,11 @@ private static async Task Main(string[] args) var app = serviceProvider.GetService(); var result = await app.RunAsync(args); - Console.ReadKey(); + + if (!Console.IsInputRedirected) + { + Console.ReadKey(); + } return result; } From 5c276ccb5e278ba655c183cf74b94522d587e615 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Wed, 17 Jun 2020 18:54:04 +0300 Subject: [PATCH 0006/1120] (new-cli) - reading version info from the pipe into output options --- .../Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs | 2 ++ new-cli/Output/OutputOptions.cs | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/new-cli/Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs b/new-cli/Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs index a6e6af82a6..b25823f3b5 100644 --- a/new-cli/Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs +++ b/new-cli/Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs @@ -16,7 +16,9 @@ public OutputAssemblyInfoCommandHandler(IService service) public override Task InvokeAsync(OutputAssemblyInfoOptions options) { var value = service.Call(); + var versionInfo = options.VersionInfo.Value; Console.WriteLine($"Command : 'output assemblyinfo', LogFile : '{options.LogFile}', WorkDir : '{options.OutputDir}', InputFile: '{options.InputFile}', AssemblyInfo: '{options.AssemblyinfoFile}' "); + Console.WriteLine($"Version info: {versionInfo}"); return Task.FromResult(value); } } diff --git a/new-cli/Output/OutputOptions.cs b/new-cli/Output/OutputOptions.cs index b477a26f5f..d003970bff 100644 --- a/new-cli/Output/OutputOptions.cs +++ b/new-cli/Output/OutputOptions.cs @@ -1,4 +1,5 @@ -using System.IO; +using System; +using System.IO; using Core; namespace Output @@ -6,6 +7,8 @@ namespace Output [Command("output", "Outputs the version object.")] public class OutputOptions : GitVersionOptions { + public Lazy VersionInfo { get; set; } = new Lazy(() => Console.IsInputRedirected ? Console.ReadLine() : null); + [Option("--input-file", "The input version file")] public FileInfo InputFile { get; set; } From 4c00c9ba990319f4cf469782c86f4fdb6aaa8368 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Fri, 19 Jun 2020 11:55:39 +0300 Subject: [PATCH 0007/1120] (new-cli) - move GetCommand method from CommandExtensions to GitVersionApp --- new-cli/Cli/Extensions/CommandExtensions.cs | 48 --------------------- new-cli/Cli/GitVersionApp.cs | 42 +++++++++++++++++- 2 files changed, 41 insertions(+), 49 deletions(-) delete mode 100644 new-cli/Cli/Extensions/CommandExtensions.cs diff --git a/new-cli/Cli/Extensions/CommandExtensions.cs b/new-cli/Cli/Extensions/CommandExtensions.cs deleted file mode 100644 index 37fd570080..0000000000 --- a/new-cli/Cli/Extensions/CommandExtensions.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.CommandLine; -using System.CommandLine.Invocation; -using System.Reflection; -using Core; -using ICommandHandler = Core.ICommandHandler; - -namespace Cli -{ - public static class CommandExtensions - { - public static Command GetCommand(this ICommandHandler commandHandler) - { - const BindingFlags declaredOnly = BindingFlags.Public | BindingFlags.Instance; - - var handlerType = commandHandler.GetType(); - var commandType = handlerType.BaseType?.GenericTypeArguments[0]; - var commandAttribute = commandType?.GetCustomAttribute(); - - if (commandAttribute == null) return null; - - var command = new Command(commandAttribute.Name, commandAttribute.Description); - var propertyInfos = commandType.GetProperties(declaredOnly); - foreach (var propertyInfo in propertyInfos) - { - var optionAttribute = propertyInfo.GetCustomAttribute(); - if (optionAttribute == null) continue; - - var option = new Option(optionAttribute.Aliases, optionAttribute.Description) - { - Required = optionAttribute.Required, - Argument = new Argument { ArgumentType = propertyInfo.PropertyType } - }; - command.AddOption(option); - } - - var handlerMethod = handlerType.GetMethod(nameof(CommandHandler.InvokeAsync), new []{ commandType }); - command.Handler = CommandHandler.Create(handlerMethod, commandHandler); - - foreach (var subCommandHandler in commandHandler.GetSubCommands()) - { - var subCommand = subCommandHandler.GetCommand(); - command.AddCommand(subCommand); - } - - return command; - } - } -} \ No newline at end of file diff --git a/new-cli/Cli/GitVersionApp.cs b/new-cli/Cli/GitVersionApp.cs index d24e9fa15d..550422e291 100644 --- a/new-cli/Cli/GitVersionApp.cs +++ b/new-cli/Cli/GitVersionApp.cs @@ -1,9 +1,12 @@ using System.Collections.Generic; using System.CommandLine; using System.CommandLine.Builder; +using System.CommandLine.Invocation; using System.CommandLine.Parsing; +using System.Reflection; using System.Threading.Tasks; using Core; +using ICommandHandler = Core.ICommandHandler; namespace Cli { @@ -13,7 +16,7 @@ public GitVersionApp(IEnumerable commandHandlers) { foreach (var commandHandler in commandHandlers) { - var command = commandHandler.GetCommand(); + var command = GetCommand(commandHandler); AddCommand(command); } } @@ -25,5 +28,42 @@ public Task RunAsync(string[] args) .Build() .InvokeAsync(args); } + + private static Command GetCommand(ICommandHandler commandHandler) + { + const BindingFlags declaredOnly = BindingFlags.Public | BindingFlags.Instance; + + var handlerType = commandHandler.GetType(); + var commandType = handlerType.BaseType?.GenericTypeArguments[0]; + var commandAttribute = commandType?.GetCustomAttribute(); + + if (commandAttribute == null) return null; + + var command = new Command(commandAttribute.Name, commandAttribute.Description); + var propertyInfos = commandType.GetProperties(declaredOnly); + foreach (var propertyInfo in propertyInfos) + { + var optionAttribute = propertyInfo.GetCustomAttribute(); + if (optionAttribute == null) continue; + + var option = new Option(optionAttribute.Aliases, optionAttribute.Description) + { + Required = optionAttribute.Required, + Argument = new Argument { ArgumentType = propertyInfo.PropertyType } + }; + command.AddOption(option); + } + + var handlerMethod = handlerType.GetMethod(nameof(CommandHandler.InvokeAsync), new [] { commandType }); + command.Handler = CommandHandler.Create(handlerMethod, commandHandler); + + foreach (var subCommandHandler in commandHandler.GetSubCommands()) + { + var subCommand = GetCommand(subCommandHandler); + command.AddCommand(subCommand); + } + + return command; + } } } \ No newline at end of file From de09166e73ed45e7aa49565c12892c8ee3c257c1 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Sun, 21 Jun 2020 23:52:15 +0300 Subject: [PATCH 0008/1120] (new-cli) - cleanup --- new-cli/Cli/GitVersionApp.cs | 16 ++++++++-------- new-cli/Core/Infrastructure/CommandHandler.cs | 4 +++- new-cli/Core/Infrastructure/ICommandHandler.cs | 5 ++++- new-cli/Output/OutputCommandHandler.cs | 2 +- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/new-cli/Cli/GitVersionApp.cs b/new-cli/Cli/GitVersionApp.cs index 550422e291..99eccf59f8 100644 --- a/new-cli/Cli/GitVersionApp.cs +++ b/new-cli/Cli/GitVersionApp.cs @@ -16,7 +16,7 @@ public GitVersionApp(IEnumerable commandHandlers) { foreach (var commandHandler in commandHandlers) { - var command = GetCommand(commandHandler); + var command = CreateCommand(commandHandler); AddCommand(command); } } @@ -29,18 +29,18 @@ public Task RunAsync(string[] args) .InvokeAsync(args); } - private static Command GetCommand(ICommandHandler commandHandler) + private static Command CreateCommand(ICommandHandler commandHandler) { const BindingFlags declaredOnly = BindingFlags.Public | BindingFlags.Instance; var handlerType = commandHandler.GetType(); - var commandType = handlerType.BaseType?.GenericTypeArguments[0]; - var commandAttribute = commandType?.GetCustomAttribute(); + var commandOptionsType = handlerType.BaseType?.GenericTypeArguments[0]; + var commandAttribute = commandOptionsType?.GetCustomAttribute(); if (commandAttribute == null) return null; var command = new Command(commandAttribute.Name, commandAttribute.Description); - var propertyInfos = commandType.GetProperties(declaredOnly); + var propertyInfos = commandOptionsType.GetProperties(declaredOnly); foreach (var propertyInfo in propertyInfos) { var optionAttribute = propertyInfo.GetCustomAttribute(); @@ -54,12 +54,12 @@ private static Command GetCommand(ICommandHandler commandHandler) command.AddOption(option); } - var handlerMethod = handlerType.GetMethod(nameof(CommandHandler.InvokeAsync), new [] { commandType }); + var handlerMethod = handlerType.GetMethod(nameof(commandHandler.InvokeAsync), new [] { commandOptionsType }); command.Handler = CommandHandler.Create(handlerMethod, commandHandler); - foreach (var subCommandHandler in commandHandler.GetSubCommands()) + foreach (var subCommandHandler in commandHandler.SubCommands()) { - var subCommand = GetCommand(subCommandHandler); + var subCommand = CreateCommand(subCommandHandler); command.AddCommand(subCommand); } diff --git a/new-cli/Core/Infrastructure/CommandHandler.cs b/new-cli/Core/Infrastructure/CommandHandler.cs index 752a74e130..bf78fb6ce7 100644 --- a/new-cli/Core/Infrastructure/CommandHandler.cs +++ b/new-cli/Core/Infrastructure/CommandHandler.cs @@ -8,6 +8,8 @@ public abstract class CommandHandler : ICommandHandler { public virtual Task InvokeAsync(T options) => Task.FromResult(0); - public virtual IEnumerable GetSubCommands() => Enumerable.Empty(); + public Task InvokeAsync(object options) => InvokeAsync((T) options); + + public virtual IEnumerable SubCommands() => Enumerable.Empty(); } } \ No newline at end of file diff --git a/new-cli/Core/Infrastructure/ICommandHandler.cs b/new-cli/Core/Infrastructure/ICommandHandler.cs index 3beebc0d06..4406e75b24 100644 --- a/new-cli/Core/Infrastructure/ICommandHandler.cs +++ b/new-cli/Core/Infrastructure/ICommandHandler.cs @@ -1,9 +1,12 @@ using System.Collections.Generic; +using System.Threading.Tasks; namespace Core { public interface ICommandHandler { - IEnumerable GetSubCommands(); + Task InvokeAsync(object options); + + IEnumerable SubCommands(); } } \ No newline at end of file diff --git a/new-cli/Output/OutputCommandHandler.cs b/new-cli/Output/OutputCommandHandler.cs index ffb65c1708..03852ad57f 100644 --- a/new-cli/Output/OutputCommandHandler.cs +++ b/new-cli/Output/OutputCommandHandler.cs @@ -12,6 +12,6 @@ public OutputCommandHandler(IEnumerable commandHandlers) this.commandHandlers = commandHandlers; } - public override IEnumerable GetSubCommands() => commandHandlers; + public override IEnumerable SubCommands() => commandHandlers; } } \ No newline at end of file From 27838a087c4dbcf8880c5192a2e96377e27b12d8 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Mon, 22 Jun 2020 12:02:34 +0300 Subject: [PATCH 0009/1120] (new-cli) - added IRootCommandHandler --- new-cli/Calculate/CalculateCommandHandler.cs | 2 +- new-cli/Calculate/CalculateModule.cs | 2 +- new-cli/Cli/GitVersionApp.cs | 2 +- new-cli/Core/Infrastructure/IRootCommandHandler.cs | 6 ++++++ new-cli/Output/OutputCommandHandler.cs | 2 +- new-cli/Output/OutputModule.cs | 2 +- 6 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 new-cli/Core/Infrastructure/IRootCommandHandler.cs diff --git a/new-cli/Calculate/CalculateCommandHandler.cs b/new-cli/Calculate/CalculateCommandHandler.cs index 957f130c87..83abf471bd 100644 --- a/new-cli/Calculate/CalculateCommandHandler.cs +++ b/new-cli/Calculate/CalculateCommandHandler.cs @@ -4,7 +4,7 @@ namespace Calculate { - public class CalculateCommandHandler : CommandHandler + public class CalculateCommandHandler : CommandHandler, IRootCommandHandler { private readonly IService service; diff --git a/new-cli/Calculate/CalculateModule.cs b/new-cli/Calculate/CalculateModule.cs index ef0c9d45dc..8935aeee2f 100644 --- a/new-cli/Calculate/CalculateModule.cs +++ b/new-cli/Calculate/CalculateModule.cs @@ -6,7 +6,7 @@ public class CalculateModule : IGitVersionModule { public void RegisterTypes(IContainerRegistrar services) { - services.AddSingleton(); + services.AddSingleton(); } } } \ No newline at end of file diff --git a/new-cli/Cli/GitVersionApp.cs b/new-cli/Cli/GitVersionApp.cs index 99eccf59f8..f7b8a6a48b 100644 --- a/new-cli/Cli/GitVersionApp.cs +++ b/new-cli/Cli/GitVersionApp.cs @@ -12,7 +12,7 @@ namespace Cli { internal class GitVersionApp : RootCommand { - public GitVersionApp(IEnumerable commandHandlers) + public GitVersionApp(IEnumerable commandHandlers) { foreach (var commandHandler in commandHandlers) { diff --git a/new-cli/Core/Infrastructure/IRootCommandHandler.cs b/new-cli/Core/Infrastructure/IRootCommandHandler.cs new file mode 100644 index 0000000000..7ff8e5512c --- /dev/null +++ b/new-cli/Core/Infrastructure/IRootCommandHandler.cs @@ -0,0 +1,6 @@ +namespace Core +{ + public interface IRootCommandHandler : ICommandHandler + { + } +} \ No newline at end of file diff --git a/new-cli/Output/OutputCommandHandler.cs b/new-cli/Output/OutputCommandHandler.cs index 03852ad57f..d3c86ea107 100644 --- a/new-cli/Output/OutputCommandHandler.cs +++ b/new-cli/Output/OutputCommandHandler.cs @@ -3,7 +3,7 @@ namespace Output { - public class OutputCommandHandler : CommandHandler + public class OutputCommandHandler : CommandHandler, IRootCommandHandler { private readonly IEnumerable commandHandlers; diff --git a/new-cli/Output/OutputModule.cs b/new-cli/Output/OutputModule.cs index 60892b7164..f660c5c9c5 100644 --- a/new-cli/Output/OutputModule.cs +++ b/new-cli/Output/OutputModule.cs @@ -6,7 +6,7 @@ public class OutputModule : IGitVersionModule { public void RegisterTypes(IContainerRegistrar services) { - services.AddSingleton(); + services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); From 50af78cd1133d4443a156130b49296f123874290 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Mon, 22 Jun 2020 12:04:43 +0300 Subject: [PATCH 0010/1120] (new-cli) - added type constraint on GitVersionOptions --- new-cli/Core/Infrastructure/CommandHandler.cs | 4 ++-- new-cli/Core/Infrastructure/ICommandHandler.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/new-cli/Core/Infrastructure/CommandHandler.cs b/new-cli/Core/Infrastructure/CommandHandler.cs index bf78fb6ce7..be9e2a0e03 100644 --- a/new-cli/Core/Infrastructure/CommandHandler.cs +++ b/new-cli/Core/Infrastructure/CommandHandler.cs @@ -4,11 +4,11 @@ namespace Core { - public abstract class CommandHandler : ICommandHandler + public abstract class CommandHandler : ICommandHandler where T : GitVersionOptions { public virtual Task InvokeAsync(T options) => Task.FromResult(0); - public Task InvokeAsync(object options) => InvokeAsync((T) options); + public Task InvokeAsync(GitVersionOptions options) => InvokeAsync((T) options); public virtual IEnumerable SubCommands() => Enumerable.Empty(); } diff --git a/new-cli/Core/Infrastructure/ICommandHandler.cs b/new-cli/Core/Infrastructure/ICommandHandler.cs index 4406e75b24..208695c9ab 100644 --- a/new-cli/Core/Infrastructure/ICommandHandler.cs +++ b/new-cli/Core/Infrastructure/ICommandHandler.cs @@ -5,7 +5,7 @@ namespace Core { public interface ICommandHandler { - Task InvokeAsync(object options); + Task InvokeAsync(GitVersionOptions options); IEnumerable SubCommands(); } From 9cacc5d6af629dd6f51f9c68bbccce8980f93a3d Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Mon, 22 Jun 2020 12:05:38 +0300 Subject: [PATCH 0011/1120] (new-cli) - cleanup --- new-cli/Core/Infrastructure/CommandHandler.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/new-cli/Core/Infrastructure/CommandHandler.cs b/new-cli/Core/Infrastructure/CommandHandler.cs index be9e2a0e03..52f004beff 100644 --- a/new-cli/Core/Infrastructure/CommandHandler.cs +++ b/new-cli/Core/Infrastructure/CommandHandler.cs @@ -6,9 +6,8 @@ namespace Core { public abstract class CommandHandler : ICommandHandler where T : GitVersionOptions { - public virtual Task InvokeAsync(T options) => Task.FromResult(0); - public Task InvokeAsync(GitVersionOptions options) => InvokeAsync((T) options); + public virtual Task InvokeAsync(T options) => Task.FromResult(0); public virtual IEnumerable SubCommands() => Enumerable.Empty(); } From 0d5e0b038a6a47a87e08ca3f566b6ccbeb5a5b01 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Mon, 22 Jun 2020 13:03:54 +0300 Subject: [PATCH 0012/1120] (new-cli) - added CoreModule - register the core module dependencies Loading the modules from assemblies --- .../Extensions/ServiceCollectionExtensions.cs | 14 ++++++++++- new-cli/Cli/Program.cs | 25 +++++++++++++------ new-cli/Core/CoreModule.cs | 10 ++++++++ 3 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 new-cli/Core/CoreModule.cs diff --git a/new-cli/Cli/Extensions/ServiceCollectionExtensions.cs b/new-cli/Cli/Extensions/ServiceCollectionExtensions.cs index dd397d7649..5a31f7e0ce 100644 --- a/new-cli/Cli/Extensions/ServiceCollectionExtensions.cs +++ b/new-cli/Cli/Extensions/ServiceCollectionExtensions.cs @@ -1,4 +1,6 @@ -namespace Core +using System.Collections.Generic; + +namespace Core { public static class ServiceCollectionExtensions { @@ -8,5 +10,15 @@ public static IContainerRegistrar RegisterModule(this IContainerRegistrar servic gitVersionModule.RegisterTypes(serviceCollection); return serviceCollection; } + + public static IContainerRegistrar RegisterModules(this IContainerRegistrar serviceCollection, + IEnumerable gitVersionModules) + { + foreach (var gitVersionModule in gitVersionModules) + { + gitVersionModule.RegisterTypes(serviceCollection); + } + return serviceCollection; + } } } \ No newline at end of file diff --git a/new-cli/Cli/Program.cs b/new-cli/Cli/Program.cs index 8784839e8a..2027767214 100644 --- a/new-cli/Cli/Program.cs +++ b/new-cli/Cli/Program.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Threading.Tasks; using Calculate; using Core; @@ -10,21 +11,29 @@ internal static class Program { private static async Task Main(string[] args) { - using var serviceProvider = new ContainerRegistrar() + // TODO: load the list of assemblies from the app working directory + var assemblies = new[] + { + typeof(CoreModule).Assembly, + typeof(CalculateModule).Assembly, + typeof(OutputModule).Assembly + }; + + var gitVersionModules = assemblies + .SelectMany(a => a.GetTypes().Where(t => typeof(IGitVersionModule).IsAssignableFrom(t) && !t.IsInterface)) + .Select(t => (IGitVersionModule)Activator.CreateInstance(t)) + .ToList(); + + using var serviceProvider = new ContainerRegistrar() + .RegisterModules(gitVersionModules) .AddSingleton() - .AddSingleton() - .RegisterModule(new CalculateModule()) - .RegisterModule(new OutputModule()) .Build(); var app = serviceProvider.GetService(); var result = await app.RunAsync(args); - if (!Console.IsInputRedirected) - { - Console.ReadKey(); - } + if (!Console.IsInputRedirected) Console.ReadKey(); return result; } diff --git a/new-cli/Core/CoreModule.cs b/new-cli/Core/CoreModule.cs new file mode 100644 index 0000000000..508dd636ce --- /dev/null +++ b/new-cli/Core/CoreModule.cs @@ -0,0 +1,10 @@ +namespace Core +{ + public class CoreModule : IGitVersionModule + { + public void RegisterTypes(IContainerRegistrar services) + { + services.AddSingleton(); + } + } +} \ No newline at end of file From 92cc08437d7730471d1d1a854181034d87022809 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Mon, 22 Jun 2020 14:19:53 +0300 Subject: [PATCH 0013/1120] (new-cli) - added "GitVersion." prefix to project names --- .../CalculateCommandHandler.cs | 5 +++-- .../CalculateModule.cs | 4 ++-- .../CalculateOptions.cs | 5 +++-- .../GitVersion.Calculate.csproj} | 3 ++- new-cli/{Cli => GitVersion.Cli}/Container.cs | 3 ++- new-cli/{Cli => GitVersion.Cli}/ContainerRegistrar.cs | 5 +++-- .../Extensions/ServiceCollectionExtensions.cs | 3 ++- .../GitVersion.Cli.csproj} | 5 +++-- new-cli/{Cli => GitVersion.Cli}/GitVersionApp.cs | 6 +++--- new-cli/{Cli => GitVersion.Cli}/Program.cs | 10 ++++++---- new-cli/{Core => GitVersion.Core}/CoreModule.cs | 4 +++- .../GitVersion.Core.csproj} | 1 + new-cli/{Core => GitVersion.Core}/GitVersionOptions.cs | 3 ++- new-cli/{Core => GitVersion.Core}/IService.cs | 2 +- .../Infrastructure/CommandAttribute.cs | 2 +- .../Infrastructure/CommandHandler.cs | 2 +- .../Infrastructure/ICommandHandler.cs | 2 +- .../Infrastructure/IContainer.cs | 2 +- .../Infrastructure/IContainerRegistrar.cs | 2 +- .../Infrastructure/IGitVersionModule.cs | 2 +- .../Infrastructure/IRootCommandHandler.cs | 2 +- .../Infrastructure/OptionAttribute.cs | 2 +- new-cli/{Core => GitVersion.Core}/Service.cs | 2 +- .../AssemblyInfo/OutputAssemblyInfoCommandHandler.cs | 5 +++-- .../AssemblyInfo/OutputAssemblyInfoOptions.cs | 4 ++-- .../GitVersion.Output.csproj} | 3 ++- .../IOutputCommandHandler.cs | 4 ++-- .../OutputCommandHandler.cs | 4 ++-- new-cli/{Output => GitVersion.Output}/OutputModule.cs | 7 +++++-- new-cli/{Output => GitVersion.Output}/OutputOptions.cs | 5 +++-- .../Project/OutputProjectCommandHandler.cs | 5 +++-- .../Project/OutputProjectOptions.cs | 4 ++-- .../Wix/OutputWixCommandHandler.cs | 5 +++-- .../Wix/OutputWixOptions.cs | 4 ++-- new-cli/{Cli.sln => GitVersion.sln} | 8 ++++---- 35 files changed, 78 insertions(+), 57 deletions(-) rename new-cli/{Calculate => GitVersion.Calculate}/CalculateCommandHandler.cs (86%) rename new-cli/{Calculate => GitVersion.Calculate}/CalculateModule.cs (76%) rename new-cli/{Calculate => GitVersion.Calculate}/CalculateOptions.cs (76%) rename new-cli/{Output/Output.csproj => GitVersion.Calculate/GitVersion.Calculate.csproj} (56%) rename new-cli/{Cli => GitVersion.Cli}/Container.cs (88%) rename new-cli/{Cli => GitVersion.Cli}/ContainerRegistrar.cs (90%) rename new-cli/{Cli => GitVersion.Cli}/Extensions/ServiceCollectionExtensions.cs (91%) rename new-cli/{Cli/Cli.csproj => GitVersion.Cli/GitVersion.Cli.csproj} (65%) rename new-cli/{Cli => GitVersion.Cli}/GitVersionApp.cs (94%) rename new-cli/{Cli => GitVersion.Cli}/Program.cs (87%) rename new-cli/{Core => GitVersion.Core}/CoreModule.cs (74%) rename new-cli/{Core/Core.csproj => GitVersion.Core/GitVersion.Core.csproj} (76%) rename new-cli/{Core => GitVersion.Core}/GitVersionOptions.cs (73%) rename new-cli/{Core => GitVersion.Core}/IService.cs (69%) rename new-cli/{Core => GitVersion.Core}/Infrastructure/CommandAttribute.cs (89%) rename new-cli/{Core => GitVersion.Core}/Infrastructure/CommandHandler.cs (91%) rename new-cli/{Core => GitVersion.Core}/Infrastructure/ICommandHandler.cs (84%) rename new-cli/{Core => GitVersion.Core}/Infrastructure/IContainer.cs (77%) rename new-cli/{Core => GitVersion.Core}/Infrastructure/IContainerRegistrar.cs (92%) rename new-cli/{Core => GitVersion.Core}/Infrastructure/IGitVersionModule.cs (71%) rename new-cli/{Core => GitVersion.Core}/Infrastructure/IRootCommandHandler.cs (62%) rename new-cli/{Core => GitVersion.Core}/Infrastructure/OptionAttribute.cs (93%) rename new-cli/{Core => GitVersion.Core}/Service.cs (80%) rename new-cli/{Output => GitVersion.Output}/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs (89%) rename new-cli/{Output => GitVersion.Output}/AssemblyInfo/OutputAssemblyInfoOptions.cs (75%) rename new-cli/{Calculate/Calculate.csproj => GitVersion.Output/GitVersion.Output.csproj} (56%) rename new-cli/{Output => GitVersion.Output}/IOutputCommandHandler.cs (52%) rename new-cli/{Output => GitVersion.Output}/OutputCommandHandler.cs (87%) rename new-cli/{Output => GitVersion.Output}/OutputModule.cs (74%) rename new-cli/{Output => GitVersion.Output}/OutputOptions.cs (85%) rename new-cli/{Output => GitVersion.Output}/Project/OutputProjectCommandHandler.cs (87%) rename new-cli/{Output => GitVersion.Output}/Project/OutputProjectOptions.cs (74%) rename new-cli/{Output => GitVersion.Output}/Wix/OutputWixCommandHandler.cs (88%) rename new-cli/{Output => GitVersion.Output}/Wix/OutputWixOptions.cs (74%) rename new-cli/{Cli.sln => GitVersion.sln} (72%) diff --git a/new-cli/Calculate/CalculateCommandHandler.cs b/new-cli/GitVersion.Calculate/CalculateCommandHandler.cs similarity index 86% rename from new-cli/Calculate/CalculateCommandHandler.cs rename to new-cli/GitVersion.Calculate/CalculateCommandHandler.cs index 83abf471bd..0999ab7042 100644 --- a/new-cli/Calculate/CalculateCommandHandler.cs +++ b/new-cli/GitVersion.Calculate/CalculateCommandHandler.cs @@ -1,8 +1,9 @@ using System; using System.Threading.Tasks; -using Core; +using GitVersion.Core; +using GitVersion.Core.Infrastructure; -namespace Calculate +namespace GitVersion.Calculate { public class CalculateCommandHandler : CommandHandler, IRootCommandHandler { diff --git a/new-cli/Calculate/CalculateModule.cs b/new-cli/GitVersion.Calculate/CalculateModule.cs similarity index 76% rename from new-cli/Calculate/CalculateModule.cs rename to new-cli/GitVersion.Calculate/CalculateModule.cs index 8935aeee2f..bf3e210a48 100644 --- a/new-cli/Calculate/CalculateModule.cs +++ b/new-cli/GitVersion.Calculate/CalculateModule.cs @@ -1,6 +1,6 @@ -using Core; +using GitVersion.Core.Infrastructure; -namespace Calculate +namespace GitVersion.Calculate { public class CalculateModule : IGitVersionModule { diff --git a/new-cli/Calculate/CalculateOptions.cs b/new-cli/GitVersion.Calculate/CalculateOptions.cs similarity index 76% rename from new-cli/Calculate/CalculateOptions.cs rename to new-cli/GitVersion.Calculate/CalculateOptions.cs index 4644914a73..52fb917462 100644 --- a/new-cli/Calculate/CalculateOptions.cs +++ b/new-cli/GitVersion.Calculate/CalculateOptions.cs @@ -1,7 +1,8 @@ using System.IO; -using Core; +using GitVersion.Core; +using GitVersion.Core.Infrastructure; -namespace Calculate +namespace GitVersion.Calculate { [Command("calculate", "Calculates the version object from the git history.")] public class CalculateOptions : GitVersionOptions diff --git a/new-cli/Output/Output.csproj b/new-cli/GitVersion.Calculate/GitVersion.Calculate.csproj similarity index 56% rename from new-cli/Output/Output.csproj rename to new-cli/GitVersion.Calculate/GitVersion.Calculate.csproj index 03b0040fe4..72519002fb 100644 --- a/new-cli/Output/Output.csproj +++ b/new-cli/GitVersion.Calculate/GitVersion.Calculate.csproj @@ -2,10 +2,11 @@ netstandard2.0 + GitVersion.Calculate - + diff --git a/new-cli/Cli/Container.cs b/new-cli/GitVersion.Cli/Container.cs similarity index 88% rename from new-cli/Cli/Container.cs rename to new-cli/GitVersion.Cli/Container.cs index 9f1607723f..178384f4bf 100644 --- a/new-cli/Cli/Container.cs +++ b/new-cli/GitVersion.Cli/Container.cs @@ -1,7 +1,8 @@ using System; +using GitVersion.Core.Infrastructure; using Microsoft.Extensions.DependencyInjection; -namespace Core +namespace GitVersion.Cli { public class Container : IContainer { diff --git a/new-cli/Cli/ContainerRegistrar.cs b/new-cli/GitVersion.Cli/ContainerRegistrar.cs similarity index 90% rename from new-cli/Cli/ContainerRegistrar.cs rename to new-cli/GitVersion.Cli/ContainerRegistrar.cs index c303e41756..4bfabf512e 100644 --- a/new-cli/Cli/ContainerRegistrar.cs +++ b/new-cli/GitVersion.Cli/ContainerRegistrar.cs @@ -1,6 +1,7 @@ -using Microsoft.Extensions.DependencyInjection; +using GitVersion.Core.Infrastructure; +using Microsoft.Extensions.DependencyInjection; -namespace Core +namespace GitVersion.Cli { public class ContainerRegistrar : IContainerRegistrar { diff --git a/new-cli/Cli/Extensions/ServiceCollectionExtensions.cs b/new-cli/GitVersion.Cli/Extensions/ServiceCollectionExtensions.cs similarity index 91% rename from new-cli/Cli/Extensions/ServiceCollectionExtensions.cs rename to new-cli/GitVersion.Cli/Extensions/ServiceCollectionExtensions.cs index 5a31f7e0ce..ef22dfb958 100644 --- a/new-cli/Cli/Extensions/ServiceCollectionExtensions.cs +++ b/new-cli/GitVersion.Cli/Extensions/ServiceCollectionExtensions.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; +using GitVersion.Core.Infrastructure; -namespace Core +namespace GitVersion.Cli.Extensions { public static class ServiceCollectionExtensions { diff --git a/new-cli/Cli/Cli.csproj b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj similarity index 65% rename from new-cli/Cli/Cli.csproj rename to new-cli/GitVersion.Cli/GitVersion.Cli.csproj index b9e744f503..6e9896dc3a 100644 --- a/new-cli/Cli/Cli.csproj +++ b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj @@ -3,6 +3,7 @@ Exe netcoreapp3.1 + GitVersion.Cli @@ -11,8 +12,8 @@ - - + + diff --git a/new-cli/Cli/GitVersionApp.cs b/new-cli/GitVersion.Cli/GitVersionApp.cs similarity index 94% rename from new-cli/Cli/GitVersionApp.cs rename to new-cli/GitVersion.Cli/GitVersionApp.cs index f7b8a6a48b..0712de1c9c 100644 --- a/new-cli/Cli/GitVersionApp.cs +++ b/new-cli/GitVersion.Cli/GitVersionApp.cs @@ -5,10 +5,10 @@ using System.CommandLine.Parsing; using System.Reflection; using System.Threading.Tasks; -using Core; -using ICommandHandler = Core.ICommandHandler; +using GitVersion.Core.Infrastructure; +using ICommandHandler = GitVersion.Core.Infrastructure.ICommandHandler; -namespace Cli +namespace GitVersion.Cli { internal class GitVersionApp : RootCommand { diff --git a/new-cli/Cli/Program.cs b/new-cli/GitVersion.Cli/Program.cs similarity index 87% rename from new-cli/Cli/Program.cs rename to new-cli/GitVersion.Cli/Program.cs index 2027767214..516ef6fa12 100644 --- a/new-cli/Cli/Program.cs +++ b/new-cli/GitVersion.Cli/Program.cs @@ -1,11 +1,13 @@ using System; using System.Linq; using System.Threading.Tasks; -using Calculate; -using Core; -using Output; +using GitVersion.Calculate; +using GitVersion.Cli.Extensions; +using GitVersion.Core; +using GitVersion.Core.Infrastructure; +using GitVersion.Output; -namespace Cli +namespace GitVersion.Cli { internal static class Program { diff --git a/new-cli/Core/CoreModule.cs b/new-cli/GitVersion.Core/CoreModule.cs similarity index 74% rename from new-cli/Core/CoreModule.cs rename to new-cli/GitVersion.Core/CoreModule.cs index 508dd636ce..bf14a6b4c6 100644 --- a/new-cli/Core/CoreModule.cs +++ b/new-cli/GitVersion.Core/CoreModule.cs @@ -1,4 +1,6 @@ -namespace Core +using GitVersion.Core.Infrastructure; + +namespace GitVersion.Core { public class CoreModule : IGitVersionModule { diff --git a/new-cli/Core/Core.csproj b/new-cli/GitVersion.Core/GitVersion.Core.csproj similarity index 76% rename from new-cli/Core/Core.csproj rename to new-cli/GitVersion.Core/GitVersion.Core.csproj index e49d1ca096..65aa55b17e 100644 --- a/new-cli/Core/Core.csproj +++ b/new-cli/GitVersion.Core/GitVersion.Core.csproj @@ -3,6 +3,7 @@ netstandard2.0 8 + GitVersion.Core diff --git a/new-cli/Core/GitVersionOptions.cs b/new-cli/GitVersion.Core/GitVersionOptions.cs similarity index 73% rename from new-cli/Core/GitVersionOptions.cs rename to new-cli/GitVersion.Core/GitVersionOptions.cs index 4a9614c3fe..f68b3ed231 100644 --- a/new-cli/Core/GitVersionOptions.cs +++ b/new-cli/GitVersion.Core/GitVersionOptions.cs @@ -1,6 +1,7 @@ using System.IO; +using GitVersion.Core.Infrastructure; -namespace Core +namespace GitVersion.Core { public class GitVersionOptions { diff --git a/new-cli/Core/IService.cs b/new-cli/GitVersion.Core/IService.cs similarity index 69% rename from new-cli/Core/IService.cs rename to new-cli/GitVersion.Core/IService.cs index e68579346e..aff7572ab9 100644 --- a/new-cli/Core/IService.cs +++ b/new-cli/GitVersion.Core/IService.cs @@ -1,4 +1,4 @@ -namespace Core +namespace GitVersion.Core { public interface IService { diff --git a/new-cli/Core/Infrastructure/CommandAttribute.cs b/new-cli/GitVersion.Core/Infrastructure/CommandAttribute.cs similarity index 89% rename from new-cli/Core/Infrastructure/CommandAttribute.cs rename to new-cli/GitVersion.Core/Infrastructure/CommandAttribute.cs index 47c6223971..900ba0754e 100644 --- a/new-cli/Core/Infrastructure/CommandAttribute.cs +++ b/new-cli/GitVersion.Core/Infrastructure/CommandAttribute.cs @@ -1,6 +1,6 @@ using System; -namespace Core +namespace GitVersion.Core.Infrastructure { [AttributeUsage(AttributeTargets.Class)] public class CommandAttribute : Attribute diff --git a/new-cli/Core/Infrastructure/CommandHandler.cs b/new-cli/GitVersion.Core/Infrastructure/CommandHandler.cs similarity index 91% rename from new-cli/Core/Infrastructure/CommandHandler.cs rename to new-cli/GitVersion.Core/Infrastructure/CommandHandler.cs index 52f004beff..6713ccf5b8 100644 --- a/new-cli/Core/Infrastructure/CommandHandler.cs +++ b/new-cli/GitVersion.Core/Infrastructure/CommandHandler.cs @@ -2,7 +2,7 @@ using System.Linq; using System.Threading.Tasks; -namespace Core +namespace GitVersion.Core.Infrastructure { public abstract class CommandHandler : ICommandHandler where T : GitVersionOptions { diff --git a/new-cli/Core/Infrastructure/ICommandHandler.cs b/new-cli/GitVersion.Core/Infrastructure/ICommandHandler.cs similarity index 84% rename from new-cli/Core/Infrastructure/ICommandHandler.cs rename to new-cli/GitVersion.Core/Infrastructure/ICommandHandler.cs index 208695c9ab..1fb5c2c168 100644 --- a/new-cli/Core/Infrastructure/ICommandHandler.cs +++ b/new-cli/GitVersion.Core/Infrastructure/ICommandHandler.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace Core +namespace GitVersion.Core.Infrastructure { public interface ICommandHandler { diff --git a/new-cli/Core/Infrastructure/IContainer.cs b/new-cli/GitVersion.Core/Infrastructure/IContainer.cs similarity index 77% rename from new-cli/Core/Infrastructure/IContainer.cs rename to new-cli/GitVersion.Core/Infrastructure/IContainer.cs index e9ada1d3c5..4e8ea338f0 100644 --- a/new-cli/Core/Infrastructure/IContainer.cs +++ b/new-cli/GitVersion.Core/Infrastructure/IContainer.cs @@ -1,6 +1,6 @@ using System; -namespace Core +namespace GitVersion.Core.Infrastructure { public interface IContainer : IDisposable { diff --git a/new-cli/Core/Infrastructure/IContainerRegistrar.cs b/new-cli/GitVersion.Core/Infrastructure/IContainerRegistrar.cs similarity index 92% rename from new-cli/Core/Infrastructure/IContainerRegistrar.cs rename to new-cli/GitVersion.Core/Infrastructure/IContainerRegistrar.cs index 3bcb3a60af..7863ffd07d 100644 --- a/new-cli/Core/Infrastructure/IContainerRegistrar.cs +++ b/new-cli/GitVersion.Core/Infrastructure/IContainerRegistrar.cs @@ -1,4 +1,4 @@ -namespace Core +namespace GitVersion.Core.Infrastructure { public interface IContainerRegistrar { diff --git a/new-cli/Core/Infrastructure/IGitVersionModule.cs b/new-cli/GitVersion.Core/Infrastructure/IGitVersionModule.cs similarity index 71% rename from new-cli/Core/Infrastructure/IGitVersionModule.cs rename to new-cli/GitVersion.Core/Infrastructure/IGitVersionModule.cs index 4d43b59117..35b9333c20 100644 --- a/new-cli/Core/Infrastructure/IGitVersionModule.cs +++ b/new-cli/GitVersion.Core/Infrastructure/IGitVersionModule.cs @@ -1,4 +1,4 @@ -namespace Core +namespace GitVersion.Core.Infrastructure { public interface IGitVersionModule { diff --git a/new-cli/Core/Infrastructure/IRootCommandHandler.cs b/new-cli/GitVersion.Core/Infrastructure/IRootCommandHandler.cs similarity index 62% rename from new-cli/Core/Infrastructure/IRootCommandHandler.cs rename to new-cli/GitVersion.Core/Infrastructure/IRootCommandHandler.cs index 7ff8e5512c..f53e43dae1 100644 --- a/new-cli/Core/Infrastructure/IRootCommandHandler.cs +++ b/new-cli/GitVersion.Core/Infrastructure/IRootCommandHandler.cs @@ -1,4 +1,4 @@ -namespace Core +namespace GitVersion.Core.Infrastructure { public interface IRootCommandHandler : ICommandHandler { diff --git a/new-cli/Core/Infrastructure/OptionAttribute.cs b/new-cli/GitVersion.Core/Infrastructure/OptionAttribute.cs similarity index 93% rename from new-cli/Core/Infrastructure/OptionAttribute.cs rename to new-cli/GitVersion.Core/Infrastructure/OptionAttribute.cs index ef16bb3a64..a80974b182 100644 --- a/new-cli/Core/Infrastructure/OptionAttribute.cs +++ b/new-cli/GitVersion.Core/Infrastructure/OptionAttribute.cs @@ -1,6 +1,6 @@ using System; -namespace Core +namespace GitVersion.Core.Infrastructure { [AttributeUsage(AttributeTargets.Property)] public class OptionAttribute : Attribute diff --git a/new-cli/Core/Service.cs b/new-cli/GitVersion.Core/Service.cs similarity index 80% rename from new-cli/Core/Service.cs rename to new-cli/GitVersion.Core/Service.cs index 62763c7c79..e033104eeb 100644 --- a/new-cli/Core/Service.cs +++ b/new-cli/GitVersion.Core/Service.cs @@ -1,4 +1,4 @@ -namespace Core +namespace GitVersion.Core { public class Service : IService { diff --git a/new-cli/Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs b/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs similarity index 89% rename from new-cli/Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs rename to new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs index b25823f3b5..32d42370fa 100644 --- a/new-cli/Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs +++ b/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs @@ -1,8 +1,9 @@ using System; using System.Threading.Tasks; -using Core; +using GitVersion.Core; +using GitVersion.Core.Infrastructure; -namespace Output +namespace GitVersion.Output.AssemblyInfo { public class OutputAssemblyInfoCommandHandler : CommandHandler, IOutputCommandHandler { diff --git a/new-cli/Output/AssemblyInfo/OutputAssemblyInfoOptions.cs b/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoOptions.cs similarity index 75% rename from new-cli/Output/AssemblyInfo/OutputAssemblyInfoOptions.cs rename to new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoOptions.cs index 99d58c40b1..f27d267415 100644 --- a/new-cli/Output/AssemblyInfo/OutputAssemblyInfoOptions.cs +++ b/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoOptions.cs @@ -1,6 +1,6 @@ -using Core; +using GitVersion.Core.Infrastructure; -namespace Output +namespace GitVersion.Output.AssemblyInfo { [Command("assemblyinfo", "Outputs version to assembly")] public class OutputAssemblyInfoOptions : OutputOptions diff --git a/new-cli/Calculate/Calculate.csproj b/new-cli/GitVersion.Output/GitVersion.Output.csproj similarity index 56% rename from new-cli/Calculate/Calculate.csproj rename to new-cli/GitVersion.Output/GitVersion.Output.csproj index 03b0040fe4..c7da650a0a 100644 --- a/new-cli/Calculate/Calculate.csproj +++ b/new-cli/GitVersion.Output/GitVersion.Output.csproj @@ -2,10 +2,11 @@ netstandard2.0 + GitVersion.Output - + diff --git a/new-cli/Output/IOutputCommandHandler.cs b/new-cli/GitVersion.Output/IOutputCommandHandler.cs similarity index 52% rename from new-cli/Output/IOutputCommandHandler.cs rename to new-cli/GitVersion.Output/IOutputCommandHandler.cs index a8be241dec..fe3077c044 100644 --- a/new-cli/Output/IOutputCommandHandler.cs +++ b/new-cli/GitVersion.Output/IOutputCommandHandler.cs @@ -1,6 +1,6 @@ -using Core; +using GitVersion.Core.Infrastructure; -namespace Output +namespace GitVersion.Output { public interface IOutputCommandHandler : ICommandHandler { diff --git a/new-cli/Output/OutputCommandHandler.cs b/new-cli/GitVersion.Output/OutputCommandHandler.cs similarity index 87% rename from new-cli/Output/OutputCommandHandler.cs rename to new-cli/GitVersion.Output/OutputCommandHandler.cs index d3c86ea107..3ec26e194f 100644 --- a/new-cli/Output/OutputCommandHandler.cs +++ b/new-cli/GitVersion.Output/OutputCommandHandler.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; -using Core; +using GitVersion.Core.Infrastructure; -namespace Output +namespace GitVersion.Output { public class OutputCommandHandler : CommandHandler, IRootCommandHandler { diff --git a/new-cli/Output/OutputModule.cs b/new-cli/GitVersion.Output/OutputModule.cs similarity index 74% rename from new-cli/Output/OutputModule.cs rename to new-cli/GitVersion.Output/OutputModule.cs index f660c5c9c5..4e81f8b811 100644 --- a/new-cli/Output/OutputModule.cs +++ b/new-cli/GitVersion.Output/OutputModule.cs @@ -1,6 +1,9 @@ -using Core; +using GitVersion.Core.Infrastructure; +using GitVersion.Output.AssemblyInfo; +using GitVersion.Output.Project; +using GitVersion.Output.Wix; -namespace Output +namespace GitVersion.Output { public class OutputModule : IGitVersionModule { diff --git a/new-cli/Output/OutputOptions.cs b/new-cli/GitVersion.Output/OutputOptions.cs similarity index 85% rename from new-cli/Output/OutputOptions.cs rename to new-cli/GitVersion.Output/OutputOptions.cs index d003970bff..5f11abb6e8 100644 --- a/new-cli/Output/OutputOptions.cs +++ b/new-cli/GitVersion.Output/OutputOptions.cs @@ -1,8 +1,9 @@ using System; using System.IO; -using Core; +using GitVersion.Core; +using GitVersion.Core.Infrastructure; -namespace Output +namespace GitVersion.Output { [Command("output", "Outputs the version object.")] public class OutputOptions : GitVersionOptions diff --git a/new-cli/Output/Project/OutputProjectCommandHandler.cs b/new-cli/GitVersion.Output/Project/OutputProjectCommandHandler.cs similarity index 87% rename from new-cli/Output/Project/OutputProjectCommandHandler.cs rename to new-cli/GitVersion.Output/Project/OutputProjectCommandHandler.cs index 7a0137c253..fe3d3d53e3 100644 --- a/new-cli/Output/Project/OutputProjectCommandHandler.cs +++ b/new-cli/GitVersion.Output/Project/OutputProjectCommandHandler.cs @@ -1,8 +1,9 @@ using System; using System.Threading.Tasks; -using Core; +using GitVersion.Core; +using GitVersion.Core.Infrastructure; -namespace Output +namespace GitVersion.Output.Project { public class OutputProjectCommandHandler : CommandHandler, IOutputCommandHandler { diff --git a/new-cli/Output/Project/OutputProjectOptions.cs b/new-cli/GitVersion.Output/Project/OutputProjectOptions.cs similarity index 74% rename from new-cli/Output/Project/OutputProjectOptions.cs rename to new-cli/GitVersion.Output/Project/OutputProjectOptions.cs index 108e56664c..4fc00c8848 100644 --- a/new-cli/Output/Project/OutputProjectOptions.cs +++ b/new-cli/GitVersion.Output/Project/OutputProjectOptions.cs @@ -1,6 +1,6 @@ -using Core; +using GitVersion.Core.Infrastructure; -namespace Output +namespace GitVersion.Output.Project { [Command("project", "Outputs version to project")] public class OutputProjectOptions : OutputOptions diff --git a/new-cli/Output/Wix/OutputWixCommandHandler.cs b/new-cli/GitVersion.Output/Wix/OutputWixCommandHandler.cs similarity index 88% rename from new-cli/Output/Wix/OutputWixCommandHandler.cs rename to new-cli/GitVersion.Output/Wix/OutputWixCommandHandler.cs index 014b23fb6c..b20a084909 100644 --- a/new-cli/Output/Wix/OutputWixCommandHandler.cs +++ b/new-cli/GitVersion.Output/Wix/OutputWixCommandHandler.cs @@ -1,8 +1,9 @@ using System; using System.Threading.Tasks; -using Core; +using GitVersion.Core; +using GitVersion.Core.Infrastructure; -namespace Output +namespace GitVersion.Output.Wix { public class OutputWixCommandHandler : CommandHandler, IOutputCommandHandler { diff --git a/new-cli/Output/Wix/OutputWixOptions.cs b/new-cli/GitVersion.Output/Wix/OutputWixOptions.cs similarity index 74% rename from new-cli/Output/Wix/OutputWixOptions.cs rename to new-cli/GitVersion.Output/Wix/OutputWixOptions.cs index 83806ef0ab..8ba1692ccc 100644 --- a/new-cli/Output/Wix/OutputWixOptions.cs +++ b/new-cli/GitVersion.Output/Wix/OutputWixOptions.cs @@ -1,6 +1,6 @@ -using Core; +using GitVersion.Core.Infrastructure; -namespace Output +namespace GitVersion.Output.Wix { [Command("wix", "Outputs version to wix file")] public class OutputWixOptions : OutputOptions diff --git a/new-cli/Cli.sln b/new-cli/GitVersion.sln similarity index 72% rename from new-cli/Cli.sln rename to new-cli/GitVersion.sln index e2fa82a73e..95201ff11c 100644 --- a/new-cli/Cli.sln +++ b/new-cli/GitVersion.sln @@ -1,12 +1,12 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cli", "Cli\Cli.csproj", "{E2520F2D-A6FF-4079-85A4-584AA0CC8594}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Cli", "GitVersion.Cli\GitVersion.Cli.csproj", "{E2520F2D-A6FF-4079-85A4-584AA0CC8594}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "Core\Core.csproj", "{02332393-1F38-4819-8D6F-3D1968B38919}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Core", "GitVersion.Core\GitVersion.Core.csproj", "{02332393-1F38-4819-8D6F-3D1968B38919}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Calculate", "Calculate\Calculate.csproj", "{8F6D4830-B870-4365-9662-457F1A13894B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Calculate", "GitVersion.Calculate\GitVersion.Calculate.csproj", "{8F6D4830-B870-4365-9662-457F1A13894B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Output", "Output\Output.csproj", "{9543A475-06BA-4C8D-A3CE-E2792FE663DA}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Output", "GitVersion.Output\GitVersion.Output.csproj", "{9543A475-06BA-4C8D-A3CE-E2792FE663DA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution From 7678cad8daac072d361783704c09a65755675887 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Mon, 22 Jun 2020 14:25:18 +0300 Subject: [PATCH 0014/1120] (new-cli) - added run configurations --- .../.idea.GitVersion/.idea/contentModel.xml | 95 +++++++++++++++++++ .../.idea.GitVersion/.idea/encodings.xml | 4 + .../.idea.GitVersion/.idea/indexLayout.xml | 8 ++ .../.idea/.idea.GitVersion/.idea/modules.xml | 8 ++ .../.idea/projectSettingsUpdater.xml | 6 ++ .../.idea/runConfigurations/Calculate.xml | 20 ++++ .../.idea/runConfigurations/Help.xml | 20 ++++ .../runConfigurations/Output_AssemblyInfo.xml | 20 ++++ .../.idea/runConfigurations/Output_Help.xml | 20 ++++ .../.idea/runConfigurations/Version.xml | 20 ++++ new-cli/.idea/.idea.GitVersion/.idea/vcs.xml | 6 ++ .../.idea/.idea.GitVersion/riderModule.iml | 7 ++ new-cli/README.md | 2 +- 13 files changed, 235 insertions(+), 1 deletion(-) create mode 100644 new-cli/.idea/.idea.GitVersion/.idea/contentModel.xml create mode 100644 new-cli/.idea/.idea.GitVersion/.idea/encodings.xml create mode 100644 new-cli/.idea/.idea.GitVersion/.idea/indexLayout.xml create mode 100644 new-cli/.idea/.idea.GitVersion/.idea/modules.xml create mode 100644 new-cli/.idea/.idea.GitVersion/.idea/projectSettingsUpdater.xml create mode 100644 new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Calculate.xml create mode 100644 new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Help.xml create mode 100644 new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Output_AssemblyInfo.xml create mode 100644 new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Output_Help.xml create mode 100644 new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Version.xml create mode 100644 new-cli/.idea/.idea.GitVersion/.idea/vcs.xml create mode 100644 new-cli/.idea/.idea.GitVersion/riderModule.iml diff --git a/new-cli/.idea/.idea.GitVersion/.idea/contentModel.xml b/new-cli/.idea/.idea.GitVersion/.idea/contentModel.xml new file mode 100644 index 0000000000..90a5d57ecb --- /dev/null +++ b/new-cli/.idea/.idea.GitVersion/.idea/contentModel.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/.idea/encodings.xml b/new-cli/.idea/.idea.GitVersion/.idea/encodings.xml new file mode 100644 index 0000000000..df87cf951f --- /dev/null +++ b/new-cli/.idea/.idea.GitVersion/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/.idea/indexLayout.xml b/new-cli/.idea/.idea.GitVersion/.idea/indexLayout.xml new file mode 100644 index 0000000000..27ba142e96 --- /dev/null +++ b/new-cli/.idea/.idea.GitVersion/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/.idea/modules.xml b/new-cli/.idea/.idea.GitVersion/.idea/modules.xml new file mode 100644 index 0000000000..9aad694954 --- /dev/null +++ b/new-cli/.idea/.idea.GitVersion/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/.idea/projectSettingsUpdater.xml b/new-cli/.idea/.idea.GitVersion/.idea/projectSettingsUpdater.xml new file mode 100644 index 0000000000..4bb9f4d2a0 --- /dev/null +++ b/new-cli/.idea/.idea.GitVersion/.idea/projectSettingsUpdater.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Calculate.xml b/new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Calculate.xml new file mode 100644 index 0000000000..907f7a59f5 --- /dev/null +++ b/new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Calculate.xml @@ -0,0 +1,20 @@ + + + + \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Help.xml b/new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Help.xml new file mode 100644 index 0000000000..8c989daed5 --- /dev/null +++ b/new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Help.xml @@ -0,0 +1,20 @@ + + + + \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Output_AssemblyInfo.xml b/new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Output_AssemblyInfo.xml new file mode 100644 index 0000000000..2592264cb8 --- /dev/null +++ b/new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Output_AssemblyInfo.xml @@ -0,0 +1,20 @@ + + + + \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Output_Help.xml b/new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Output_Help.xml new file mode 100644 index 0000000000..b697a679e9 --- /dev/null +++ b/new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Output_Help.xml @@ -0,0 +1,20 @@ + + + + \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Version.xml b/new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Version.xml new file mode 100644 index 0000000000..5f34cc9ed4 --- /dev/null +++ b/new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Version.xml @@ -0,0 +1,20 @@ + + + + \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/.idea/vcs.xml b/new-cli/.idea/.idea.GitVersion/.idea/vcs.xml new file mode 100644 index 0000000000..94a25f7f4c --- /dev/null +++ b/new-cli/.idea/.idea.GitVersion/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/riderModule.iml b/new-cli/.idea/.idea.GitVersion/riderModule.iml new file mode 100644 index 0000000000..1a4e0d95f0 --- /dev/null +++ b/new-cli/.idea/.idea.GitVersion/riderModule.iml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/new-cli/README.md b/new-cli/README.md index a17d05dfb4..dc5b5bd805 100644 --- a/new-cli/README.md +++ b/new-cli/README.md @@ -1 +1 @@ -Cli +GitVersion From 62e2c43db85eed11738ca5384755ed19ec03cc11 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Mon, 6 Jul 2020 19:14:50 +0300 Subject: [PATCH 0015/1120] (new-cli) - added normalize and config commands --- .../.idea.GitVersion/.idea/contentModel.xml | 40 ++ .../.idea.GitVersion/.idea/workspace.xml | 356 ++++++++++++++++++ new-cli/GitVersion.Cli/GitVersion.Cli.csproj | 2 + new-cli/GitVersion.Cli/Program.cs | 6 +- .../GitVersion.Config/ConfigCommandHandler.cs | 18 + new-cli/GitVersion.Config/ConfigModule.cs | 16 + new-cli/GitVersion.Config/ConfigOptions.cs | 13 + .../GitVersion.Config.csproj | 11 + .../IConfigCommandHandler.cs | 8 + .../Init/ConfigInitCommandHandler.cs | 24 ++ .../Init/ConfigInitOptions.cs | 9 + .../Show/ConfigInitCommandHandler.cs | 24 ++ .../Show/ConfigShowOptions.cs | 9 + .../GitVersion.Normalize.csproj | 11 + .../NormalizeCommandHandler.cs | 24 ++ .../GitVersion.Normalize/NormalizeModule.cs | 12 + .../GitVersion.Normalize/NormalizeOptions.cs | 13 + new-cli/GitVersion.sln | 25 ++ new-cli/command.md | 69 ++++ 19 files changed, 689 insertions(+), 1 deletion(-) create mode 100644 new-cli/.idea/.idea.GitVersion/.idea/workspace.xml create mode 100644 new-cli/GitVersion.Config/ConfigCommandHandler.cs create mode 100644 new-cli/GitVersion.Config/ConfigModule.cs create mode 100644 new-cli/GitVersion.Config/ConfigOptions.cs create mode 100644 new-cli/GitVersion.Config/GitVersion.Config.csproj create mode 100644 new-cli/GitVersion.Config/IConfigCommandHandler.cs create mode 100644 new-cli/GitVersion.Config/Init/ConfigInitCommandHandler.cs create mode 100644 new-cli/GitVersion.Config/Init/ConfigInitOptions.cs create mode 100644 new-cli/GitVersion.Config/Show/ConfigInitCommandHandler.cs create mode 100644 new-cli/GitVersion.Config/Show/ConfigShowOptions.cs create mode 100644 new-cli/GitVersion.Normalize/GitVersion.Normalize.csproj create mode 100644 new-cli/GitVersion.Normalize/NormalizeCommandHandler.cs create mode 100644 new-cli/GitVersion.Normalize/NormalizeModule.cs create mode 100644 new-cli/GitVersion.Normalize/NormalizeOptions.cs create mode 100644 new-cli/command.md diff --git a/new-cli/.idea/.idea.GitVersion/.idea/contentModel.xml b/new-cli/.idea/.idea.GitVersion/.idea/contentModel.xml index 90a5d57ecb..5f81bd578d 100644 --- a/new-cli/.idea/.idea.GitVersion/.idea/contentModel.xml +++ b/new-cli/.idea/.idea.GitVersion/.idea/contentModel.xml @@ -4,6 +4,8 @@ + + @@ -36,6 +38,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -61,6 +86,20 @@ + + + + + + + + + + + + + + @@ -90,6 +129,7 @@ + \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/.idea/workspace.xml b/new-cli/.idea/.idea.GitVersion/.idea/workspace.xml new file mode 100644 index 0000000000..97e8e0a154 --- /dev/null +++ b/new-cli/.idea/.idea.GitVersion/.idea/workspace.xml @@ -0,0 +1,356 @@ + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1593668070591 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 3d21c2c9d2a7031ba5c7a2607afcba6c5aa6dc96 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Tue, 14 Jul 2020 12:07:17 +0300 Subject: [PATCH 0020/1120] (new-cli) - cleanup --- new-cli/.gitignore | 2 + .../.idea.GitVersion/.idea/contentModel.xml | 135 ------------------ new-cli/GitVersion.Cli/ContainerRegistrar.cs | 30 ++-- ...ons.cs => ContainerRegistrarExtensions.cs} | 14 +- .../Infrastructure/IContainerRegistrar.cs | 8 +- 5 files changed, 38 insertions(+), 151 deletions(-) delete mode 100644 new-cli/.idea/.idea.GitVersion/.idea/contentModel.xml rename new-cli/GitVersion.Cli/Extensions/{ServiceCollectionExtensions.cs => ContainerRegistrarExtensions.cs} (59%) diff --git a/new-cli/.gitignore b/new-cli/.gitignore index 29b8902d34..cb7133d6c0 100644 --- a/new-cli/.gitignore +++ b/new-cli/.gitignore @@ -5,3 +5,5 @@ .idea/.idea.Cli/.idea/workspace.xml .idea/.idea.GitVersion/.idea/workspace.xml + +.idea/.idea.GitVersion/.idea/contentModel.xml diff --git a/new-cli/.idea/.idea.GitVersion/.idea/contentModel.xml b/new-cli/.idea/.idea.GitVersion/.idea/contentModel.xml deleted file mode 100644 index 5f81bd578d..0000000000 --- a/new-cli/.idea/.idea.GitVersion/.idea/contentModel.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/new-cli/GitVersion.Cli/ContainerRegistrar.cs b/new-cli/GitVersion.Cli/ContainerRegistrar.cs index 4bfabf512e..d5f642c6ea 100644 --- a/new-cli/GitVersion.Cli/ContainerRegistrar.cs +++ b/new-cli/GitVersion.Cli/ContainerRegistrar.cs @@ -1,4 +1,5 @@ -using GitVersion.Core.Infrastructure; +using System; +using GitVersion.Core.Infrastructure; using Microsoft.Extensions.DependencyInjection; namespace GitVersion.Cli @@ -14,24 +15,37 @@ public IContainerRegistrar AddSingleton() serviceCollection.AddSingleton(); return this; } - - public IContainerRegistrar AddTransient() - where TService : class - => AddTransient(); - - + public IContainerRegistrar AddSingleton() where TService : class => AddSingleton(); + + public IContainerRegistrar AddSingleton(Func implementationFactory) + where TService : class + { + serviceCollection.AddSingleton(typeof(TService), implementationFactory); + return this; + } public IContainerRegistrar AddTransient() where TService : class where TImplementation : class, TService { - serviceCollection.AddSingleton(); + serviceCollection.AddTransient(); + return this; + } + + public IContainerRegistrar AddTransient(Func implementationFactory) + where TService : class + { + serviceCollection.AddTransient(typeof(TService), implementationFactory); return this; } + public IContainerRegistrar AddTransient() + where TService : class + => AddTransient(); + public IContainer Build() => new Container(serviceCollection.BuildServiceProvider()); } } \ No newline at end of file diff --git a/new-cli/GitVersion.Cli/Extensions/ServiceCollectionExtensions.cs b/new-cli/GitVersion.Cli/Extensions/ContainerRegistrarExtensions.cs similarity index 59% rename from new-cli/GitVersion.Cli/Extensions/ServiceCollectionExtensions.cs rename to new-cli/GitVersion.Cli/Extensions/ContainerRegistrarExtensions.cs index ef22dfb958..22ea6f2a42 100644 --- a/new-cli/GitVersion.Cli/Extensions/ServiceCollectionExtensions.cs +++ b/new-cli/GitVersion.Cli/Extensions/ContainerRegistrarExtensions.cs @@ -3,23 +3,23 @@ namespace GitVersion.Cli.Extensions { - public static class ServiceCollectionExtensions + public static class ContainerRegistrarExtensions { - public static IContainerRegistrar RegisterModule(this IContainerRegistrar serviceCollection, + public static IContainerRegistrar RegisterModule(this IContainerRegistrar containerRegistrar, IGitVersionModule gitVersionModule) { - gitVersionModule.RegisterTypes(serviceCollection); - return serviceCollection; + gitVersionModule.RegisterTypes(containerRegistrar); + return containerRegistrar; } - public static IContainerRegistrar RegisterModules(this IContainerRegistrar serviceCollection, + public static IContainerRegistrar RegisterModules(this IContainerRegistrar containerRegistrar, IEnumerable gitVersionModules) { foreach (var gitVersionModule in gitVersionModules) { - gitVersionModule.RegisterTypes(serviceCollection); + containerRegistrar.RegisterModule(gitVersionModule); } - return serviceCollection; + return containerRegistrar; } } } \ No newline at end of file diff --git a/new-cli/GitVersion.Core/Infrastructure/IContainerRegistrar.cs b/new-cli/GitVersion.Core/Infrastructure/IContainerRegistrar.cs index 7863ffd07d..814f839448 100644 --- a/new-cli/GitVersion.Core/Infrastructure/IContainerRegistrar.cs +++ b/new-cli/GitVersion.Core/Infrastructure/IContainerRegistrar.cs @@ -1,4 +1,6 @@ -namespace GitVersion.Core.Infrastructure +using System; + +namespace GitVersion.Core.Infrastructure { public interface IContainerRegistrar { @@ -6,10 +8,14 @@ public interface IContainerRegistrar IContainerRegistrar AddSingleton() where TService : class where TImplementation : class, TService; + IContainerRegistrar AddSingleton(Func implementationFactory) where TService : class; + IContainerRegistrar AddTransient() where TService : class; IContainerRegistrar AddTransient() where TService : class where TImplementation : class, TService; + IContainerRegistrar AddTransient(Func implementationFactory) where TService : class; + IContainer Build(); } } \ No newline at end of file From 0882047163525f8e663f2abd60295edb4f3e3926 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Tue, 14 Jul 2020 14:12:14 +0300 Subject: [PATCH 0021/1120] (new-cli) - change target to net5.0 --- new-cli/GitVersion.Cli/GitVersion.Cli.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/new-cli/GitVersion.Cli/GitVersion.Cli.csproj b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj index b0b986846d..51f2d8af8c 100644 --- a/new-cli/GitVersion.Cli/GitVersion.Cli.csproj +++ b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net5.0 GitVersion.Cli From 01d12384fb62388c791a50ca1e85e30eb4283a68 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Tue, 14 Jul 2020 14:13:02 +0300 Subject: [PATCH 0022/1120] (new-cli) - Added ILogger abstraction, that internally depends on Microsoft.Extensions.Logging --- .../CalculateCommandHandler.cs | 6 ++++-- new-cli/GitVersion.Cli/CliModule.cs | 19 +++++++++++++++++ new-cli/GitVersion.Cli/GitVersion.Cli.csproj | 4 ++-- .../{ => Infrastructure}/Container.cs | 2 +- .../ContainerRegistrar.cs | 21 ++++++++++++------- .../GitVersion.Cli/Infrastructure/Logger.cs | 21 +++++++++++++++++++ new-cli/GitVersion.Cli/Program.cs | 7 ++++--- .../GitVersion.Config/ConfigCommandHandler.cs | 6 +----- .../Init/ConfigInitCommandHandler.cs | 6 ++++-- .../Show/ConfigInitCommandHandler.cs | 6 ++++-- .../Infrastructure/IContainerRegistrar.cs | 2 ++ .../GitVersion.Core/Infrastructure/ILogger.cs | 12 +++++++++++ .../NormalizeCommandHandler.cs | 6 ++++-- .../OutputAssemblyInfoCommandHandler.cs | 8 ++++--- .../GitVersion.Output/OutputCommandHandler.cs | 5 +---- .../Project/OutputProjectCommandHandler.cs | 6 ++++-- .../Wix/OutputWixCommandHandler.cs | 6 ++++-- 17 files changed, 106 insertions(+), 37 deletions(-) create mode 100644 new-cli/GitVersion.Cli/CliModule.cs rename new-cli/GitVersion.Cli/{ => Infrastructure}/Container.cs (93%) rename new-cli/GitVersion.Cli/{ => Infrastructure}/ContainerRegistrar.cs (65%) create mode 100644 new-cli/GitVersion.Cli/Infrastructure/Logger.cs create mode 100644 new-cli/GitVersion.Core/Infrastructure/ILogger.cs diff --git a/new-cli/GitVersion.Calculate/CalculateCommandHandler.cs b/new-cli/GitVersion.Calculate/CalculateCommandHandler.cs index 0999ab7042..c92a72bf77 100644 --- a/new-cli/GitVersion.Calculate/CalculateCommandHandler.cs +++ b/new-cli/GitVersion.Calculate/CalculateCommandHandler.cs @@ -7,17 +7,19 @@ namespace GitVersion.Calculate { public class CalculateCommandHandler : CommandHandler, IRootCommandHandler { + private readonly ILogger logger; private readonly IService service; - public CalculateCommandHandler(IService service) + public CalculateCommandHandler(ILogger logger, IService service) { + this.logger = logger; this.service = service; } public override Task InvokeAsync(CalculateOptions options) { var value = service.Call(); - Console.WriteLine($"Command : 'calculate', LogFile : '{options.LogFile}', WorkDir : '{options.WorkDir}' "); + logger.LogInformation($"Command : 'calculate', LogFile : '{options.LogFile}', WorkDir : '{options.WorkDir}' "); return Task.FromResult(value); } } diff --git a/new-cli/GitVersion.Cli/CliModule.cs b/new-cli/GitVersion.Cli/CliModule.cs new file mode 100644 index 0000000000..79c032ac03 --- /dev/null +++ b/new-cli/GitVersion.Cli/CliModule.cs @@ -0,0 +1,19 @@ +using GitVersion.Cli.Infrastructure; +using GitVersion.Core.Infrastructure; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using ILogger = GitVersion.Core.Infrastructure.ILogger; + +namespace GitVersion.Cli +{ + public class CliModule : IGitVersionModule + { + public void RegisterTypes(IContainerRegistrar services) + { + services.AddConsoleLogging(); + services.AddSingleton(provider => new Logger(provider.GetService>())); + + services.AddSingleton(); + } + } +} \ No newline at end of file diff --git a/new-cli/GitVersion.Cli/GitVersion.Cli.csproj b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj index 51f2d8af8c..87b004f5b5 100644 --- a/new-cli/GitVersion.Cli/GitVersion.Cli.csproj +++ b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/new-cli/GitVersion.Cli/Container.cs b/new-cli/GitVersion.Cli/Infrastructure/Container.cs similarity index 93% rename from new-cli/GitVersion.Cli/Container.cs rename to new-cli/GitVersion.Cli/Infrastructure/Container.cs index 178384f4bf..aef986d190 100644 --- a/new-cli/GitVersion.Cli/Container.cs +++ b/new-cli/GitVersion.Cli/Infrastructure/Container.cs @@ -2,7 +2,7 @@ using GitVersion.Core.Infrastructure; using Microsoft.Extensions.DependencyInjection; -namespace GitVersion.Cli +namespace GitVersion.Cli.Infrastructure { public class Container : IContainer { diff --git a/new-cli/GitVersion.Cli/ContainerRegistrar.cs b/new-cli/GitVersion.Cli/Infrastructure/ContainerRegistrar.cs similarity index 65% rename from new-cli/GitVersion.Cli/ContainerRegistrar.cs rename to new-cli/GitVersion.Cli/Infrastructure/ContainerRegistrar.cs index d5f642c6ea..fd8f1b2904 100644 --- a/new-cli/GitVersion.Cli/ContainerRegistrar.cs +++ b/new-cli/GitVersion.Cli/Infrastructure/ContainerRegistrar.cs @@ -1,18 +1,19 @@ using System; using GitVersion.Core.Infrastructure; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; -namespace GitVersion.Cli +namespace GitVersion.Cli.Infrastructure { public class ContainerRegistrar : IContainerRegistrar { - private readonly ServiceCollection serviceCollection = new ServiceCollection(); + private readonly ServiceCollection services = new ServiceCollection(); public IContainerRegistrar AddSingleton() where TService : class where TImplementation : class, TService { - serviceCollection.AddSingleton(); + services.AddSingleton(); return this; } @@ -23,7 +24,7 @@ public IContainerRegistrar AddSingleton() public IContainerRegistrar AddSingleton(Func implementationFactory) where TService : class { - serviceCollection.AddSingleton(typeof(TService), implementationFactory); + services.AddSingleton(typeof(TService), implementationFactory); return this; } @@ -31,21 +32,27 @@ public IContainerRegistrar AddTransient() where TService : class where TImplementation : class, TService { - serviceCollection.AddTransient(); + services.AddTransient(); return this; } public IContainerRegistrar AddTransient(Func implementationFactory) where TService : class { - serviceCollection.AddTransient(typeof(TService), implementationFactory); + services.AddTransient(typeof(TService), implementationFactory); return this; } public IContainerRegistrar AddTransient() where TService : class => AddTransient(); + + public IContainerRegistrar AddConsoleLogging() + { + services.AddLogging(builder => builder.AddConsole()); + return this; + } - public IContainer Build() => new Container(serviceCollection.BuildServiceProvider()); + public IContainer Build() => new Container(services.BuildServiceProvider()); } } \ No newline at end of file diff --git a/new-cli/GitVersion.Cli/Infrastructure/Logger.cs b/new-cli/GitVersion.Cli/Infrastructure/Logger.cs new file mode 100644 index 0000000000..78d1dcd30b --- /dev/null +++ b/new-cli/GitVersion.Cli/Infrastructure/Logger.cs @@ -0,0 +1,21 @@ +using Microsoft.Extensions.Logging; + +namespace GitVersion.Cli.Infrastructure +{ + public class Logger : Core.Infrastructure.ILogger + { + private readonly ILogger logger; + + public Logger(ILogger logger) + { + this.logger = logger; + } + + public void LogTrace(string message, params object[] args) => logger.LogTrace(message, args); + public void LogDebug(string message, params object[] args) => logger.LogDebug(message, args); + public void LogInformation(string message, params object[] args) => logger.LogInformation(message, args); + public void LogWarning(string message, params object[] args) => logger.LogWarning(message, args); + public void LogError(string message, params object[] args) => logger.LogError(message, args); + public void LogCritical(string message, params object[] args) => logger.LogCritical(message, args); + } +} \ No newline at end of file diff --git a/new-cli/GitVersion.Cli/Program.cs b/new-cli/GitVersion.Cli/Program.cs index a7c8f225d8..5d05f731e8 100644 --- a/new-cli/GitVersion.Cli/Program.cs +++ b/new-cli/GitVersion.Cli/Program.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using GitVersion.Calculate; using GitVersion.Cli.Extensions; +using GitVersion.Cli.Infrastructure; using GitVersion.Config; using GitVersion.Core; using GitVersion.Core.Infrastructure; @@ -22,9 +23,10 @@ private static async Task Main(string[] args) typeof(NormalizeModule).Assembly, typeof(CalculateModule).Assembly, typeof(ConfigModule).Assembly, - typeof(OutputModule).Assembly + typeof(OutputModule).Assembly, + typeof(CliModule).Assembly }; - + var gitVersionModules = assemblies .SelectMany(a => a.GetTypes().Where(t => typeof(IGitVersionModule).IsAssignableFrom(t) && !t.IsInterface)) .Select(t => (IGitVersionModule)Activator.CreateInstance(t)) @@ -32,7 +34,6 @@ private static async Task Main(string[] args) using var serviceProvider = new ContainerRegistrar() .RegisterModules(gitVersionModules) - .AddSingleton() .Build(); var app = serviceProvider.GetService(); diff --git a/new-cli/GitVersion.Config/ConfigCommandHandler.cs b/new-cli/GitVersion.Config/ConfigCommandHandler.cs index b72d1e7038..075b59312b 100644 --- a/new-cli/GitVersion.Config/ConfigCommandHandler.cs +++ b/new-cli/GitVersion.Config/ConfigCommandHandler.cs @@ -7,12 +7,8 @@ public class ConfigCommandHandler : CommandHandler, IRootCommandH { private readonly IEnumerable commandHandlers; + public ConfigCommandHandler(IEnumerable commandHandlers) => this.commandHandlers = commandHandlers; - public ConfigCommandHandler(IEnumerable commandHandlers) - { - this.commandHandlers = commandHandlers; - } - public override IEnumerable SubCommands() => commandHandlers; } } \ No newline at end of file diff --git a/new-cli/GitVersion.Config/Init/ConfigInitCommandHandler.cs b/new-cli/GitVersion.Config/Init/ConfigInitCommandHandler.cs index 9f0142fdb0..d39f43ed48 100644 --- a/new-cli/GitVersion.Config/Init/ConfigInitCommandHandler.cs +++ b/new-cli/GitVersion.Config/Init/ConfigInitCommandHandler.cs @@ -7,17 +7,19 @@ namespace GitVersion.Config.Init { public class ConfigInitCommandHandler : CommandHandler, IConfigCommandHandler { + private readonly ILogger logger; private readonly IService service; - public ConfigInitCommandHandler(IService service) + public ConfigInitCommandHandler(ILogger logger, IService service) { + this.logger = logger; this.service = service; } public override Task InvokeAsync(ConfigInitOptions options) { var value = service.Call(); - Console.WriteLine($"Command : 'config init', LogFile : '{options.LogFile}', WorkDir : '{options.WorkDir}' "); + logger.LogInformation($"Command : 'config init', LogFile : '{options.LogFile}', WorkDir : '{options.WorkDir}' "); return Task.FromResult(value); } } diff --git a/new-cli/GitVersion.Config/Show/ConfigInitCommandHandler.cs b/new-cli/GitVersion.Config/Show/ConfigInitCommandHandler.cs index 30df8bc4e3..d6cec8da17 100644 --- a/new-cli/GitVersion.Config/Show/ConfigInitCommandHandler.cs +++ b/new-cli/GitVersion.Config/Show/ConfigInitCommandHandler.cs @@ -7,17 +7,19 @@ namespace GitVersion.Config.Show { public class ConfigShowCommandHandler : CommandHandler, IConfigCommandHandler { + private readonly ILogger logger; private readonly IService service; - public ConfigShowCommandHandler(IService service) + public ConfigShowCommandHandler(ILogger logger, IService service) { + this.logger = logger; this.service = service; } public override Task InvokeAsync(ConfigShowOptions options) { var value = service.Call(); - Console.WriteLine($"Command : 'config show', LogFile : '{options.LogFile}', WorkDir : '{options.WorkDir}' "); + logger.LogInformation($"Command : 'config show', LogFile : '{options.LogFile}', WorkDir : '{options.WorkDir}' "); return Task.FromResult(value); } } diff --git a/new-cli/GitVersion.Core/Infrastructure/IContainerRegistrar.cs b/new-cli/GitVersion.Core/Infrastructure/IContainerRegistrar.cs index 814f839448..1b2bb38c32 100644 --- a/new-cli/GitVersion.Core/Infrastructure/IContainerRegistrar.cs +++ b/new-cli/GitVersion.Core/Infrastructure/IContainerRegistrar.cs @@ -15,6 +15,8 @@ public interface IContainerRegistrar IContainerRegistrar AddTransient() where TService : class where TImplementation : class, TService; IContainerRegistrar AddTransient(Func implementationFactory) where TService : class; + + IContainerRegistrar AddConsoleLogging(); IContainer Build(); } diff --git a/new-cli/GitVersion.Core/Infrastructure/ILogger.cs b/new-cli/GitVersion.Core/Infrastructure/ILogger.cs new file mode 100644 index 0000000000..9e2d4b52a8 --- /dev/null +++ b/new-cli/GitVersion.Core/Infrastructure/ILogger.cs @@ -0,0 +1,12 @@ +namespace GitVersion.Core.Infrastructure +{ + public interface ILogger + { + void LogTrace(string message, params object[] args); + void LogDebug(string message, params object[] args); + void LogInformation(string message, params object[] args); + void LogWarning(string message, params object[] args); + void LogError(string message, params object[] args); + void LogCritical(string message, params object[] args); + } +} \ No newline at end of file diff --git a/new-cli/GitVersion.Normalize/NormalizeCommandHandler.cs b/new-cli/GitVersion.Normalize/NormalizeCommandHandler.cs index 6b50bec0c1..a00fe271e0 100644 --- a/new-cli/GitVersion.Normalize/NormalizeCommandHandler.cs +++ b/new-cli/GitVersion.Normalize/NormalizeCommandHandler.cs @@ -7,17 +7,19 @@ namespace GitVersion.Normalize { public class NormalizeCommandHandler : CommandHandler, IRootCommandHandler { + private readonly ILogger logger; private readonly IService service; - public NormalizeCommandHandler(IService service) + public NormalizeCommandHandler(ILogger logger, IService service) { + this.logger = logger; this.service = service; } public override Task InvokeAsync(NormalizeOptions options) { var value = service.Call(); - Console.WriteLine($"Command : 'normalize', LogFile : '{options.LogFile}', WorkDir : '{options.WorkDir}' "); + logger.LogInformation($"Command : 'normalize', LogFile : '{options.LogFile}', WorkDir : '{options.WorkDir}' "); return Task.FromResult(value); } } diff --git a/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs b/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs index 32d42370fa..5712235bf8 100644 --- a/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs +++ b/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs @@ -7,10 +7,12 @@ namespace GitVersion.Output.AssemblyInfo { public class OutputAssemblyInfoCommandHandler : CommandHandler, IOutputCommandHandler { + private readonly ILogger logger; private readonly IService service; - public OutputAssemblyInfoCommandHandler(IService service) + public OutputAssemblyInfoCommandHandler(ILogger logger, IService service) { + this.logger = logger; this.service = service; } @@ -18,8 +20,8 @@ public override Task InvokeAsync(OutputAssemblyInfoOptions options) { var value = service.Call(); var versionInfo = options.VersionInfo.Value; - Console.WriteLine($"Command : 'output assemblyinfo', LogFile : '{options.LogFile}', WorkDir : '{options.OutputDir}', InputFile: '{options.InputFile}', AssemblyInfo: '{options.AssemblyinfoFile}' "); - Console.WriteLine($"Version info: {versionInfo}"); + logger.LogInformation($"Command : 'output assemblyinfo', LogFile : '{options.LogFile}', WorkDir : '{options.OutputDir}', InputFile: '{options.InputFile}', AssemblyInfo: '{options.AssemblyinfoFile}' "); + logger.LogInformation($"Version info: {versionInfo}"); return Task.FromResult(value); } } diff --git a/new-cli/GitVersion.Output/OutputCommandHandler.cs b/new-cli/GitVersion.Output/OutputCommandHandler.cs index 3ec26e194f..b63e0a0517 100644 --- a/new-cli/GitVersion.Output/OutputCommandHandler.cs +++ b/new-cli/GitVersion.Output/OutputCommandHandler.cs @@ -7,10 +7,7 @@ public class OutputCommandHandler : CommandHandler, IRootCommandH { private readonly IEnumerable commandHandlers; - public OutputCommandHandler(IEnumerable commandHandlers) - { - this.commandHandlers = commandHandlers; - } + public OutputCommandHandler(IEnumerable commandHandlers) => this.commandHandlers = commandHandlers; public override IEnumerable SubCommands() => commandHandlers; } diff --git a/new-cli/GitVersion.Output/Project/OutputProjectCommandHandler.cs b/new-cli/GitVersion.Output/Project/OutputProjectCommandHandler.cs index fe3d3d53e3..403deb4f62 100644 --- a/new-cli/GitVersion.Output/Project/OutputProjectCommandHandler.cs +++ b/new-cli/GitVersion.Output/Project/OutputProjectCommandHandler.cs @@ -7,17 +7,19 @@ namespace GitVersion.Output.Project { public class OutputProjectCommandHandler : CommandHandler, IOutputCommandHandler { + private readonly ILogger logger; private readonly IService service; - public OutputProjectCommandHandler(IService service) + public OutputProjectCommandHandler(ILogger logger, IService service) { + this.logger = logger; this.service = service; } public override Task InvokeAsync(OutputProjectOptions options) { var value = service.Call(); - Console.WriteLine($"Command : 'output project', LogFile : '{options.LogFile}', WorkDir : '{options.OutputDir}', InputFile: '{options.InputFile}', Project: '{options.ProjectFile}' "); + logger.LogInformation($"Command : 'output project', LogFile : '{options.LogFile}', WorkDir : '{options.OutputDir}', InputFile: '{options.InputFile}', Project: '{options.ProjectFile}' "); return Task.FromResult(value); } } diff --git a/new-cli/GitVersion.Output/Wix/OutputWixCommandHandler.cs b/new-cli/GitVersion.Output/Wix/OutputWixCommandHandler.cs index b20a084909..617a46980b 100644 --- a/new-cli/GitVersion.Output/Wix/OutputWixCommandHandler.cs +++ b/new-cli/GitVersion.Output/Wix/OutputWixCommandHandler.cs @@ -7,17 +7,19 @@ namespace GitVersion.Output.Wix { public class OutputWixCommandHandler : CommandHandler, IOutputCommandHandler { + private readonly ILogger logger; private readonly IService service; - public OutputWixCommandHandler(IService service) + public OutputWixCommandHandler(ILogger logger, IService service) { + this.logger = logger; this.service = service; } public override Task InvokeAsync(OutputWixOptions options) { var value = service.Call(); - Console.WriteLine($"Command : 'output wix', LogFile : '{options.LogFile}', WorkDir : '{options.OutputDir}', InputFile: '{options.InputFile}', WixFile: '{options.WixFile}' "); + logger.LogInformation($"Command : 'output wix', LogFile : '{options.LogFile}', WorkDir : '{options.OutputDir}', InputFile: '{options.InputFile}', WixFile: '{options.WixFile}' "); return Task.FromResult(value); } } From 302821e2cae3e2d3b5ff6e015ea459bceac5835d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Sat, 1 Aug 2020 01:41:09 +0200 Subject: [PATCH 0023/1120] (new-cli) - Set the language version to 8 --- new-cli/GitVersion.Cli/GitVersion.Cli.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/new-cli/GitVersion.Cli/GitVersion.Cli.csproj b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj index 87b004f5b5..410186ff32 100644 --- a/new-cli/GitVersion.Cli/GitVersion.Cli.csproj +++ b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj @@ -4,6 +4,7 @@ Exe net5.0 GitVersion.Cli + 8 From 9a06b6190fb309f9588589e7fd7f7da5a1a74ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Sat, 1 Aug 2020 01:41:59 +0200 Subject: [PATCH 0024/1120] (new-cli) - Add reference to Microsoft.Bcl.AsyncInterfaces --- new-cli/GitVersion.Cli/GitVersion.Cli.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/new-cli/GitVersion.Cli/GitVersion.Cli.csproj b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj index 410186ff32..eed9f28c38 100644 --- a/new-cli/GitVersion.Cli/GitVersion.Cli.csproj +++ b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj @@ -1,4 +1,4 @@ - + Exe @@ -8,6 +8,7 @@ + From cae6100e8408b01ed83622dcc4566ad79d9bb8a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Sat, 1 Aug 2020 01:45:32 +0200 Subject: [PATCH 0025/1120] (new-cli) - The name of the project should perhaps be committed? --- new-cli/.idea/.idea.GitVersion/.idea/.name | 1 + 1 file changed, 1 insertion(+) create mode 100644 new-cli/.idea/.idea.GitVersion/.idea/.name diff --git a/new-cli/.idea/.idea.GitVersion/.idea/.name b/new-cli/.idea/.idea.GitVersion/.idea/.name new file mode 100644 index 0000000000..f28b69fd4c --- /dev/null +++ b/new-cli/.idea/.idea.GitVersion/.idea/.name @@ -0,0 +1 @@ +GitVersion \ No newline at end of file From c1363fca95f2cd3fd6cf14eecd36e462457b9988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Sat, 1 Aug 2020 01:50:02 +0200 Subject: [PATCH 0026/1120] (new-cli) - Remove `Core` from namespace --- new-cli/GitVersion.Calculate/CalculateCommandHandler.cs | 6 ++---- new-cli/GitVersion.Calculate/CalculateModule.cs | 2 +- new-cli/GitVersion.Calculate/CalculateOptions.cs | 3 +-- new-cli/GitVersion.Cli/CliModule.cs | 4 ++-- .../Extensions/ContainerRegistrarExtensions.cs | 2 +- new-cli/GitVersion.Cli/GitVersionApp.cs | 4 ++-- new-cli/GitVersion.Cli/Infrastructure/Container.cs | 2 +- new-cli/GitVersion.Cli/Infrastructure/ContainerRegistrar.cs | 2 +- new-cli/GitVersion.Cli/Infrastructure/Logger.cs | 2 +- new-cli/GitVersion.Cli/Program.cs | 3 +-- new-cli/GitVersion.Config/ConfigCommandHandler.cs | 2 +- new-cli/GitVersion.Config/ConfigModule.cs | 2 +- new-cli/GitVersion.Config/ConfigOptions.cs | 3 +-- new-cli/GitVersion.Config/IConfigCommandHandler.cs | 2 +- new-cli/GitVersion.Config/Init/ConfigInitCommandHandler.cs | 6 ++---- new-cli/GitVersion.Config/Init/ConfigInitOptions.cs | 2 +- new-cli/GitVersion.Config/Show/ConfigInitCommandHandler.cs | 6 ++---- new-cli/GitVersion.Config/Show/ConfigShowOptions.cs | 2 +- new-cli/GitVersion.Core/CoreModule.cs | 4 ++-- new-cli/GitVersion.Core/GitVersion.Core.csproj | 4 ++-- new-cli/GitVersion.Core/GitVersionOptions.cs | 4 ++-- new-cli/GitVersion.Core/IService.cs | 2 +- new-cli/GitVersion.Core/Infrastructure/CommandAttribute.cs | 2 +- new-cli/GitVersion.Core/Infrastructure/CommandHandler.cs | 2 +- new-cli/GitVersion.Core/Infrastructure/ICommandHandler.cs | 2 +- new-cli/GitVersion.Core/Infrastructure/IContainer.cs | 2 +- .../GitVersion.Core/Infrastructure/IContainerRegistrar.cs | 2 +- new-cli/GitVersion.Core/Infrastructure/IGitVersionModule.cs | 2 +- new-cli/GitVersion.Core/Infrastructure/ILogger.cs | 2 +- .../GitVersion.Core/Infrastructure/IRootCommandHandler.cs | 2 +- new-cli/GitVersion.Core/Infrastructure/OptionAttribute.cs | 2 +- new-cli/GitVersion.Core/Service.cs | 2 +- new-cli/GitVersion.Normalize/NormalizeCommandHandler.cs | 6 ++---- new-cli/GitVersion.Normalize/NormalizeModule.cs | 2 +- new-cli/GitVersion.Normalize/NormalizeOptions.cs | 3 +-- .../AssemblyInfo/OutputAssemblyInfoCommandHandler.cs | 6 ++---- .../AssemblyInfo/OutputAssemblyInfoOptions.cs | 2 +- new-cli/GitVersion.Output/IOutputCommandHandler.cs | 2 +- new-cli/GitVersion.Output/OutputCommandHandler.cs | 2 +- new-cli/GitVersion.Output/OutputModule.cs | 2 +- new-cli/GitVersion.Output/OutputOptions.cs | 3 +-- .../Project/OutputProjectCommandHandler.cs | 6 ++---- new-cli/GitVersion.Output/Project/OutputProjectOptions.cs | 2 +- new-cli/GitVersion.Output/Wix/OutputWixCommandHandler.cs | 6 ++---- new-cli/GitVersion.Output/Wix/OutputWixOptions.cs | 2 +- 45 files changed, 57 insertions(+), 76 deletions(-) diff --git a/new-cli/GitVersion.Calculate/CalculateCommandHandler.cs b/new-cli/GitVersion.Calculate/CalculateCommandHandler.cs index c92a72bf77..783717a144 100644 --- a/new-cli/GitVersion.Calculate/CalculateCommandHandler.cs +++ b/new-cli/GitVersion.Calculate/CalculateCommandHandler.cs @@ -1,7 +1,5 @@ -using System; -using System.Threading.Tasks; -using GitVersion.Core; -using GitVersion.Core.Infrastructure; +using System.Threading.Tasks; +using GitVersion.Infrastructure; namespace GitVersion.Calculate { diff --git a/new-cli/GitVersion.Calculate/CalculateModule.cs b/new-cli/GitVersion.Calculate/CalculateModule.cs index bf3e210a48..00fb422ddc 100644 --- a/new-cli/GitVersion.Calculate/CalculateModule.cs +++ b/new-cli/GitVersion.Calculate/CalculateModule.cs @@ -1,4 +1,4 @@ -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; namespace GitVersion.Calculate { diff --git a/new-cli/GitVersion.Calculate/CalculateOptions.cs b/new-cli/GitVersion.Calculate/CalculateOptions.cs index 52fb917462..a3e0c1d034 100644 --- a/new-cli/GitVersion.Calculate/CalculateOptions.cs +++ b/new-cli/GitVersion.Calculate/CalculateOptions.cs @@ -1,6 +1,5 @@ using System.IO; -using GitVersion.Core; -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; namespace GitVersion.Calculate { diff --git a/new-cli/GitVersion.Cli/CliModule.cs b/new-cli/GitVersion.Cli/CliModule.cs index 79c032ac03..b4ab668bcd 100644 --- a/new-cli/GitVersion.Cli/CliModule.cs +++ b/new-cli/GitVersion.Cli/CliModule.cs @@ -1,8 +1,8 @@ using GitVersion.Cli.Infrastructure; -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using ILogger = GitVersion.Core.Infrastructure.ILogger; +using ILogger = GitVersion.Infrastructure.ILogger; namespace GitVersion.Cli { diff --git a/new-cli/GitVersion.Cli/Extensions/ContainerRegistrarExtensions.cs b/new-cli/GitVersion.Cli/Extensions/ContainerRegistrarExtensions.cs index 22ea6f2a42..981fa26e84 100644 --- a/new-cli/GitVersion.Cli/Extensions/ContainerRegistrarExtensions.cs +++ b/new-cli/GitVersion.Cli/Extensions/ContainerRegistrarExtensions.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; namespace GitVersion.Cli.Extensions { diff --git a/new-cli/GitVersion.Cli/GitVersionApp.cs b/new-cli/GitVersion.Cli/GitVersionApp.cs index 0712de1c9c..ae39f81f7a 100644 --- a/new-cli/GitVersion.Cli/GitVersionApp.cs +++ b/new-cli/GitVersion.Cli/GitVersionApp.cs @@ -5,8 +5,8 @@ using System.CommandLine.Parsing; using System.Reflection; using System.Threading.Tasks; -using GitVersion.Core.Infrastructure; -using ICommandHandler = GitVersion.Core.Infrastructure.ICommandHandler; +using GitVersion.Infrastructure; +using ICommandHandler = GitVersion.Infrastructure.ICommandHandler; namespace GitVersion.Cli { diff --git a/new-cli/GitVersion.Cli/Infrastructure/Container.cs b/new-cli/GitVersion.Cli/Infrastructure/Container.cs index aef986d190..a199a207a9 100644 --- a/new-cli/GitVersion.Cli/Infrastructure/Container.cs +++ b/new-cli/GitVersion.Cli/Infrastructure/Container.cs @@ -1,5 +1,5 @@ using System; -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; using Microsoft.Extensions.DependencyInjection; namespace GitVersion.Cli.Infrastructure diff --git a/new-cli/GitVersion.Cli/Infrastructure/ContainerRegistrar.cs b/new-cli/GitVersion.Cli/Infrastructure/ContainerRegistrar.cs index fd8f1b2904..71a9dc2c55 100644 --- a/new-cli/GitVersion.Cli/Infrastructure/ContainerRegistrar.cs +++ b/new-cli/GitVersion.Cli/Infrastructure/ContainerRegistrar.cs @@ -1,5 +1,5 @@ using System; -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; diff --git a/new-cli/GitVersion.Cli/Infrastructure/Logger.cs b/new-cli/GitVersion.Cli/Infrastructure/Logger.cs index 78d1dcd30b..0b5de7fa60 100644 --- a/new-cli/GitVersion.Cli/Infrastructure/Logger.cs +++ b/new-cli/GitVersion.Cli/Infrastructure/Logger.cs @@ -2,7 +2,7 @@ namespace GitVersion.Cli.Infrastructure { - public class Logger : Core.Infrastructure.ILogger + public class Logger : GitVersion.Infrastructure.ILogger { private readonly ILogger logger; diff --git a/new-cli/GitVersion.Cli/Program.cs b/new-cli/GitVersion.Cli/Program.cs index 5d05f731e8..de6de98f95 100644 --- a/new-cli/GitVersion.Cli/Program.cs +++ b/new-cli/GitVersion.Cli/Program.cs @@ -5,8 +5,7 @@ using GitVersion.Cli.Extensions; using GitVersion.Cli.Infrastructure; using GitVersion.Config; -using GitVersion.Core; -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; using GitVersion.Normalize; using GitVersion.Output; diff --git a/new-cli/GitVersion.Config/ConfigCommandHandler.cs b/new-cli/GitVersion.Config/ConfigCommandHandler.cs index 075b59312b..5249426c77 100644 --- a/new-cli/GitVersion.Config/ConfigCommandHandler.cs +++ b/new-cli/GitVersion.Config/ConfigCommandHandler.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; namespace GitVersion.Config { diff --git a/new-cli/GitVersion.Config/ConfigModule.cs b/new-cli/GitVersion.Config/ConfigModule.cs index c4ef50783f..65390f74fc 100644 --- a/new-cli/GitVersion.Config/ConfigModule.cs +++ b/new-cli/GitVersion.Config/ConfigModule.cs @@ -1,6 +1,6 @@ using GitVersion.Config.Init; using GitVersion.Config.Show; -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; namespace GitVersion.Config { diff --git a/new-cli/GitVersion.Config/ConfigOptions.cs b/new-cli/GitVersion.Config/ConfigOptions.cs index 00361a182c..979cef92b1 100644 --- a/new-cli/GitVersion.Config/ConfigOptions.cs +++ b/new-cli/GitVersion.Config/ConfigOptions.cs @@ -1,6 +1,5 @@ using System.IO; -using GitVersion.Core; -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; namespace GitVersion.Config { diff --git a/new-cli/GitVersion.Config/IConfigCommandHandler.cs b/new-cli/GitVersion.Config/IConfigCommandHandler.cs index 18d72cedf9..cc4309c953 100644 --- a/new-cli/GitVersion.Config/IConfigCommandHandler.cs +++ b/new-cli/GitVersion.Config/IConfigCommandHandler.cs @@ -1,4 +1,4 @@ -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; namespace GitVersion.Config { diff --git a/new-cli/GitVersion.Config/Init/ConfigInitCommandHandler.cs b/new-cli/GitVersion.Config/Init/ConfigInitCommandHandler.cs index d39f43ed48..f7cfbedc71 100644 --- a/new-cli/GitVersion.Config/Init/ConfigInitCommandHandler.cs +++ b/new-cli/GitVersion.Config/Init/ConfigInitCommandHandler.cs @@ -1,7 +1,5 @@ -using System; -using System.Threading.Tasks; -using GitVersion.Core; -using GitVersion.Core.Infrastructure; +using System.Threading.Tasks; +using GitVersion.Infrastructure; namespace GitVersion.Config.Init { diff --git a/new-cli/GitVersion.Config/Init/ConfigInitOptions.cs b/new-cli/GitVersion.Config/Init/ConfigInitOptions.cs index 7452984dd4..e48714346a 100644 --- a/new-cli/GitVersion.Config/Init/ConfigInitOptions.cs +++ b/new-cli/GitVersion.Config/Init/ConfigInitOptions.cs @@ -1,4 +1,4 @@ -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; namespace GitVersion.Config.Init { diff --git a/new-cli/GitVersion.Config/Show/ConfigInitCommandHandler.cs b/new-cli/GitVersion.Config/Show/ConfigInitCommandHandler.cs index d6cec8da17..1feed45abb 100644 --- a/new-cli/GitVersion.Config/Show/ConfigInitCommandHandler.cs +++ b/new-cli/GitVersion.Config/Show/ConfigInitCommandHandler.cs @@ -1,7 +1,5 @@ -using System; -using System.Threading.Tasks; -using GitVersion.Core; -using GitVersion.Core.Infrastructure; +using System.Threading.Tasks; +using GitVersion.Infrastructure; namespace GitVersion.Config.Show { diff --git a/new-cli/GitVersion.Config/Show/ConfigShowOptions.cs b/new-cli/GitVersion.Config/Show/ConfigShowOptions.cs index 95a4bb65b3..e9095ed6fa 100644 --- a/new-cli/GitVersion.Config/Show/ConfigShowOptions.cs +++ b/new-cli/GitVersion.Config/Show/ConfigShowOptions.cs @@ -1,4 +1,4 @@ -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; namespace GitVersion.Config.Show { diff --git a/new-cli/GitVersion.Core/CoreModule.cs b/new-cli/GitVersion.Core/CoreModule.cs index bf14a6b4c6..ed10d0cda3 100644 --- a/new-cli/GitVersion.Core/CoreModule.cs +++ b/new-cli/GitVersion.Core/CoreModule.cs @@ -1,6 +1,6 @@ -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; -namespace GitVersion.Core +namespace GitVersion { public class CoreModule : IGitVersionModule { diff --git a/new-cli/GitVersion.Core/GitVersion.Core.csproj b/new-cli/GitVersion.Core/GitVersion.Core.csproj index 65aa55b17e..9bed88aeae 100644 --- a/new-cli/GitVersion.Core/GitVersion.Core.csproj +++ b/new-cli/GitVersion.Core/GitVersion.Core.csproj @@ -1,9 +1,9 @@ - + netstandard2.0 8 - GitVersion.Core + GitVersion diff --git a/new-cli/GitVersion.Core/GitVersionOptions.cs b/new-cli/GitVersion.Core/GitVersionOptions.cs index f68b3ed231..ca76014909 100644 --- a/new-cli/GitVersion.Core/GitVersionOptions.cs +++ b/new-cli/GitVersion.Core/GitVersionOptions.cs @@ -1,7 +1,7 @@ using System.IO; -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; -namespace GitVersion.Core +namespace GitVersion { public class GitVersionOptions { diff --git a/new-cli/GitVersion.Core/IService.cs b/new-cli/GitVersion.Core/IService.cs index aff7572ab9..23d4d34398 100644 --- a/new-cli/GitVersion.Core/IService.cs +++ b/new-cli/GitVersion.Core/IService.cs @@ -1,4 +1,4 @@ -namespace GitVersion.Core +namespace GitVersion { public interface IService { diff --git a/new-cli/GitVersion.Core/Infrastructure/CommandAttribute.cs b/new-cli/GitVersion.Core/Infrastructure/CommandAttribute.cs index 900ba0754e..843b6e08ff 100644 --- a/new-cli/GitVersion.Core/Infrastructure/CommandAttribute.cs +++ b/new-cli/GitVersion.Core/Infrastructure/CommandAttribute.cs @@ -1,6 +1,6 @@ using System; -namespace GitVersion.Core.Infrastructure +namespace GitVersion.Infrastructure { [AttributeUsage(AttributeTargets.Class)] public class CommandAttribute : Attribute diff --git a/new-cli/GitVersion.Core/Infrastructure/CommandHandler.cs b/new-cli/GitVersion.Core/Infrastructure/CommandHandler.cs index 6713ccf5b8..6c18ac5b83 100644 --- a/new-cli/GitVersion.Core/Infrastructure/CommandHandler.cs +++ b/new-cli/GitVersion.Core/Infrastructure/CommandHandler.cs @@ -2,7 +2,7 @@ using System.Linq; using System.Threading.Tasks; -namespace GitVersion.Core.Infrastructure +namespace GitVersion.Infrastructure { public abstract class CommandHandler : ICommandHandler where T : GitVersionOptions { diff --git a/new-cli/GitVersion.Core/Infrastructure/ICommandHandler.cs b/new-cli/GitVersion.Core/Infrastructure/ICommandHandler.cs index 1fb5c2c168..e631164783 100644 --- a/new-cli/GitVersion.Core/Infrastructure/ICommandHandler.cs +++ b/new-cli/GitVersion.Core/Infrastructure/ICommandHandler.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace GitVersion.Core.Infrastructure +namespace GitVersion.Infrastructure { public interface ICommandHandler { diff --git a/new-cli/GitVersion.Core/Infrastructure/IContainer.cs b/new-cli/GitVersion.Core/Infrastructure/IContainer.cs index 4e8ea338f0..8451be72de 100644 --- a/new-cli/GitVersion.Core/Infrastructure/IContainer.cs +++ b/new-cli/GitVersion.Core/Infrastructure/IContainer.cs @@ -1,6 +1,6 @@ using System; -namespace GitVersion.Core.Infrastructure +namespace GitVersion.Infrastructure { public interface IContainer : IDisposable { diff --git a/new-cli/GitVersion.Core/Infrastructure/IContainerRegistrar.cs b/new-cli/GitVersion.Core/Infrastructure/IContainerRegistrar.cs index 1b2bb38c32..52b3dfb698 100644 --- a/new-cli/GitVersion.Core/Infrastructure/IContainerRegistrar.cs +++ b/new-cli/GitVersion.Core/Infrastructure/IContainerRegistrar.cs @@ -1,6 +1,6 @@ using System; -namespace GitVersion.Core.Infrastructure +namespace GitVersion.Infrastructure { public interface IContainerRegistrar { diff --git a/new-cli/GitVersion.Core/Infrastructure/IGitVersionModule.cs b/new-cli/GitVersion.Core/Infrastructure/IGitVersionModule.cs index 35b9333c20..2b7f01fa52 100644 --- a/new-cli/GitVersion.Core/Infrastructure/IGitVersionModule.cs +++ b/new-cli/GitVersion.Core/Infrastructure/IGitVersionModule.cs @@ -1,4 +1,4 @@ -namespace GitVersion.Core.Infrastructure +namespace GitVersion.Infrastructure { public interface IGitVersionModule { diff --git a/new-cli/GitVersion.Core/Infrastructure/ILogger.cs b/new-cli/GitVersion.Core/Infrastructure/ILogger.cs index 9e2d4b52a8..36c809efe9 100644 --- a/new-cli/GitVersion.Core/Infrastructure/ILogger.cs +++ b/new-cli/GitVersion.Core/Infrastructure/ILogger.cs @@ -1,4 +1,4 @@ -namespace GitVersion.Core.Infrastructure +namespace GitVersion.Infrastructure { public interface ILogger { diff --git a/new-cli/GitVersion.Core/Infrastructure/IRootCommandHandler.cs b/new-cli/GitVersion.Core/Infrastructure/IRootCommandHandler.cs index f53e43dae1..877aa238af 100644 --- a/new-cli/GitVersion.Core/Infrastructure/IRootCommandHandler.cs +++ b/new-cli/GitVersion.Core/Infrastructure/IRootCommandHandler.cs @@ -1,4 +1,4 @@ -namespace GitVersion.Core.Infrastructure +namespace GitVersion.Infrastructure { public interface IRootCommandHandler : ICommandHandler { diff --git a/new-cli/GitVersion.Core/Infrastructure/OptionAttribute.cs b/new-cli/GitVersion.Core/Infrastructure/OptionAttribute.cs index a80974b182..b6ba691d93 100644 --- a/new-cli/GitVersion.Core/Infrastructure/OptionAttribute.cs +++ b/new-cli/GitVersion.Core/Infrastructure/OptionAttribute.cs @@ -1,6 +1,6 @@ using System; -namespace GitVersion.Core.Infrastructure +namespace GitVersion.Infrastructure { [AttributeUsage(AttributeTargets.Property)] public class OptionAttribute : Attribute diff --git a/new-cli/GitVersion.Core/Service.cs b/new-cli/GitVersion.Core/Service.cs index e033104eeb..068a31f670 100644 --- a/new-cli/GitVersion.Core/Service.cs +++ b/new-cli/GitVersion.Core/Service.cs @@ -1,4 +1,4 @@ -namespace GitVersion.Core +namespace GitVersion { public class Service : IService { diff --git a/new-cli/GitVersion.Normalize/NormalizeCommandHandler.cs b/new-cli/GitVersion.Normalize/NormalizeCommandHandler.cs index a00fe271e0..6ebac499ae 100644 --- a/new-cli/GitVersion.Normalize/NormalizeCommandHandler.cs +++ b/new-cli/GitVersion.Normalize/NormalizeCommandHandler.cs @@ -1,7 +1,5 @@ -using System; -using System.Threading.Tasks; -using GitVersion.Core; -using GitVersion.Core.Infrastructure; +using System.Threading.Tasks; +using GitVersion.Infrastructure; namespace GitVersion.Normalize { diff --git a/new-cli/GitVersion.Normalize/NormalizeModule.cs b/new-cli/GitVersion.Normalize/NormalizeModule.cs index bde9956985..35dbf31b11 100644 --- a/new-cli/GitVersion.Normalize/NormalizeModule.cs +++ b/new-cli/GitVersion.Normalize/NormalizeModule.cs @@ -1,4 +1,4 @@ -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; namespace GitVersion.Normalize { diff --git a/new-cli/GitVersion.Normalize/NormalizeOptions.cs b/new-cli/GitVersion.Normalize/NormalizeOptions.cs index b2b0dddf8d..ce242844bb 100644 --- a/new-cli/GitVersion.Normalize/NormalizeOptions.cs +++ b/new-cli/GitVersion.Normalize/NormalizeOptions.cs @@ -1,6 +1,5 @@ using System.IO; -using GitVersion.Core; -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; namespace GitVersion.Normalize { diff --git a/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs b/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs index 5712235bf8..c54c05fea1 100644 --- a/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs +++ b/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs @@ -1,7 +1,5 @@ -using System; -using System.Threading.Tasks; -using GitVersion.Core; -using GitVersion.Core.Infrastructure; +using System.Threading.Tasks; +using GitVersion.Infrastructure; namespace GitVersion.Output.AssemblyInfo { diff --git a/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoOptions.cs b/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoOptions.cs index f27d267415..37a6caea35 100644 --- a/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoOptions.cs +++ b/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoOptions.cs @@ -1,4 +1,4 @@ -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; namespace GitVersion.Output.AssemblyInfo { diff --git a/new-cli/GitVersion.Output/IOutputCommandHandler.cs b/new-cli/GitVersion.Output/IOutputCommandHandler.cs index fe3077c044..0e9c40b44d 100644 --- a/new-cli/GitVersion.Output/IOutputCommandHandler.cs +++ b/new-cli/GitVersion.Output/IOutputCommandHandler.cs @@ -1,4 +1,4 @@ -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; namespace GitVersion.Output { diff --git a/new-cli/GitVersion.Output/OutputCommandHandler.cs b/new-cli/GitVersion.Output/OutputCommandHandler.cs index b63e0a0517..ae278408f9 100644 --- a/new-cli/GitVersion.Output/OutputCommandHandler.cs +++ b/new-cli/GitVersion.Output/OutputCommandHandler.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; namespace GitVersion.Output { diff --git a/new-cli/GitVersion.Output/OutputModule.cs b/new-cli/GitVersion.Output/OutputModule.cs index 4e81f8b811..85a5b99297 100644 --- a/new-cli/GitVersion.Output/OutputModule.cs +++ b/new-cli/GitVersion.Output/OutputModule.cs @@ -1,4 +1,4 @@ -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; using GitVersion.Output.AssemblyInfo; using GitVersion.Output.Project; using GitVersion.Output.Wix; diff --git a/new-cli/GitVersion.Output/OutputOptions.cs b/new-cli/GitVersion.Output/OutputOptions.cs index 5f11abb6e8..fc8101f6e8 100644 --- a/new-cli/GitVersion.Output/OutputOptions.cs +++ b/new-cli/GitVersion.Output/OutputOptions.cs @@ -1,7 +1,6 @@ using System; using System.IO; -using GitVersion.Core; -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; namespace GitVersion.Output { diff --git a/new-cli/GitVersion.Output/Project/OutputProjectCommandHandler.cs b/new-cli/GitVersion.Output/Project/OutputProjectCommandHandler.cs index 403deb4f62..24b5fe3e1f 100644 --- a/new-cli/GitVersion.Output/Project/OutputProjectCommandHandler.cs +++ b/new-cli/GitVersion.Output/Project/OutputProjectCommandHandler.cs @@ -1,7 +1,5 @@ -using System; -using System.Threading.Tasks; -using GitVersion.Core; -using GitVersion.Core.Infrastructure; +using System.Threading.Tasks; +using GitVersion.Infrastructure; namespace GitVersion.Output.Project { diff --git a/new-cli/GitVersion.Output/Project/OutputProjectOptions.cs b/new-cli/GitVersion.Output/Project/OutputProjectOptions.cs index 4fc00c8848..5ad70b12f3 100644 --- a/new-cli/GitVersion.Output/Project/OutputProjectOptions.cs +++ b/new-cli/GitVersion.Output/Project/OutputProjectOptions.cs @@ -1,4 +1,4 @@ -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; namespace GitVersion.Output.Project { diff --git a/new-cli/GitVersion.Output/Wix/OutputWixCommandHandler.cs b/new-cli/GitVersion.Output/Wix/OutputWixCommandHandler.cs index 617a46980b..b2e59c4f33 100644 --- a/new-cli/GitVersion.Output/Wix/OutputWixCommandHandler.cs +++ b/new-cli/GitVersion.Output/Wix/OutputWixCommandHandler.cs @@ -1,7 +1,5 @@ -using System; -using System.Threading.Tasks; -using GitVersion.Core; -using GitVersion.Core.Infrastructure; +using System.Threading.Tasks; +using GitVersion.Infrastructure; namespace GitVersion.Output.Wix { diff --git a/new-cli/GitVersion.Output/Wix/OutputWixOptions.cs b/new-cli/GitVersion.Output/Wix/OutputWixOptions.cs index 8ba1692ccc..d786d1ad1a 100644 --- a/new-cli/GitVersion.Output/Wix/OutputWixOptions.cs +++ b/new-cli/GitVersion.Output/Wix/OutputWixOptions.cs @@ -1,4 +1,4 @@ -using GitVersion.Core.Infrastructure; +using GitVersion.Infrastructure; namespace GitVersion.Output.Wix { From 3179036c0c8b5a42b916ce765cd7ebd941401564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Sat, 1 Aug 2020 01:53:26 +0200 Subject: [PATCH 0027/1120] (new-cli) - Add TypeIsGitVersionModule method and exclude abstract types --- new-cli/GitVersion.Cli/Program.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/new-cli/GitVersion.Cli/Program.cs b/new-cli/GitVersion.Cli/Program.cs index de6de98f95..8cb22399f6 100644 --- a/new-cli/GitVersion.Cli/Program.cs +++ b/new-cli/GitVersion.Cli/Program.cs @@ -27,7 +27,7 @@ private static async Task Main(string[] args) }; var gitVersionModules = assemblies - .SelectMany(a => a.GetTypes().Where(t => typeof(IGitVersionModule).IsAssignableFrom(t) && !t.IsInterface)) + .SelectMany(a => a.GetTypes().Where(TypeIsGitVersionModule)) .Select(t => (IGitVersionModule)Activator.CreateInstance(t)) .ToList(); @@ -43,5 +43,13 @@ private static async Task Main(string[] args) return result; } + + private static bool TypeIsGitVersionModule(Type type) + { + return typeof(IGitVersionModule).IsAssignableFrom(type) && + !type.IsInterface && + !type.IsAbstract; + } + } } \ No newline at end of file From 4eb468a91aecbd0f12bf27cbdb782ae4303cf3b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Sat, 1 Aug 2020 01:57:46 +0200 Subject: [PATCH 0028/1120] (new-cli) - Rename GitVersion.Calculate to GitVersion.Calculation --- .../CalculateCommandHandler.cs | 2 +- .../CalculateModule.cs | 2 +- .../CalculateOptions.cs | 2 +- .../GitVersion.Calculation.csproj} | 4 ++-- new-cli/GitVersion.Cli/GitVersion.Cli.csproj | 2 +- new-cli/GitVersion.Cli/Program.cs | 2 +- new-cli/GitVersion.sln | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) rename new-cli/{GitVersion.Calculate => GitVersion.Calculation}/CalculateCommandHandler.cs (95%) rename new-cli/{GitVersion.Calculate => GitVersion.Calculation}/CalculateModule.cs (89%) rename new-cli/{GitVersion.Calculate => GitVersion.Calculation}/CalculateOptions.cs (91%) rename new-cli/{GitVersion.Calculate/GitVersion.Calculate.csproj => GitVersion.Calculation/GitVersion.Calculation.csproj} (69%) diff --git a/new-cli/GitVersion.Calculate/CalculateCommandHandler.cs b/new-cli/GitVersion.Calculation/CalculateCommandHandler.cs similarity index 95% rename from new-cli/GitVersion.Calculate/CalculateCommandHandler.cs rename to new-cli/GitVersion.Calculation/CalculateCommandHandler.cs index 783717a144..2f983ef9c9 100644 --- a/new-cli/GitVersion.Calculate/CalculateCommandHandler.cs +++ b/new-cli/GitVersion.Calculation/CalculateCommandHandler.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; using GitVersion.Infrastructure; -namespace GitVersion.Calculate +namespace GitVersion.Calculation { public class CalculateCommandHandler : CommandHandler, IRootCommandHandler { diff --git a/new-cli/GitVersion.Calculate/CalculateModule.cs b/new-cli/GitVersion.Calculation/CalculateModule.cs similarity index 89% rename from new-cli/GitVersion.Calculate/CalculateModule.cs rename to new-cli/GitVersion.Calculation/CalculateModule.cs index 00fb422ddc..3728bf168d 100644 --- a/new-cli/GitVersion.Calculate/CalculateModule.cs +++ b/new-cli/GitVersion.Calculation/CalculateModule.cs @@ -1,6 +1,6 @@ using GitVersion.Infrastructure; -namespace GitVersion.Calculate +namespace GitVersion.Calculation { public class CalculateModule : IGitVersionModule { diff --git a/new-cli/GitVersion.Calculate/CalculateOptions.cs b/new-cli/GitVersion.Calculation/CalculateOptions.cs similarity index 91% rename from new-cli/GitVersion.Calculate/CalculateOptions.cs rename to new-cli/GitVersion.Calculation/CalculateOptions.cs index a3e0c1d034..f64dd01ccb 100644 --- a/new-cli/GitVersion.Calculate/CalculateOptions.cs +++ b/new-cli/GitVersion.Calculation/CalculateOptions.cs @@ -1,7 +1,7 @@ using System.IO; using GitVersion.Infrastructure; -namespace GitVersion.Calculate +namespace GitVersion.Calculation { [Command("calculate", "Calculates the version object from the git history.")] public class CalculateOptions : GitVersionOptions diff --git a/new-cli/GitVersion.Calculate/GitVersion.Calculate.csproj b/new-cli/GitVersion.Calculation/GitVersion.Calculation.csproj similarity index 69% rename from new-cli/GitVersion.Calculate/GitVersion.Calculate.csproj rename to new-cli/GitVersion.Calculation/GitVersion.Calculation.csproj index 72519002fb..2ff4f57d52 100644 --- a/new-cli/GitVersion.Calculate/GitVersion.Calculate.csproj +++ b/new-cli/GitVersion.Calculation/GitVersion.Calculation.csproj @@ -1,8 +1,8 @@ - + netstandard2.0 - GitVersion.Calculate + GitVersion.Calculation diff --git a/new-cli/GitVersion.Cli/GitVersion.Cli.csproj b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj index eed9f28c38..a322edeeae 100644 --- a/new-cli/GitVersion.Cli/GitVersion.Cli.csproj +++ b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj @@ -14,7 +14,7 @@ - + diff --git a/new-cli/GitVersion.Cli/Program.cs b/new-cli/GitVersion.Cli/Program.cs index 8cb22399f6..fac7da575b 100644 --- a/new-cli/GitVersion.Cli/Program.cs +++ b/new-cli/GitVersion.Cli/Program.cs @@ -1,7 +1,7 @@ using System; using System.Linq; using System.Threading.Tasks; -using GitVersion.Calculate; +using GitVersion.Calculation; using GitVersion.Cli.Extensions; using GitVersion.Cli.Infrastructure; using GitVersion.Config; diff --git a/new-cli/GitVersion.sln b/new-cli/GitVersion.sln index 3bd8641560..c13eaf6570 100644 --- a/new-cli/GitVersion.sln +++ b/new-cli/GitVersion.sln @@ -4,7 +4,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Cli", "GitVersio EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Core", "GitVersion.Core\GitVersion.Core.csproj", "{02332393-1F38-4819-8D6F-3D1968B38919}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Calculate", "GitVersion.Calculate\GitVersion.Calculate.csproj", "{8F6D4830-B870-4365-9662-457F1A13894B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Calculation", "GitVersion.Calculation\GitVersion.Calculation.csproj", "{8F6D4830-B870-4365-9662-457F1A13894B}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Output", "GitVersion.Output\GitVersion.Output.csproj", "{9543A475-06BA-4C8D-A3CE-E2792FE663DA}" EndProject From d0fd56c9e42a320c619794aed1e43685f52d4343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Sat, 1 Aug 2020 01:59:14 +0200 Subject: [PATCH 0029/1120] (new-cli) - Rename GitVersion.Normalize to GitVersion.Normalization --- new-cli/GitVersion.Cli/GitVersion.Cli.csproj | 2 +- new-cli/GitVersion.Cli/Program.cs | 2 +- .../GitVersion.Normalization.csproj} | 0 .../NormalizeCommandHandler.cs | 2 +- .../NormalizeModule.cs | 2 +- .../NormalizeOptions.cs | 2 +- new-cli/GitVersion.sln | 2 +- 7 files changed, 6 insertions(+), 6 deletions(-) rename new-cli/{GitVersion.Normalize/GitVersion.Normalize.csproj => GitVersion.Normalization/GitVersion.Normalization.csproj} (100%) rename new-cli/{GitVersion.Normalize => GitVersion.Normalization}/NormalizeCommandHandler.cs (95%) rename new-cli/{GitVersion.Normalize => GitVersion.Normalization}/NormalizeModule.cs (88%) rename new-cli/{GitVersion.Normalize => GitVersion.Normalization}/NormalizeOptions.cs (90%) diff --git a/new-cli/GitVersion.Cli/GitVersion.Cli.csproj b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj index a322edeeae..4b3944266d 100644 --- a/new-cli/GitVersion.Cli/GitVersion.Cli.csproj +++ b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj @@ -16,7 +16,7 @@ - + diff --git a/new-cli/GitVersion.Cli/Program.cs b/new-cli/GitVersion.Cli/Program.cs index fac7da575b..6e14d8f48d 100644 --- a/new-cli/GitVersion.Cli/Program.cs +++ b/new-cli/GitVersion.Cli/Program.cs @@ -6,7 +6,7 @@ using GitVersion.Cli.Infrastructure; using GitVersion.Config; using GitVersion.Infrastructure; -using GitVersion.Normalize; +using GitVersion.Normalization; using GitVersion.Output; namespace GitVersion.Cli diff --git a/new-cli/GitVersion.Normalize/GitVersion.Normalize.csproj b/new-cli/GitVersion.Normalization/GitVersion.Normalization.csproj similarity index 100% rename from new-cli/GitVersion.Normalize/GitVersion.Normalize.csproj rename to new-cli/GitVersion.Normalization/GitVersion.Normalization.csproj diff --git a/new-cli/GitVersion.Normalize/NormalizeCommandHandler.cs b/new-cli/GitVersion.Normalization/NormalizeCommandHandler.cs similarity index 95% rename from new-cli/GitVersion.Normalize/NormalizeCommandHandler.cs rename to new-cli/GitVersion.Normalization/NormalizeCommandHandler.cs index 6ebac499ae..1a463a5825 100644 --- a/new-cli/GitVersion.Normalize/NormalizeCommandHandler.cs +++ b/new-cli/GitVersion.Normalization/NormalizeCommandHandler.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; using GitVersion.Infrastructure; -namespace GitVersion.Normalize +namespace GitVersion.Normalization { public class NormalizeCommandHandler : CommandHandler, IRootCommandHandler { diff --git a/new-cli/GitVersion.Normalize/NormalizeModule.cs b/new-cli/GitVersion.Normalization/NormalizeModule.cs similarity index 88% rename from new-cli/GitVersion.Normalize/NormalizeModule.cs rename to new-cli/GitVersion.Normalization/NormalizeModule.cs index 35dbf31b11..7e46f0c344 100644 --- a/new-cli/GitVersion.Normalize/NormalizeModule.cs +++ b/new-cli/GitVersion.Normalization/NormalizeModule.cs @@ -1,6 +1,6 @@ using GitVersion.Infrastructure; -namespace GitVersion.Normalize +namespace GitVersion.Normalization { public class NormalizeModule : IGitVersionModule { diff --git a/new-cli/GitVersion.Normalize/NormalizeOptions.cs b/new-cli/GitVersion.Normalization/NormalizeOptions.cs similarity index 90% rename from new-cli/GitVersion.Normalize/NormalizeOptions.cs rename to new-cli/GitVersion.Normalization/NormalizeOptions.cs index ce242844bb..d7e12c05bc 100644 --- a/new-cli/GitVersion.Normalize/NormalizeOptions.cs +++ b/new-cli/GitVersion.Normalization/NormalizeOptions.cs @@ -1,7 +1,7 @@ using System.IO; using GitVersion.Infrastructure; -namespace GitVersion.Normalize +namespace GitVersion.Normalization { [Command("normalize", "Normalizes the git repository for GitVersion calculations.")] public class NormalizeOptions : GitVersionOptions diff --git a/new-cli/GitVersion.sln b/new-cli/GitVersion.sln index c13eaf6570..9d474091dd 100644 --- a/new-cli/GitVersion.sln +++ b/new-cli/GitVersion.sln @@ -13,7 +13,7 @@ ProjectSection(SolutionItems) = preProject command.md = command.md EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Normalize", "GitVersion.Normalize\GitVersion.Normalize.csproj", "{45776CC1-7FDA-4299-86A7-9F11E7855CE4}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Normalization", "GitVersion.Normalization\GitVersion.Normalization.csproj", "{45776CC1-7FDA-4299-86A7-9F11E7855CE4}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Config", "GitVersion.Config\GitVersion.Config.csproj", "{2127F18A-F52B-4024-A0FD-B4D9F75FD85F}" EndProject From b1bf52b188e299db97e5a13f6fefc3f28158ecf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Sat, 1 Aug 2020 02:00:11 +0200 Subject: [PATCH 0030/1120] (new-cli) - Rename GitVersion.Config to GitVersion.Configuration --- new-cli/GitVersion.Cli/GitVersion.Cli.csproj | 2 +- new-cli/GitVersion.Cli/Program.cs | 2 +- .../ConfigCommandHandler.cs | 2 +- .../ConfigModule.cs | 6 +++--- .../ConfigOptions.cs | 2 +- .../GitVersion.Configuration.csproj} | 0 .../IConfigCommandHandler.cs | 2 +- .../Init/ConfigInitCommandHandler.cs | 2 +- .../Init/ConfigInitOptions.cs | 2 +- .../Show/ConfigInitCommandHandler.cs | 2 +- .../Show/ConfigShowOptions.cs | 2 +- new-cli/GitVersion.sln | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) rename new-cli/{GitVersion.Config => GitVersion.Configuration}/ConfigCommandHandler.cs (93%) rename new-cli/{GitVersion.Config => GitVersion.Configuration}/ConfigModule.cs (79%) rename new-cli/{GitVersion.Config => GitVersion.Configuration}/ConfigOptions.cs (90%) rename new-cli/{GitVersion.Config/GitVersion.Config.csproj => GitVersion.Configuration/GitVersion.Configuration.csproj} (100%) rename new-cli/{GitVersion.Config => GitVersion.Configuration}/IConfigCommandHandler.cs (76%) rename new-cli/{GitVersion.Config => GitVersion.Configuration}/Init/ConfigInitCommandHandler.cs (94%) rename new-cli/{GitVersion.Config => GitVersion.Configuration}/Init/ConfigInitOptions.cs (81%) rename new-cli/{GitVersion.Config => GitVersion.Configuration}/Show/ConfigInitCommandHandler.cs (94%) rename new-cli/{GitVersion.Config => GitVersion.Configuration}/Show/ConfigShowOptions.cs (80%) diff --git a/new-cli/GitVersion.Cli/GitVersion.Cli.csproj b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj index 4b3944266d..840a501fda 100644 --- a/new-cli/GitVersion.Cli/GitVersion.Cli.csproj +++ b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj @@ -15,7 +15,7 @@ - + diff --git a/new-cli/GitVersion.Cli/Program.cs b/new-cli/GitVersion.Cli/Program.cs index 6e14d8f48d..66d6bb798e 100644 --- a/new-cli/GitVersion.Cli/Program.cs +++ b/new-cli/GitVersion.Cli/Program.cs @@ -4,7 +4,7 @@ using GitVersion.Calculation; using GitVersion.Cli.Extensions; using GitVersion.Cli.Infrastructure; -using GitVersion.Config; +using GitVersion.Configuration; using GitVersion.Infrastructure; using GitVersion.Normalization; using GitVersion.Output; diff --git a/new-cli/GitVersion.Config/ConfigCommandHandler.cs b/new-cli/GitVersion.Configuration/ConfigCommandHandler.cs similarity index 93% rename from new-cli/GitVersion.Config/ConfigCommandHandler.cs rename to new-cli/GitVersion.Configuration/ConfigCommandHandler.cs index 5249426c77..5fb74f51a8 100644 --- a/new-cli/GitVersion.Config/ConfigCommandHandler.cs +++ b/new-cli/GitVersion.Configuration/ConfigCommandHandler.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using GitVersion.Infrastructure; -namespace GitVersion.Config +namespace GitVersion.Configuration { public class ConfigCommandHandler : CommandHandler, IRootCommandHandler { diff --git a/new-cli/GitVersion.Config/ConfigModule.cs b/new-cli/GitVersion.Configuration/ConfigModule.cs similarity index 79% rename from new-cli/GitVersion.Config/ConfigModule.cs rename to new-cli/GitVersion.Configuration/ConfigModule.cs index 65390f74fc..7a6543477d 100644 --- a/new-cli/GitVersion.Config/ConfigModule.cs +++ b/new-cli/GitVersion.Configuration/ConfigModule.cs @@ -1,8 +1,8 @@ -using GitVersion.Config.Init; -using GitVersion.Config.Show; +using GitVersion.Configuration.Init; +using GitVersion.Configuration.Show; using GitVersion.Infrastructure; -namespace GitVersion.Config +namespace GitVersion.Configuration { public class ConfigModule : IGitVersionModule { diff --git a/new-cli/GitVersion.Config/ConfigOptions.cs b/new-cli/GitVersion.Configuration/ConfigOptions.cs similarity index 90% rename from new-cli/GitVersion.Config/ConfigOptions.cs rename to new-cli/GitVersion.Configuration/ConfigOptions.cs index 979cef92b1..98917edd15 100644 --- a/new-cli/GitVersion.Config/ConfigOptions.cs +++ b/new-cli/GitVersion.Configuration/ConfigOptions.cs @@ -1,7 +1,7 @@ using System.IO; using GitVersion.Infrastructure; -namespace GitVersion.Config +namespace GitVersion.Configuration { [Command("config", "Manages the GitVersion configuration file.")] public class ConfigOptions : GitVersionOptions diff --git a/new-cli/GitVersion.Config/GitVersion.Config.csproj b/new-cli/GitVersion.Configuration/GitVersion.Configuration.csproj similarity index 100% rename from new-cli/GitVersion.Config/GitVersion.Config.csproj rename to new-cli/GitVersion.Configuration/GitVersion.Configuration.csproj diff --git a/new-cli/GitVersion.Config/IConfigCommandHandler.cs b/new-cli/GitVersion.Configuration/IConfigCommandHandler.cs similarity index 76% rename from new-cli/GitVersion.Config/IConfigCommandHandler.cs rename to new-cli/GitVersion.Configuration/IConfigCommandHandler.cs index cc4309c953..60c0b22e1a 100644 --- a/new-cli/GitVersion.Config/IConfigCommandHandler.cs +++ b/new-cli/GitVersion.Configuration/IConfigCommandHandler.cs @@ -1,6 +1,6 @@ using GitVersion.Infrastructure; -namespace GitVersion.Config +namespace GitVersion.Configuration { public interface IConfigCommandHandler : ICommandHandler { diff --git a/new-cli/GitVersion.Config/Init/ConfigInitCommandHandler.cs b/new-cli/GitVersion.Configuration/Init/ConfigInitCommandHandler.cs similarity index 94% rename from new-cli/GitVersion.Config/Init/ConfigInitCommandHandler.cs rename to new-cli/GitVersion.Configuration/Init/ConfigInitCommandHandler.cs index f7cfbedc71..32ca1277a5 100644 --- a/new-cli/GitVersion.Config/Init/ConfigInitCommandHandler.cs +++ b/new-cli/GitVersion.Configuration/Init/ConfigInitCommandHandler.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; using GitVersion.Infrastructure; -namespace GitVersion.Config.Init +namespace GitVersion.Configuration.Init { public class ConfigInitCommandHandler : CommandHandler, IConfigCommandHandler { diff --git a/new-cli/GitVersion.Config/Init/ConfigInitOptions.cs b/new-cli/GitVersion.Configuration/Init/ConfigInitOptions.cs similarity index 81% rename from new-cli/GitVersion.Config/Init/ConfigInitOptions.cs rename to new-cli/GitVersion.Configuration/Init/ConfigInitOptions.cs index e48714346a..6c1665b0bc 100644 --- a/new-cli/GitVersion.Config/Init/ConfigInitOptions.cs +++ b/new-cli/GitVersion.Configuration/Init/ConfigInitOptions.cs @@ -1,6 +1,6 @@ using GitVersion.Infrastructure; -namespace GitVersion.Config.Init +namespace GitVersion.Configuration.Init { [Command("init", "Inits the configuration for current repository.")] public class ConfigInitOptions : ConfigOptions diff --git a/new-cli/GitVersion.Config/Show/ConfigInitCommandHandler.cs b/new-cli/GitVersion.Configuration/Show/ConfigInitCommandHandler.cs similarity index 94% rename from new-cli/GitVersion.Config/Show/ConfigInitCommandHandler.cs rename to new-cli/GitVersion.Configuration/Show/ConfigInitCommandHandler.cs index 1feed45abb..f456856844 100644 --- a/new-cli/GitVersion.Config/Show/ConfigInitCommandHandler.cs +++ b/new-cli/GitVersion.Configuration/Show/ConfigInitCommandHandler.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; using GitVersion.Infrastructure; -namespace GitVersion.Config.Show +namespace GitVersion.Configuration.Show { public class ConfigShowCommandHandler : CommandHandler, IConfigCommandHandler { diff --git a/new-cli/GitVersion.Config/Show/ConfigShowOptions.cs b/new-cli/GitVersion.Configuration/Show/ConfigShowOptions.cs similarity index 80% rename from new-cli/GitVersion.Config/Show/ConfigShowOptions.cs rename to new-cli/GitVersion.Configuration/Show/ConfigShowOptions.cs index e9095ed6fa..7c6c831b2f 100644 --- a/new-cli/GitVersion.Config/Show/ConfigShowOptions.cs +++ b/new-cli/GitVersion.Configuration/Show/ConfigShowOptions.cs @@ -1,6 +1,6 @@ using GitVersion.Infrastructure; -namespace GitVersion.Config.Show +namespace GitVersion.Configuration.Show { [Command("show", "Shows the effective configuration.")] public class ConfigShowOptions : ConfigOptions diff --git a/new-cli/GitVersion.sln b/new-cli/GitVersion.sln index 9d474091dd..0a5b486762 100644 --- a/new-cli/GitVersion.sln +++ b/new-cli/GitVersion.sln @@ -15,7 +15,7 @@ EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Normalization", "GitVersion.Normalization\GitVersion.Normalization.csproj", "{45776CC1-7FDA-4299-86A7-9F11E7855CE4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Config", "GitVersion.Config\GitVersion.Config.csproj", "{2127F18A-F52B-4024-A0FD-B4D9F75FD85F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Configuration", "GitVersion.Configuration\GitVersion.Configuration.csproj", "{2127F18A-F52B-4024-A0FD-B4D9F75FD85F}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{511CE16D-A65E-48F4-9A95-BB521A9048AF}" EndProject From 5a4c37eee5223c104298db6cd80a13f66d382d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Sat, 1 Aug 2020 02:05:21 +0200 Subject: [PATCH 0031/1120] (new-cli) - Change from backslash to forward slash in examples --- new-cli/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/new-cli/README.md b/new-cli/README.md index 11f5f03c53..76983ffecf 100644 --- a/new-cli/README.md +++ b/new-cli/README.md @@ -1,13 +1,13 @@ Ways the commands can be run from command line ```bash -dotnet run --project .\GitVersion.Cli\ -- --help +dotnet run --project ./GitVersion.Cli/ -- --help -dotnet run --project .\GitVersion.Cli\ -- output --help +dotnet run --project ./GitVersion.Cli/ -- output --help -dotnet run --project .\GitVersion.Cli\ -- output assemblyinfo --help +dotnet run --project ./GitVersion.Cli/ -- output assemblyinfo --help -dotnet run --project .\GitVersion.Cli\ -- output assemblyinfo --assemblyinfo-file GlobalAssemblyInfo.cs --output-dir c:\output +dotnet run --project ./GitVersion.Cli/ -- output assemblyinfo --assemblyinfo-file GlobalAssemblyInfo.cs --output-dir c:\output -"1.2.3-beta4" | dotnet run --project .\GitVersion.Cli\ -- output assemblyinfo --assemblyinfo-file GlobalAssemblyInfo.cs --output-dir c:\output +"1.2.3-beta4" | dotnet run --project ./GitVersion.Cli/ -- output assemblyinfo --assemblyinfo-file GlobalAssemblyInfo.cs --output-dir c:\output ``` From 9afe044a458801521225fae3857076b85a93f42c Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Tue, 11 Aug 2020 12:26:27 +0300 Subject: [PATCH 0032/1120] (new-cli) - Renamed GitVersion.Core to GitVersion.Common for now Moved Command specific classes to Command folder Added GitVersion.Core project that will contain Git specific classes --- new-cli/Directory.Build.props | 5 +++++ .../GitVersion.Calculation/CalculateCommandHandler.cs | 1 + new-cli/GitVersion.Calculation/CalculateModule.cs | 3 ++- new-cli/GitVersion.Calculation/CalculateOptions.cs | 1 + .../GitVersion.Calculation/GitVersion.Calculation.csproj | 2 +- new-cli/GitVersion.Cli/GitVersion.Cli.csproj | 1 - new-cli/GitVersion.Cli/GitVersionApp.cs | 8 ++++---- .../Command}/CommandAttribute.cs | 2 +- .../Command}/CommandHandler.cs | 2 +- .../Command}/ICommandHandler.cs | 2 +- .../Command}/IRootCommandHandler.cs | 2 +- .../Command}/OptionAttribute.cs | 2 +- .../{GitVersion.Core => GitVersion.Common}/CoreModule.cs | 0 new-cli/GitVersion.Common/GitVersion.Common.csproj | 8 ++++++++ .../GitVersionOptions.cs | 1 + .../{GitVersion.Core => GitVersion.Common}/IService.cs | 0 .../Infrastructure/IContainer.cs | 0 .../Infrastructure/IContainerRegistrar.cs | 0 .../Infrastructure/IGitVersionModule.cs | 0 .../Infrastructure/ILogger.cs | 0 .../{GitVersion.Core => GitVersion.Common}/Service.cs | 0 new-cli/GitVersion.Configuration/ConfigCommandHandler.cs | 1 + new-cli/GitVersion.Configuration/ConfigModule.cs | 3 ++- new-cli/GitVersion.Configuration/ConfigOptions.cs | 1 + .../GitVersion.Configuration.csproj | 3 ++- .../GitVersion.Configuration/IConfigCommandHandler.cs | 3 ++- .../Init/ConfigInitCommandHandler.cs | 1 + .../GitVersion.Configuration/Init/ConfigInitOptions.cs | 3 ++- .../Show/ConfigInitCommandHandler.cs | 1 + .../GitVersion.Configuration/Show/ConfigShowOptions.cs | 3 ++- new-cli/GitVersion.Core/GitVersion.Core.csproj | 3 +-- .../GitVersion.Normalization.csproj | 3 ++- .../GitVersion.Normalization/NormalizeCommandHandler.cs | 1 + new-cli/GitVersion.Normalization/NormalizeModule.cs | 3 ++- new-cli/GitVersion.Normalization/NormalizeOptions.cs | 1 + .../AssemblyInfo/OutputAssemblyInfoCommandHandler.cs | 1 + .../AssemblyInfo/OutputAssemblyInfoOptions.cs | 3 ++- new-cli/GitVersion.Output/GitVersion.Output.csproj | 2 +- new-cli/GitVersion.Output/IOutputCommandHandler.cs | 3 ++- new-cli/GitVersion.Output/OutputCommandHandler.cs | 1 + new-cli/GitVersion.Output/OutputModule.cs | 3 ++- new-cli/GitVersion.Output/OutputOptions.cs | 1 + .../Project/OutputProjectCommandHandler.cs | 1 + .../GitVersion.Output/Project/OutputProjectOptions.cs | 3 ++- new-cli/GitVersion.Output/Wix/OutputWixCommandHandler.cs | 1 + new-cli/GitVersion.Output/Wix/OutputWixOptions.cs | 3 ++- new-cli/GitVersion.sln | 9 ++++++++- 47 files changed, 73 insertions(+), 28 deletions(-) create mode 100644 new-cli/Directory.Build.props rename new-cli/{GitVersion.Core/Infrastructure => GitVersion.Common/Command}/CommandAttribute.cs (90%) rename new-cli/{GitVersion.Core/Infrastructure => GitVersion.Common/Command}/CommandHandler.cs (92%) rename new-cli/{GitVersion.Core/Infrastructure => GitVersion.Common/Command}/ICommandHandler.cs (86%) rename new-cli/{GitVersion.Core/Infrastructure => GitVersion.Common/Command}/IRootCommandHandler.cs (65%) rename new-cli/{GitVersion.Core/Infrastructure => GitVersion.Common/Command}/OptionAttribute.cs (94%) rename new-cli/{GitVersion.Core => GitVersion.Common}/CoreModule.cs (100%) create mode 100644 new-cli/GitVersion.Common/GitVersion.Common.csproj rename new-cli/{GitVersion.Core => GitVersion.Common}/GitVersionOptions.cs (90%) rename new-cli/{GitVersion.Core => GitVersion.Common}/IService.cs (100%) rename new-cli/{GitVersion.Core => GitVersion.Common}/Infrastructure/IContainer.cs (100%) rename new-cli/{GitVersion.Core => GitVersion.Common}/Infrastructure/IContainerRegistrar.cs (100%) rename new-cli/{GitVersion.Core => GitVersion.Common}/Infrastructure/IGitVersionModule.cs (100%) rename new-cli/{GitVersion.Core => GitVersion.Common}/Infrastructure/ILogger.cs (100%) rename new-cli/{GitVersion.Core => GitVersion.Common}/Service.cs (100%) diff --git a/new-cli/Directory.Build.props b/new-cli/Directory.Build.props new file mode 100644 index 0000000000..b09852f3ca --- /dev/null +++ b/new-cli/Directory.Build.props @@ -0,0 +1,5 @@ + + + 8.0 + + diff --git a/new-cli/GitVersion.Calculation/CalculateCommandHandler.cs b/new-cli/GitVersion.Calculation/CalculateCommandHandler.cs index 2f983ef9c9..bf84d461a4 100644 --- a/new-cli/GitVersion.Calculation/CalculateCommandHandler.cs +++ b/new-cli/GitVersion.Calculation/CalculateCommandHandler.cs @@ -1,4 +1,5 @@ using System.Threading.Tasks; +using GitVersion.Command; using GitVersion.Infrastructure; namespace GitVersion.Calculation diff --git a/new-cli/GitVersion.Calculation/CalculateModule.cs b/new-cli/GitVersion.Calculation/CalculateModule.cs index 3728bf168d..76f010897d 100644 --- a/new-cli/GitVersion.Calculation/CalculateModule.cs +++ b/new-cli/GitVersion.Calculation/CalculateModule.cs @@ -1,4 +1,5 @@ -using GitVersion.Infrastructure; +using GitVersion.Command; +using GitVersion.Infrastructure; namespace GitVersion.Calculation { diff --git a/new-cli/GitVersion.Calculation/CalculateOptions.cs b/new-cli/GitVersion.Calculation/CalculateOptions.cs index f64dd01ccb..cd82feba6c 100644 --- a/new-cli/GitVersion.Calculation/CalculateOptions.cs +++ b/new-cli/GitVersion.Calculation/CalculateOptions.cs @@ -1,4 +1,5 @@ using System.IO; +using GitVersion.Command; using GitVersion.Infrastructure; namespace GitVersion.Calculation diff --git a/new-cli/GitVersion.Calculation/GitVersion.Calculation.csproj b/new-cli/GitVersion.Calculation/GitVersion.Calculation.csproj index 2ff4f57d52..05da03885e 100644 --- a/new-cli/GitVersion.Calculation/GitVersion.Calculation.csproj +++ b/new-cli/GitVersion.Calculation/GitVersion.Calculation.csproj @@ -6,7 +6,7 @@ - + diff --git a/new-cli/GitVersion.Cli/GitVersion.Cli.csproj b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj index 840a501fda..b4008fa905 100644 --- a/new-cli/GitVersion.Cli/GitVersion.Cli.csproj +++ b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj @@ -4,7 +4,6 @@ Exe net5.0 GitVersion.Cli - 8 diff --git a/new-cli/GitVersion.Cli/GitVersionApp.cs b/new-cli/GitVersion.Cli/GitVersionApp.cs index ae39f81f7a..081b87e476 100644 --- a/new-cli/GitVersion.Cli/GitVersionApp.cs +++ b/new-cli/GitVersion.Cli/GitVersionApp.cs @@ -5,8 +5,8 @@ using System.CommandLine.Parsing; using System.Reflection; using System.Threading.Tasks; -using GitVersion.Infrastructure; -using ICommandHandler = GitVersion.Infrastructure.ICommandHandler; +using GitVersion.Command; +using ICommandHandler = GitVersion.Command.ICommandHandler; namespace GitVersion.Cli { @@ -29,7 +29,7 @@ public Task RunAsync(string[] args) .InvokeAsync(args); } - private static Command CreateCommand(ICommandHandler commandHandler) + private static System.CommandLine.Command CreateCommand(ICommandHandler commandHandler) { const BindingFlags declaredOnly = BindingFlags.Public | BindingFlags.Instance; @@ -39,7 +39,7 @@ private static Command CreateCommand(ICommandHandler commandHandler) if (commandAttribute == null) return null; - var command = new Command(commandAttribute.Name, commandAttribute.Description); + var command = new System.CommandLine.Command(commandAttribute.Name, commandAttribute.Description); var propertyInfos = commandOptionsType.GetProperties(declaredOnly); foreach (var propertyInfo in propertyInfos) { diff --git a/new-cli/GitVersion.Core/Infrastructure/CommandAttribute.cs b/new-cli/GitVersion.Common/Command/CommandAttribute.cs similarity index 90% rename from new-cli/GitVersion.Core/Infrastructure/CommandAttribute.cs rename to new-cli/GitVersion.Common/Command/CommandAttribute.cs index 843b6e08ff..5d55b771cc 100644 --- a/new-cli/GitVersion.Core/Infrastructure/CommandAttribute.cs +++ b/new-cli/GitVersion.Common/Command/CommandAttribute.cs @@ -1,6 +1,6 @@ using System; -namespace GitVersion.Infrastructure +namespace GitVersion.Command { [AttributeUsage(AttributeTargets.Class)] public class CommandAttribute : Attribute diff --git a/new-cli/GitVersion.Core/Infrastructure/CommandHandler.cs b/new-cli/GitVersion.Common/Command/CommandHandler.cs similarity index 92% rename from new-cli/GitVersion.Core/Infrastructure/CommandHandler.cs rename to new-cli/GitVersion.Common/Command/CommandHandler.cs index 6c18ac5b83..d98c3ff01b 100644 --- a/new-cli/GitVersion.Core/Infrastructure/CommandHandler.cs +++ b/new-cli/GitVersion.Common/Command/CommandHandler.cs @@ -2,7 +2,7 @@ using System.Linq; using System.Threading.Tasks; -namespace GitVersion.Infrastructure +namespace GitVersion.Command { public abstract class CommandHandler : ICommandHandler where T : GitVersionOptions { diff --git a/new-cli/GitVersion.Core/Infrastructure/ICommandHandler.cs b/new-cli/GitVersion.Common/Command/ICommandHandler.cs similarity index 86% rename from new-cli/GitVersion.Core/Infrastructure/ICommandHandler.cs rename to new-cli/GitVersion.Common/Command/ICommandHandler.cs index e631164783..5f61ddc456 100644 --- a/new-cli/GitVersion.Core/Infrastructure/ICommandHandler.cs +++ b/new-cli/GitVersion.Common/Command/ICommandHandler.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace GitVersion.Infrastructure +namespace GitVersion.Command { public interface ICommandHandler { diff --git a/new-cli/GitVersion.Core/Infrastructure/IRootCommandHandler.cs b/new-cli/GitVersion.Common/Command/IRootCommandHandler.cs similarity index 65% rename from new-cli/GitVersion.Core/Infrastructure/IRootCommandHandler.cs rename to new-cli/GitVersion.Common/Command/IRootCommandHandler.cs index 877aa238af..847c85c858 100644 --- a/new-cli/GitVersion.Core/Infrastructure/IRootCommandHandler.cs +++ b/new-cli/GitVersion.Common/Command/IRootCommandHandler.cs @@ -1,4 +1,4 @@ -namespace GitVersion.Infrastructure +namespace GitVersion.Command { public interface IRootCommandHandler : ICommandHandler { diff --git a/new-cli/GitVersion.Core/Infrastructure/OptionAttribute.cs b/new-cli/GitVersion.Common/Command/OptionAttribute.cs similarity index 94% rename from new-cli/GitVersion.Core/Infrastructure/OptionAttribute.cs rename to new-cli/GitVersion.Common/Command/OptionAttribute.cs index b6ba691d93..c9a23300e9 100644 --- a/new-cli/GitVersion.Core/Infrastructure/OptionAttribute.cs +++ b/new-cli/GitVersion.Common/Command/OptionAttribute.cs @@ -1,6 +1,6 @@ using System; -namespace GitVersion.Infrastructure +namespace GitVersion.Command { [AttributeUsage(AttributeTargets.Property)] public class OptionAttribute : Attribute diff --git a/new-cli/GitVersion.Core/CoreModule.cs b/new-cli/GitVersion.Common/CoreModule.cs similarity index 100% rename from new-cli/GitVersion.Core/CoreModule.cs rename to new-cli/GitVersion.Common/CoreModule.cs diff --git a/new-cli/GitVersion.Common/GitVersion.Common.csproj b/new-cli/GitVersion.Common/GitVersion.Common.csproj new file mode 100644 index 0000000000..2dc5f3c5ae --- /dev/null +++ b/new-cli/GitVersion.Common/GitVersion.Common.csproj @@ -0,0 +1,8 @@ + + + + netstandard2.0 + GitVersion + + + diff --git a/new-cli/GitVersion.Core/GitVersionOptions.cs b/new-cli/GitVersion.Common/GitVersionOptions.cs similarity index 90% rename from new-cli/GitVersion.Core/GitVersionOptions.cs rename to new-cli/GitVersion.Common/GitVersionOptions.cs index ca76014909..ca2ec64946 100644 --- a/new-cli/GitVersion.Core/GitVersionOptions.cs +++ b/new-cli/GitVersion.Common/GitVersionOptions.cs @@ -1,4 +1,5 @@ using System.IO; +using GitVersion.Command; using GitVersion.Infrastructure; namespace GitVersion diff --git a/new-cli/GitVersion.Core/IService.cs b/new-cli/GitVersion.Common/IService.cs similarity index 100% rename from new-cli/GitVersion.Core/IService.cs rename to new-cli/GitVersion.Common/IService.cs diff --git a/new-cli/GitVersion.Core/Infrastructure/IContainer.cs b/new-cli/GitVersion.Common/Infrastructure/IContainer.cs similarity index 100% rename from new-cli/GitVersion.Core/Infrastructure/IContainer.cs rename to new-cli/GitVersion.Common/Infrastructure/IContainer.cs diff --git a/new-cli/GitVersion.Core/Infrastructure/IContainerRegistrar.cs b/new-cli/GitVersion.Common/Infrastructure/IContainerRegistrar.cs similarity index 100% rename from new-cli/GitVersion.Core/Infrastructure/IContainerRegistrar.cs rename to new-cli/GitVersion.Common/Infrastructure/IContainerRegistrar.cs diff --git a/new-cli/GitVersion.Core/Infrastructure/IGitVersionModule.cs b/new-cli/GitVersion.Common/Infrastructure/IGitVersionModule.cs similarity index 100% rename from new-cli/GitVersion.Core/Infrastructure/IGitVersionModule.cs rename to new-cli/GitVersion.Common/Infrastructure/IGitVersionModule.cs diff --git a/new-cli/GitVersion.Core/Infrastructure/ILogger.cs b/new-cli/GitVersion.Common/Infrastructure/ILogger.cs similarity index 100% rename from new-cli/GitVersion.Core/Infrastructure/ILogger.cs rename to new-cli/GitVersion.Common/Infrastructure/ILogger.cs diff --git a/new-cli/GitVersion.Core/Service.cs b/new-cli/GitVersion.Common/Service.cs similarity index 100% rename from new-cli/GitVersion.Core/Service.cs rename to new-cli/GitVersion.Common/Service.cs diff --git a/new-cli/GitVersion.Configuration/ConfigCommandHandler.cs b/new-cli/GitVersion.Configuration/ConfigCommandHandler.cs index 5fb74f51a8..b288d06853 100644 --- a/new-cli/GitVersion.Configuration/ConfigCommandHandler.cs +++ b/new-cli/GitVersion.Configuration/ConfigCommandHandler.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using GitVersion.Command; using GitVersion.Infrastructure; namespace GitVersion.Configuration diff --git a/new-cli/GitVersion.Configuration/ConfigModule.cs b/new-cli/GitVersion.Configuration/ConfigModule.cs index 7a6543477d..f21dfee1b6 100644 --- a/new-cli/GitVersion.Configuration/ConfigModule.cs +++ b/new-cli/GitVersion.Configuration/ConfigModule.cs @@ -1,4 +1,5 @@ -using GitVersion.Configuration.Init; +using GitVersion.Command; +using GitVersion.Configuration.Init; using GitVersion.Configuration.Show; using GitVersion.Infrastructure; diff --git a/new-cli/GitVersion.Configuration/ConfigOptions.cs b/new-cli/GitVersion.Configuration/ConfigOptions.cs index 98917edd15..d01be44476 100644 --- a/new-cli/GitVersion.Configuration/ConfigOptions.cs +++ b/new-cli/GitVersion.Configuration/ConfigOptions.cs @@ -1,4 +1,5 @@ using System.IO; +using GitVersion.Command; using GitVersion.Infrastructure; namespace GitVersion.Configuration diff --git a/new-cli/GitVersion.Configuration/GitVersion.Configuration.csproj b/new-cli/GitVersion.Configuration/GitVersion.Configuration.csproj index 243f71f090..36d6c78e3d 100644 --- a/new-cli/GitVersion.Configuration/GitVersion.Configuration.csproj +++ b/new-cli/GitVersion.Configuration/GitVersion.Configuration.csproj @@ -2,10 +2,11 @@ netstandard2.0 + GitVersion.Configuration - + diff --git a/new-cli/GitVersion.Configuration/IConfigCommandHandler.cs b/new-cli/GitVersion.Configuration/IConfigCommandHandler.cs index 60c0b22e1a..55155dafa9 100644 --- a/new-cli/GitVersion.Configuration/IConfigCommandHandler.cs +++ b/new-cli/GitVersion.Configuration/IConfigCommandHandler.cs @@ -1,4 +1,5 @@ -using GitVersion.Infrastructure; +using GitVersion.Command; +using GitVersion.Infrastructure; namespace GitVersion.Configuration { diff --git a/new-cli/GitVersion.Configuration/Init/ConfigInitCommandHandler.cs b/new-cli/GitVersion.Configuration/Init/ConfigInitCommandHandler.cs index 32ca1277a5..a6344e41ed 100644 --- a/new-cli/GitVersion.Configuration/Init/ConfigInitCommandHandler.cs +++ b/new-cli/GitVersion.Configuration/Init/ConfigInitCommandHandler.cs @@ -1,4 +1,5 @@ using System.Threading.Tasks; +using GitVersion.Command; using GitVersion.Infrastructure; namespace GitVersion.Configuration.Init diff --git a/new-cli/GitVersion.Configuration/Init/ConfigInitOptions.cs b/new-cli/GitVersion.Configuration/Init/ConfigInitOptions.cs index 6c1665b0bc..05bb84c2d5 100644 --- a/new-cli/GitVersion.Configuration/Init/ConfigInitOptions.cs +++ b/new-cli/GitVersion.Configuration/Init/ConfigInitOptions.cs @@ -1,4 +1,5 @@ -using GitVersion.Infrastructure; +using GitVersion.Command; +using GitVersion.Infrastructure; namespace GitVersion.Configuration.Init { diff --git a/new-cli/GitVersion.Configuration/Show/ConfigInitCommandHandler.cs b/new-cli/GitVersion.Configuration/Show/ConfigInitCommandHandler.cs index f456856844..106ce394f9 100644 --- a/new-cli/GitVersion.Configuration/Show/ConfigInitCommandHandler.cs +++ b/new-cli/GitVersion.Configuration/Show/ConfigInitCommandHandler.cs @@ -1,4 +1,5 @@ using System.Threading.Tasks; +using GitVersion.Command; using GitVersion.Infrastructure; namespace GitVersion.Configuration.Show diff --git a/new-cli/GitVersion.Configuration/Show/ConfigShowOptions.cs b/new-cli/GitVersion.Configuration/Show/ConfigShowOptions.cs index 7c6c831b2f..6bfc2a7781 100644 --- a/new-cli/GitVersion.Configuration/Show/ConfigShowOptions.cs +++ b/new-cli/GitVersion.Configuration/Show/ConfigShowOptions.cs @@ -1,4 +1,5 @@ -using GitVersion.Infrastructure; +using GitVersion.Command; +using GitVersion.Infrastructure; namespace GitVersion.Configuration.Show { diff --git a/new-cli/GitVersion.Core/GitVersion.Core.csproj b/new-cli/GitVersion.Core/GitVersion.Core.csproj index 9bed88aeae..4220ed9d3d 100644 --- a/new-cli/GitVersion.Core/GitVersion.Core.csproj +++ b/new-cli/GitVersion.Core/GitVersion.Core.csproj @@ -1,8 +1,7 @@ - + netstandard2.0 - 8 GitVersion diff --git a/new-cli/GitVersion.Normalization/GitVersion.Normalization.csproj b/new-cli/GitVersion.Normalization/GitVersion.Normalization.csproj index 243f71f090..586d02d185 100644 --- a/new-cli/GitVersion.Normalization/GitVersion.Normalization.csproj +++ b/new-cli/GitVersion.Normalization/GitVersion.Normalization.csproj @@ -2,10 +2,11 @@ netstandard2.0 + GitVersion.Normalization - + diff --git a/new-cli/GitVersion.Normalization/NormalizeCommandHandler.cs b/new-cli/GitVersion.Normalization/NormalizeCommandHandler.cs index 1a463a5825..59fddaff2c 100644 --- a/new-cli/GitVersion.Normalization/NormalizeCommandHandler.cs +++ b/new-cli/GitVersion.Normalization/NormalizeCommandHandler.cs @@ -1,4 +1,5 @@ using System.Threading.Tasks; +using GitVersion.Command; using GitVersion.Infrastructure; namespace GitVersion.Normalization diff --git a/new-cli/GitVersion.Normalization/NormalizeModule.cs b/new-cli/GitVersion.Normalization/NormalizeModule.cs index 7e46f0c344..dc9a88a0c0 100644 --- a/new-cli/GitVersion.Normalization/NormalizeModule.cs +++ b/new-cli/GitVersion.Normalization/NormalizeModule.cs @@ -1,4 +1,5 @@ -using GitVersion.Infrastructure; +using GitVersion.Command; +using GitVersion.Infrastructure; namespace GitVersion.Normalization { diff --git a/new-cli/GitVersion.Normalization/NormalizeOptions.cs b/new-cli/GitVersion.Normalization/NormalizeOptions.cs index d7e12c05bc..ea19ee209e 100644 --- a/new-cli/GitVersion.Normalization/NormalizeOptions.cs +++ b/new-cli/GitVersion.Normalization/NormalizeOptions.cs @@ -1,4 +1,5 @@ using System.IO; +using GitVersion.Command; using GitVersion.Infrastructure; namespace GitVersion.Normalization diff --git a/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs b/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs index c54c05fea1..b254df5502 100644 --- a/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs +++ b/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoCommandHandler.cs @@ -1,4 +1,5 @@ using System.Threading.Tasks; +using GitVersion.Command; using GitVersion.Infrastructure; namespace GitVersion.Output.AssemblyInfo diff --git a/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoOptions.cs b/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoOptions.cs index 37a6caea35..532131814a 100644 --- a/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoOptions.cs +++ b/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoOptions.cs @@ -1,4 +1,5 @@ -using GitVersion.Infrastructure; +using GitVersion.Command; +using GitVersion.Infrastructure; namespace GitVersion.Output.AssemblyInfo { diff --git a/new-cli/GitVersion.Output/GitVersion.Output.csproj b/new-cli/GitVersion.Output/GitVersion.Output.csproj index c7da650a0a..6c6231ec54 100644 --- a/new-cli/GitVersion.Output/GitVersion.Output.csproj +++ b/new-cli/GitVersion.Output/GitVersion.Output.csproj @@ -6,7 +6,7 @@ - + diff --git a/new-cli/GitVersion.Output/IOutputCommandHandler.cs b/new-cli/GitVersion.Output/IOutputCommandHandler.cs index 0e9c40b44d..3ea88be930 100644 --- a/new-cli/GitVersion.Output/IOutputCommandHandler.cs +++ b/new-cli/GitVersion.Output/IOutputCommandHandler.cs @@ -1,4 +1,5 @@ -using GitVersion.Infrastructure; +using GitVersion.Command; +using GitVersion.Infrastructure; namespace GitVersion.Output { diff --git a/new-cli/GitVersion.Output/OutputCommandHandler.cs b/new-cli/GitVersion.Output/OutputCommandHandler.cs index ae278408f9..35b9c67795 100644 --- a/new-cli/GitVersion.Output/OutputCommandHandler.cs +++ b/new-cli/GitVersion.Output/OutputCommandHandler.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using GitVersion.Command; using GitVersion.Infrastructure; namespace GitVersion.Output diff --git a/new-cli/GitVersion.Output/OutputModule.cs b/new-cli/GitVersion.Output/OutputModule.cs index 85a5b99297..78b9572d1b 100644 --- a/new-cli/GitVersion.Output/OutputModule.cs +++ b/new-cli/GitVersion.Output/OutputModule.cs @@ -1,4 +1,5 @@ -using GitVersion.Infrastructure; +using GitVersion.Command; +using GitVersion.Infrastructure; using GitVersion.Output.AssemblyInfo; using GitVersion.Output.Project; using GitVersion.Output.Wix; diff --git a/new-cli/GitVersion.Output/OutputOptions.cs b/new-cli/GitVersion.Output/OutputOptions.cs index fc8101f6e8..0c7820feda 100644 --- a/new-cli/GitVersion.Output/OutputOptions.cs +++ b/new-cli/GitVersion.Output/OutputOptions.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using GitVersion.Command; using GitVersion.Infrastructure; namespace GitVersion.Output diff --git a/new-cli/GitVersion.Output/Project/OutputProjectCommandHandler.cs b/new-cli/GitVersion.Output/Project/OutputProjectCommandHandler.cs index 24b5fe3e1f..a83b7f62ff 100644 --- a/new-cli/GitVersion.Output/Project/OutputProjectCommandHandler.cs +++ b/new-cli/GitVersion.Output/Project/OutputProjectCommandHandler.cs @@ -1,4 +1,5 @@ using System.Threading.Tasks; +using GitVersion.Command; using GitVersion.Infrastructure; namespace GitVersion.Output.Project diff --git a/new-cli/GitVersion.Output/Project/OutputProjectOptions.cs b/new-cli/GitVersion.Output/Project/OutputProjectOptions.cs index 5ad70b12f3..aff6f462e2 100644 --- a/new-cli/GitVersion.Output/Project/OutputProjectOptions.cs +++ b/new-cli/GitVersion.Output/Project/OutputProjectOptions.cs @@ -1,4 +1,5 @@ -using GitVersion.Infrastructure; +using GitVersion.Command; +using GitVersion.Infrastructure; namespace GitVersion.Output.Project { diff --git a/new-cli/GitVersion.Output/Wix/OutputWixCommandHandler.cs b/new-cli/GitVersion.Output/Wix/OutputWixCommandHandler.cs index b2e59c4f33..6810615c60 100644 --- a/new-cli/GitVersion.Output/Wix/OutputWixCommandHandler.cs +++ b/new-cli/GitVersion.Output/Wix/OutputWixCommandHandler.cs @@ -1,4 +1,5 @@ using System.Threading.Tasks; +using GitVersion.Command; using GitVersion.Infrastructure; namespace GitVersion.Output.Wix diff --git a/new-cli/GitVersion.Output/Wix/OutputWixOptions.cs b/new-cli/GitVersion.Output/Wix/OutputWixOptions.cs index d786d1ad1a..cfcb624493 100644 --- a/new-cli/GitVersion.Output/Wix/OutputWixOptions.cs +++ b/new-cli/GitVersion.Output/Wix/OutputWixOptions.cs @@ -1,4 +1,5 @@ -using GitVersion.Infrastructure; +using GitVersion.Command; +using GitVersion.Infrastructure; namespace GitVersion.Output.Wix { diff --git a/new-cli/GitVersion.sln b/new-cli/GitVersion.sln index 0a5b486762..8092a3968e 100644 --- a/new-cli/GitVersion.sln +++ b/new-cli/GitVersion.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Cli", "GitVersion.Cli\GitVersion.Cli.csproj", "{E2520F2D-A6FF-4079-85A4-584AA0CC8594}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Core", "GitVersion.Core\GitVersion.Core.csproj", "{02332393-1F38-4819-8D6F-3D1968B38919}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Common", "GitVersion.Common\GitVersion.Common.csproj", "{02332393-1F38-4819-8D6F-3D1968B38919}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Calculation", "GitVersion.Calculation\GitVersion.Calculation.csproj", "{8F6D4830-B870-4365-9662-457F1A13894B}" EndProject @@ -11,6 +11,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitVersion", "GitVersion", "{610883EF-A96B-4A86-8A3F-1F1601FFDC7D}" ProjectSection(SolutionItems) = preProject command.md = command.md + Directory.Build.props = Directory.Build.props EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Normalization", "GitVersion.Normalization\GitVersion.Normalization.csproj", "{45776CC1-7FDA-4299-86A7-9F11E7855CE4}" @@ -19,6 +20,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Configuration", EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{511CE16D-A65E-48F4-9A95-BB521A9048AF}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Core", "GitVersion.Core\GitVersion.Core.csproj", "{2167C815-3A7E-4758-9F45-03EFE1E8EB1F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -49,6 +52,10 @@ Global {2127F18A-F52B-4024-A0FD-B4D9F75FD85F}.Debug|Any CPU.Build.0 = Debug|Any CPU {2127F18A-F52B-4024-A0FD-B4D9F75FD85F}.Release|Any CPU.ActiveCfg = Release|Any CPU {2127F18A-F52B-4024-A0FD-B4D9F75FD85F}.Release|Any CPU.Build.0 = Release|Any CPU + {2167C815-3A7E-4758-9F45-03EFE1E8EB1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2167C815-3A7E-4758-9F45-03EFE1E8EB1F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2167C815-3A7E-4758-9F45-03EFE1E8EB1F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2167C815-3A7E-4758-9F45-03EFE1E8EB1F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {8F6D4830-B870-4365-9662-457F1A13894B} = {511CE16D-A65E-48F4-9A95-BB521A9048AF} From 1900f4fc1789ff8a5e9ad9f7258812f4fe2b13d5 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Tue, 11 Aug 2020 12:45:17 +0300 Subject: [PATCH 0033/1120] (new-cli) - added GitVersion.Common.Command project that will contain the common Command specific code --- .../GitVersion.Calculation.csproj | 2 +- .../CommandAttribute.cs | 0 .../CommandHandler.cs | 0 .../GitVersion.Common.Command.csproj | 12 ++++++++++++ .../GitVersionOptions.cs | 4 +--- .../ICommandHandler.cs | 0 .../IRootCommandHandler.cs | 0 .../OptionAttribute.cs | 0 .../GitVersion.Configuration.csproj | 2 +- .../GitVersion.Normalization.csproj | 2 +- new-cli/GitVersion.Output/GitVersion.Output.csproj | 2 +- new-cli/GitVersion.sln | 6 ++++++ 12 files changed, 23 insertions(+), 7 deletions(-) rename new-cli/{GitVersion.Common/Command => GitVersion.Common.Command}/CommandAttribute.cs (100%) rename new-cli/{GitVersion.Common/Command => GitVersion.Common.Command}/CommandHandler.cs (100%) create mode 100644 new-cli/GitVersion.Common.Command/GitVersion.Common.Command.csproj rename new-cli/{GitVersion.Common => GitVersion.Common.Command}/GitVersionOptions.cs (69%) rename new-cli/{GitVersion.Common/Command => GitVersion.Common.Command}/ICommandHandler.cs (100%) rename new-cli/{GitVersion.Common/Command => GitVersion.Common.Command}/IRootCommandHandler.cs (100%) rename new-cli/{GitVersion.Common/Command => GitVersion.Common.Command}/OptionAttribute.cs (100%) diff --git a/new-cli/GitVersion.Calculation/GitVersion.Calculation.csproj b/new-cli/GitVersion.Calculation/GitVersion.Calculation.csproj index 05da03885e..b38ef83fce 100644 --- a/new-cli/GitVersion.Calculation/GitVersion.Calculation.csproj +++ b/new-cli/GitVersion.Calculation/GitVersion.Calculation.csproj @@ -6,7 +6,7 @@ - + diff --git a/new-cli/GitVersion.Common/Command/CommandAttribute.cs b/new-cli/GitVersion.Common.Command/CommandAttribute.cs similarity index 100% rename from new-cli/GitVersion.Common/Command/CommandAttribute.cs rename to new-cli/GitVersion.Common.Command/CommandAttribute.cs diff --git a/new-cli/GitVersion.Common/Command/CommandHandler.cs b/new-cli/GitVersion.Common.Command/CommandHandler.cs similarity index 100% rename from new-cli/GitVersion.Common/Command/CommandHandler.cs rename to new-cli/GitVersion.Common.Command/CommandHandler.cs diff --git a/new-cli/GitVersion.Common.Command/GitVersion.Common.Command.csproj b/new-cli/GitVersion.Common.Command/GitVersion.Common.Command.csproj new file mode 100644 index 0000000000..fc199272aa --- /dev/null +++ b/new-cli/GitVersion.Common.Command/GitVersion.Common.Command.csproj @@ -0,0 +1,12 @@ + + + + netstandard2.0 + GitVersion.Command + + + + + + + diff --git a/new-cli/GitVersion.Common/GitVersionOptions.cs b/new-cli/GitVersion.Common.Command/GitVersionOptions.cs similarity index 69% rename from new-cli/GitVersion.Common/GitVersionOptions.cs rename to new-cli/GitVersion.Common.Command/GitVersionOptions.cs index ca2ec64946..dadc4be350 100644 --- a/new-cli/GitVersion.Common/GitVersionOptions.cs +++ b/new-cli/GitVersion.Common.Command/GitVersionOptions.cs @@ -1,8 +1,6 @@ using System.IO; -using GitVersion.Command; -using GitVersion.Infrastructure; -namespace GitVersion +namespace GitVersion.Command { public class GitVersionOptions { diff --git a/new-cli/GitVersion.Common/Command/ICommandHandler.cs b/new-cli/GitVersion.Common.Command/ICommandHandler.cs similarity index 100% rename from new-cli/GitVersion.Common/Command/ICommandHandler.cs rename to new-cli/GitVersion.Common.Command/ICommandHandler.cs diff --git a/new-cli/GitVersion.Common/Command/IRootCommandHandler.cs b/new-cli/GitVersion.Common.Command/IRootCommandHandler.cs similarity index 100% rename from new-cli/GitVersion.Common/Command/IRootCommandHandler.cs rename to new-cli/GitVersion.Common.Command/IRootCommandHandler.cs diff --git a/new-cli/GitVersion.Common/Command/OptionAttribute.cs b/new-cli/GitVersion.Common.Command/OptionAttribute.cs similarity index 100% rename from new-cli/GitVersion.Common/Command/OptionAttribute.cs rename to new-cli/GitVersion.Common.Command/OptionAttribute.cs diff --git a/new-cli/GitVersion.Configuration/GitVersion.Configuration.csproj b/new-cli/GitVersion.Configuration/GitVersion.Configuration.csproj index 36d6c78e3d..d0fe58f4ed 100644 --- a/new-cli/GitVersion.Configuration/GitVersion.Configuration.csproj +++ b/new-cli/GitVersion.Configuration/GitVersion.Configuration.csproj @@ -6,7 +6,7 @@ - + diff --git a/new-cli/GitVersion.Normalization/GitVersion.Normalization.csproj b/new-cli/GitVersion.Normalization/GitVersion.Normalization.csproj index 586d02d185..5e735c7938 100644 --- a/new-cli/GitVersion.Normalization/GitVersion.Normalization.csproj +++ b/new-cli/GitVersion.Normalization/GitVersion.Normalization.csproj @@ -6,7 +6,7 @@ - + diff --git a/new-cli/GitVersion.Output/GitVersion.Output.csproj b/new-cli/GitVersion.Output/GitVersion.Output.csproj index 6c6231ec54..e1173efba5 100644 --- a/new-cli/GitVersion.Output/GitVersion.Output.csproj +++ b/new-cli/GitVersion.Output/GitVersion.Output.csproj @@ -6,7 +6,7 @@ - + diff --git a/new-cli/GitVersion.sln b/new-cli/GitVersion.sln index 8092a3968e..b9957c76fd 100644 --- a/new-cli/GitVersion.sln +++ b/new-cli/GitVersion.sln @@ -22,6 +22,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{511C EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Core", "GitVersion.Core\GitVersion.Core.csproj", "{2167C815-3A7E-4758-9F45-03EFE1E8EB1F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitVersion.Common.Command", "GitVersion.Common.Command\GitVersion.Common.Command.csproj", "{CB8166C6-2621-4B65-BEB4-4485F27B2368}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -56,6 +58,10 @@ Global {2167C815-3A7E-4758-9F45-03EFE1E8EB1F}.Debug|Any CPU.Build.0 = Debug|Any CPU {2167C815-3A7E-4758-9F45-03EFE1E8EB1F}.Release|Any CPU.ActiveCfg = Release|Any CPU {2167C815-3A7E-4758-9F45-03EFE1E8EB1F}.Release|Any CPU.Build.0 = Release|Any CPU + {CB8166C6-2621-4B65-BEB4-4485F27B2368}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CB8166C6-2621-4B65-BEB4-4485F27B2368}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB8166C6-2621-4B65-BEB4-4485F27B2368}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CB8166C6-2621-4B65-BEB4-4485F27B2368}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {8F6D4830-B870-4365-9662-457F1A13894B} = {511CE16D-A65E-48F4-9A95-BB521A9048AF} From edc8114794f0a14ad01dca6a6d0bafd427a69be7 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Sat, 31 Oct 2020 11:10:48 +0100 Subject: [PATCH 0034/1120] (new-cli) - nuget update --- new-cli/.idea/.idea.GitVersion/.idea/modules.xml | 2 +- .../.idea/.idea.GitVersion/.idea/riderModule.iml | 7 +++++++ new-cli/Directory.Build.props | 2 +- new-cli/GitVersion.Cli/GitVersion.Cli.csproj | 14 +++++++------- new-cli/GitVersion.Cli/GitVersionApp.cs | 7 ++++--- .../GitVersion.Common.Command/OptionAttribute.cs | 10 +++++----- 6 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 new-cli/.idea/.idea.GitVersion/.idea/riderModule.iml diff --git a/new-cli/.idea/.idea.GitVersion/.idea/modules.xml b/new-cli/.idea/.idea.GitVersion/.idea/modules.xml index 9aad694954..a5cd674e7d 100644 --- a/new-cli/.idea/.idea.GitVersion/.idea/modules.xml +++ b/new-cli/.idea/.idea.GitVersion/.idea/modules.xml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/.idea/riderModule.iml b/new-cli/.idea/.idea.GitVersion/.idea/riderModule.iml new file mode 100644 index 0000000000..1a4e0d95f0 --- /dev/null +++ b/new-cli/.idea/.idea.GitVersion/.idea/riderModule.iml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/new-cli/Directory.Build.props b/new-cli/Directory.Build.props index b09852f3ca..edd7e6e64a 100644 --- a/new-cli/Directory.Build.props +++ b/new-cli/Directory.Build.props @@ -1,5 +1,5 @@ - 8.0 + 9.0 diff --git a/new-cli/GitVersion.Cli/GitVersion.Cli.csproj b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj index b4008fa905..dd350811ca 100644 --- a/new-cli/GitVersion.Cli/GitVersion.Cli.csproj +++ b/new-cli/GitVersion.Cli/GitVersion.Cli.csproj @@ -7,16 +7,16 @@ - - - + + + - - - - + + + + diff --git a/new-cli/GitVersion.Cli/GitVersionApp.cs b/new-cli/GitVersion.Cli/GitVersionApp.cs index 081b87e476..b5ca4515fa 100644 --- a/new-cli/GitVersion.Cli/GitVersionApp.cs +++ b/new-cli/GitVersion.Cli/GitVersionApp.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.CommandLine; using System.CommandLine.Builder; using System.CommandLine.Invocation; @@ -48,14 +49,14 @@ private static System.CommandLine.Command CreateCommand(ICommandHandler commandH var option = new Option(optionAttribute.Aliases, optionAttribute.Description) { - Required = optionAttribute.Required, + IsRequired = optionAttribute.IsRequired, Argument = new Argument { ArgumentType = propertyInfo.PropertyType } }; command.AddOption(option); } var handlerMethod = handlerType.GetMethod(nameof(commandHandler.InvokeAsync), new [] { commandOptionsType }); - command.Handler = CommandHandler.Create(handlerMethod, commandHandler); + command.Handler = CommandHandler.Create(handlerMethod ?? throw new InvalidOperationException(), commandHandler); foreach (var subCommandHandler in commandHandler.SubCommands()) { diff --git a/new-cli/GitVersion.Common.Command/OptionAttribute.cs b/new-cli/GitVersion.Common.Command/OptionAttribute.cs index c9a23300e9..0b1f91bd19 100644 --- a/new-cli/GitVersion.Common.Command/OptionAttribute.cs +++ b/new-cli/GitVersion.Common.Command/OptionAttribute.cs @@ -7,17 +7,17 @@ public class OptionAttribute : Attribute { public string[] Aliases { get; } public string Description { get; } - public bool Required { get; } + public bool IsRequired { get; } - public OptionAttribute(string alias, string description = "", bool required = false) - : this(new[] { alias }, description, required) + public OptionAttribute(string alias, string description = "", bool isRequired = false) + : this(new[] { alias }, description, isRequired) { } - public OptionAttribute(string[] aliases, string description = "", bool required = false) + public OptionAttribute(string[] aliases, string description = "", bool isRequired = false) { Aliases = aliases; - Required = required; + IsRequired = isRequired; Description = description; } } From 2cd91ea7f9caff6f7259e28bf2cd3df0030c0ec8 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Sat, 31 Oct 2020 11:39:46 +0100 Subject: [PATCH 0035/1120] (new-cli) - Enable nullable for all projects, use records for options --- new-cli/Directory.Build.props | 1 + .../CalculateOptions.cs | 5 ++-- new-cli/GitVersion.Cli/CliModule.cs | 4 ++-- new-cli/GitVersion.Cli/GitVersionApp.cs | 24 ++++++++++++------- .../Infrastructure/Container.cs | 2 +- new-cli/GitVersion.Cli/Program.cs | 3 +-- .../GitVersionOptions.cs | 4 ++-- new-cli/GitVersion.Common/Fix.cs | 17 +++++++++++++ .../ConfigCommandHandler.cs | 1 - .../GitVersion.Configuration/ConfigOptions.cs | 5 ++-- .../IConfigCommandHandler.cs | 1 - .../Init/ConfigInitOptions.cs | 3 +-- .../Show/ConfigShowOptions.cs | 3 +-- .../NormalizeOptions.cs | 5 ++-- .../AssemblyInfo/OutputAssemblyInfoOptions.cs | 5 ++-- .../IOutputCommandHandler.cs | 1 - .../GitVersion.Output/OutputCommandHandler.cs | 1 - new-cli/GitVersion.Output/OutputOptions.cs | 9 ++++--- .../Project/OutputProjectOptions.cs | 5 ++-- .../GitVersion.Output/Wix/OutputWixOptions.cs | 5 ++-- 20 files changed, 57 insertions(+), 47 deletions(-) create mode 100644 new-cli/GitVersion.Common/Fix.cs diff --git a/new-cli/Directory.Build.props b/new-cli/Directory.Build.props index edd7e6e64a..7d6f3f4485 100644 --- a/new-cli/Directory.Build.props +++ b/new-cli/Directory.Build.props @@ -1,5 +1,6 @@ 9.0 + enable diff --git a/new-cli/GitVersion.Calculation/CalculateOptions.cs b/new-cli/GitVersion.Calculation/CalculateOptions.cs index cd82feba6c..6597d290e9 100644 --- a/new-cli/GitVersion.Calculation/CalculateOptions.cs +++ b/new-cli/GitVersion.Calculation/CalculateOptions.cs @@ -1,13 +1,12 @@ using System.IO; using GitVersion.Command; -using GitVersion.Infrastructure; namespace GitVersion.Calculation { [Command("calculate", "Calculates the version object from the git history.")] - public class CalculateOptions : GitVersionOptions + public record CalculateOptions : GitVersionOptions { [Option("--work-dir", "The working directory with the git repository")] - public DirectoryInfo WorkDir { get; set; } + public DirectoryInfo WorkDir { get; init; } = default!; } } \ No newline at end of file diff --git a/new-cli/GitVersion.Cli/CliModule.cs b/new-cli/GitVersion.Cli/CliModule.cs index b4ab668bcd..a1953d59c8 100644 --- a/new-cli/GitVersion.Cli/CliModule.cs +++ b/new-cli/GitVersion.Cli/CliModule.cs @@ -11,8 +11,8 @@ public class CliModule : IGitVersionModule public void RegisterTypes(IContainerRegistrar services) { services.AddConsoleLogging(); - services.AddSingleton(provider => new Logger(provider.GetService>())); - + services.AddSingleton(provider => new Logger(provider.GetService>()!)); + services.AddSingleton(); } } diff --git a/new-cli/GitVersion.Cli/GitVersionApp.cs b/new-cli/GitVersion.Cli/GitVersionApp.cs index b5ca4515fa..961cb70066 100644 --- a/new-cli/GitVersion.Cli/GitVersionApp.cs +++ b/new-cli/GitVersion.Cli/GitVersionApp.cs @@ -18,7 +18,7 @@ public GitVersionApp(IEnumerable commandHandlers) foreach (var commandHandler in commandHandlers) { var command = CreateCommand(commandHandler); - AddCommand(command); + if (command != null) AddCommand(command); } } @@ -30,15 +30,19 @@ public Task RunAsync(string[] args) .InvokeAsync(args); } - private static System.CommandLine.Command CreateCommand(ICommandHandler commandHandler) + private static System.CommandLine.Command? CreateCommand(ICommandHandler commandHandler) { const BindingFlags declaredOnly = BindingFlags.Public | BindingFlags.Instance; var handlerType = commandHandler.GetType(); - var commandOptionsType = handlerType.BaseType?.GenericTypeArguments[0]; - var commandAttribute = commandOptionsType?.GetCustomAttribute(); + if (handlerType.BaseType is null) + return null; - if (commandAttribute == null) return null; + var commandOptionsType = handlerType.BaseType.GenericTypeArguments[0]; + var commandAttribute = commandOptionsType.GetCustomAttribute(); + + if (commandAttribute == null) + return null; var command = new System.CommandLine.Command(commandAttribute.Name, commandAttribute.Description); var propertyInfos = commandOptionsType.GetProperties(declaredOnly); @@ -54,14 +58,16 @@ private static System.CommandLine.Command CreateCommand(ICommandHandler commandH }; command.AddOption(option); } - - var handlerMethod = handlerType.GetMethod(nameof(commandHandler.InvokeAsync), new [] { commandOptionsType }); - command.Handler = CommandHandler.Create(handlerMethod ?? throw new InvalidOperationException(), commandHandler); + + var handlerMethod = + handlerType.GetMethod(nameof(commandHandler.InvokeAsync), new[] { commandOptionsType }); + command.Handler = CommandHandler.Create(handlerMethod ?? throw new InvalidOperationException(), + commandHandler); foreach (var subCommandHandler in commandHandler.SubCommands()) { var subCommand = CreateCommand(subCommandHandler); - command.AddCommand(subCommand); + if (subCommand != null) command.AddCommand(subCommand); } return command; diff --git a/new-cli/GitVersion.Cli/Infrastructure/Container.cs b/new-cli/GitVersion.Cli/Infrastructure/Container.cs index a199a207a9..32e4db1f3b 100644 --- a/new-cli/GitVersion.Cli/Infrastructure/Container.cs +++ b/new-cli/GitVersion.Cli/Infrastructure/Container.cs @@ -10,7 +10,7 @@ public class Container : IContainer public Container(ServiceProvider serviceProvider) => this.serviceProvider = serviceProvider; - public T GetService() => serviceProvider.GetService(); + public T? GetService() => serviceProvider.GetService(); public object GetService(Type type) => serviceProvider.GetService(type); diff --git a/new-cli/GitVersion.Cli/Program.cs b/new-cli/GitVersion.Cli/Program.cs index 66d6bb798e..8bac581a70 100644 --- a/new-cli/GitVersion.Cli/Program.cs +++ b/new-cli/GitVersion.Cli/Program.cs @@ -28,7 +28,7 @@ private static async Task Main(string[] args) var gitVersionModules = assemblies .SelectMany(a => a.GetTypes().Where(TypeIsGitVersionModule)) - .Select(t => (IGitVersionModule)Activator.CreateInstance(t)) + .Select(t => (IGitVersionModule)Activator.CreateInstance(t)!) .ToList(); using var serviceProvider = new ContainerRegistrar() @@ -50,6 +50,5 @@ private static bool TypeIsGitVersionModule(Type type) !type.IsInterface && !type.IsAbstract; } - } } \ No newline at end of file diff --git a/new-cli/GitVersion.Common.Command/GitVersionOptions.cs b/new-cli/GitVersion.Common.Command/GitVersionOptions.cs index dadc4be350..348f27473d 100644 --- a/new-cli/GitVersion.Common.Command/GitVersionOptions.cs +++ b/new-cli/GitVersion.Common.Command/GitVersionOptions.cs @@ -2,9 +2,9 @@ namespace GitVersion.Command { - public class GitVersionOptions + public record GitVersionOptions { [Option(new[] { "--log-file", "-l" }, "The log file")] - public FileInfo LogFile { get; set; } + public FileInfo LogFile { get; init; } = default!; // see https://docs.microsoft.com/en-us/ef/core/miscellaneous/nullable-reference-types#non-nullable-properties-and-initialization } } \ No newline at end of file diff --git a/new-cli/GitVersion.Common/Fix.cs b/new-cli/GitVersion.Common/Fix.cs new file mode 100644 index 0000000000..1bde1f73ce --- /dev/null +++ b/new-cli/GitVersion.Common/Fix.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; + +namespace System.Runtime.CompilerServices +{ + /// + /// Reserved to be used by the compiler for tracking metadata. + /// This class should not be used by developers in source code. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public static class IsExternalInit + { + } +} \ No newline at end of file diff --git a/new-cli/GitVersion.Configuration/ConfigCommandHandler.cs b/new-cli/GitVersion.Configuration/ConfigCommandHandler.cs index b288d06853..0d9cf23fd2 100644 --- a/new-cli/GitVersion.Configuration/ConfigCommandHandler.cs +++ b/new-cli/GitVersion.Configuration/ConfigCommandHandler.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using GitVersion.Command; -using GitVersion.Infrastructure; namespace GitVersion.Configuration { diff --git a/new-cli/GitVersion.Configuration/ConfigOptions.cs b/new-cli/GitVersion.Configuration/ConfigOptions.cs index d01be44476..092ca22c78 100644 --- a/new-cli/GitVersion.Configuration/ConfigOptions.cs +++ b/new-cli/GitVersion.Configuration/ConfigOptions.cs @@ -1,13 +1,12 @@ using System.IO; using GitVersion.Command; -using GitVersion.Infrastructure; namespace GitVersion.Configuration { [Command("config", "Manages the GitVersion configuration file.")] - public class ConfigOptions : GitVersionOptions + public record ConfigOptions : GitVersionOptions { [Option("--work-dir", "The working directory with the git repository")] - public DirectoryInfo WorkDir { get; set; } + public DirectoryInfo WorkDir { get; init; } = default!; } } \ No newline at end of file diff --git a/new-cli/GitVersion.Configuration/IConfigCommandHandler.cs b/new-cli/GitVersion.Configuration/IConfigCommandHandler.cs index 55155dafa9..cf08d22681 100644 --- a/new-cli/GitVersion.Configuration/IConfigCommandHandler.cs +++ b/new-cli/GitVersion.Configuration/IConfigCommandHandler.cs @@ -1,5 +1,4 @@ using GitVersion.Command; -using GitVersion.Infrastructure; namespace GitVersion.Configuration { diff --git a/new-cli/GitVersion.Configuration/Init/ConfigInitOptions.cs b/new-cli/GitVersion.Configuration/Init/ConfigInitOptions.cs index 05bb84c2d5..0671c4c82c 100644 --- a/new-cli/GitVersion.Configuration/Init/ConfigInitOptions.cs +++ b/new-cli/GitVersion.Configuration/Init/ConfigInitOptions.cs @@ -1,10 +1,9 @@ using GitVersion.Command; -using GitVersion.Infrastructure; namespace GitVersion.Configuration.Init { [Command("init", "Inits the configuration for current repository.")] - public class ConfigInitOptions : ConfigOptions + public record ConfigInitOptions : ConfigOptions { } } \ No newline at end of file diff --git a/new-cli/GitVersion.Configuration/Show/ConfigShowOptions.cs b/new-cli/GitVersion.Configuration/Show/ConfigShowOptions.cs index 6bfc2a7781..cc7bee837e 100644 --- a/new-cli/GitVersion.Configuration/Show/ConfigShowOptions.cs +++ b/new-cli/GitVersion.Configuration/Show/ConfigShowOptions.cs @@ -1,10 +1,9 @@ using GitVersion.Command; -using GitVersion.Infrastructure; namespace GitVersion.Configuration.Show { [Command("show", "Shows the effective configuration.")] - public class ConfigShowOptions : ConfigOptions + public record ConfigShowOptions : ConfigOptions { } } \ No newline at end of file diff --git a/new-cli/GitVersion.Normalization/NormalizeOptions.cs b/new-cli/GitVersion.Normalization/NormalizeOptions.cs index ea19ee209e..f778e153c2 100644 --- a/new-cli/GitVersion.Normalization/NormalizeOptions.cs +++ b/new-cli/GitVersion.Normalization/NormalizeOptions.cs @@ -1,13 +1,12 @@ using System.IO; using GitVersion.Command; -using GitVersion.Infrastructure; namespace GitVersion.Normalization { [Command("normalize", "Normalizes the git repository for GitVersion calculations.")] - public class NormalizeOptions : GitVersionOptions + public record NormalizeOptions : GitVersionOptions { [Option("--work-dir", "The working directory with the git repository")] - public DirectoryInfo WorkDir { get; set; } + public DirectoryInfo WorkDir { get; init; } = default!; } } \ No newline at end of file diff --git a/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoOptions.cs b/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoOptions.cs index 532131814a..56d768bf70 100644 --- a/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoOptions.cs +++ b/new-cli/GitVersion.Output/AssemblyInfo/OutputAssemblyInfoOptions.cs @@ -1,12 +1,11 @@ using GitVersion.Command; -using GitVersion.Infrastructure; namespace GitVersion.Output.AssemblyInfo { [Command("assemblyinfo", "Outputs version to assembly")] - public class OutputAssemblyInfoOptions : OutputOptions + public record OutputAssemblyInfoOptions : OutputOptions { [Option("--assemblyinfo-file", "The assembly file")] - public string AssemblyinfoFile { get; set; } + public string AssemblyinfoFile { get; init; } = default!; } } \ No newline at end of file diff --git a/new-cli/GitVersion.Output/IOutputCommandHandler.cs b/new-cli/GitVersion.Output/IOutputCommandHandler.cs index 3ea88be930..458f6598e8 100644 --- a/new-cli/GitVersion.Output/IOutputCommandHandler.cs +++ b/new-cli/GitVersion.Output/IOutputCommandHandler.cs @@ -1,5 +1,4 @@ using GitVersion.Command; -using GitVersion.Infrastructure; namespace GitVersion.Output { diff --git a/new-cli/GitVersion.Output/OutputCommandHandler.cs b/new-cli/GitVersion.Output/OutputCommandHandler.cs index 35b9c67795..23ea8eb711 100644 --- a/new-cli/GitVersion.Output/OutputCommandHandler.cs +++ b/new-cli/GitVersion.Output/OutputCommandHandler.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using GitVersion.Command; -using GitVersion.Infrastructure; namespace GitVersion.Output { diff --git a/new-cli/GitVersion.Output/OutputOptions.cs b/new-cli/GitVersion.Output/OutputOptions.cs index 0c7820feda..11fb99c67f 100644 --- a/new-cli/GitVersion.Output/OutputOptions.cs +++ b/new-cli/GitVersion.Output/OutputOptions.cs @@ -1,19 +1,18 @@ using System; using System.IO; using GitVersion.Command; -using GitVersion.Infrastructure; namespace GitVersion.Output { [Command("output", "Outputs the version object.")] - public class OutputOptions : GitVersionOptions + public record OutputOptions : GitVersionOptions { - public Lazy VersionInfo { get; set; } = new Lazy(() => Console.IsInputRedirected ? Console.ReadLine() : null); + public Lazy VersionInfo { get; } = new Lazy(() => Console.IsInputRedirected ? Console.ReadLine() : ""); [Option("--input-file", "The input version file")] - public FileInfo InputFile { get; set; } + public FileInfo InputFile { get; init; } = default!; [Option("--output-dir", "The output directory with the git repository")] - public DirectoryInfo OutputDir { get; set; } + public DirectoryInfo OutputDir { get; init; } = default!; } } \ No newline at end of file diff --git a/new-cli/GitVersion.Output/Project/OutputProjectOptions.cs b/new-cli/GitVersion.Output/Project/OutputProjectOptions.cs index aff6f462e2..d51bef2c16 100644 --- a/new-cli/GitVersion.Output/Project/OutputProjectOptions.cs +++ b/new-cli/GitVersion.Output/Project/OutputProjectOptions.cs @@ -1,12 +1,11 @@ using GitVersion.Command; -using GitVersion.Infrastructure; namespace GitVersion.Output.Project { [Command("project", "Outputs version to project")] - public class OutputProjectOptions : OutputOptions + public record OutputProjectOptions : OutputOptions { [Option("--project-file", "The project file")] - public string ProjectFile { get; set; } + public string ProjectFile { get; init; } = default!; } } \ No newline at end of file diff --git a/new-cli/GitVersion.Output/Wix/OutputWixOptions.cs b/new-cli/GitVersion.Output/Wix/OutputWixOptions.cs index cfcb624493..0112bb11cd 100644 --- a/new-cli/GitVersion.Output/Wix/OutputWixOptions.cs +++ b/new-cli/GitVersion.Output/Wix/OutputWixOptions.cs @@ -1,12 +1,11 @@ using GitVersion.Command; -using GitVersion.Infrastructure; namespace GitVersion.Output.Wix { [Command("wix", "Outputs version to wix file")] - public class OutputWixOptions : OutputOptions + public record OutputWixOptions : OutputOptions { [Option("--wix-file", "The wix file")] - public string WixFile { get; set; } + public string WixFile { get; init; } = default!; } } \ No newline at end of file From c4dff5fcabbd082b77c1eb71ff433e8eab84734e Mon Sep 17 00:00:00 2001 From: Artur Date: Sun, 27 Dec 2020 12:19:54 +0100 Subject: [PATCH 0036/1120] (new-cli) - added to ignore --- new-cli/.gitignore | 30 +++++++++++++++---- new-cli/.idea/.idea.GitVersion/.idea/.name | 1 - .../.idea.GitVersion/.idea/encodings.xml | 4 --- .../.idea.GitVersion/.idea/indexLayout.xml | 8 ----- .../.idea/.idea.GitVersion/.idea/modules.xml | 8 ----- .../.idea/projectSettingsUpdater.xml | 6 ---- .../.idea.GitVersion/.idea/riderModule.iml | 7 ----- new-cli/.idea/.idea.GitVersion/.idea/vcs.xml | 6 ---- 8 files changed, 25 insertions(+), 45 deletions(-) delete mode 100644 new-cli/.idea/.idea.GitVersion/.idea/.name delete mode 100644 new-cli/.idea/.idea.GitVersion/.idea/encodings.xml delete mode 100644 new-cli/.idea/.idea.GitVersion/.idea/indexLayout.xml delete mode 100644 new-cli/.idea/.idea.GitVersion/.idea/modules.xml delete mode 100644 new-cli/.idea/.idea.GitVersion/.idea/projectSettingsUpdater.xml delete mode 100644 new-cli/.idea/.idea.GitVersion/.idea/riderModule.iml delete mode 100644 new-cli/.idea/.idea.GitVersion/.idea/vcs.xml diff --git a/new-cli/.gitignore b/new-cli/.gitignore index cb7133d6c0..57b6f6814f 100644 --- a/new-cli/.gitignore +++ b/new-cli/.gitignore @@ -1,9 +1,29 @@ -[Bb]in +################# +## Visual Studio +################# + +# User-specific files +.vs +*.suo +*.user +*.userprefs +*.sln.docstates +*.pidb +*.received.txt +# Build results +[Dd]ebug/ +[Rr]elease/ +[Bb]in [Oo]bj -.idea/.idea.Cli/.idea/contentModel.xml +################ +# Project Rider +################ -.idea/.idea.Cli/.idea/workspace.xml +.idea +*.sln.iml -.idea/.idea.GitVersion/.idea/workspace.xml +#################### +# Visual Studio Code +#################### -.idea/.idea.GitVersion/.idea/contentModel.xml +.vscode diff --git a/new-cli/.idea/.idea.GitVersion/.idea/.name b/new-cli/.idea/.idea.GitVersion/.idea/.name deleted file mode 100644 index f28b69fd4c..0000000000 --- a/new-cli/.idea/.idea.GitVersion/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -GitVersion \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/.idea/encodings.xml b/new-cli/.idea/.idea.GitVersion/.idea/encodings.xml deleted file mode 100644 index df87cf951f..0000000000 --- a/new-cli/.idea/.idea.GitVersion/.idea/encodings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/.idea/indexLayout.xml b/new-cli/.idea/.idea.GitVersion/.idea/indexLayout.xml deleted file mode 100644 index 27ba142e96..0000000000 --- a/new-cli/.idea/.idea.GitVersion/.idea/indexLayout.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/.idea/modules.xml b/new-cli/.idea/.idea.GitVersion/.idea/modules.xml deleted file mode 100644 index a5cd674e7d..0000000000 --- a/new-cli/.idea/.idea.GitVersion/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/.idea/projectSettingsUpdater.xml b/new-cli/.idea/.idea.GitVersion/.idea/projectSettingsUpdater.xml deleted file mode 100644 index 4bb9f4d2a0..0000000000 --- a/new-cli/.idea/.idea.GitVersion/.idea/projectSettingsUpdater.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/.idea/riderModule.iml b/new-cli/.idea/.idea.GitVersion/.idea/riderModule.iml deleted file mode 100644 index 1a4e0d95f0..0000000000 --- a/new-cli/.idea/.idea.GitVersion/.idea/riderModule.iml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/.idea/vcs.xml b/new-cli/.idea/.idea.GitVersion/.idea/vcs.xml deleted file mode 100644 index 94a25f7f4c..0000000000 --- a/new-cli/.idea/.idea.GitVersion/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From 1dc936581d3024e3ca006d26263e4df747d349ba Mon Sep 17 00:00:00 2001 From: Artur Date: Tue, 29 Dec 2020 12:43:00 +0100 Subject: [PATCH 0037/1120] (new-cli) - moving work-dir argument to base GitVersionOptions --- new-cli/GitVersion.Calculation/CalculateOptions.cs | 2 -- new-cli/GitVersion.Common.Command/GitVersionOptions.cs | 5 ++++- new-cli/GitVersion.Configuration/ConfigOptions.cs | 2 -- new-cli/GitVersion.Normalization/NormalizeOptions.cs | 2 -- new-cli/command.md | 7 +++++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/new-cli/GitVersion.Calculation/CalculateOptions.cs b/new-cli/GitVersion.Calculation/CalculateOptions.cs index 6597d290e9..18a903e4ec 100644 --- a/new-cli/GitVersion.Calculation/CalculateOptions.cs +++ b/new-cli/GitVersion.Calculation/CalculateOptions.cs @@ -6,7 +6,5 @@ namespace GitVersion.Calculation [Command("calculate", "Calculates the version object from the git history.")] public record CalculateOptions : GitVersionOptions { - [Option("--work-dir", "The working directory with the git repository")] - public DirectoryInfo WorkDir { get; init; } = default!; } } \ No newline at end of file diff --git a/new-cli/GitVersion.Common.Command/GitVersionOptions.cs b/new-cli/GitVersion.Common.Command/GitVersionOptions.cs index 348f27473d..79fecc54a2 100644 --- a/new-cli/GitVersion.Common.Command/GitVersionOptions.cs +++ b/new-cli/GitVersion.Common.Command/GitVersionOptions.cs @@ -5,6 +5,9 @@ namespace GitVersion.Command public record GitVersionOptions { [Option(new[] { "--log-file", "-l" }, "The log file")] - public FileInfo LogFile { get; init; } = default!; // see https://docs.microsoft.com/en-us/ef/core/miscellaneous/nullable-reference-types#non-nullable-properties-and-initialization + public FileInfo? LogFile { get; init; } = default; + + [Option("--work-dir", "The working directory with the git repository")] + public DirectoryInfo WorkDir { get; init; } = new DirectoryInfo(System.Environment.CurrentDirectory); } } \ No newline at end of file diff --git a/new-cli/GitVersion.Configuration/ConfigOptions.cs b/new-cli/GitVersion.Configuration/ConfigOptions.cs index 092ca22c78..94d98f23e3 100644 --- a/new-cli/GitVersion.Configuration/ConfigOptions.cs +++ b/new-cli/GitVersion.Configuration/ConfigOptions.cs @@ -6,7 +6,5 @@ namespace GitVersion.Configuration [Command("config", "Manages the GitVersion configuration file.")] public record ConfigOptions : GitVersionOptions { - [Option("--work-dir", "The working directory with the git repository")] - public DirectoryInfo WorkDir { get; init; } = default!; } } \ No newline at end of file diff --git a/new-cli/GitVersion.Normalization/NormalizeOptions.cs b/new-cli/GitVersion.Normalization/NormalizeOptions.cs index f778e153c2..10e9737ed1 100644 --- a/new-cli/GitVersion.Normalization/NormalizeOptions.cs +++ b/new-cli/GitVersion.Normalization/NormalizeOptions.cs @@ -6,7 +6,5 @@ namespace GitVersion.Normalization [Command("normalize", "Normalizes the git repository for GitVersion calculations.")] public record NormalizeOptions : GitVersionOptions { - [Option("--work-dir", "The working directory with the git repository")] - public DirectoryInfo WorkDir { get; init; } = default!; } } \ No newline at end of file diff --git a/new-cli/command.md b/new-cli/command.md index 95278d70fc..c137381b07 100644 --- a/new-cli/command.md +++ b/new-cli/command.md @@ -9,7 +9,7 @@ gitversion --help gitversion normalize # Normalize the repository inside `./project/` to its required state: -gitversion normalize --repository ./project/ +gitversion normalize --work-dir ./project/ # Initialize GitVersion.yml gitversion config init @@ -59,8 +59,11 @@ cat gitversion.json | gitversion output wix --path ./**/*.wxi # Read version variables from stdin and output them to environment variables cat gitversion.json | gitversion output environment +# Read version variables from stdin and output them to environment variables +cat gitversion.json | gitversion output environment --property FullSemVer + # Read version variables from stdin and output only the `FullSemVer` property to stdout. -cat gitversion.json | gitversion output FullSemVer +cat gitversion.json | gitversion output --property FullSemVer # Pipe the output of calculate to gitversion output gitversion calculate | gitversion output assemblyinfo --path ./**/AssemblyInfo.cs From 69bdb19113642a6a1526f450006babb4b0dc6d2b Mon Sep 17 00:00:00 2001 From: Artur Date: Tue, 29 Dec 2020 19:01:32 +0100 Subject: [PATCH 0038/1120] (new-cli) - update Rider configurations --- .../.idea/runConfigurations/Calculate.xml | 10 +++++----- .../.idea/runConfigurations/Config_Help.xml | 8 ++++---- .../.idea/runConfigurations/Config_Init.xml | 10 +++++----- .../.idea/runConfigurations/Config_Show.xml | 8 ++++---- .../.idea.GitVersion/.idea/runConfigurations/Help.xml | 8 ++++---- .../.idea/runConfigurations/Normalize.xml | 8 ++++---- .../.idea/runConfigurations/Output_AssemblyInfo.xml | 10 +++++----- .../.idea/runConfigurations/Output_Help.xml | 8 ++++---- .../.idea/runConfigurations/Output_Project.xml | 10 +++++----- .../.idea/runConfigurations/Output_Wix.xml | 10 +++++----- .../.idea/runConfigurations/Version.xml | 8 ++++---- 11 files changed, 49 insertions(+), 49 deletions(-) diff --git a/new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Calculate.xml b/new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Calculate.xml index 907f7a59f5..aaded953f3 100644 --- a/new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Calculate.xml +++ b/new-cli/.idea/.idea.GitVersion/.idea/runConfigurations/Calculate.xml @@ -1,8 +1,8 @@ - + -