diff --git a/src/GitVersion.App.Tests/ArgumentParserTests.cs b/src/GitVersion.App.Tests/ArgumentParserTests.cs index 0655a1dec3..fed0715a6a 100644 --- a/src/GitVersion.App.Tests/ArgumentParserTests.cs +++ b/src/GitVersion.App.Tests/ArgumentParserTests.cs @@ -1,10 +1,9 @@ using GitTools.Testing; +using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Extensions; using GitVersion.Helpers; using GitVersion.Logging; -using GitVersion.Model; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; using Microsoft.Extensions.DependencyInjection; using NUnit.Framework; @@ -410,7 +409,7 @@ private static IEnumerable OverrideconfigWithInvalidOptionTestData } [TestCaseSource(nameof(OverrideConfigWithSingleOptionTestData))] - public void OverrideConfigWithSingleOptions(string options, Config expected) + public void OverrideConfigWithSingleOptions(string options, GitVersionConfiguration expected) { var arguments = this.argumentParser.ParseArguments($"/overrideconfig {options}"); arguments.OverrideConfig.ShouldBeEquivalentTo(expected); @@ -420,126 +419,126 @@ private static IEnumerable OverrideConfigWithSingleOptionTestData( { yield return new TestCaseData( "assembly-versioning-scheme=MajorMinor", - new Config + new GitVersionConfiguration { AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinor } ); yield return new TestCaseData( "assembly-file-versioning-scheme=\"MajorMinorPatch\"", - new Config + new GitVersionConfiguration { AssemblyFileVersioningScheme = AssemblyFileVersioningScheme.MajorMinorPatch } ); yield return new TestCaseData( "assembly-informational-format=\"{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}\"", - new Config + new GitVersionConfiguration { AssemblyInformationalFormat = "{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}" } ); yield return new TestCaseData( "assembly-versioning-format=\"{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}\"", - new Config + new GitVersionConfiguration { AssemblyVersioningFormat = "{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}" } ); yield return new TestCaseData( "assembly-file-versioning-format=\"{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}\"", - new Config + new GitVersionConfiguration { AssemblyFileVersioningFormat = "{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}" } ); yield return new TestCaseData( "mode=ContinuousDelivery", - new Config + new GitVersionConfiguration { VersioningMode = VersioningMode.ContinuousDelivery } ); yield return new TestCaseData( "tag-prefix=sample", - new Config + new GitVersionConfiguration { TagPrefix = "sample" } ); yield return new TestCaseData( "continuous-delivery-fallback-tag=cd-tag", - new Config + new GitVersionConfiguration { ContinuousDeploymentFallbackTag = "cd-tag" } ); yield return new TestCaseData( "next-version=1", - new Config + new GitVersionConfiguration { NextVersion = "1" } ); yield return new TestCaseData( "major-version-bump-message=\"This is major version bump message.\"", - new Config + new GitVersionConfiguration { MajorVersionBumpMessage = "This is major version bump message." } ); yield return new TestCaseData( "minor-version-bump-message=\"This is minor version bump message.\"", - new Config + new GitVersionConfiguration { MinorVersionBumpMessage = "This is minor version bump message." } ); yield return new TestCaseData( "patch-version-bump-message=\"This is patch version bump message.\"", - new Config + new GitVersionConfiguration { PatchVersionBumpMessage = "This is patch version bump message." } ); yield return new TestCaseData( "no-bump-message=\"This is no bump message.\"", - new Config + new GitVersionConfiguration { NoBumpMessage = "This is no bump message." } ); yield return new TestCaseData( "tag-pre-release-weight=2", - new Config + new GitVersionConfiguration { TagPreReleaseWeight = 2 } ); yield return new TestCaseData( "commit-message-incrementing=MergeMessageOnly", - new Config + new GitVersionConfiguration { CommitMessageIncrementing = CommitMessageIncrementMode.MergeMessageOnly } ); yield return new TestCaseData( "increment=Minor", - new Config + new GitVersionConfiguration { Increment = IncrementStrategy.Minor } ); yield return new TestCaseData( "commit-date-format=\"MM/dd/yyyy h:mm tt\"", - new Config + new GitVersionConfiguration { CommitDateFormat = "MM/dd/yyyy h:mm tt" } ); yield return new TestCaseData( "update-build-number=true", - new Config + new GitVersionConfiguration { UpdateBuildNumber = true } @@ -547,7 +546,7 @@ private static IEnumerable OverrideConfigWithSingleOptionTestData( } [TestCaseSource(nameof(OverrideconfigWithMultipleOptionsTestData))] - public void OverrideconfigWithMultipleOptions(string options, Config expected) + public void OverrideconfigWithMultipleOptions(string options, GitVersionConfiguration expected) { var arguments = this.argumentParser.ParseArguments(options); arguments.OverrideConfig.ShouldBeEquivalentTo(expected); @@ -557,7 +556,7 @@ private static IEnumerable OverrideconfigWithMultipleOptionsTestDa { yield return new TestCaseData( "/overrideconfig tag-prefix=sample /overrideconfig assembly-versioning-scheme=MajorMinor", - new Config + new GitVersionConfiguration { TagPrefix = "sample", AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinor @@ -565,7 +564,7 @@ private static IEnumerable OverrideconfigWithMultipleOptionsTestDa ); yield return new TestCaseData( "/overrideconfig tag-prefix=sample /overrideconfig assembly-versioning-format=\"{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}\"", - new Config + new GitVersionConfiguration { TagPrefix = "sample", AssemblyVersioningFormat = "{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}" @@ -573,7 +572,7 @@ private static IEnumerable OverrideconfigWithMultipleOptionsTestDa ); yield return new TestCaseData( "/overrideconfig tag-prefix=sample /overrideconfig assembly-versioning-format=\"{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}\" /overrideconfig update-build-number=true /overrideconfig assembly-versioning-scheme=MajorMinorPatchTag /overrideconfig mode=ContinuousDelivery /overrideconfig tag-pre-release-weight=4", - new Config + new GitVersionConfiguration { TagPrefix = "sample", AssemblyVersioningFormat = "{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}", diff --git a/src/GitVersion.App/ArgumentParser.cs b/src/GitVersion.App/ArgumentParser.cs index 7197c592f0..5d8fe82ed1 100644 --- a/src/GitVersion.App/ArgumentParser.cs +++ b/src/GitVersion.App/ArgumentParser.cs @@ -2,7 +2,6 @@ using GitVersion.Extensions; using GitVersion.Helpers; using GitVersion.Logging; -using GitVersion.Model; using GitVersion.OutputVariables; namespace GitVersion; @@ -420,7 +419,7 @@ private static void ParseOverrideConfig(Arguments arguments, IReadOnlyCollection if (values == null || values.Count == 0) return; - var parser = new OverrideConfigOptionParser(); + var parser = new OverrideConfigurationOptionParser(); // key=value foreach (var keyValueOption in values) @@ -432,7 +431,7 @@ private static void ParseOverrideConfig(Arguments arguments, IReadOnlyCollection } var optionKey = keyAndValue[0].ToLowerInvariant(); - if (!OverrideConfigOptionParser.SupportedProperties.Contains(optionKey)) + if (!OverrideConfigurationOptionParser.SupportedProperties.Contains(optionKey)) { throw new WarningException($"Could not parse /overrideconfig option: {keyValueOption}. Unsupported 'key'."); } diff --git a/src/GitVersion.App/Arguments.cs b/src/GitVersion.App/Arguments.cs index 29ba7baaa7..9c6858ee44 100644 --- a/src/GitVersion.App/Arguments.cs +++ b/src/GitVersion.App/Arguments.cs @@ -1,6 +1,5 @@ +using GitVersion.Configuration; using GitVersion.Logging; -using GitVersion.Model; -using GitVersion.Model.Configuration; namespace GitVersion; @@ -9,7 +8,7 @@ public class Arguments public AuthenticationInfo Authentication = new(); public string? ConfigFile; - public Config? OverrideConfig; + public GitVersionConfiguration? OverrideConfig; public bool ShowConfig; public string? TargetPath; diff --git a/src/GitVersion.App/GitVersionExecutor.cs b/src/GitVersion.App/GitVersionExecutor.cs index eb4df79884..569cdc2a84 100644 --- a/src/GitVersion.App/GitVersionExecutor.cs +++ b/src/GitVersion.App/GitVersionExecutor.cs @@ -1,7 +1,6 @@ using GitVersion.Configuration; using GitVersion.Extensions; using GitVersion.Logging; -using GitVersion.Model; namespace GitVersion; @@ -9,23 +8,23 @@ public class GitVersionExecutor : IGitVersionExecutor { private readonly ILog log; private readonly IConsole console; - private readonly IConfigFileLocator configFileLocator; + private readonly IConfigurationFileLocator configFileLocator; private readonly IHelpWriter helpWriter; private readonly IGitRepositoryInfo repositoryInfo; - private readonly IConfigProvider configProvider; + private readonly IConfigurationProvider configurationProvider; private readonly IGitVersionCalculateTool gitVersionCalculateTool; private readonly IGitVersionOutputTool gitVersionOutputTool; private readonly IVersionWriter versionWriter; public GitVersionExecutor(ILog log, IConsole console, - IConfigFileLocator configFileLocator, IConfigProvider configProvider, + IConfigurationFileLocator configFileLocator, IConfigurationProvider configurationProvider, IGitVersionCalculateTool gitVersionCalculateTool, IGitVersionOutputTool gitVersionOutputTool, IVersionWriter versionWriter, IHelpWriter helpWriter, IGitRepositoryInfo repositoryInfo) { this.log = log.NotNull(); this.console = console.NotNull(); this.configFileLocator = configFileLocator.NotNull(); - this.configProvider = configProvider.NotNull(); + this.configurationProvider = configurationProvider.NotNull(); this.gitVersionCalculateTool = gitVersionCalculateTool.NotNull(); this.gitVersionOutputTool = gitVersionOutputTool.NotNull(); @@ -65,7 +64,7 @@ private int RunGitVersionTool(GitVersionOptions gitVersionOptions) var variables = this.gitVersionCalculateTool.CalculateVersionVariables(); - var configuration = this.configProvider.Provide(gitVersionOptions.ConfigInfo.OverrideConfig); + var configuration = this.configurationProvider.Provide(gitVersionOptions.ConfigInfo.OverrideConfig); this.gitVersionOutputTool.OutputVariables(variables, configuration.UpdateBuildNumber ?? true); this.gitVersionOutputTool.UpdateAssemblyInfo(variables); @@ -148,15 +147,15 @@ private bool HandleNonMainCommand(GitVersionOptions gitVersionOptions, out int e if (gitVersionOptions.Init) { - this.configProvider.Init(workingDirectory); + this.configurationProvider.Init(workingDirectory); exitCode = 0; return true; } if (gitVersionOptions.ConfigInfo.ShowConfig) { - var config = this.configProvider.Provide(workingDirectory); - this.console.WriteLine(config.ToString()); + var configuration = this.configurationProvider.Provide(workingDirectory); + this.console.WriteLine(configuration.ToString()); exitCode = 0; return true; } diff --git a/src/GitVersion.App/OverrideConfigOptionParser.cs b/src/GitVersion.App/OverrideConfigurationOptionParser.cs similarity index 86% rename from src/GitVersion.App/OverrideConfigOptionParser.cs rename to src/GitVersion.App/OverrideConfigurationOptionParser.cs index 4f18f59b03..9af1221f18 100644 --- a/src/GitVersion.App/OverrideConfigOptionParser.cs +++ b/src/GitVersion.App/OverrideConfigurationOptionParser.cs @@ -1,27 +1,27 @@ -using GitVersion.Model.Configuration; +using GitVersion.Configuration; using YamlDotNet.Serialization; namespace GitVersion; -internal class OverrideConfigOptionParser +internal class OverrideConfigurationOptionParser { private static readonly Lazy> _lazySupportedProperties = new(GetSupportedProperties, true); - private readonly Lazy lazyConfig = new(); + private readonly Lazy lazyConfig = new(); internal static ILookup SupportedProperties => _lazySupportedProperties.Value; /// /// Dynamically creates of - /// properties supported as a part of command line '/overrideconfig' option. + /// properties supported as a part of command line '/overrideconfig' option. /// /// /// /// Lookup keys are created from to match 'GitVersion.yml' /// options as close as possible. /// - private static ILookup GetSupportedProperties() => typeof(Config).GetProperties(BindingFlags.Public | BindingFlags.Instance) + private static ILookup GetSupportedProperties() => typeof(GitVersionConfiguration).GetProperties(BindingFlags.Public | BindingFlags.Instance) .Where( pi => IsSupportedPropertyType(pi.PropertyType) && pi.CanWrite @@ -33,7 +33,7 @@ internal class OverrideConfigOptionParser ); /// - /// Checks if property of + /// Checks if property of /// is supported as a part of command line '/overrideconfig' option. /// /// Type we want to check. @@ -97,5 +97,5 @@ internal void SetValue(string key, string value) } } - internal Config? GetConfig() => this.lazyConfig.IsValueCreated ? this.lazyConfig.Value : null; + internal GitVersionConfiguration? GetConfig() => this.lazyConfig.IsValueCreated ? this.lazyConfig.Value : null; } diff --git a/src/GitVersion.App/PublicAPI.Shipped.txt b/src/GitVersion.App/PublicAPI.Shipped.txt index 8c88bf07ad..75afceb36f 100644 --- a/src/GitVersion.App/PublicAPI.Shipped.txt +++ b/src/GitVersion.App/PublicAPI.Shipped.txt @@ -18,9 +18,9 @@ GitVersion.Arguments.LogFilePath -> string? GitVersion.Arguments.NoCache -> bool GitVersion.Arguments.NoFetch -> bool GitVersion.Arguments.NoNormalize -> bool -GitVersion.Arguments.Output -> System.Collections.Generic.ISet! +GitVersion.Arguments.Output -> System.Collections.Generic.ISet! GitVersion.Arguments.OutputFile -> string? -GitVersion.Arguments.OverrideConfig -> GitVersion.Model.Configuration.Config? +GitVersion.Arguments.OverrideConfig -> GitVersion.Configuration.GitVersionConfiguration? GitVersion.Arguments.ShowConfig -> bool GitVersion.Arguments.ShowVariable -> string? GitVersion.Arguments.TargetBranch -> string? @@ -37,7 +37,7 @@ GitVersion.GitVersionAppModule.GitVersionAppModule() -> void GitVersion.GitVersionAppModule.RegisterTypes(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void GitVersion.GitVersionExecutor GitVersion.GitVersionExecutor.Execute(GitVersion.GitVersionOptions! gitVersionOptions) -> int -GitVersion.GitVersionExecutor.GitVersionExecutor(GitVersion.Logging.ILog! log, GitVersion.Logging.IConsole! console, GitVersion.Configuration.IConfigFileLocator! configFileLocator, GitVersion.Configuration.IConfigProvider! configProvider, GitVersion.IGitVersionCalculateTool! gitVersionCalculateTool, GitVersion.IGitVersionOutputTool! gitVersionOutputTool, GitVersion.IVersionWriter! versionWriter, GitVersion.IHelpWriter! helpWriter, GitVersion.IGitRepositoryInfo! repositoryInfo) -> void +GitVersion.GitVersionExecutor.GitVersionExecutor(GitVersion.Logging.ILog! log, GitVersion.Logging.IConsole! console, GitVersion.Configuration.IConfigurationFileLocator! configFileLocator, GitVersion.Configuration.IConfigurationProvider! configurationProvider, GitVersion.IGitVersionCalculateTool! gitVersionCalculateTool, GitVersion.IGitVersionOutputTool! gitVersionOutputTool, GitVersion.IVersionWriter! versionWriter, GitVersion.IHelpWriter! helpWriter, GitVersion.IGitRepositoryInfo! repositoryInfo) -> void GitVersion.GlobbingResolver GitVersion.GlobbingResolver.GlobbingResolver() -> void GitVersion.GlobbingResolver.Resolve(string! workingDirectory, string! pattern) -> System.Collections.Generic.IEnumerable! diff --git a/src/GitVersion.Core.Tests/BuildAgents/BitBucketPipelinesTests.cs b/src/GitVersion.Core.Tests/BuildAgents/BitBucketPipelinesTests.cs index ecd5218fa0..3ca40bd25e 100644 --- a/src/GitVersion.Core.Tests/BuildAgents/BitBucketPipelinesTests.cs +++ b/src/GitVersion.Core.Tests/BuildAgents/BitBucketPipelinesTests.cs @@ -150,10 +150,10 @@ private void AssertVariablesAreWrittenToFile(string file) semanticVersion.BuildMetaData.CommitDate = new DateTimeOffset(2022, 4, 6, 16, 10, 59, TimeSpan.FromHours(10)); semanticVersion.BuildMetaData.Sha = "f28807e615e9f06aec8a33c87780374e0c1f6fb8"; - var config = new TestEffectiveConfiguration(); + var configuration = new TestEffectiveConfiguration(); var variableProvider = this.sp.GetRequiredService(); - var variables = variableProvider.GetVariablesFor(semanticVersion, config, false); + var variables = variableProvider.GetVariablesFor(semanticVersion, configuration, false); this.buildServer.WithPropertyFile(file); diff --git a/src/GitVersion.Core.Tests/BuildAgents/BuildServerBaseTests.cs b/src/GitVersion.Core.Tests/BuildAgents/BuildServerBaseTests.cs index ceacebd38b..8dbe61b878 100644 --- a/src/GitVersion.Core.Tests/BuildAgents/BuildServerBaseTests.cs +++ b/src/GitVersion.Core.Tests/BuildAgents/BuildServerBaseTests.cs @@ -38,9 +38,9 @@ public void BuildNumberIsFullSemVer() semanticVersion.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); semanticVersion.BuildMetaData.Sha = "commitSha"; - var config = new TestEffectiveConfiguration(); + var configuration = new TestEffectiveConfiguration(); - var variables = this.buildServer.GetVariablesFor(semanticVersion, config, false); + var variables = this.buildServer.GetVariablesFor(semanticVersion, configuration, false); var buildAgent = this.sp.GetRequiredService(); buildAgent.WriteIntegration(writes.Add, variables); diff --git a/src/GitVersion.Core.Tests/BuildAgents/CodeBuildTests.cs b/src/GitVersion.Core.Tests/BuildAgents/CodeBuildTests.cs index b81e4f1e91..2ec4188791 100644 --- a/src/GitVersion.Core.Tests/BuildAgents/CodeBuildTests.cs +++ b/src/GitVersion.Core.Tests/BuildAgents/CodeBuildTests.cs @@ -83,11 +83,11 @@ private void AssertVariablesAreWrittenToFile(string file) semanticVersion.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); semanticVersion.BuildMetaData.Sha = "commitSha"; - var config = new TestEffectiveConfiguration(); + var configuration = new TestEffectiveConfiguration(); var variableProvider = this.sp.GetRequiredService(); - var variables = variableProvider.GetVariablesFor(semanticVersion, config, false); + var variables = variableProvider.GetVariablesFor(semanticVersion, configuration, false); this.buildServer.WithPropertyFile(file); diff --git a/src/GitVersion.Core.Tests/BuildAgents/GitLabCiTests.cs b/src/GitVersion.Core.Tests/BuildAgents/GitLabCiTests.cs index 18f9809406..47606f0463 100644 --- a/src/GitVersion.Core.Tests/BuildAgents/GitLabCiTests.cs +++ b/src/GitVersion.Core.Tests/BuildAgents/GitLabCiTests.cs @@ -68,10 +68,10 @@ private void AssertVariablesAreWrittenToFile(string file) semanticVersion.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); semanticVersion.BuildMetaData.Sha = "commitSha"; - var config = new TestEffectiveConfiguration(); + var configuration = new TestEffectiveConfiguration(); var variableProvider = this.sp.GetRequiredService(); - var variables = variableProvider.GetVariablesFor(semanticVersion, config, false); + var variables = variableProvider.GetVariablesFor(semanticVersion, configuration, false); this.buildServer.WithPropertyFile(file); diff --git a/src/GitVersion.Core.Tests/BuildAgents/JenkinsTests.cs b/src/GitVersion.Core.Tests/BuildAgents/JenkinsTests.cs index 896b9aacab..370733acd6 100644 --- a/src/GitVersion.Core.Tests/BuildAgents/JenkinsTests.cs +++ b/src/GitVersion.Core.Tests/BuildAgents/JenkinsTests.cs @@ -139,11 +139,11 @@ private void AssertVariablesAreWrittenToFile(string file) semanticVersion.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); semanticVersion.BuildMetaData.Sha = "commitSha"; - var config = new TestEffectiveConfiguration(); + var configuration = new TestEffectiveConfiguration(); var variableProvider = this.sp.GetRequiredService(); - var variables = variableProvider.GetVariablesFor(semanticVersion, config, false); + var variables = variableProvider.GetVariablesFor(semanticVersion, configuration, false); this.buildServer.WithPropertyFile(file); diff --git a/src/GitVersion.Core.Tests/Model/CommitDateTests.cs b/src/GitVersion.Core.Tests/CommitDateTests.cs similarity index 100% rename from src/GitVersion.Core.Tests/Model/CommitDateTests.cs rename to src/GitVersion.Core.Tests/CommitDateTests.cs diff --git a/src/GitVersion.Core.Tests/Configuration/ConfigExtensionsTests.cs b/src/GitVersion.Core.Tests/Configuration/ConfigExtensionsTests.cs deleted file mode 100644 index afb2f94eec..0000000000 --- a/src/GitVersion.Core.Tests/Configuration/ConfigExtensionsTests.cs +++ /dev/null @@ -1,30 +0,0 @@ -using GitVersion.Configuration; -using GitVersion.Core.Tests.Helpers; -using GitVersion.Model.Configuration; -using NUnit.Framework; -using Shouldly; - -namespace GitVersion.Core.Tests.Configuration; - -[TestFixture] -public class ConfigExtensionsTests : TestBase -{ - [Test] - public void GetReleaseBranchConfigReturnsAllReleaseBranches() - { - var config = new Config() - { - Branches = new Dictionary - { - { "foo", new BranchConfig { Name = "foo" } }, - { "bar", new BranchConfig { Name = "bar", IsReleaseBranch = true } }, - { "baz", new BranchConfig { Name = "baz", IsReleaseBranch = true } } - } - }; - - var result = config.GetReleaseBranchConfig(); - - result.Count.ShouldBe(2); - result.ShouldNotContain(b => b.Key == "foo"); - } -} diff --git a/src/GitVersion.Core.Tests/Configuration/ConfigurationExtensionsTests.cs b/src/GitVersion.Core.Tests/Configuration/ConfigurationExtensionsTests.cs new file mode 100644 index 0000000000..deb0defc07 --- /dev/null +++ b/src/GitVersion.Core.Tests/Configuration/ConfigurationExtensionsTests.cs @@ -0,0 +1,29 @@ +using GitVersion.Configuration; +using GitVersion.Core.Tests.Helpers; +using NUnit.Framework; +using Shouldly; + +namespace GitVersion.Core.Tests.Configuration; + +[TestFixture] +public class ConfigurationExtensionsTests : TestBase +{ + [Test] + public void GetReleaseBranchConfigReturnsAllReleaseBranches() + { + var configuration = new GitVersionConfiguration() + { + Branches = new Dictionary + { + { "foo", new BranchConfiguration { Name = "foo" } }, + { "bar", new BranchConfiguration { Name = "bar", IsReleaseBranch = true } }, + { "baz", new BranchConfiguration { Name = "baz", IsReleaseBranch = true } } + } + }; + + var result = configuration.GetReleaseBranchConfiguration(); + + result.Count.ShouldBe(2); + result.ShouldNotContain(b => b.Key == "foo"); + } +} diff --git a/src/GitVersion.Core.Tests/Configuration/DefaultConfigFileLocatorTests.cs b/src/GitVersion.Core.Tests/Configuration/ConfigurationFileLocatorTests.cs similarity index 88% rename from src/GitVersion.Core.Tests/Configuration/DefaultConfigFileLocatorTests.cs rename to src/GitVersion.Core.Tests/Configuration/ConfigurationFileLocatorTests.cs index 0ee6005603..6a36cc9634 100644 --- a/src/GitVersion.Core.Tests/Configuration/DefaultConfigFileLocatorTests.cs +++ b/src/GitVersion.Core.Tests/Configuration/ConfigurationFileLocatorTests.cs @@ -11,7 +11,7 @@ namespace GitVersion.Core.Tests; [TestFixture] -public class ConfigFileLocatorTests +public class ConfigurationFileLocatorTests { public class DefaultConfigFileLocatorTests : TestBase { @@ -21,8 +21,8 @@ public class DefaultConfigFileLocatorTests : TestBase private string repoPath; private string workingPath; private IFileSystem fileSystem; - private IConfigProvider configurationProvider; - private IConfigFileLocator configFileLocator; + private IConfigurationProvider configurationProvider; + private IConfigurationFileLocator configFileLocator; [SetUp] public void Setup() @@ -34,13 +34,13 @@ public void Setup() var sp = ConfigureServices(services => services.AddSingleton(options)); this.fileSystem = sp.GetRequiredService(); - this.configurationProvider = sp.GetRequiredService(); - this.configFileLocator = sp.GetRequiredService(); + this.configurationProvider = sp.GetRequiredService(); + this.configFileLocator = sp.GetRequiredService(); ShouldlyConfiguration.ShouldMatchApprovedDefaults.LocateTestMethodUsingAttribute(); } - [TestCase(ConfigFileLocator.DefaultFileName, ConfigFileLocator.DefaultFileName)] + [TestCase(ConfigurationFileLocator.DefaultFileName, ConfigurationFileLocator.DefaultFileName)] public void ThrowsExceptionOnAmbiguousConfigFileLocation(string repoConfigFile, string workingConfigFile) { var repositoryConfigFilePath = SetupConfigFileContent(string.Empty, repoConfigFile, this.repoPath); @@ -48,14 +48,14 @@ public void ThrowsExceptionOnAmbiguousConfigFileLocation(string repoConfigFile, var exception = Should.Throw(() => this.configFileLocator.Verify(this.workingPath, this.repoPath)); - var expectedMessage = $"Ambiguous config file selection from '{workingDirectoryConfigFilePath}' and '{repositoryConfigFilePath}'"; + var expectedMessage = $"Ambiguous configuration file selection from '{workingDirectoryConfigFilePath}' and '{repositoryConfigFilePath}'"; exception.Message.ShouldBe(expectedMessage); } [Test] public void NoWarnOnGitVersionYmlFile() { - SetupConfigFileContent(string.Empty, ConfigFileLocator.DefaultFileName, this.repoPath); + SetupConfigFileContent(string.Empty, ConfigurationFileLocator.DefaultFileName, this.repoPath); Should.NotThrow(() => this.configurationProvider.Provide(this.repoPath)); } @@ -72,7 +72,7 @@ private string SetupConfigFileContent(string text, string fileName, string path) } } - public class NamedConfigFileLocatorTests : TestBase + public class NamedConfigurationFileLocatorTests : TestBase { private const string DefaultRepoPath = @"c:\MyGitRepo"; private const string DefaultWorkingPath = @"c:\MyGitRepo\Working"; @@ -80,7 +80,7 @@ public class NamedConfigFileLocatorTests : TestBase private string repoPath; private string workingPath; private IFileSystem fileSystem; - private IConfigFileLocator configFileLocator; + private IConfigurationFileLocator configFileLocator; private GitVersionOptions gitVersionOptions; [SetUp] @@ -97,7 +97,7 @@ public void Setup() public void ThrowsExceptionOnAmbiguousConfigFileLocation() { var sp = GetServiceProvider(this.gitVersionOptions); - this.configFileLocator = sp.GetRequiredService(); + this.configFileLocator = sp.GetRequiredService(); this.fileSystem = sp.GetRequiredService(); var repositoryConfigFilePath = SetupConfigFileContent(string.Empty, path: this.repoPath); @@ -105,7 +105,7 @@ public void ThrowsExceptionOnAmbiguousConfigFileLocation() var exception = Should.Throw(() => this.configFileLocator.Verify(this.workingPath, this.repoPath)); - var expectedMessage = $"Ambiguous config file selection from '{workingDirectoryConfigFilePath}' and '{repositoryConfigFilePath}'"; + var expectedMessage = $"Ambiguous configuration file selection from '{workingDirectoryConfigFilePath}' and '{repositoryConfigFilePath}'"; exception.Message.ShouldBe(expectedMessage); } @@ -115,7 +115,7 @@ public void DoNotThrowWhenWorkingAndRepoPathsAreSame() this.workingPath = DefaultRepoPath; var sp = GetServiceProvider(this.gitVersionOptions); - this.configFileLocator = sp.GetRequiredService(); + this.configFileLocator = sp.GetRequiredService(); this.fileSystem = sp.GetRequiredService(); SetupConfigFileContent(string.Empty, path: this.workingPath); @@ -129,7 +129,7 @@ public void DoNotThrowWhenWorkingAndRepoPathsAreSame_WithDifferentCasing() this.workingPath = DefaultRepoPath.ToLower(); var sp = GetServiceProvider(this.gitVersionOptions); - this.configFileLocator = sp.GetRequiredService(); + this.configFileLocator = sp.GetRequiredService(); this.fileSystem = sp.GetRequiredService(); SetupConfigFileContent(string.Empty, path: this.workingPath); @@ -144,7 +144,7 @@ public void DoNotThrowWhenConfigFileIsInSubDirectoryOfRepoPath() this.gitVersionOptions = new GitVersionOptions { ConfigInfo = { ConfigFile = "./src/my-config.yaml" } }; var sp = GetServiceProvider(this.gitVersionOptions); - this.configFileLocator = sp.GetRequiredService(); + this.configFileLocator = sp.GetRequiredService(); this.fileSystem = sp.GetRequiredService(); SetupConfigFileContent(string.Empty, path: this.workingPath); @@ -162,12 +162,12 @@ public void NoWarnOnCustomYmlFile() var log = new Log(logAppender); var sp = GetServiceProvider(this.gitVersionOptions, log); - this.configFileLocator = sp.GetRequiredService(); + this.configFileLocator = sp.GetRequiredService(); this.fileSystem = sp.GetRequiredService(); SetupConfigFileContent(string.Empty); - var configurationProvider = sp.GetRequiredService(); + var configurationProvider = sp.GetRequiredService(); configurationProvider.Provide(this.repoPath); stringLogger.Length.ShouldBe(0); @@ -183,12 +183,12 @@ public void NoWarnOnCustomYmlFileOutsideRepoPath() var log = new Log(logAppender); var sp = GetServiceProvider(this.gitVersionOptions, log); - this.configFileLocator = sp.GetRequiredService(); + this.configFileLocator = sp.GetRequiredService(); this.fileSystem = sp.GetRequiredService(); SetupConfigFileContent(string.Empty, path: @"c:\\Unrelated\\path"); - var configurationProvider = sp.GetRequiredService(); + var configurationProvider = sp.GetRequiredService(); configurationProvider.Provide(this.repoPath); stringLogger.Length.ShouldBe(0); @@ -198,7 +198,7 @@ public void NoWarnOnCustomYmlFileOutsideRepoPath() public void ThrowsExceptionOnCustomYmlFileDoesNotExist() { var sp = GetServiceProvider(this.gitVersionOptions); - this.configFileLocator = sp.GetRequiredService(); + this.configFileLocator = sp.GetRequiredService(); var exception = Should.Throw(() => this.configFileLocator.Verify(this.workingPath, this.repoPath)); diff --git a/src/GitVersion.Core.Tests/Configuration/ConfigProviderTests.CanWriteOutEffectiveConfiguration.approved.txt b/src/GitVersion.Core.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt similarity index 100% rename from src/GitVersion.Core.Tests/Configuration/ConfigProviderTests.CanWriteOutEffectiveConfiguration.approved.txt rename to src/GitVersion.Core.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt diff --git a/src/GitVersion.Core.Tests/Configuration/ConfigProviderTests.cs b/src/GitVersion.Core.Tests/Configuration/ConfigurationProviderTests.cs similarity index 64% rename from src/GitVersion.Core.Tests/Configuration/ConfigProviderTests.cs rename to src/GitVersion.Core.Tests/Configuration/ConfigurationProviderTests.cs index bb1b1386de..cbe5d2f923 100644 --- a/src/GitVersion.Core.Tests/Configuration/ConfigProviderTests.cs +++ b/src/GitVersion.Core.Tests/Configuration/ConfigurationProviderTests.cs @@ -4,7 +4,6 @@ using GitVersion.Extensions; using GitVersion.Helpers; using GitVersion.Logging; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; @@ -15,12 +14,12 @@ namespace GitVersion.Core.Tests; [TestFixture] -public class ConfigProviderTests : TestBase +public class ConfigurationProviderTests : TestBase { private const string DefaultRepoPath = @"c:\MyGitRepo"; private string repoPath; - private IConfigProvider configProvider; + private IConfigurationProvider configurationProvider; private IFileSystem fileSystem; [SetUp] @@ -29,7 +28,7 @@ public void Setup() this.repoPath = DefaultRepoPath; var options = Options.Create(new GitVersionOptions { WorkingDirectory = repoPath }); var sp = ConfigureServices(services => services.AddSingleton(options)); - this.configProvider = sp.GetRequiredService(); + this.configurationProvider = sp.GetRequiredService(); this.fileSystem = sp.GetRequiredService(); ShouldlyConfiguration.ShouldMatchApprovedDefaults.LocateTestMethodUsingAttribute(); @@ -38,7 +37,7 @@ public void Setup() [Test] public void OverwritesDefaultsWithProvidedConfig() { - var defaultConfig = this.configProvider.Provide(this.repoPath); + var defaultConfig = this.configurationProvider.Provide(this.repoPath); const string text = @" next-version: 2.0.0 branches: @@ -46,13 +45,13 @@ public void OverwritesDefaultsWithProvidedConfig() mode: ContinuousDeployment tag: dev"; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); + var configuration = this.configurationProvider.Provide(this.repoPath); - config.NextVersion.ShouldBe("2.0.0"); - config.Branches.ShouldNotBeNull(); - config.Branches["develop"].Increment.ShouldBe(defaultConfig.Branches["develop"].Increment); - config.Branches["develop"].VersioningMode.ShouldBe(defaultConfig.Branches["develop"].VersioningMode); - config.Branches["develop"].Tag.ShouldBe("dev"); + configuration.NextVersion.ShouldBe("2.0.0"); + configuration.Branches.ShouldNotBeNull(); + configuration.Branches["develop"].Increment.ShouldBe(defaultConfig.Branches["develop"].Increment); + configuration.Branches["develop"].VersioningMode.ShouldBe(defaultConfig.Branches["develop"].VersioningMode); + configuration.Branches["develop"].Tag.ShouldBe("dev"); } [Test] @@ -60,8 +59,8 @@ public void AllBranchesModeWhenUsingMainline() { const string text = "mode: Mainline"; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); - var branches = config.Branches.Select(x => x.Value); + var configuration = this.configurationProvider.Provide(this.repoPath); + var branches = configuration.Branches.Select(x => x.Value); branches.All(branch => branch.VersioningMode == VersioningMode.Mainline).ShouldBe(true); } @@ -74,10 +73,10 @@ public void CanRemoveTag() release: tag: """""; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); + var configuration = this.configurationProvider.Provide(this.repoPath); - config.NextVersion.ShouldBe("2.0.0"); - config.Branches["release"].Tag.ShouldBe(string.Empty); + configuration.NextVersion.ShouldBe("2.0.0"); + configuration.Branches["release"].Tag.ShouldBe(string.Empty); } [Test] @@ -89,7 +88,7 @@ public void RegexIsRequired() bug: tag: bugfix"; SetupConfigFileContent(text); - var ex = Should.Throw(() => this.configProvider.Provide(this.repoPath)); + var ex = Should.Throw(() => this.configurationProvider.Provide(this.repoPath)); ex.Message.ShouldBe($"Branch configuration 'bug' is missing required configuration 'regex'{System.Environment.NewLine}" + "See https://gitversion.net/docs/reference/configuration for more info"); } @@ -104,7 +103,7 @@ public void SourceBranchIsRequired() regex: 'bug[/-]' tag: bugfix"; SetupConfigFileContent(text); - var ex = Should.Throw(() => this.configProvider.Provide(this.repoPath)); + var ex = Should.Throw(() => this.configurationProvider.Provide(this.repoPath)); ex.Message.ShouldBe($"Branch configuration 'bug' is missing required configuration 'source-branches'{System.Environment.NewLine}" + "See https://gitversion.net/docs/reference/configuration for more info"); } @@ -119,14 +118,14 @@ public void SourceBranchesValidationShouldFailWhenMatchingBranchConfigurationIsM tag: bugfix source-branches: [notconfigured]"; SetupConfigFileContent(text); - var ex = Should.Throw(() => this.configProvider.Provide(this.repoPath)); + var ex = Should.Throw(() => this.configurationProvider.Provide(this.repoPath)); ex.Message.ShouldBe($"Branch configuration 'bug' defines these 'source-branches' that are not configured: '[notconfigured]'{System.Environment.NewLine}" + "See https://gitversion.net/docs/reference/configuration for more info"); } [Test(Description = "Well-known branches may not be present in the configuration file. This test confirms the validation check succeeds when the source-branches configuration contain these well-known branches.")] - [TestCase(Config.MainBranchKey)] - [TestCase(Config.DevelopBranchKey)] + [TestCase(GitVersionConfiguration.MainBranchKey)] + [TestCase(GitVersionConfiguration.DevelopBranchKey)] public void SourceBranchesValidationShouldSucceedForWellKnownBranches(string wellKnownBranchKey) { var text = $@" @@ -136,9 +135,9 @@ public void SourceBranchesValidationShouldSucceedForWellKnownBranches(string wel tag: bugfix source-branches: [{wellKnownBranchKey}]"; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); + var configuration = this.configurationProvider.Provide(this.repoPath); - config.Branches["bug"].SourceBranches.ShouldBe(new List { wellKnownBranchKey }); + configuration.Branches["bug"].SourceBranches.ShouldBe(new List { wellKnownBranchKey }); } [Test] @@ -152,10 +151,10 @@ public void CanProvideConfigForNewBranch() tag: bugfix source-branches: []"; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); + var configuration = this.configurationProvider.Provide(this.repoPath); - config.Branches["bug"].Regex.ShouldBe("bug[/-]"); - config.Branches["bug"].Tag.ShouldBe("bugfix"); + configuration.Branches["bug"].Regex.ShouldBe("bug[/-]"); + configuration.Branches["bug"].Tag.ShouldBe("bugfix"); } [Test] @@ -169,10 +168,10 @@ public void MasterConfigReplacedWithMain() tag: beta"; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); + var configuration = this.configurationProvider.Provide(this.repoPath); - config.Branches[MainBranch].Regex.ShouldBe("^master$|^main$"); - config.Branches[MainBranch].Tag.ShouldBe("beta"); + configuration.Branches[MainBranch].Regex.ShouldBe("^master$|^main$"); + configuration.Branches[MainBranch].Tag.ShouldBe("beta"); } [Test] @@ -189,11 +188,11 @@ public void MasterConfigReplacedWithMainInSourceBranches() is-release-branch: false"; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); + var configuration = this.configurationProvider.Provide(this.repoPath); - config.Branches["breaking"].Regex.ShouldBe("breaking[/]"); - config.Branches["breaking"].SourceBranches.ShouldHaveSingleItem(); - config.Branches["breaking"].SourceBranches?.ShouldContain(MainBranch); + configuration.Branches["breaking"].Regex.ShouldBe("breaking[/]"); + configuration.Branches["breaking"].SourceBranches.ShouldHaveSingleItem(); + configuration.Branches["breaking"].SourceBranches?.ShouldContain(MainBranch); } [Test] @@ -201,9 +200,9 @@ public void NextVersionCanBeInteger() { const string text = "next-version: 2"; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); + var configuration = this.configurationProvider.Provide(this.repoPath); - config.NextVersion.ShouldBe("2.0"); + configuration.NextVersion.ShouldBe("2.0"); } [Test] @@ -211,9 +210,9 @@ public void NextVersionCanHaveEnormousMinorVersion() { const string text = "next-version: 2.118998723"; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); + var configuration = this.configurationProvider.Provide(this.repoPath); - config.NextVersion.ShouldBe("2.118998723"); + configuration.NextVersion.ShouldBe("2.118998723"); } [Test] @@ -221,18 +220,18 @@ public void NextVersionCanHavePatch() { const string text = "next-version: 2.12.654651698"; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); + var configuration = this.configurationProvider.Provide(this.repoPath); - config.NextVersion.ShouldBe("2.12.654651698"); + configuration.NextVersion.ShouldBe("2.12.654651698"); } [Test] [MethodImpl(MethodImplOptions.NoInlining)] public void CanWriteOutEffectiveConfiguration() { - var config = this.configProvider.Provide(this.repoPath); + var configuration = this.configurationProvider.Provide(this.repoPath); - config.ToString().ShouldMatchApproved(); + configuration.ToString().ShouldMatchApproved(); } [Test] @@ -245,10 +244,10 @@ public void CanUpdateAssemblyInformationalVersioningScheme() SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); - config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinor); - config.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch); - config.AssemblyInformationalFormat.ShouldBe("{NugetVersion}"); + var configuration = this.configurationProvider.Provide(this.repoPath); + configuration.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinor); + configuration.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch); + configuration.AssemblyInformationalFormat.ShouldBe("{NugetVersion}"); } [Test] @@ -261,10 +260,10 @@ public void CanUpdateAssemblyInformationalVersioningSchemeWithMultipleVariables( SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); - config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinor); - config.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch); - config.AssemblyInformationalFormat.ShouldBe("{Major}.{Minor}.{Patch}"); + var configuration = this.configurationProvider.Provide(this.repoPath); + configuration.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinor); + configuration.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch); + configuration.AssemblyInformationalFormat.ShouldBe("{Major}.{Minor}.{Patch}"); } @@ -280,10 +279,10 @@ public void CanUpdateAssemblyInformationalVersioningSchemeWithFullSemVer() SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); - config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinorPatch); - config.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch); - config.AssemblyInformationalFormat.ShouldBe("{FullSemVer}"); + var configuration = this.configurationProvider.Provide(this.repoPath); + configuration.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinorPatch); + configuration.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch); + configuration.AssemblyInformationalFormat.ShouldBe("{FullSemVer}"); } [Test] @@ -291,21 +290,21 @@ public void CanReadDefaultDocument() { const string text = ""; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); - config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinorPatch); - config.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch); - config.AssemblyInformationalFormat.ShouldBe(null); - config.Branches["develop"].Tag.ShouldBe("alpha"); - config.Branches["release"].Tag.ShouldBe("beta"); - config.TagPrefix.ShouldBe(Config.DefaultTagPrefix); - config.NextVersion.ShouldBe(null); + var configuration = this.configurationProvider.Provide(this.repoPath); + configuration.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinorPatch); + configuration.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch); + configuration.AssemblyInformationalFormat.ShouldBe(null); + configuration.Branches["develop"].Tag.ShouldBe("alpha"); + configuration.Branches["release"].Tag.ShouldBe("beta"); + configuration.TagPrefix.ShouldBe(GitVersionConfiguration.DefaultTagPrefix); + configuration.NextVersion.ShouldBe(null); } [Test] public void VerifyAliases() { - var config = typeof(Config); - var propertiesMissingAlias = config.GetProperties() + var configuration = typeof(GitVersionConfiguration); + var propertiesMissingAlias = configuration.GetProperties() .Where(p => p.GetCustomAttribute() == null) .Where(p => p.GetCustomAttribute(typeof(YamlMemberAttribute)) == null) .Select(p => p.Name); @@ -330,14 +329,14 @@ public void NoWarnOnGitVersionYmlFile() services.AddSingleton(options); services.AddSingleton(log); }); - this.configProvider = sp.GetRequiredService(); + this.configurationProvider = sp.GetRequiredService(); - this.configProvider.Provide(this.repoPath); + this.configurationProvider.Provide(this.repoPath); stringLogger.Length.ShouldBe(0); } - private void SetupConfigFileContent(string text, string fileName = ConfigFileLocator.DefaultFileName) => SetupConfigFileContent(text, fileName, this.repoPath); + private void SetupConfigFileContent(string text, string fileName = ConfigurationFileLocator.DefaultFileName) => SetupConfigFileContent(text, fileName, this.repoPath); private void SetupConfigFileContent(string text, string fileName, string path) { @@ -356,9 +355,9 @@ public void ShouldUseSpecifiedSourceBranchesForDevelop() source-branches: ['develop'] tag: dev"; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); + var configuration = this.configurationProvider.Provide(this.repoPath); - config.Branches["develop"].SourceBranches.ShouldBe(new List { "develop" }); + configuration.Branches["develop"].SourceBranches.ShouldBe(new List { "develop" }); } [Test] @@ -371,9 +370,9 @@ public void ShouldUseDefaultSourceBranchesWhenNotSpecifiedForDevelop() mode: ContinuousDeployment tag: dev"; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); + var configuration = this.configurationProvider.Provide(this.repoPath); - config.Branches["develop"].SourceBranches.ShouldBe(new List()); + configuration.Branches["develop"].SourceBranches.ShouldBe(new List()); } [Test] @@ -387,9 +386,9 @@ public void ShouldUseSpecifiedSourceBranchesForFeature() source-branches: ['develop', 'release'] tag: dev"; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); + var configuration = this.configurationProvider.Provide(this.repoPath); - config.Branches["feature"].SourceBranches.ShouldBe(new List { "develop", "release" }); + configuration.Branches["feature"].SourceBranches.ShouldBe(new List { "develop", "release" }); } [Test] @@ -402,9 +401,9 @@ public void ShouldUseDefaultSourceBranchesWhenNotSpecifiedForFeature() mode: ContinuousDeployment tag: dev"; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); + var configuration = this.configurationProvider.Provide(this.repoPath); - config.Branches["feature"].SourceBranches.ShouldBe( + configuration.Branches["feature"].SourceBranches.ShouldBe( new List { "develop", MainBranch, "release", "feature", "support", "hotfix" }); } @@ -416,8 +415,8 @@ public void ShouldNotOverrideAnythingWhenOverrideConfigIsEmpty() tag-prefix: custom-tag-prefix-from-yml"; SetupConfigFileContent(text); - var expectedConfig = this.configProvider.Provide(this.repoPath); - var overridenConfig = this.configProvider.Provide(this.repoPath, new Config()); + var expectedConfig = this.configurationProvider.Provide(this.repoPath); + var overridenConfig = this.configurationProvider.Provide(this.repoPath, new GitVersionConfiguration()); overridenConfig.AssemblyVersioningScheme.ShouldBe(expectedConfig.AssemblyVersioningScheme); overridenConfig.AssemblyFileVersioningScheme.ShouldBe(expectedConfig.AssemblyFileVersioningScheme); @@ -454,9 +453,9 @@ public void ShouldUseDefaultTagPrefixWhenNotSetInConfigFile() { const string text = ""; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); + var configuration = this.configurationProvider.Provide(this.repoPath); - config.TagPrefix.ShouldBe("[vV]"); + configuration.TagPrefix.ShouldBe("[vV]"); } [Test] @@ -464,9 +463,9 @@ public void ShouldUseTagPrefixFromConfigFileWhenProvided() { const string text = "tag-prefix: custom-tag-prefix-from-yml"; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath); + var configuration = this.configurationProvider.Provide(this.repoPath); - config.TagPrefix.ShouldBe("custom-tag-prefix-from-yml"); + configuration.TagPrefix.ShouldBe("custom-tag-prefix-from-yml"); } [Test] @@ -474,9 +473,9 @@ public void ShouldOverrideTagPrefixWithOverrideConfigValue([Values] bool tagPref { var text = tagPrefixSetAtYmlFile ? "tag-prefix: custom-tag-prefix-from-yml" : ""; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath, new Config { TagPrefix = "tag-prefix-from-override-config" }); + var configuration = this.configurationProvider.Provide(this.repoPath, new GitVersionConfiguration { TagPrefix = "tag-prefix-from-override-configuration" }); - config.TagPrefix.ShouldBe("tag-prefix-from-override-config"); + configuration.TagPrefix.ShouldBe("tag-prefix-from-override-configuration"); } [Test] @@ -484,9 +483,9 @@ public void ShouldNotOverrideDefaultTagPrefixWhenNotSetInOverrideConfig() { const string text = ""; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath, new Config { TagPrefix = null }); + var configuration = this.configurationProvider.Provide(this.repoPath, new GitVersionConfiguration { TagPrefix = null }); - config.TagPrefix.ShouldBe("[vV]"); + configuration.TagPrefix.ShouldBe("[vV]"); } [Test] @@ -494,8 +493,8 @@ public void ShouldNotOverrideTagPrefixFromConfigFileWhenNotSetInOverrideConfig() { const string text = "tag-prefix: custom-tag-prefix-from-yml"; SetupConfigFileContent(text); - var config = this.configProvider.Provide(this.repoPath, new Config { TagPrefix = null }); + var configuration = this.configurationProvider.Provide(this.repoPath, new GitVersionConfiguration { TagPrefix = null }); - config.TagPrefix.ShouldBe("custom-tag-prefix-from-yml"); + configuration.TagPrefix.ShouldBe("custom-tag-prefix-from-yml"); } } diff --git a/src/GitVersion.Core.Tests/Configuration/IgnoreConfigTests.cs b/src/GitVersion.Core.Tests/Configuration/IgnoreConfigurationTests.cs similarity index 53% rename from src/GitVersion.Core.Tests/Configuration/IgnoreConfigTests.cs rename to src/GitVersion.Core.Tests/Configuration/IgnoreConfigurationTests.cs index 4cc79f76f8..cb18215c6d 100644 --- a/src/GitVersion.Core.Tests/Configuration/IgnoreConfigTests.cs +++ b/src/GitVersion.Core.Tests/Configuration/IgnoreConfigurationTests.cs @@ -1,6 +1,5 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; -using GitVersion.Model.Configuration; using NUnit.Framework; using Shouldly; using YamlDotNet.Core; @@ -8,7 +7,7 @@ namespace GitVersion.Core.Tests.Configuration; [TestFixture] -public class IgnoreConfigTests : TestBase +public class IgnoreConfigurationTests : TestBase { [Test] public void CanDeserialize() @@ -20,12 +19,12 @@ public void CanDeserialize() "; using var reader = new StringReader(yaml); - var config = ConfigSerializer.Read(reader); + var configuration = ConfigurationSerializer.Read(reader); - config.Ignore.ShouldNotBeNull(); - config.Ignore.ShAs.ShouldNotBeEmpty(); - config.Ignore.ShAs.ShouldBe(new[] { "b6c0c9fda88830ebcd563e500a5a7da5a1658e98" }); - config.Ignore.Before.ShouldBe(DateTimeOffset.Parse("2015-10-23T12:23:15")); + configuration.Ignore.ShouldNotBeNull(); + configuration.Ignore.Shas.ShouldNotBeEmpty(); + configuration.Ignore.Shas.ShouldBe(new[] { "b6c0c9fda88830ebcd563e500a5a7da5a1658e98" }); + configuration.Ignore.Before.ShouldBe(DateTimeOffset.Parse("2015-10-23T12:23:15")); } [Test] @@ -39,11 +38,11 @@ public void ShouldSupportsOtherSequenceFormat() "; using var reader = new StringReader(yaml); - var config = ConfigSerializer.Read(reader); + var configuration = ConfigurationSerializer.Read(reader); - config.Ignore.ShouldNotBeNull(); - config.Ignore.ShAs.ShouldNotBeEmpty(); - config.Ignore.ShAs.ShouldBe(new[] { "b6c0c9fda88830ebcd563e500a5a7da5a1658e98", "6c19c7c219ecf8dbc468042baefa73a1b213e8b1" }); + configuration.Ignore.ShouldNotBeNull(); + configuration.Ignore.Shas.ShouldNotBeEmpty(); + configuration.Ignore.Shas.ShouldBe(new[] { "b6c0c9fda88830ebcd563e500a5a7da5a1658e98", "6c19c7c219ecf8dbc468042baefa73a1b213e8b1" }); } [Test] @@ -54,11 +53,11 @@ public void WhenNotInConfigShouldHaveDefaults() "; using var reader = new StringReader(yaml); - var config = ConfigSerializer.Read(reader); + var configuration = ConfigurationSerializer.Read(reader); - config.Ignore.ShouldNotBeNull(); - config.Ignore.ShAs.ShouldBeEmpty(); - config.Ignore.Before.ShouldBe(null); + configuration.Ignore.ShouldNotBeNull(); + configuration.Ignore.Shas.ShouldBeEmpty(); + configuration.Ignore.Before.ShouldBe(null); } [Test] @@ -70,13 +69,13 @@ public void WhenBadDateFormatShouldFail() "; using var reader = new StringReader(yaml); - Should.Throw(() => ConfigSerializer.Read(reader)); + Should.Throw(() => ConfigurationSerializer.Read(reader)); } [Test] public void NewInstanceShouldBeEmpty() { - var ignoreConfig = new IgnoreConfig(); + var ignoreConfig = new IgnoreConfiguration(); ignoreConfig.IsEmpty.ShouldBeTrue(); } diff --git a/src/GitVersion.Core.Tests/Configuration/Init/InitScenarios.cs b/src/GitVersion.Core.Tests/Configuration/Init/InitScenarios.cs index 9bf8eef45b..db3fa0f996 100644 --- a/src/GitVersion.Core.Tests/Configuration/Init/InitScenarios.cs +++ b/src/GitVersion.Core.Tests/Configuration/Init/InitScenarios.cs @@ -28,7 +28,7 @@ public void CanSetNextVersion() services.AddSingleton(options); }); - var configurationProvider = sp.GetRequiredService(); + var configurationProvider = sp.GetRequiredService(); var fileSystem = sp.GetRequiredService(); configurationProvider.Init(workingDirectory); diff --git a/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs b/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs index 7498274ec8..b0b8fc33fd 100644 --- a/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs +++ b/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs @@ -4,7 +4,6 @@ using GitVersion.Core.Tests.Helpers; using GitVersion.Helpers; using GitVersion.Logging; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation.Cache; using LibGit2Sharp; using Microsoft.Extensions.DependencyInjection; @@ -205,8 +204,8 @@ public void CacheFileExistsOnDiskWhenOverrideConfigIsSpecifiedVersionShouldBeDyn var cacheDirectoryTimestamp = this.fileSystem.GetLastDirectoryWrite(cacheDirectory); - var config = new ConfigurationBuilder().Add(new Config { TagPrefix = "prefix" }).Build(); - gitVersionOptions = new GitVersionOptions { WorkingDirectory = fixture.RepositoryPath, ConfigInfo = { OverrideConfig = config } }; + var configuration = new ConfigurationBuilder().Add(new GitVersionConfiguration { TagPrefix = "prefix" }).Build(); + gitVersionOptions = new GitVersionOptions { WorkingDirectory = fixture.RepositoryPath, ConfigInfo = { OverrideConfig = configuration } }; gitVersionCalculator = GetGitVersionCalculator(gitVersionOptions); versionVariables = gitVersionCalculator.CalculateVersionVariables(); @@ -214,7 +213,7 @@ public void CacheFileExistsOnDiskWhenOverrideConfigIsSpecifiedVersionShouldBeDyn versionVariables.AssemblySemVer.ShouldBe("0.0.1.0"); var cachedDirectoryTimestampAfter = this.fileSystem.GetLastDirectoryWrite(cacheDirectory); - cachedDirectoryTimestampAfter.ShouldBe(cacheDirectoryTimestamp, "Cache was updated when override config was set"); + cachedDirectoryTimestampAfter.ShouldBe(cacheDirectoryTimestamp, "Cache was updated when override configuration was set"); } [Test] @@ -287,7 +286,7 @@ public void ConfigChangeInvalidatesCache() versionVariables = gitVersionCalculator.CalculateVersionVariables(); versionVariables.AssemblySemVer.ShouldBe("4.10.3.0"); - var configPath = PathHelper.Combine(fixture.RepositoryPath, ConfigFileLocator.DefaultFileName); + var configPath = PathHelper.Combine(fixture.RepositoryPath, ConfigurationFileLocator.DefaultFileName); this.fileSystem.WriteAllText(configPath, "next-version: 5.0.0"); gitVersionCalculator = GetGitVersionCalculator(gitVersionOptions, fs: this.fileSystem); diff --git a/src/GitVersion.Core.Tests/Core/RepositoryStoreTests.cs b/src/GitVersion.Core.Tests/Core/RepositoryStoreTests.cs index 8aca3eeeb1..e4a3bf545b 100644 --- a/src/GitVersion.Core.Tests/Core/RepositoryStoreTests.cs +++ b/src/GitVersion.Core.Tests/Core/RepositoryStoreTests.cs @@ -1,8 +1,8 @@ using GitTools.Testing; +using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Core.Tests.IntegrationTests; using GitVersion.Logging; -using GitVersion.Model.Configuration; using Microsoft.Extensions.DependencyInjection; using NUnit.Framework; using Shouldly; @@ -228,7 +228,7 @@ public void FindCommitBranchWasBranchedFromShouldReturnNullIfTheRemoteIsTheOnlyS var branch = localRepository.FindBranch("main"); branch.ShouldNotBeNull(); - var branchedCommit = gitRepoMetadataProvider.FindCommitBranchWasBranchedFrom(branch, new Config(), Array.Empty()); + var branchedCommit = gitRepoMetadataProvider.FindCommitBranchWasBranchedFrom(branch, new GitVersionConfiguration(), Array.Empty()); Assert.IsNull(branchedCommit.Branch); Assert.IsNull(branchedCommit.Commit); diff --git a/src/GitVersion.Core.Tests/DocumentationTests.cs b/src/GitVersion.Core.Tests/DocumentationTests.cs index 2844a20361..f0df4f1744 100644 --- a/src/GitVersion.Core.Tests/DocumentationTests.cs +++ b/src/GitVersion.Core.Tests/DocumentationTests.cs @@ -1,6 +1,6 @@ +using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Helpers; -using GitVersion.Model.Configuration; using GitVersion.OutputVariables; using NUnit.Framework; using Shouldly; @@ -22,9 +22,9 @@ public void ConfigurationDocumentationIsUpToDate() var configurationDocumentationFile = ReadDocumentationFile("input/docs/reference/configuration.md"); const BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.Instance; - var configProperties = typeof(Config) + var configProperties = typeof(GitVersionConfiguration) .GetProperties(bindingFlags) - .Union(typeof(BranchConfig).GetProperties(bindingFlags)) + .Union(typeof(BranchConfiguration).GetProperties(bindingFlags)) .Select(p => p.GetCustomAttribute()) .Where(a => a != null) .Select(a => a?.Alias) diff --git a/src/GitVersion.Core.Tests/Extensions/GitToolsTestingExtensions.cs b/src/GitVersion.Core.Tests/Extensions/GitToolsTestingExtensions.cs index f50d11f9f3..2a4d344237 100644 --- a/src/GitVersion.Core.Tests/Extensions/GitToolsTestingExtensions.cs +++ b/src/GitVersion.Core.Tests/Extensions/GitToolsTestingExtensions.cs @@ -3,7 +3,6 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Extensions; -using GitVersion.Model.Configuration; using GitVersion.OutputVariables; using GitVersion.VersionCalculation; using LibGit2Sharp; @@ -54,10 +53,8 @@ public static IBranch CreateMockBranch(string name, params ICommit[] commits) public static void DumpGraph(this IRepository repository, Action? writer = null, int? maxCommits = null) => GitExtensions.DumpGraph(repository.ToGitRepository().Path, writer, maxCommits); - public static VersionVariables GetVersion(this RepositoryFixtureBase fixture, Config? configuration = null, IRepository? repository = null, string? commitId = null, bool onlyTrackedBranches = true, string? branch = null) + public static VersionVariables GetVersion(this RepositoryFixtureBase fixture, GitVersionConfiguration? configuration = null, IRepository? repository = null, string? commitId = null, bool onlyTrackedBranches = true, string? branch = null) { - configuration ??= new ConfigurationBuilder().Build(); - repository ??= fixture.Repository; var options = Options.Create(new GitVersionOptions @@ -104,7 +101,7 @@ public static void WriteVersionVariables(this RepositoryFixtureBase fixture, str writer.Write(versionInfo.ToString()); } - public static void AssertFullSemver(this RepositoryFixtureBase fixture, string fullSemver, Config? configuration = null, IRepository? repository = null, string? commitId = null, bool onlyTrackedBranches = true, string? targetBranch = null) + public static void AssertFullSemver(this RepositoryFixtureBase fixture, string fullSemver, GitVersionConfiguration? configuration = null, IRepository? repository = null, string? commitId = null, bool onlyTrackedBranches = true, string? targetBranch = null) { Console.WriteLine("---------"); diff --git a/src/GitVersion.Core.Tests/Helpers/EmptyConfigurationBuilder.cs b/src/GitVersion.Core.Tests/Helpers/EmptyConfigurationBuilder.cs new file mode 100644 index 0000000000..850cf36a63 --- /dev/null +++ b/src/GitVersion.Core.Tests/Helpers/EmptyConfigurationBuilder.cs @@ -0,0 +1,10 @@ +namespace GitVersion.Core.Tests.Helpers; + +internal sealed class EmptyConfigurationBuilder : TestConfigurationBuilderBase +{ + public static EmptyConfigurationBuilder New => new(); + + private EmptyConfigurationBuilder() + { + } +} diff --git a/src/GitVersion.Core.Tests/Helpers/GitFlowConfigurationBuilder.cs b/src/GitVersion.Core.Tests/Helpers/GitFlowConfigurationBuilder.cs new file mode 100644 index 0000000000..09028e451b --- /dev/null +++ b/src/GitVersion.Core.Tests/Helpers/GitFlowConfigurationBuilder.cs @@ -0,0 +1,191 @@ +using GitVersion.Extensions; +using GitVersion.VersionCalculation; + +namespace GitVersion.Core.Tests.Helpers; + +internal sealed class GitFlowConfigurationBuilder : TestConfigurationBuilderBase +{ + public static GitFlowConfigurationBuilder New => new(); + + private GitFlowConfigurationBuilder() + { + WithConfiguration(new() + { + AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatch, + AssemblyFileVersioningScheme = AssemblyFileVersioningScheme.MajorMinorPatch, + TagPrefix = "[vV]", + VersioningMode = VersioningMode.ContinuousDelivery, + ContinuousDeploymentFallbackTag = "ci", + MajorVersionBumpMessage = IncrementStrategyFinder.DefaultMajorPattern, + MinorVersionBumpMessage = IncrementStrategyFinder.DefaultMinorPattern, + PatchVersionBumpMessage = IncrementStrategyFinder.DefaultPatchPattern, + NoBumpMessage = IncrementStrategyFinder.DefaultNoBumpPattern, + CommitMessageIncrementing = CommitMessageIncrementMode.Enabled, + CommitDateFormat = "yyyy-MM-dd", + UpdateBuildNumber = true, + SemanticVersionFormat = SemanticVersionFormat.Strict, + TagPreReleaseWeight = 60000, + Increment = IncrementStrategy.Inherit + }); + + WithBranch(DevelopBranch.Name).WithConfiguration(new() + { + VersioningMode = VersioningMode.ContinuousDeployment, + Increment = IncrementStrategy.Minor, + Regex = DevelopBranch.RegexPattern, + SourceBranches = new HashSet(), + Tag = "alpha", + PreventIncrementOfMergedBranchVersion = false, + TrackMergeTarget = true, + TracksReleaseBranches = true, + IsMainline = false, + IsReleaseBranch = false, + PreReleaseWeight = 0 + }); + + WithBranch(MainBranch.Name).WithConfiguration(new() + { + VersioningMode = VersioningMode.ContinuousDelivery, + Increment = IncrementStrategy.Patch, + Regex = MainBranch.RegexPattern, + SourceBranches = new HashSet { + DevelopBranch.Name, + ReleaseBranch.Name + }, + Tag = string.Empty, + PreventIncrementOfMergedBranchVersion = true, + TrackMergeTarget = false, + TracksReleaseBranches = false, + IsMainline = true, + IsReleaseBranch = false, + PreReleaseWeight = 55000 + }); + + WithBranch(ReleaseBranch.Name).WithConfiguration(new() + { + VersioningMode = VersioningMode.ContinuousDelivery, + Increment = IncrementStrategy.None, + Regex = ReleaseBranch.RegexPattern, + SourceBranches = new HashSet { + DevelopBranch.Name, + MainBranch.Name, + SupportBranch.Name, + ReleaseBranch.Name + }, + Tag = "beta", + PreventIncrementOfMergedBranchVersion = true, + TrackMergeTarget = false, + TracksReleaseBranches = false, + IsMainline = false, + IsReleaseBranch = true, + PreReleaseWeight = 30000 + }); + + WithBranch(FeatureBranch.Name).WithConfiguration(new() + { + VersioningMode = VersioningMode.ContinuousDelivery, + Increment = IncrementStrategy.Inherit, + Regex = FeatureBranch.RegexPattern, + SourceBranches = new HashSet { + DevelopBranch.Name, + MainBranch.Name, + ReleaseBranch.Name, + FeatureBranch.Name, + SupportBranch.Name, + HotfixBranch.Name + }, + Tag = "{BranchName}", + PreReleaseWeight = 30000 + }); + + WithBranch(PullRequestBranch.Name).WithConfiguration(new() + { + VersioningMode = VersioningMode.ContinuousDelivery, + Increment = IncrementStrategy.Inherit, + Regex = PullRequestBranch.RegexPattern, + SourceBranches = new HashSet { + DevelopBranch.Name, + MainBranch.Name, + ReleaseBranch.Name, + FeatureBranch.Name, + SupportBranch.Name, + HotfixBranch.Name + }, + Tag = "PullRequest", + TagNumberPattern = @"[/-](?\d+)", + PreReleaseWeight = 30000 + }); + + WithBranch(HotfixBranch.Name).WithConfiguration(new() + { + VersioningMode = VersioningMode.ContinuousDelivery, + Increment = IncrementStrategy.Inherit, + Regex = HotfixBranch.RegexPattern, + SourceBranches = new HashSet { + ReleaseBranch.Name, + MainBranch.Name, + SupportBranch.Name, + HotfixBranch.Name + }, + Tag = "beta", + PreReleaseWeight = 30000 + }); + + WithBranch(SupportBranch.Name).WithConfiguration(new() + { + VersioningMode = VersioningMode.ContinuousDelivery, + Increment = IncrementStrategy.Patch, + Regex = SupportBranch.RegexPattern, + SourceBranches = new HashSet { MainBranch.Name }, + Tag = string.Empty, + PreventIncrementOfMergedBranchVersion = true, + TrackMergeTarget = false, + TracksReleaseBranches = false, + IsMainline = true, + IsReleaseBranch = false, + PreReleaseWeight = 55000 + }); + } + + public static BranchMetaData MainBranch = new() + { + Name = "main", + RegexPattern = "^master$|^main$" + }; + + public static BranchMetaData DevelopBranch = new() + { + Name = "develop", + RegexPattern = "^dev(elop)?(ment)?$" + }; + + public static BranchMetaData ReleaseBranch = new() + { + Name = "release", + RegexPattern = "^releases?[/-]" + }; + + public static BranchMetaData FeatureBranch = new() + { + Name = "feature", + RegexPattern = "^features?[/-]" + }; + + public static BranchMetaData PullRequestBranch = new() + { + Name = "pull-request", + RegexPattern = @"^(pull|pull\-requests|pr)[/-]" + }; + + public static BranchMetaData HotfixBranch = new() + { + Name = "hotfix", + RegexPattern = "^hotfix(es)?[/-]" + }; + + public static BranchMetaData SupportBranch = new() + { + Name = "support", + RegexPattern = "^support[/-]" + }; +} diff --git a/src/GitVersion.Core.Tests/Helpers/GitHubFlowConfigurationBuilder.cs b/src/GitVersion.Core.Tests/Helpers/GitHubFlowConfigurationBuilder.cs new file mode 100644 index 0000000000..49de2d5e6c --- /dev/null +++ b/src/GitVersion.Core.Tests/Helpers/GitHubFlowConfigurationBuilder.cs @@ -0,0 +1,119 @@ +using GitVersion.Extensions; +using GitVersion.VersionCalculation; + +namespace GitVersion.Core.Tests.Helpers; + +internal sealed class GitHubFlowConfigurationBuilder : TestConfigurationBuilderBase +{ + public static GitHubFlowConfigurationBuilder New => new(); + + private GitHubFlowConfigurationBuilder() + { + WithConfiguration(new() + { + AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatch, + AssemblyFileVersioningScheme = AssemblyFileVersioningScheme.MajorMinorPatch, + TagPrefix = "[vV]", + VersioningMode = VersioningMode.ContinuousDelivery, + ContinuousDeploymentFallbackTag = "ci", + MajorVersionBumpMessage = IncrementStrategyFinder.DefaultMajorPattern, + MinorVersionBumpMessage = IncrementStrategyFinder.DefaultMinorPattern, + PatchVersionBumpMessage = IncrementStrategyFinder.DefaultPatchPattern, + NoBumpMessage = IncrementStrategyFinder.DefaultNoBumpPattern, + CommitMessageIncrementing = CommitMessageIncrementMode.Enabled, + CommitDateFormat = "yyyy-MM-dd", + UpdateBuildNumber = true, + SemanticVersionFormat = SemanticVersionFormat.Strict, + TagPreReleaseWeight = 60000, + Increment = IncrementStrategy.Inherit + }); + + WithBranch(MainBranch.Name).WithConfiguration(new() + { + VersioningMode = VersioningMode.ContinuousDelivery, + Increment = IncrementStrategy.Patch, + Regex = MainBranch.RegexPattern, + SourceBranches = new HashSet { + ReleaseBranch.Name + }, + Tag = string.Empty, + PreventIncrementOfMergedBranchVersion = true, + TrackMergeTarget = false, + TracksReleaseBranches = false, + IsMainline = true, + IsReleaseBranch = false, + PreReleaseWeight = 55000 + }); + + WithBranch(ReleaseBranch.Name).WithConfiguration(new() + { + VersioningMode = VersioningMode.ContinuousDelivery, + Increment = IncrementStrategy.None, + Regex = ReleaseBranch.RegexPattern, + SourceBranches = new HashSet { + MainBranch.Name, + ReleaseBranch.Name + }, + Tag = "beta", + PreventIncrementOfMergedBranchVersion = true, + TrackMergeTarget = false, + TracksReleaseBranches = false, + IsMainline = false, + IsReleaseBranch = true, + PreReleaseWeight = 30000 + }); + + WithBranch(FeatureBranch.Name).WithConfiguration(new() + { + VersioningMode = VersioningMode.ContinuousDelivery, + Increment = IncrementStrategy.Inherit, + Regex = FeatureBranch.RegexPattern, + SourceBranches = new HashSet { + MainBranch.Name, + ReleaseBranch.Name, + FeatureBranch.Name + }, + Tag = "{BranchName}", + PreReleaseWeight = 30000 + }); + + WithBranch(PullRequestBranch.Name).WithConfiguration(new() + { + VersioningMode = VersioningMode.ContinuousDelivery, + Increment = IncrementStrategy.Inherit, + Regex = PullRequestBranch.RegexPattern, + SourceBranches = new HashSet { + MainBranch.Name, + ReleaseBranch.Name, + FeatureBranch.Name + }, + Tag = "PullRequest", + TagNumberPattern = @"[/-](?\d+)", + PreReleaseWeight = 30000 + }); + } + + public static BranchMetaData MainBranch = new() + { + Name = "main", + RegexPattern = "^master$|^main$" + }; + + public static BranchMetaData ReleaseBranch = new() + { + Name = "release", + RegexPattern = "^releases?[/-]" + }; + + public static BranchMetaData FeatureBranch = new() + { + Name = "feature", + RegexPattern = "^features?[/-]" + }; + + public static BranchMetaData PullRequestBranch = new() + { + Name = "pull-request", + RegexPattern = @"^(pull|pull\-requests|pr)[/-]" + }; +} diff --git a/src/GitVersion.Core.Tests/Helpers/GitVersionContextBuilder.cs b/src/GitVersion.Core.Tests/Helpers/GitVersionContextBuilder.cs index b8558d13f9..f58ff53ec0 100644 --- a/src/GitVersion.Core.Tests/Helpers/GitVersionContextBuilder.cs +++ b/src/GitVersion.Core.Tests/Helpers/GitVersionContextBuilder.cs @@ -2,7 +2,6 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Extensions; -using GitVersion.Model.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using NSubstitute; @@ -12,7 +11,7 @@ namespace GitVersion.Core.Tests; public class GitVersionContextBuilder { private IGitRepository? repository; - private Config? configuration; + private GitVersionConfiguration? configuration; public IServiceProvider? ServicesProvider; private Action? overrideServices; @@ -22,9 +21,9 @@ public GitVersionContextBuilder WithRepository(IGitRepository gitRepository) return this; } - public GitVersionContextBuilder WithConfig(Config config) + public GitVersionContextBuilder WithConfig(GitVersionConfiguration configuration) { - this.configuration = config; + this.configuration = configuration; return this; } @@ -60,14 +59,14 @@ public void Build() { var repo = this.repository ?? CreateRepository(); - var config = new ConfigurationBuilder() - .Add(this.configuration ?? new Config()) + var configuration = new ConfigurationBuilder() + .Add(this.configuration ?? new GitVersionConfiguration()) .Build(); var options = Options.Create(new GitVersionOptions { WorkingDirectory = new EmptyRepositoryFixture().RepositoryPath, - ConfigInfo = { OverrideConfig = config } + ConfigInfo = { OverrideConfig = configuration } }); this.ServicesProvider = ConfigureServices(services => diff --git a/src/GitVersion.Core.Tests/Helpers/TestBase.cs b/src/GitVersion.Core.Tests/Helpers/TestBase.cs index f39d61baa5..321dc69dde 100644 --- a/src/GitVersion.Core.Tests/Helpers/TestBase.cs +++ b/src/GitVersion.Core.Tests/Helpers/TestBase.cs @@ -1,6 +1,5 @@ using GitVersion.Configuration; using GitVersion.Extensions; -using GitVersion.Model.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; @@ -20,13 +19,13 @@ protected static IServiceProvider ConfigureServices(Action? return services.BuildServiceProvider(); } - protected static IServiceProvider BuildServiceProvider(string workingDirectory, IGitRepository repository, string branch, Config? config = null) + protected static IServiceProvider BuildServiceProvider(string workingDirectory, IGitRepository repository, string branch, GitVersionConfiguration? configuration = null) { - config ??= new ConfigurationBuilder().Build(); + configuration ??= new ConfigurationBuilder().Build(); var options = Options.Create(new GitVersionOptions { WorkingDirectory = workingDirectory, - ConfigInfo = { OverrideConfig = config }, + ConfigInfo = { OverrideConfig = configuration }, RepositoryInfo = { TargetBranch = branch } }); diff --git a/src/GitVersion.Core.Tests/Helpers/TestBranchConfigurationBuilder.cs b/src/GitVersion.Core.Tests/Helpers/TestBranchConfigurationBuilder.cs new file mode 100644 index 0000000000..24455b2dbd --- /dev/null +++ b/src/GitVersion.Core.Tests/Helpers/TestBranchConfigurationBuilder.cs @@ -0,0 +1,172 @@ +using GitVersion.Configuration; +using GitVersion.VersionCalculation; + +namespace GitVersion.Core.Tests.Helpers; + +public class TestBranchConfigurationBuilder +{ + public static TestBranchConfigurationBuilder New => new(); + + private string name; + private VersioningMode? versioningMode; + private string? tag; + private IncrementStrategy? increment; + private bool? preventIncrementOfMergedBranchVersion; + private string? tagNumberPattern; + private bool? trackMergeTarget; + private CommitMessageIncrementMode? commitMessageIncrementing; + private string? regex; + private HashSet? sourceBranches; + private HashSet? isSourceBranchFor; + private bool? tracksReleaseBranches; + private bool? isReleaseBranch; + private bool? isMainline; + private int? preReleaseWeight; + + private TestBranchConfigurationBuilder() => this.name = "Just-A-Test"; + + public virtual TestBranchConfigurationBuilder WithName(string value) + { + this.name = value; + return this; + } + + public virtual TestBranchConfigurationBuilder WithVersioningMode(VersioningMode? value) + { + this.versioningMode = value; + return this; + } + + public virtual TestBranchConfigurationBuilder WithTag(string? value) + { + this.tag = value; + return this; + } + + public virtual TestBranchConfigurationBuilder WithIncrement(IncrementStrategy? value) + { + this.increment = value; + return this; + } + + public virtual TestBranchConfigurationBuilder WithPreventIncrementOfMergedBranchVersion(bool? value) + { + this.preventIncrementOfMergedBranchVersion = value; + return this; + } + + public virtual TestBranchConfigurationBuilder WithTagNumberPattern(string? value) + { + this.tagNumberPattern = value; + return this; + } + + public virtual TestBranchConfigurationBuilder WithTrackMergeTarget(bool? value) + { + this.trackMergeTarget = value; + return this; + } + + public virtual TestBranchConfigurationBuilder WithCommitMessageIncrementing(CommitMessageIncrementMode? value) + { + this.commitMessageIncrementing = value; + return this; + } + + public virtual TestBranchConfigurationBuilder WithRegex(string? value) + { + this.regex = value; + return this; + } + + public virtual TestBranchConfigurationBuilder WithSourceBranches(IEnumerable values) + { + WithSourceBranches(values.ToArray()); + return this; + } + + public virtual TestBranchConfigurationBuilder WithSourceBranches(params string[] values) + { + this.sourceBranches = new HashSet(values); + return this; + } + + public virtual TestBranchConfigurationBuilder WithIsSourceBranchFor(IEnumerable values) + { + WithIsSourceBranchFor(values.ToArray()); + return this; + } + + public virtual TestBranchConfigurationBuilder WithIsSourceBranchFor(params string[] values) + { + this.isSourceBranchFor = new HashSet(values); + return this; + } + + public virtual TestBranchConfigurationBuilder WithTracksReleaseBranches(bool? value) + { + this.tracksReleaseBranches = value; + return this; + } + + public virtual TestBranchConfigurationBuilder WithIsReleaseBranch(bool? value) + { + this.isReleaseBranch = value; + return this; + } + + public virtual TestBranchConfigurationBuilder WithIsMainline(bool? value) + { + this.isMainline = value; + return this; + } + + public virtual TestBranchConfigurationBuilder WithPreReleaseWeight(int? value) + { + this.preReleaseWeight = value; + return this; + } + + public virtual TestBranchConfigurationBuilder WithConfiguration(BranchConfiguration value) + { + WithName(value.Name); + WithVersioningMode(value.VersioningMode); + WithTag(value.Tag); + WithIncrement(value.Increment); + WithPreventIncrementOfMergedBranchVersion(value.PreventIncrementOfMergedBranchVersion); + WithTagNumberPattern(value.TagNumberPattern); + WithTrackMergeTarget(value.TrackMergeTarget); + WithCommitMessageIncrementing(value.CommitMessageIncrementing); + WithRegex(value.Regex); + WithTracksReleaseBranches(value.TracksReleaseBranches); + WithIsReleaseBranch(value.IsReleaseBranch); + WithIsMainline(value.IsMainline); + WithPreReleaseWeight(value.PreReleaseWeight); + WithSourceBranches(value.SourceBranches ?? Enumerable.Empty()); + WithIsSourceBranchFor(value.IsSourceBranchFor ?? Enumerable.Empty()); + return this; + } + + public BranchConfiguration Build() + { + var result = new BranchConfiguration() + { + Name = name, + VersioningMode = versioningMode, + Tag = tag, + Increment = increment, + Regex = regex, + TracksReleaseBranches = tracksReleaseBranches, + TrackMergeTarget = trackMergeTarget, + CommitMessageIncrementing = commitMessageIncrementing, + IsMainline = isMainline, + IsReleaseBranch = isReleaseBranch, + TagNumberPattern = tagNumberPattern, + PreventIncrementOfMergedBranchVersion = preventIncrementOfMergedBranchVersion, + PreReleaseWeight = preReleaseWeight, + SourceBranches = sourceBranches, + IsSourceBranchFor = isSourceBranchFor + }; + return result; + } +} diff --git a/src/GitVersion.Core.Tests/Helpers/TestConfigurationBuilder.cs b/src/GitVersion.Core.Tests/Helpers/TestConfigurationBuilder.cs deleted file mode 100644 index 2dcbf077c8..0000000000 --- a/src/GitVersion.Core.Tests/Helpers/TestConfigurationBuilder.cs +++ /dev/null @@ -1,161 +0,0 @@ -using GitVersion.Configuration; -using GitVersion.Model.Configuration; -using GitVersion.VersionCalculation; - -namespace GitVersion.Core.Tests.Helpers; - -public sealed class TestConfigurationBuilder -{ - public static TestConfigurationBuilder New => new(); - - private string? nextVersion; - private VersioningMode? versioningMode; - private readonly Dictionary versioningModeDictionary = new(); - private bool withoutAnyTrackMergeTargets; - private readonly Dictionary trackMergeTargetsDictionary = new(); - private readonly Dictionary preventIncrementOfMergedBranchVersionDictionary = new(); - private IncrementStrategy? increment; - private readonly Dictionary incrementDictionary = new(); - private readonly Dictionary tagDictionary = new(); - private IgnoreConfig? ignoreConfig; - - private TestConfigurationBuilder() - { - withoutAnyTrackMergeTargets = false; - increment = IncrementStrategy.Inherit; - versioningMode = VersioningMode.ContinuousDelivery; - } - - public TestConfigurationBuilder WithNextVersion(string? value) - { - nextVersion = value; - return this; - } - - public TestConfigurationBuilder WithVersioningMode(VersioningMode value) - { - versioningMode = value; - return this; - } - - public TestConfigurationBuilder WithoutVersioningMode() - { - versioningMode = null; - return this; - } - - public TestConfigurationBuilder WithVersioningMode(string branch, VersioningMode value) - { - versioningModeDictionary[branch] = value; - return this; - } - - public TestConfigurationBuilder WithoutVersioningMode(string branch) - { - versioningModeDictionary[branch] = null; - return this; - } - - public TestConfigurationBuilder WithTrackMergeTarget(string branch, bool value) - { - trackMergeTargetsDictionary[branch] = value; - return this; - } - - public TestConfigurationBuilder WithoutAnyTrackMergeTargets() - { - withoutAnyTrackMergeTargets = true; - trackMergeTargetsDictionary.Clear(); - return this; - } - - public TestConfigurationBuilder WithPreventIncrementOfMergedBranchVersion(string branch, bool value) - { - preventIncrementOfMergedBranchVersionDictionary[branch] = value; - return this; - } - - public TestConfigurationBuilder WithIncrement(IncrementStrategy? value) - { - increment = value; - return this; - } - - public TestConfigurationBuilder WithIncrement(string branch, IncrementStrategy value) - { - incrementDictionary[branch] = value; - return this; - } - - public TestConfigurationBuilder WithoutTag(string branch) - { - tagDictionary[branch] = null; - return this; - } - - public TestConfigurationBuilder WithTag(string branch, string value) - { - tagDictionary[branch] = value; - return this; - } - - public TestConfigurationBuilder WithIgnoreConfig(IgnoreConfig value) - { - ignoreConfig = value; - return this; - } - - public Config Build() - { - Config configuration = new() - { - NextVersion = nextVersion, - VersioningMode = versioningMode - }; - - if (ignoreConfig != null) - { - configuration.Ignore = ignoreConfig; - } - - ConfigurationBuilder configurationBuilder = new(); - configuration = configurationBuilder.Add(configuration).Build(); - - if (withoutAnyTrackMergeTargets) - { - foreach (var branchConfiguration in configuration.Branches.Values) - { - branchConfiguration.TrackMergeTarget = false; - } - } - - foreach (var item in trackMergeTargetsDictionary) - { - configuration.Branches[item.Key].TrackMergeTarget = item.Value; - } - - foreach (var item in versioningModeDictionary) - { - configuration.Branches[item.Key].VersioningMode = item.Value; - } - - foreach (var item in preventIncrementOfMergedBranchVersionDictionary) - { - configuration.Branches[item.Key].PreventIncrementOfMergedBranchVersion = item.Value; - } - - configuration.Increment = increment; - - foreach (var item in incrementDictionary) - { - configuration.Branches[item.Key].Increment = item.Value; - } - - foreach (var item in tagDictionary) - { - configuration.Branches[item.Key].Tag = item.Value; - } - - return configuration; - } -} diff --git a/src/GitVersion.Core.Tests/Helpers/TestConfigurationBuilderBase.cs b/src/GitVersion.Core.Tests/Helpers/TestConfigurationBuilderBase.cs new file mode 100644 index 0000000000..76ed28b0e2 --- /dev/null +++ b/src/GitVersion.Core.Tests/Helpers/TestConfigurationBuilderBase.cs @@ -0,0 +1,317 @@ +using GitVersion.Configuration; +using GitVersion.Extensions; +using GitVersion.VersionCalculation; + +namespace GitVersion.Core.Tests.Helpers; + +internal abstract class TestConfigurationBuilderBase + where TConfigurationBuilder : TestConfigurationBuilderBase +{ + private AssemblyVersioningScheme? assemblyVersioningScheme; + private AssemblyFileVersioningScheme? assemblyFileVersioningScheme; + private string? assemblyInformationalFormat; + private string? assemblyVersioningFormat; + private string? assemblyFileVersioningFormat; + private VersioningMode? versioningMode; + private string? tagPrefix; + private string? continuousDeploymentFallbackTag; + private string? nextVersion; + private string? majorVersionBumpMessage; + private string? minorVersionBumpMessage; + private string? patchVersionBumpMessage; + private string? noBumpMessage; + private int? tagPreReleaseWeight; + private CommitMessageIncrementMode? commitMessageIncrementing; + private IgnoreConfiguration ignore; + private IncrementStrategy? increment; + private string? commitDateFormat; + private bool? updateBuildNumber; + private SemanticVersionFormat semanticVersionFormat = SemanticVersionFormat.Strict; + private Dictionary? mergeMessageFormats; + protected readonly Dictionary branchConfigurationBuilders = new(); + + protected TestConfigurationBuilderBase() + { + if (GetType() != typeof(TConfigurationBuilder)) + { + throw new ArgumentException("The generic type parameter is not equal to the instance type."); + } + } + + public virtual TConfigurationBuilder WithAssemblyVersioningScheme(AssemblyVersioningScheme? value) + { + this.assemblyVersioningScheme = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithAssemblyFileVersioningScheme(AssemblyFileVersioningScheme? value) + { + this.assemblyFileVersioningScheme = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithAssemblyInformationalFormat(string? value) + { + this.assemblyInformationalFormat = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithAssemblyVersioningFormat(string? value) + { + this.assemblyVersioningFormat = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithAssemblyFileVersioningFormat(string? value) + { + this.assemblyFileVersioningFormat = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithoutVersioningMode() + { + this.versioningMode = null; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithVersioningMode(VersioningMode value) + { + this.versioningMode = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithTagPrefix(string? value) + { + this.tagPrefix = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithContinuousDeploymentFallbackTag(string? value) + { + this.continuousDeploymentFallbackTag = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithNextVersion(string? value) + { + this.nextVersion = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithMajorVersionBumpMessage(string? value) + { + this.majorVersionBumpMessage = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithMinorVersionBumpMessage(string? value) + { + this.minorVersionBumpMessage = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithPatchVersionBumpMessage(string? value) + { + this.patchVersionBumpMessage = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithNoBumpMessage(string? value) + { + this.noBumpMessage = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithTagPreReleaseWeight(int? value) + { + this.tagPreReleaseWeight = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithCommitMessageIncrementing(CommitMessageIncrementMode? value) + { + this.commitMessageIncrementing = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithIgnoreConfiguration(IgnoreConfiguration value) + { + this.ignore = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithIncrement(IncrementStrategy? value) + { + this.increment = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithCommitDateFormat(string? value) + { + this.commitDateFormat = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithUpdateBuildNumber(bool? value) + { + this.updateBuildNumber = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithSemanticVersionFormat(SemanticVersionFormat value) + { + this.semanticVersionFormat = value; + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithMergeMessageFormats(Dictionary value) + { + this.mergeMessageFormats = value; + return (TConfigurationBuilder)this; + } + + public virtual TestBranchConfigurationBuilder WithBranch(string value) + { + var result = this.branchConfigurationBuilders.GetOrAdd(value, () => TestBranchConfigurationBuilder.New); + result.WithName(value); + return result; + } + + public virtual TConfigurationBuilder WithBranch(string value, Action action) + { + var result = this.branchConfigurationBuilders.GetOrAdd(value, () => TestBranchConfigurationBuilder.New); + result.WithName(value); + action(result); + return (TConfigurationBuilder)this; + } + + public virtual TConfigurationBuilder WithConfiguration(GitVersionConfiguration value) + { + WithAssemblyVersioningScheme(value.AssemblyVersioningScheme); + WithAssemblyFileVersioningScheme(value.AssemblyFileVersioningScheme); + WithAssemblyInformationalFormat(value.AssemblyInformationalFormat); + WithAssemblyVersioningFormat(value.AssemblyVersioningFormat); + WithAssemblyFileVersioningFormat(value.AssemblyFileVersioningFormat); + if (value.VersioningMode.HasValue) + { + WithVersioningMode(value.VersioningMode.Value); + } + else + { + WithoutVersioningMode(); + } + WithTagPrefix(value.TagPrefix); + WithContinuousDeploymentFallbackTag(value.ContinuousDeploymentFallbackTag); + WithNextVersion(value.NextVersion); + WithMajorVersionBumpMessage(value.MajorVersionBumpMessage); + WithMinorVersionBumpMessage(value.MinorVersionBumpMessage); + WithPatchVersionBumpMessage(value.PatchVersionBumpMessage); + WithNoBumpMessage(value.NoBumpMessage); + WithTagPreReleaseWeight(value.TagPreReleaseWeight); + WithCommitMessageIncrementing(value.CommitMessageIncrementing); + WithIgnoreConfiguration(value.Ignore); + WithIncrement(value.Increment); + WithCommitDateFormat(value.CommitDateFormat); + WithUpdateBuildNumber(value.UpdateBuildNumber); + WithSemanticVersionFormat(value.SemanticVersionFormat); + WithMergeMessageFormats(value.MergeMessageFormats); + foreach (var (name, branchConfiguration) in value.Branches) + { + WithBranch(name).WithConfiguration(branchConfiguration); + } + return (TConfigurationBuilder)this; + } + + public virtual GitVersionConfiguration Build() + { + GitVersionConfiguration configuration = new() + { + AssemblyVersioningScheme = this.assemblyVersioningScheme, + AssemblyFileVersioningScheme = this.assemblyFileVersioningScheme, + AssemblyInformationalFormat = this.assemblyInformationalFormat, + AssemblyVersioningFormat = this.assemblyVersioningFormat, + AssemblyFileVersioningFormat = this.assemblyFileVersioningFormat, + VersioningMode = this.versioningMode, + TagPrefix = this.tagPrefix, + ContinuousDeploymentFallbackTag = this.continuousDeploymentFallbackTag, + NextVersion = this.nextVersion, + MajorVersionBumpMessage = this.majorVersionBumpMessage, + MinorVersionBumpMessage = this.minorVersionBumpMessage, + PatchVersionBumpMessage = this.patchVersionBumpMessage, + NoBumpMessage = this.noBumpMessage, + TagPreReleaseWeight = this.tagPreReleaseWeight, + CommitMessageIncrementing = this.commitMessageIncrementing, + Ignore = this.ignore, + Increment = this.increment, + CommitDateFormat = this.commitDateFormat, + UpdateBuildNumber = this.updateBuildNumber, + SemanticVersionFormat = this.semanticVersionFormat, + MergeMessageFormats = this.mergeMessageFormats ?? new() + }; + Dictionary branches = new(); + foreach (var (name, branchConfigurationBuilder) in this.branchConfigurationBuilders) + { + branches.Add(name, branchConfigurationBuilder.Build()); + } + + FinalizeConfiguration(configuration); + ValidateConfiguration(configuration); + + configuration.Branches = branches; + return configuration; + } + + private static void FinalizeConfiguration(GitVersionConfiguration configuration) + { + foreach (var (name, branchConfiguration) in configuration.Branches) + { + FinalizeBranchConfiguration(configuration, name, branchConfiguration); + } + } + + private static void FinalizeBranchConfiguration(GitVersionConfiguration configuration, string name, BranchConfiguration branchConfiguration) + { + branchConfiguration.Name = name; + if (branchConfiguration.IsSourceBranchFor == null) + return; + + foreach (var targetBranchName in branchConfiguration.IsSourceBranchFor) + { + var targetBranchConfig = configuration.Branches[targetBranchName]; + targetBranchConfig.SourceBranches ??= new HashSet(); + targetBranchConfig.SourceBranches.Add(name); + } + } + + private static void ValidateConfiguration(GitVersionConfiguration configuration) + { + foreach (var (name, branchConfiguration) in configuration.Branches) + { + var helpUrl = $"{System.Environment.NewLine}See https://gitversion.net/docs/reference/configuration for more info"; + + if (branchConfiguration.Regex == null) + { + throw new ConfigurationException($"Branch configuration '{name}' is missing required configuration 'regex'{helpUrl}"); + } + + var sourceBranches = branchConfiguration?.SourceBranches; + if (sourceBranches == null) + { + throw new ConfigurationException($"Branch configuration '{name}' is missing required configuration 'source-branches'{helpUrl}"); + } + + var missingSourceBranches = sourceBranches.Where(sb => !configuration.Branches.ContainsKey(sb)).ToArray(); + if (missingSourceBranches.Any()) + { + throw new ConfigurationException($"Branch configuration '{name}' defines these 'source-branches' that are not configured: '[{string.Join(",", missingSourceBranches)}]'{helpUrl}"); + } + } + } + + public record BranchMetaData + { + public string Name { get; init; } + + public string RegexPattern { get; init; } + } +} diff --git a/src/GitVersion.Core.Tests/Helpers/TestEffectiveConfiguration.cs b/src/GitVersion.Core.Tests/Helpers/TestEffectiveConfiguration.cs index 3108784245..5807d33553 100644 --- a/src/GitVersion.Core.Tests/Helpers/TestEffectiveConfiguration.cs +++ b/src/GitVersion.Core.Tests/Helpers/TestEffectiveConfiguration.cs @@ -1,5 +1,5 @@ +using GitVersion.Configuration; using GitVersion.Extensions; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; namespace GitVersion.Core.Tests.Helpers; diff --git a/src/GitVersion.Core.Tests/IntegrationTests/ContinuousDeploymentTestScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/ContinuousDeploymentTestScenarios.cs index 85a7d72e15..80e109c726 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/ContinuousDeploymentTestScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/ContinuousDeploymentTestScenarios.cs @@ -13,7 +13,10 @@ public void ShouldUseTheFallbackVersionOnMainWhenNoVersionsAreAvailable() { // * 2373a87 58 minutes ago (HEAD -> main) - var configuration = TestConfigurationBuilder.New.WithVersioningMode(VersioningMode.ContinuousDeployment).Build(); + var configuration = GitFlowConfigurationBuilder.New + .WithVersioningMode(VersioningMode.ContinuousDeployment) + .WithBranch("main", builder => builder.WithVersioningMode(VersioningMode.ContinuousDeployment)) + .Build(); using var fixture = new EmptyRepositoryFixture(); @@ -30,7 +33,7 @@ public void ShouldUseTheFallbackVersionOnDevelopWhenNoVersionsAreAvailable() { // * a831d61 58 minutes ago (HEAD -> develop) - var configuration = TestConfigurationBuilder.New.WithVersioningMode(VersioningMode.ContinuousDeployment).Build(); + var configuration = GitFlowConfigurationBuilder.New.WithVersioningMode(VersioningMode.ContinuousDeployment).Build(); using var fixture = new EmptyRepositoryFixture("develop"); @@ -47,9 +50,10 @@ public void ShouldUseConfiguredNextVersionOnMainWhenNoHigherVersionsAvailable() { // * 8c64db3 58 minutes ago (HEAD -> main) - var configuration = TestConfigurationBuilder.New - .WithVersioningMode(VersioningMode.ContinuousDeployment) - .WithNextVersion("1.0.0").Build(); + var configuration = GitFlowConfigurationBuilder.New + .WithNextVersion("1.0.0").WithVersioningMode(VersioningMode.ContinuousDeployment) + .WithBranch("main", builder => builder.WithVersioningMode(VersioningMode.ContinuousDeployment)) + .Build(); using var fixture = new EmptyRepositoryFixture(); @@ -66,7 +70,7 @@ public void ShouldNotMatterWhenConfiguredNextVersionIsEqualsToTheTaggeVersion() { // * 858f71b 58 minutes ago (HEAD -> main, tag: 1.0.0) - var configuration = TestConfigurationBuilder.New + var configuration = GitFlowConfigurationBuilder.New .WithVersioningMode(VersioningMode.ContinuousDeployment) .WithNextVersion("1.0.0").Build(); @@ -85,7 +89,7 @@ public void ShouldUseTaggedVersionWhenGreaterThanConfiguredNextVersion() { // * ba74727 58 minutes ago (HEAD -> main, tag: 1.1.0) - var configuration = TestConfigurationBuilder.New + var configuration = GitFlowConfigurationBuilder.New .WithVersioningMode(VersioningMode.ContinuousDeployment) .WithNextVersion("1.0.0").Build(); @@ -108,7 +112,11 @@ public void ShouldCalculateTheCorrectVersionWhenMergingFromMainToFeatureBranch() // |/ // *ec77f9c 58 minutes ago - var configuration = TestConfigurationBuilder.New.WithVersioningMode(VersioningMode.ContinuousDeployment).Build(); + var configuration = GitFlowConfigurationBuilder.New + .WithVersioningMode(VersioningMode.ContinuousDeployment) + .WithBranch("main", builder => builder.WithVersioningMode(VersioningMode.ContinuousDeployment)) + .WithBranch("feature", builder => builder.WithVersioningMode(VersioningMode.ContinuousDeployment)) + .Build(); using var fixture = new EmptyRepositoryFixture(); @@ -154,7 +162,11 @@ public void ShouldCalculateTheCorrectVersionWhenMergingFromDevelopToFeatureBranc // |/ // *67acc03 58 minutes ago(main) - var configuration = TestConfigurationBuilder.New.WithVersioningMode(VersioningMode.ContinuousDeployment).Build(); + var configuration = GitFlowConfigurationBuilder.New + .WithVersioningMode(VersioningMode.ContinuousDeployment) + .WithBranch("develop", builder => builder.WithVersioningMode(VersioningMode.ContinuousDeployment)) + .WithBranch("feature", builder => builder.WithVersioningMode(VersioningMode.ContinuousDeployment)) + .Build(); using var fixture = new EmptyRepositoryFixture(); @@ -202,7 +214,12 @@ public void ShouldCalculateTheCorrectVersionWhenMergingFromReleaseToFeatureBranc // |/ // *f63a536 58 minutes ago(main) - var configuration = TestConfigurationBuilder.New.WithVersioningMode(VersioningMode.ContinuousDeployment).Build(); + var configuration = GitFlowConfigurationBuilder.New + .WithVersioningMode(VersioningMode.ContinuousDeployment) + .WithBranch("main", builder => builder.WithVersioningMode(VersioningMode.ContinuousDeployment)) + .WithBranch("release", builder => builder.WithVersioningMode(VersioningMode.ContinuousDeployment)) + .WithBranch("feature", builder => builder.WithVersioningMode(VersioningMode.ContinuousDeployment)) + .Build(); using var fixture = new EmptyRepositoryFixture(); @@ -252,9 +269,17 @@ public void ShouldFallbackToTheVersionOnDevelopLikeTheReleaseWasNeverCreatedWhen // *f5640b3 56 minutes ago // *2099a07 58 minutes ago(main) - var configuration = TestConfigurationBuilder.New - .WithVersioningMode(VersioningMode.ContinuousDeployment) - .WithoutAnyTrackMergeTargets().Build(); + var configuration = GitFlowConfigurationBuilder.New + .WithBranch("main", builder => builder + .WithVersioningMode(VersioningMode.ContinuousDeployment).WithTrackMergeTarget(false) + ) + .WithBranch("develop", builder => builder + .WithVersioningMode(VersioningMode.ContinuousDeployment).WithTrackMergeTarget(false) + ) + .WithBranch("release", builder => builder + .WithVersioningMode(VersioningMode.ContinuousDeployment).WithTrackMergeTarget(false) + ) + .Build(); using var fixture = new EmptyRepositoryFixture(); @@ -328,9 +353,17 @@ public void ShouldConsiderTheMergeCommitFromMainToDevelopWhenReleaseHasBeenMerge // |/ // * 252971e 58 minutes ago - var configuration = TestConfigurationBuilder.New - .WithVersioningMode(VersioningMode.ContinuousDeployment) - .WithoutAnyTrackMergeTargets().Build(); + var configuration = GitFlowConfigurationBuilder.New + .WithBranch("main", builder => builder + .WithVersioningMode(VersioningMode.ContinuousDeployment).WithTrackMergeTarget(false) + ) + .WithBranch("develop", builder => builder + .WithVersioningMode(VersioningMode.ContinuousDeployment).WithTrackMergeTarget(false) + ) + .WithBranch("release", builder => builder + .WithVersioningMode(VersioningMode.ContinuousDeployment).WithTrackMergeTarget(false) + ) + .Build(); using var fixture = new EmptyRepositoryFixture(); diff --git a/src/GitVersion.Core.Tests/IntegrationTests/CreatingAFeatureBranchFromAReleaseBranchScenario.cs b/src/GitVersion.Core.Tests/IntegrationTests/CreatingAFeatureBranchFromAReleaseBranchScenario.cs index bdc6e9d8d6..f2bf15538f 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/CreatingAFeatureBranchFromAReleaseBranchScenario.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/CreatingAFeatureBranchFromAReleaseBranchScenario.cs @@ -22,7 +22,7 @@ public void ShouldTreatTheFeatureBranchLikeTheFirstReleaseBranchWhenItHasBeenBra // |/ // *e0b5034 6 seconds ago - var configuration = TestConfigurationBuilder.New.Build(); + var configuration = GitFlowConfigurationBuilder.New.Build(); using var fixture = new EmptyRepositoryFixture("main"); @@ -98,7 +98,7 @@ public void ShouldTreatTheFeatureBranchNotLikeTheReleaseBranchWhenItHasBeenBranc // |/ // *d5ac9aa in the future - var configuration = TestConfigurationBuilder.New.Build(); + var configuration = GitFlowConfigurationBuilder.New.Build(); using var fixture = new EmptyRepositoryFixture("develop"); @@ -182,7 +182,7 @@ public void ShouldTreatTheHotfixBranchLikeTheFirstReleaseBranchWhenItHasBeenBran // |/ // *e00f53d 49 minutes ago - var configuration = TestConfigurationBuilder.New.Build(); + var configuration = GitFlowConfigurationBuilder.New.Build(); using var fixture = new EmptyRepositoryFixture(branchName); @@ -253,7 +253,7 @@ public void ShouldTreatTheFeatureBranchLikeTheFirstReleaseBranchWhenItHasBeenBra // |/ // *22596b8 47 minutes ago - var configuration = TestConfigurationBuilder.New.Build(); + var configuration = GitFlowConfigurationBuilder.New.Build(); using var fixture = new EmptyRepositoryFixture(branchName); fixture.Repository.MakeACommit(); @@ -325,7 +325,7 @@ public void ShouldTreatTheHotfixBranchLikeTheFirstReleaseBranchWhenItHasBeenBran // |/ // *22596b8 47 minutes ago - var configuration = TestConfigurationBuilder.New.Build(); + var configuration = GitFlowConfigurationBuilder.New.Build(); using var fixture = new EmptyRepositoryFixture(branchName); fixture.Repository.MakeACommit(); @@ -393,7 +393,7 @@ public void ShouldTreatTheFeatureBranchLikeTheReleaseBranchWhenItHasBeenBranched // *9e557cd in the future // *2e022d7 in the future(main) - var configuration = TestConfigurationBuilder.New.Build(); + var configuration = GitFlowConfigurationBuilder.New.Build(); using var fixture = new EmptyRepositoryFixture(); @@ -458,7 +458,7 @@ public void ShouldTreatTheMergeFromReleaseToDevelopLikeTheReleaseBranchHasNeverB // *9dc9b22 in the future // *f708abd in the future(main) - var configuration = TestConfigurationBuilder.New.Build(); + var configuration = GitFlowConfigurationBuilder.New.Build(); using var fixture = new EmptyRepositoryFixture(); @@ -537,7 +537,7 @@ public void ShouldOnlyTrackTheCommitsOnDevelopBranchForNextReleaseWhenReleaseHas // |/ // *838a95b in the future - var configuration = TestConfigurationBuilder.New.Build(); + var configuration = GitFlowConfigurationBuilder.New.Build(); using var fixture = new EmptyRepositoryFixture(); @@ -626,7 +626,7 @@ public void ShouldNotConsiderTheMergeCommitFromReleaseToMainWhenCommitHasNotBeen // |/ // *42db9ba in the future - var configuration = TestConfigurationBuilder.New.Build(); + var configuration = GitFlowConfigurationBuilder.New.Build(); using var fixture = new EmptyRepositoryFixture(); diff --git a/src/GitVersion.Core.Tests/IntegrationTests/DevelopScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/DevelopScenarios.cs index 666393118d..2abebc72aa 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/DevelopScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/DevelopScenarios.cs @@ -1,6 +1,6 @@ using GitTools.Testing; +using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; using LibGit2Sharp; using NUnit.Framework; @@ -54,13 +54,13 @@ public void WhenDevelopBranchedFromTaggedCommitOnMainVersionDoesNotChange() [Test] public void CanChangeDevelopTagViaConfig() { - var config = new Config + var configuration = new GitVersionConfiguration { Branches = { { "develop", - new BranchConfig + new BranchConfiguration { Tag = "alpha", SourceBranches = new HashSet() @@ -72,7 +72,7 @@ public void CanChangeDevelopTagViaConfig() fixture.Repository.MakeATaggedCommit("1.0.0"); Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("develop")); fixture.Repository.MakeACommit(); - fixture.AssertFullSemver("1.1.0-alpha.1", config); + fixture.AssertFullSemver("1.1.0-alpha.1", configuration); } [Test] @@ -115,15 +115,15 @@ public void MergingReleaseBranchBackIntoDevelopWithMergingToMainDoesBumpDevelopV [Test] public void CanHandleContinuousDelivery() { - var config = new Config + var configuration = new GitVersionConfiguration { - Branches = { { "develop", new BranchConfig { VersioningMode = VersioningMode.ContinuousDelivery } } } + Branches = { { "develop", new BranchConfiguration { VersioningMode = VersioningMode.ContinuousDelivery } } } }; using var fixture = new EmptyRepositoryFixture(); fixture.Repository.MakeATaggedCommit("1.0.0"); Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("develop")); fixture.Repository.MakeATaggedCommit("1.1.0-alpha7"); - fixture.AssertFullSemver("1.1.0-alpha.7", config); + fixture.AssertFullSemver("1.1.0-alpha.7", configuration); } [Test] @@ -222,7 +222,7 @@ public void TagOnHotfixShouldNotAffectDevelop() [Test] public void CommitsSinceVersionSourceShouldNotGoDownUponGitFlowReleaseFinish() { - var config = new Config + var configuration = new GitVersionConfiguration { VersioningMode = VersioningMode.ContinuousDeployment }; @@ -257,13 +257,13 @@ public void CommitsSinceVersionSourceShouldNotGoDownUponGitFlowReleaseFinish() fixture.Repository.Branches.Remove("release/1.2.0"); const string expectedFullSemVer = "1.3.0-alpha.9"; - fixture.AssertFullSemver(expectedFullSemVer, config); + fixture.AssertFullSemver(expectedFullSemVer, configuration); } [Test] public void CommitsSinceVersionSourceShouldNotGoDownUponMergingFeatureOnlyToDevelop() { - var config = new Config + var configuration = new GitVersionConfiguration { VersioningMode = VersioningMode.ContinuousDeployment }; @@ -289,7 +289,7 @@ public void CommitsSinceVersionSourceShouldNotGoDownUponMergingFeatureOnlyToDeve fixture.Repository.Branches.Remove("release/1.2.0"); const string expectedFullSemVer = "1.3.0-alpha.5"; - fixture.AssertFullSemver(expectedFullSemVer, config); + fixture.AssertFullSemver(expectedFullSemVer, configuration); } [Test] @@ -311,12 +311,12 @@ public void PreviousPreReleaseTagShouldBeRespectedWhenCountingCommits() [Test] public void WhenPreventIncrementOfMergedBranchVersionIsSetToFalseForDevelopCommitsSinceVersionSourceShouldNotGoDownWhenMergingReleaseToDevelop() { - var config = new Config + var configuration = new GitVersionConfiguration { VersioningMode = VersioningMode.ContinuousDeployment, - Branches = new Dictionary + Branches = new Dictionary { - { "develop", new BranchConfig { PreventIncrementOfMergedBranchVersion = false } } + { "develop", new BranchConfiguration { PreventIncrementOfMergedBranchVersion = false } } } }; @@ -342,23 +342,25 @@ public void WhenPreventIncrementOfMergedBranchVersionIsSetToFalseForDevelopCommi // Version numbers will still be correct when the release branch is around. fixture.AssertFullSemver("1.2.0-alpha.6"); - fixture.AssertFullSemver("1.2.0-alpha.6", config); + fixture.AssertFullSemver("1.2.0-alpha.6", configuration); - var versionSourceBeforeReleaseBranchIsRemoved = fixture.GetVersion(config).Sha; + var versionSourceBeforeReleaseBranchIsRemoved = fixture.GetVersion(configuration).Sha; fixture.Repository.Branches.Remove(ReleaseBranch); - var versionSourceAfterReleaseBranchIsRemoved = fixture.GetVersion(config).Sha; + var versionSourceAfterReleaseBranchIsRemoved = fixture.GetVersion(configuration).Sha; Assert.AreEqual(versionSourceBeforeReleaseBranchIsRemoved, versionSourceAfterReleaseBranchIsRemoved); fixture.AssertFullSemver("1.2.0-alpha.6"); - fixture.AssertFullSemver("1.2.0-alpha.6", config); + fixture.AssertFullSemver("1.2.0-alpha.6", configuration); } [Test] public void WhenPreventIncrementOfMergedBranchVersionIsSetToTrueForDevelopCommitsSinceVersionSourceShouldNotGoDownWhenMergingReleaseToDevelop() { - var configuration = TestConfigurationBuilder.New + var configuration = GitFlowConfigurationBuilder.New .WithVersioningMode(VersioningMode.ContinuousDeployment) - .WithPreventIncrementOfMergedBranchVersion("develop", true) + .WithBranch("develop", builder => builder + .WithPreventIncrementOfMergedBranchVersion(true) + ) .Build(); using var fixture = new EmptyRepositoryFixture(); @@ -397,13 +399,13 @@ public void WhenPreventIncrementOfMergedBranchVersionIsSetToTrueForDevelopCommit [Test] public void WhenPreventIncrementOfMergedBranchVersionIsSetToFalseForDevelopCommitsSinceVersionSourceShouldNotGoDownWhenMergingHotfixToDevelop() { - var config = new Config + var configuration = new GitVersionConfiguration { VersioningMode = VersioningMode.ContinuousDeployment, - Branches = new Dictionary + Branches = new Dictionary { - { "develop", new BranchConfig { PreventIncrementOfMergedBranchVersion = false } }, - { "hotfix", new BranchConfig { PreventIncrementOfMergedBranchVersion = true, Regex = "^(origin/)?hotfix[/-]" } } + { "develop", new BranchConfiguration { PreventIncrementOfMergedBranchVersion = false } }, + { "hotfix", new BranchConfiguration { PreventIncrementOfMergedBranchVersion = true, Regex = "^(origin/)?hotfix[/-]" } } } }; @@ -416,12 +418,12 @@ public void WhenPreventIncrementOfMergedBranchVersionIsSetToFalseForDevelopCommi fixture.Checkout("develop"); fixture.Repository.MakeCommits(3); - fixture.AssertFullSemver("1.1.0-alpha.4", config); + fixture.AssertFullSemver("1.1.0-alpha.4", configuration); const string ReleaseBranch = "release/1.1.0"; Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch(ReleaseBranch)); fixture.Repository.MakeCommits(3); - fixture.AssertFullSemver("1.1.0-beta.3", config); + fixture.AssertFullSemver("1.1.0-beta.3", configuration); // Simulate a GitFlow release finish. fixture.Checkout(MainBranch); @@ -433,7 +435,7 @@ public void WhenPreventIncrementOfMergedBranchVersionIsSetToFalseForDevelopCommi fixture.Repository.MakeCommits(2); fixture.MergeNoFF(ReleaseBranch); fixture.Repository.Branches.Remove(ReleaseBranch); - fixture.AssertFullSemver("1.2.0-alpha.6", config); + fixture.AssertFullSemver("1.2.0-alpha.6", configuration); // Create hotfix for defects found in release/1.1.0 const string HotfixBranch = "hotfix/1.1.1"; @@ -450,12 +452,12 @@ public void WhenPreventIncrementOfMergedBranchVersionIsSetToFalseForDevelopCommi fixture.Checkout("develop"); // Simulate some work done on develop while the hotfix branch was open. fixture.Repository.MakeCommits(3); - fixture.AssertFullSemver("1.2.0-alpha.9", config); + fixture.AssertFullSemver("1.2.0-alpha.9", configuration); fixture.Repository.MergeNoFF(HotfixBranch); - fixture.AssertFullSemver("1.2.0-alpha.19", config); + fixture.AssertFullSemver("1.2.0-alpha.19", configuration); fixture.Repository.Branches.Remove(HotfixBranch); - fixture.AssertFullSemver("1.2.0-alpha.19", config); + fixture.AssertFullSemver("1.2.0-alpha.19", configuration); } [Test] @@ -463,7 +465,7 @@ public void NextVersionShouldBeConsideredOnTheMainBranch() { using EmptyRepositoryFixture fixture = new("main"); - var configurationBuilder = TestConfigurationBuilder.New; + var configurationBuilder = GitFlowConfigurationBuilder.New; fixture.MakeACommit(); @@ -496,7 +498,7 @@ public void PreventDecrementationOfVersionsOnTheMainBranch() { using EmptyRepositoryFixture fixture = new("develop"); - var configurationBuilder = TestConfigurationBuilder.New; + var configurationBuilder = GitFlowConfigurationBuilder.New; fixture.MakeACommit(); configurationBuilder.WithNextVersion("1.0.0"); diff --git a/src/GitVersion.Core.Tests/IntegrationTests/FeatureBranchScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/FeatureBranchScenarios.cs index 2dfff4b0ed..51902e0a01 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/FeatureBranchScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/FeatureBranchScenarios.cs @@ -1,7 +1,7 @@ using GitTools.Testing; +using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Extensions; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; using LibGit2Sharp; using NUnit.Framework; @@ -39,13 +39,13 @@ public void ShouldInheritIncrementCorrectlyWithMultiplePossibleParentsAndWeirdly [Test] public void BranchCreatedAfterFastForwardMergeShouldInheritCorrectly() { - var config = new Config + var configuration = new GitVersionConfiguration { Branches = { { "unstable", - new BranchConfig + new BranchConfiguration { Increment = IncrementStrategy.Minor, Regex = "unstable", @@ -75,7 +75,7 @@ public void BranchCreatedAfterFastForwardMergeShouldInheritCorrectly() Commands.Checkout(fixture.Repository, "feature/JIRA-124"); fixture.Repository.MakeCommits(1); - fixture.AssertFullSemver("1.1.0-JIRA-124.1+2", config); + fixture.AssertFullSemver("1.1.0-JIRA-124.1+2", configuration); } [Test] @@ -168,19 +168,19 @@ public void ShouldBePossibleToMergeDevelopForALongRunningBranchWhereDevelopAndMa Commands.Checkout(fixture.Repository, branchName); fixture.Repository.Merge(fixture.Repository.Branches["develop"], Generate.SignatureNow()); - var configuration = new Config { VersioningMode = VersioningMode.ContinuousDeployment }; + var configuration = new GitVersionConfiguration { VersioningMode = VersioningMode.ContinuousDeployment }; fixture.AssertFullSemver("1.2.0-longrunning.2", configuration); } [Test] public void CanUseBranchNameOffAReleaseBranch() { - var config = new Config + var configuration = new GitVersionConfiguration { Branches = { - { "release", new BranchConfig { Tag = "build" } }, - { "feature", new BranchConfig { Tag = "useBranchName" } } + { "release", new BranchConfiguration { Tag = "build" } }, + { "feature", new BranchConfiguration { Tag = "useBranchName" } } } }; @@ -192,7 +192,7 @@ public void CanUseBranchNameOffAReleaseBranch() fixture.BranchTo("feature/PROJ-1"); fixture.MakeACommit(); - fixture.AssertFullSemver("0.3.0-PROJ-1.1+3", config); + fixture.AssertFullSemver("0.3.0-PROJ-1.1+3", configuration); } [TestCase("alpha", "JIRA-123", "alpha")] @@ -200,11 +200,11 @@ public void CanUseBranchNameOffAReleaseBranch() [TestCase("alpha.{BranchName}", "JIRA-123", "alpha.JIRA-123")] public void ShouldUseConfiguredTag(string tag, string featureName, string preReleaseTagName) { - var config = new Config + var configuration = new GitVersionConfiguration { Branches = { - { "feature", new BranchConfig { Tag = tag } } + { "feature", new BranchConfiguration { Tag = tag } } } }; @@ -216,7 +216,7 @@ public void ShouldUseConfiguredTag(string tag, string featureName, string preRel fixture.Repository.MakeCommits(5); var expectedFullSemVer = $"1.0.1-{preReleaseTagName}.1+5"; - fixture.AssertFullSemver(expectedFullSemVer, config); + fixture.AssertFullSemver(expectedFullSemVer, configuration); } [Test] @@ -300,12 +300,12 @@ public class WhenMainAsIsDevelop [Test] public void ShouldPickUpVersionFromMainAfterReleaseBranchCreated() { - var config = new Config + var configuration = new GitVersionConfiguration { - Branches = new Dictionary + Branches = new Dictionary { { - MainBranch, new BranchConfig + MainBranch, new BranchConfiguration { TracksReleaseBranches = true, Regex = MainBranch @@ -321,22 +321,22 @@ public void ShouldPickUpVersionFromMainAfterReleaseBranchCreated() fixture.MakeACommit(); fixture.Checkout(MainBranch); fixture.MakeACommit(); - fixture.AssertFullSemver("1.0.1+1", config); + fixture.AssertFullSemver("1.0.1+1", configuration); // create a feature branch from main and verify the version fixture.BranchTo("feature/test"); - fixture.AssertFullSemver("1.0.1-test.1+1", config); + fixture.AssertFullSemver("1.0.1-test.1+1", configuration); } [Test] public void ShouldPickUpVersionFromMainAfterReleaseBranchMergedBack() { - var config = new Config + var configuration = new GitVersionConfiguration { - Branches = new Dictionary + Branches = new Dictionary { { - MainBranch, new BranchConfig + MainBranch, new BranchConfiguration { TracksReleaseBranches = true, Regex = MainBranch @@ -354,11 +354,11 @@ public void ShouldPickUpVersionFromMainAfterReleaseBranchMergedBack() // merge release into main fixture.Checkout(MainBranch); fixture.MergeNoFF("release/1.0.0"); - fixture.AssertFullSemver("1.0.1+2", config); + fixture.AssertFullSemver("1.0.1+2", configuration); // create a feature branch from main and verify the version fixture.BranchTo("feature/test"); - fixture.AssertFullSemver("1.0.1-test.1+2", config); + fixture.AssertFullSemver("1.0.1-test.1+2", configuration); } } @@ -378,7 +378,7 @@ public void ShouldPickUpVersionFromMainAfterReleaseBranchCreated() fixture.MakeACommit(); fixture.AssertFullSemver("1.1.0-alpha.1"); - // create a misnamed feature branch (i.e. it uses the default config) from develop and verify the version + // create a misnamed feature branch (i.e. it uses the default configuration) from develop and verify the version fixture.BranchTo("misnamed"); fixture.AssertFullSemver("1.1.0-misnamed.1+1"); } @@ -399,7 +399,7 @@ public void ShouldPickUpVersionFromDevelopAfterReleaseBranchMergedBack() fixture.MergeNoFF("release/1.0.0"); fixture.AssertFullSemver("1.1.0-alpha.2"); - // create a misnamed feature branch (i.e. it uses the default config) from develop and verify the version + // create a misnamed feature branch (i.e. it uses the default configuration) from develop and verify the version fixture.BranchTo("misnamed"); fixture.AssertFullSemver("1.1.0-misnamed.1+2"); } @@ -410,12 +410,12 @@ public class WhenMainMarkedAsIsDevelop [Test] public void ShouldPickUpVersionFromMainAfterReleaseBranchCreated() { - var config = new Config + var configuration = new GitVersionConfiguration { - Branches = new Dictionary + Branches = new Dictionary { { - MainBranch, new BranchConfig + MainBranch, new BranchConfiguration { TracksReleaseBranches = true, Regex = MainBranch @@ -431,22 +431,22 @@ public void ShouldPickUpVersionFromMainAfterReleaseBranchCreated() fixture.MakeACommit(); fixture.Checkout(MainBranch); fixture.MakeACommit(); - fixture.AssertFullSemver("1.0.1+1", config); + fixture.AssertFullSemver("1.0.1+1", configuration); - // create a misnamed feature branch (i.e. it uses the default config) from main and verify the version + // create a misnamed feature branch (i.e. it uses the default configuration) from main and verify the version fixture.BranchTo("misnamed"); - fixture.AssertFullSemver("1.0.1-misnamed.1+1", config); + fixture.AssertFullSemver("1.0.1-misnamed.1+1", configuration); } [Test] public void ShouldPickUpVersionFromMainAfterReleaseBranchMergedBack() { - var config = new Config + var configuration = new GitVersionConfiguration { - Branches = new Dictionary + Branches = new Dictionary { { - MainBranch, new BranchConfig + MainBranch, new BranchConfiguration { TracksReleaseBranches = true, Regex = MainBranch @@ -464,11 +464,11 @@ public void ShouldPickUpVersionFromMainAfterReleaseBranchMergedBack() // merge release into main fixture.Checkout(MainBranch); fixture.MergeNoFF("release/1.0.0"); - fixture.AssertFullSemver("1.0.1+2", config); + fixture.AssertFullSemver("1.0.1+2", configuration); - // create a misnamed feature branch (i.e. it uses the default config) from main and verify the version + // create a misnamed feature branch (i.e. it uses the default configuration) from main and verify the version fixture.BranchTo("misnamed"); - fixture.AssertFullSemver("1.0.1-misnamed.1+2", config); + fixture.AssertFullSemver("1.0.1-misnamed.1+2", configuration); } } } @@ -476,20 +476,20 @@ public void ShouldPickUpVersionFromMainAfterReleaseBranchMergedBack() [Test] public void PickUpVersionFromMainMarkedWithIsTracksReleaseBranches() { - var config = new Config + var configuration = new GitVersionConfiguration { VersioningMode = VersioningMode.ContinuousDelivery, - Branches = new Dictionary + Branches = new Dictionary { { - MainBranch, new BranchConfig + MainBranch, new BranchConfiguration { Tag = "pre", TracksReleaseBranches = true } }, { - "release", new BranchConfig + "release", new BranchConfiguration { IsReleaseBranch = true, Tag = "rc" @@ -505,37 +505,37 @@ public void PickUpVersionFromMainMarkedWithIsTracksReleaseBranches() fixture.BranchTo("release/0.10.0"); fixture.MakeACommit(); fixture.MakeACommit(); - fixture.AssertFullSemver("0.10.0-rc.1+2", config); + fixture.AssertFullSemver("0.10.0-rc.1+2", configuration); // switch to main and verify the version fixture.Checkout(MainBranch); fixture.MakeACommit(); - fixture.AssertFullSemver("0.10.1-pre.1+1", config); + fixture.AssertFullSemver("0.10.1-pre.1+1", configuration); // create a feature branch from main and verify the version fixture.BranchTo("MyFeatureD"); - fixture.AssertFullSemver("0.10.1-MyFeatureD.1+1", config); + fixture.AssertFullSemver("0.10.1-MyFeatureD.1+1", configuration); } [Test] public void ShouldHaveAGreaterSemVerAfterDevelopIsMergedIntoFeature() { - var config = new Config + var configuration = new GitVersionConfiguration { VersioningMode = VersioningMode.ContinuousDeployment, AssemblyVersioningScheme = AssemblyVersioningScheme.Major, AssemblyFileVersioningFormat = "{MajorMinorPatch}.{env:WeightedPreReleaseNumber ?? 0}", CommitMessageIncrementing = CommitMessageIncrementMode.Disabled, - Branches = new Dictionary + Branches = new Dictionary { { - "develop", new BranchConfig + "develop", new BranchConfiguration { PreventIncrementOfMergedBranchVersion = true } }, { - "feature", new BranchConfig + "feature", new BranchConfiguration { Tag = "feat-{BranchName}" } @@ -554,6 +554,6 @@ public void ShouldHaveAGreaterSemVerAfterDevelopIsMergedIntoFeature() fixture.MakeACommit(); fixture.Checkout("feature/featX"); fixture.MergeNoFF("develop"); - fixture.AssertFullSemver("16.24.0-feat-featX.4", config); + fixture.AssertFullSemver("16.24.0-feat-featX.4", configuration); } } diff --git a/src/GitVersion.Core.Tests/IntegrationTests/HotfixBranchScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/HotfixBranchScenarios.cs index 332fe6c421..8f1f2882fa 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/HotfixBranchScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/HotfixBranchScenarios.cs @@ -1,7 +1,7 @@ using GitTools.Testing; +using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Extensions; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; using LibGit2Sharp; using NUnit.Framework; @@ -127,7 +127,7 @@ public void PatchOlderReleaseExample() [Test] public void FeatureOnHotfixFeatureBranchDeleted() { - var config = new Config + var configuration = new GitVersionConfiguration { AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatchTag, VersioningMode = VersioningMode.ContinuousDeployment @@ -147,7 +147,7 @@ public void FeatureOnHotfixFeatureBranchDeleted() // create release branch fixture.Repository.CreateBranch(release450); Commands.Checkout(fixture.Repository, release450); - fixture.AssertFullSemver("4.5.0-beta.0", config); + fixture.AssertFullSemver("4.5.0-beta.0", configuration); fixture.Repository.MakeACommit("blabla"); Commands.Checkout(fixture.Repository, "develop"); fixture.Repository.MergeNoFF(release450, Generate.SignatureNow()); @@ -158,7 +158,7 @@ public void FeatureOnHotfixFeatureBranchDeleted() fixture.Repository.CreateBranch(support45); Commands.Checkout(fixture.Repository, support45); fixture.Repository.ApplyTag(tag450); - fixture.AssertFullSemver("4.5.0", config); + fixture.AssertFullSemver("4.5.0", configuration); // create hotfix branch fixture.Repository.CreateBranch(hotfix451); @@ -171,7 +171,7 @@ public void FeatureOnHotfixFeatureBranchDeleted() Commands.Checkout(fixture.Repository, hotfix451); fixture.Repository.MergeNoFF(featureBranch, Generate.SignatureNow()); // commit 2 fixture.Repository.Branches.Remove(featureBranch); - fixture.AssertFullSemver("4.5.1-beta.2", config); + fixture.AssertFullSemver("4.5.1-beta.2", configuration); } /// @@ -180,7 +180,7 @@ public void FeatureOnHotfixFeatureBranchDeleted() [Test] public void FeatureOnHotfixFeatureBranchNotDeleted() { - var config = new Config + var configuration = new GitVersionConfiguration { AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatchTag, VersioningMode = VersioningMode.ContinuousDeployment @@ -200,7 +200,7 @@ public void FeatureOnHotfixFeatureBranchNotDeleted() // create release branch fixture.Repository.CreateBranch(release450); Commands.Checkout(fixture.Repository, release450); - fixture.AssertFullSemver("4.5.0-beta.0", config); + fixture.AssertFullSemver("4.5.0-beta.0", configuration); fixture.Repository.MakeACommit("blabla"); Commands.Checkout(fixture.Repository, "develop"); fixture.Repository.MergeNoFF(release450, Generate.SignatureNow()); @@ -211,7 +211,7 @@ public void FeatureOnHotfixFeatureBranchNotDeleted() fixture.Repository.CreateBranch(support45); Commands.Checkout(fixture.Repository, support45); fixture.Repository.ApplyTag(tag450); - fixture.AssertFullSemver("4.5.0", config); + fixture.AssertFullSemver("4.5.0", configuration); // create hotfix branch fixture.Repository.CreateBranch(hotfix451); @@ -223,7 +223,7 @@ public void FeatureOnHotfixFeatureBranchNotDeleted() fixture.Repository.MakeACommit("blabla"); // commit 1 Commands.Checkout(fixture.Repository, hotfix451); fixture.Repository.MergeNoFF(featureBranch, Generate.SignatureNow()); // commit 2 - fixture.AssertFullSemver("4.5.1-beta.2", config); + fixture.AssertFullSemver("4.5.1-beta.2", configuration); } } diff --git a/src/GitVersion.Core.Tests/IntegrationTests/IgnoreBeforeScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/IgnoreBeforeScenarios.cs index 4116e01855..4a1aea5b02 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/IgnoreBeforeScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/IgnoreBeforeScenarios.cs @@ -17,8 +17,8 @@ public void ShouldFallbackToBaseVersionWhenAllCommitsAreIgnored(string? nextVers var dateTimeNow = DateTimeOffset.Now; fixture.MakeACommit(); - var configuration = TestConfigurationBuilder.New.WithNextVersion(nextVersion) - .WithIgnoreConfig(new() { Before = dateTimeNow.AddDays(1) }).Build(); + var configuration = GitFlowConfigurationBuilder.New.WithNextVersion(nextVersion) + .WithIgnoreConfiguration(new() { Before = dateTimeNow.AddDays(1) }).Build(); fixture.AssertFullSemver(expectedFullSemVer, configuration); } @@ -33,8 +33,8 @@ public void ShouldNotFallbackToBaseVersionWhenAllCommitsAreNotIgnored(string? ne var dateTimeNow = DateTimeOffset.Now; fixture.MakeACommit(); - var configuration = TestConfigurationBuilder.New.WithNextVersion(nextVersion) - .WithIgnoreConfig(new() { Before = dateTimeNow.AddDays(-1) }).Build(); + var configuration = GitFlowConfigurationBuilder.New.WithNextVersion(nextVersion) + .WithIgnoreConfiguration(new() { Before = dateTimeNow.AddDays(-1) }).Build(); fixture.AssertFullSemver(expectedFullSemVer, configuration); } diff --git a/src/GitVersion.Core.Tests/IntegrationTests/MainScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/MainScenarios.cs index f2bd6b697a..1e3e070273 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/MainScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/MainScenarios.cs @@ -1,6 +1,6 @@ using GitTools.Testing; +using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; using LibGit2Sharp; using NUnit.Framework; @@ -13,12 +13,12 @@ public class MainScenarios : TestBase [Test] public void CanHandleContinuousDelivery() { - var config = new Config + var configuaration = new GitVersionConfiguration { Branches = { { - MainBranch, new BranchConfig + MainBranch, new BranchConfiguration { VersioningMode = VersioningMode.ContinuousDelivery } @@ -28,18 +28,18 @@ public void CanHandleContinuousDelivery() using var fixture = new EmptyRepositoryFixture(); fixture.Repository.MakeATaggedCommit("1.0.0"); fixture.Repository.MakeCommits(2); - fixture.AssertFullSemver("1.0.1+2", config); + fixture.AssertFullSemver("1.0.1+2", configuaration); } [Test] public void CanHandleContinuousDeployment() { - var config = new Config + var configuration = new GitVersionConfiguration { Branches = { { - MainBranch, new BranchConfig + MainBranch, new BranchConfiguration { VersioningMode = VersioningMode.ContinuousDeployment } @@ -49,7 +49,7 @@ public void CanHandleContinuousDeployment() using var fixture = new EmptyRepositoryFixture(); fixture.Repository.MakeATaggedCommit("1.0.0"); fixture.Repository.MakeCommits(2); - fixture.AssertFullSemver("1.0.1-ci.2", config); + fixture.AssertFullSemver("1.0.1-ci.2", configuration); } [Test] @@ -100,13 +100,13 @@ public void GivenARepositoryWithCommitsButNoTagsWithDetachedHeadVersionShouldBe0 public void GivenARepositoryWithTagAndNextVersionInConfigVersionShouldMatchVersionTxtFile() { const string expectedNextVersion = "1.1.0"; - var config = new Config { NextVersion = expectedNextVersion }; + var configuration = new GitVersionConfiguration { NextVersion = expectedNextVersion }; using var fixture = new EmptyRepositoryFixture(); const string taggedVersion = "1.0.3"; fixture.Repository.MakeATaggedCommit(taggedVersion); fixture.Repository.MakeCommits(5); - fixture.AssertFullSemver("1.1.0+5", config); + fixture.AssertFullSemver("1.1.0+5", configuration); } [Test] @@ -116,7 +116,7 @@ public void GivenARepositoryWithTagAndANextVersionTxtFileAndNoCommitsVersionShou const string taggedVersion = "1.0.3"; fixture.Repository.MakeATaggedCommit(taggedVersion); fixture.AssertFullSemver("1.0.3"); - fixture.AssertFullSemver("1.0.3", new Config { NextVersion = "1.1.0" }); + fixture.AssertFullSemver("1.0.3", new GitVersionConfiguration { NextVersion = "1.1.0" }); } [Test] @@ -130,7 +130,7 @@ public void GivenARepositoryWithTagAndANextVersionTxtFileAndNoCommitsVersionShou // I'm not sure if the postfix +1 is correct here... // but the next version configuration property is something for the user to manipulate the resulting version. - fixture.AssertFullSemver("1.1.0+1", new Config { NextVersion = "1.1.0" }); + fixture.AssertFullSemver("1.1.0+1", new GitVersionConfiguration { NextVersion = "1.1.0" }); } [Test] @@ -140,7 +140,7 @@ public void GivenARepositoryWithTagAndANextVersionTxtFileAndNoCommitsVersionShou const string taggedVersion = "1.0.3"; fixture.Repository.MakeATaggedCommit(taggedVersion); fixture.AssertFullSemver("1.0.3"); - fixture.AssertFullSemver("1.0.3", new Config { NextVersion = "1.0.2" }); + fixture.AssertFullSemver("1.0.3", new GitVersionConfiguration { NextVersion = "1.0.2" }); } [Test] @@ -151,7 +151,7 @@ public void GivenARepositoryWithTagAndANextVersionTxtFileAndNoCommitsVersionShou fixture.Repository.MakeATaggedCommit(taggedVersion); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.0.4+1"); - fixture.AssertFullSemver("1.0.4+1", new Config { NextVersion = "1.0.4" }); + fixture.AssertFullSemver("1.0.4+1", new GitVersionConfiguration { NextVersion = "1.0.4" }); } [Test] @@ -183,7 +183,7 @@ public void GivenARepositoryWithTagAndOldNextVersionConfigVersionShouldBeTagWith fixture.Repository.MakeATaggedCommit(taggedVersion); fixture.Repository.MakeCommits(5); - fixture.AssertFullSemver("1.1.1+5", new Config { NextVersion = "1.0.0" }); + fixture.AssertFullSemver("1.1.1+5", new GitVersionConfiguration { NextVersion = "1.0.0" }); } [Test] @@ -193,7 +193,7 @@ public void GivenARepositoryWithTagAndOldNextVersionConfigAndNoCommitsVersionSho const string taggedVersion = "1.1.0"; fixture.Repository.MakeATaggedCommit(taggedVersion); - fixture.AssertFullSemver("1.1.0", new Config { NextVersion = "1.0.0" }); + fixture.AssertFullSemver("1.1.0", new GitVersionConfiguration { NextVersion = "1.0.0" }); } [Test] @@ -204,42 +204,42 @@ public void CanSpecifyTagPrefixes() fixture.Repository.MakeATaggedCommit(taggedVersion); fixture.Repository.MakeCommits(5); - fixture.AssertFullSemver("1.0.4+5", new Config { TagPrefix = "version-" }); + fixture.AssertFullSemver("1.0.4+5", new GitVersionConfiguration { TagPrefix = "version-" }); } [Test] public void CanSpecifyTagPrefixesAsRegex() { - var config = new Config { TagPrefix = "version-|[vV]" }; + var configuration = new GitVersionConfiguration { TagPrefix = "version-|[vV]" }; using var fixture = new EmptyRepositoryFixture(); var taggedVersion = "v1.0.3"; fixture.Repository.MakeATaggedCommit(taggedVersion); fixture.Repository.MakeCommits(5); - fixture.AssertFullSemver("1.0.4+5", config); + fixture.AssertFullSemver("1.0.4+5", configuration); taggedVersion = "version-1.0.5"; fixture.Repository.MakeATaggedCommit(taggedVersion); fixture.Repository.MakeCommits(5); - fixture.AssertFullSemver("1.0.6+5", config); + fixture.AssertFullSemver("1.0.6+5", configuration); } [Test] public void AreTagsNotAdheringToTagPrefixIgnored() { - var config = new Config { TagPrefix = "" }; + var configuration = new GitVersionConfiguration { TagPrefix = "" }; using var fixture = new EmptyRepositoryFixture(); var taggedVersion = "version-1.0.3"; fixture.Repository.MakeATaggedCommit(taggedVersion); fixture.Repository.MakeCommits(5); - fixture.AssertFullSemver("0.0.1+6", config); + fixture.AssertFullSemver("0.0.1+6", configuration); taggedVersion = "bad/1.0.3"; fixture.Repository.MakeATaggedCommit(taggedVersion); - fixture.AssertFullSemver("0.0.1+7", config); + fixture.AssertFullSemver("0.0.1+7", configuration); } [Test] @@ -247,7 +247,7 @@ public void NextVersionShouldBeConsideredOnTheDevelopmentBranch() { using EmptyRepositoryFixture fixture = new("develop"); - var configurationBuilder = TestConfigurationBuilder.New; + var configurationBuilder = GitFlowConfigurationBuilder.New; fixture.MakeACommit(); @@ -280,7 +280,7 @@ public void PreventDecrementationOfVersionsOnTheDevelopmentBranch() { using EmptyRepositoryFixture fixture = new("develop"); - var configurationBuilder = TestConfigurationBuilder.New; + var configurationBuilder = GitFlowConfigurationBuilder.New; configurationBuilder.WithNextVersion("1.0.0"); fixture.MakeACommit(); diff --git a/src/GitVersion.Core.Tests/IntegrationTests/MainlineDevelopmentMode.cs b/src/GitVersion.Core.Tests/IntegrationTests/MainlineDevelopmentMode.cs index 3ba84e8e74..53e32f43db 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/MainlineDevelopmentMode.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/MainlineDevelopmentMode.cs @@ -1,7 +1,7 @@ using GitTools.Testing; +using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Extensions; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; using LibGit2Sharp; using NUnit.Framework; @@ -11,7 +11,7 @@ namespace GitVersion.Core.Tests.IntegrationTests; public class MainlineDevelopmentMode : TestBase { - private readonly Config config = new() { VersioningMode = VersioningMode.Mainline }; + private readonly GitVersionConfiguration configuration = new() { VersioningMode = VersioningMode.Mainline }; [Test] public void VerifyNonMainMainlineVersionIdenticalAsMain() @@ -24,11 +24,11 @@ public void VerifyNonMainMainlineVersionIdenticalAsMain() fixture.Checkout(MainBranch); fixture.MergeNoFF("feature/foo"); - fixture.AssertFullSemver("1.0.0", this.config); + fixture.AssertFullSemver("1.0.0", this.configuration); fixture.BranchTo("support/1.0", "support"); - fixture.AssertFullSemver("1.0.0", this.config); + fixture.AssertFullSemver("1.0.0", this.configuration); } [Test] @@ -40,20 +40,20 @@ public void MergedFeatureBranchesToMainImpliesRelease() fixture.BranchTo("feature/foo", "foo"); fixture.MakeACommit("2"); - fixture.AssertFullSemver("1.0.1-foo.1", this.config); + fixture.AssertFullSemver("1.0.1-foo.1", this.configuration); fixture.MakeACommit("2.1"); - fixture.AssertFullSemver("1.0.1-foo.2", this.config); + fixture.AssertFullSemver("1.0.1-foo.2", this.configuration); fixture.Checkout(MainBranch); fixture.MergeNoFF("feature/foo"); - fixture.AssertFullSemver("1.0.1", this.config); + fixture.AssertFullSemver("1.0.1", this.configuration); fixture.BranchTo("feature/foo2", "foo2"); fixture.MakeACommit("3 +semver: minor"); - fixture.AssertFullSemver("1.1.0-foo2.1", this.config); + fixture.AssertFullSemver("1.1.0-foo2.1", this.configuration); fixture.Checkout(MainBranch); fixture.MergeNoFF("feature/foo2"); - fixture.AssertFullSemver("1.1.0", this.config); + fixture.AssertFullSemver("1.1.0", this.configuration); fixture.BranchTo("feature/foo3", "foo3"); fixture.MakeACommit("4"); @@ -63,37 +63,37 @@ public void MergedFeatureBranchesToMainImpliesRelease() var commit = fixture.Repository.Head.Tip; // Put semver increment in merge message fixture.Repository.Commit(commit.Message + " +semver: minor", commit.Author, commit.Committer, new CommitOptions { AmendPreviousCommit = true }); - fixture.AssertFullSemver("1.2.0", this.config); + fixture.AssertFullSemver("1.2.0", this.configuration); fixture.BranchTo("feature/foo4", "foo4"); fixture.MakeACommit("5 +semver: major"); - fixture.AssertFullSemver("2.0.0-foo4.1", this.config); + fixture.AssertFullSemver("2.0.0-foo4.1", this.configuration); fixture.Checkout(MainBranch); fixture.MergeNoFF("feature/foo4"); - fixture.AssertFullSemver("2.0.0", this.config); + fixture.AssertFullSemver("2.0.0", this.configuration); // We should evaluate any commits not included in merge commit calculations for direct commit/push or squash to merge commits fixture.MakeACommit("6 +semver: major"); - fixture.AssertFullSemver("3.0.0", this.config); + fixture.AssertFullSemver("3.0.0", this.configuration); fixture.MakeACommit("7 +semver: minor"); - fixture.AssertFullSemver("3.1.0", this.config); + fixture.AssertFullSemver("3.1.0", this.configuration); fixture.MakeACommit("8"); - fixture.AssertFullSemver("3.1.1", this.config); + fixture.AssertFullSemver("3.1.1", this.configuration); // Finally verify that the merge commits still function properly fixture.BranchTo("feature/foo5", "foo5"); fixture.MakeACommit("9 +semver: minor"); - fixture.AssertFullSemver("3.2.0-foo5.1", this.config); + fixture.AssertFullSemver("3.2.0-foo5.1", this.configuration); fixture.Checkout(MainBranch); fixture.MergeNoFF("feature/foo5"); - fixture.AssertFullSemver("3.2.0", this.config); + fixture.AssertFullSemver("3.2.0", this.configuration); // One more direct commit for good measure fixture.MakeACommit("10 +semver: minor"); - fixture.AssertFullSemver("3.3.0", this.config); + fixture.AssertFullSemver("3.3.0", this.configuration); // And we can commit without bumping semver fixture.MakeACommit("11 +semver: none"); - fixture.AssertFullSemver("3.3.0", this.config); + fixture.AssertFullSemver("3.3.0", this.configuration); Console.WriteLine(fixture.SequenceDiagram.GetDiagram()); } @@ -104,14 +104,14 @@ public void VerifyPullRequestsActLikeContinuousDelivery() fixture.Repository.MakeACommit("1"); fixture.MakeATaggedCommit("1.0.0"); fixture.MakeACommit(); - fixture.AssertFullSemver("1.0.1", this.config); + fixture.AssertFullSemver("1.0.1", this.configuration); fixture.BranchTo("feature/foo", "foo"); - fixture.AssertFullSemver("1.0.2-foo.0", this.config); + fixture.AssertFullSemver("1.0.2-foo.0", this.configuration); fixture.MakeACommit(); fixture.MakeACommit(); fixture.Repository.CreatePullRequestRef("feature/foo", MainBranch, normalise: true, prNumber: 8); - fixture.AssertFullSemver("1.0.2-PullRequest8.3", this.config); + fixture.AssertFullSemver("1.0.2-PullRequest8.3", this.configuration); } [Test] @@ -122,29 +122,29 @@ public void SupportBranches() fixture.MakeATaggedCommit("1.0.0"); fixture.MakeACommit(); // 1.0.1 fixture.MakeACommit(); // 1.0.2 - fixture.AssertFullSemver("1.0.2", this.config); + fixture.AssertFullSemver("1.0.2", this.configuration); fixture.BranchTo("support/1.0", "support10"); - fixture.AssertFullSemver("1.0.2", this.config); + fixture.AssertFullSemver("1.0.2", this.configuration); // Move main on fixture.Checkout(MainBranch); fixture.MakeACommit("+semver: major"); // 2.0.0 (on main) - fixture.AssertFullSemver("2.0.0", this.config); + fixture.AssertFullSemver("2.0.0", this.configuration); // Continue on support/1.0 fixture.Checkout("support/1.0"); fixture.MakeACommit(); // 1.0.3 fixture.MakeACommit(); // 1.0.4 - fixture.AssertFullSemver("1.0.4", this.config); + fixture.AssertFullSemver("1.0.4", this.configuration); fixture.BranchTo("feature/foo", "foo"); - fixture.AssertFullSemver("1.0.5-foo.0", this.config); + fixture.AssertFullSemver("1.0.5-foo.0", this.configuration); fixture.MakeACommit(); - fixture.AssertFullSemver("1.0.5-foo.1", this.config); + fixture.AssertFullSemver("1.0.5-foo.1", this.configuration); fixture.MakeACommit(); - fixture.AssertFullSemver("1.0.5-foo.2", this.config); + fixture.AssertFullSemver("1.0.5-foo.2", this.configuration); fixture.Repository.CreatePullRequestRef("feature/foo", "support/1.0", normalise: true, prNumber: 7); - fixture.AssertFullSemver("1.0.5-PullRequest7.3", this.config); + fixture.AssertFullSemver("1.0.5-PullRequest7.3", this.configuration); } [Test] @@ -157,20 +157,20 @@ public void VerifyForwardMerge() fixture.BranchTo("feature/foo", "foo"); fixture.MakeACommit(); - fixture.AssertFullSemver("1.0.2-foo.1", this.config); + fixture.AssertFullSemver("1.0.2-foo.1", this.configuration); fixture.MakeACommit(); - fixture.AssertFullSemver("1.0.2-foo.2", this.config); + fixture.AssertFullSemver("1.0.2-foo.2", this.configuration); fixture.Checkout(MainBranch); fixture.MakeACommit(); - fixture.AssertFullSemver("1.0.2", this.config); + fixture.AssertFullSemver("1.0.2", this.configuration); fixture.Checkout("feature/foo"); // This may seem surprising, but this happens because we branched off mainline // and incremented. Mainline has then moved on. We do not follow mainline // in feature branches, you need to merge mainline in to get the mainline version - fixture.AssertFullSemver("1.0.2-foo.2", this.config); + fixture.AssertFullSemver("1.0.2-foo.2", this.configuration); fixture.MergeNoFF(MainBranch); - fixture.AssertFullSemver("1.0.3-foo.3", this.config); + fixture.AssertFullSemver("1.0.3-foo.3", this.configuration); } [Test] @@ -187,18 +187,18 @@ public void VerifySupportForwardMerge() fixture.Checkout(MainBranch); fixture.MakeACommit("+semver: minor"); - fixture.AssertFullSemver("1.1.0", this.config); + fixture.AssertFullSemver("1.1.0", this.configuration); fixture.MergeNoFF("support/1.0"); - fixture.AssertFullSemver("1.1.1", this.config); + fixture.AssertFullSemver("1.1.1", this.configuration); fixture.MakeACommit(); - fixture.AssertFullSemver("1.1.2", this.config); + fixture.AssertFullSemver("1.1.2", this.configuration); fixture.Checkout("support/1.0"); - fixture.AssertFullSemver("1.0.3", this.config); + fixture.AssertFullSemver("1.0.3", this.configuration); fixture.BranchTo("feature/foo", "foo"); fixture.MakeACommit(); fixture.MakeACommit(); - fixture.AssertFullSemver("1.0.4-foo.2", this.config); // TODO This probably should be 1.0.5 + fixture.AssertFullSemver("1.0.4-foo.2", this.configuration); // TODO This probably should be 1.0.5 } [Test] @@ -211,31 +211,31 @@ public void VerifyDevelopTracksMainVersion() // branching increments the version fixture.BranchTo("develop"); - fixture.AssertFullSemver("1.1.0-alpha.0", this.config); + fixture.AssertFullSemver("1.1.0-alpha.0", this.configuration); fixture.MakeACommit(); - fixture.AssertFullSemver("1.1.0-alpha.1", this.config); + fixture.AssertFullSemver("1.1.0-alpha.1", this.configuration); // merging develop into main increments minor version on main fixture.Checkout(MainBranch); fixture.MergeNoFF("develop"); - fixture.AssertFullSemver("1.1.0", this.config); + fixture.AssertFullSemver("1.1.0", this.configuration); // a commit on develop before the merge still has the same version number fixture.Checkout("develop"); - fixture.AssertFullSemver("1.1.0-alpha.1", this.config); + fixture.AssertFullSemver("1.1.0-alpha.1", this.configuration); // moving on to further work on develop tracks main's version from the merge fixture.MakeACommit(); - fixture.AssertFullSemver("1.2.0-alpha.1", this.config); + fixture.AssertFullSemver("1.2.0-alpha.1", this.configuration); // adding a commit to main increments patch fixture.Checkout(MainBranch); fixture.MakeACommit(); - fixture.AssertFullSemver("1.1.1", this.config); + fixture.AssertFullSemver("1.1.1", this.configuration); // adding a commit to main doesn't change develop's version fixture.Checkout("develop"); - fixture.AssertFullSemver("1.2.0-alpha.1", this.config); + fixture.AssertFullSemver("1.2.0-alpha.1", this.configuration); } [Test] @@ -248,41 +248,41 @@ public void VerifyDevelopFeatureTracksMainVersion() // branching increments the version fixture.BranchTo("develop"); - fixture.AssertFullSemver("1.1.0-alpha.0", this.config); + fixture.AssertFullSemver("1.1.0-alpha.0", this.configuration); fixture.MakeACommit(); - fixture.AssertFullSemver("1.1.0-alpha.1", this.config); + fixture.AssertFullSemver("1.1.0-alpha.1", this.configuration); // merging develop into main increments minor version on main fixture.Checkout(MainBranch); fixture.MergeNoFF("develop"); - fixture.AssertFullSemver("1.1.0", this.config); + fixture.AssertFullSemver("1.1.0", this.configuration); // a commit on develop before the merge still has the same version number fixture.Checkout("develop"); - fixture.AssertFullSemver("1.1.0-alpha.1", this.config); + fixture.AssertFullSemver("1.1.0-alpha.1", this.configuration); // a branch from develop before the merge tracks the pre-merge version from main // (note: the commit on develop looks like a commit to this branch, thus the .1) fixture.BranchTo("feature/foo"); - fixture.AssertFullSemver("1.0.2-foo.1", this.config); + fixture.AssertFullSemver("1.0.2-foo.1", this.configuration); // further work on the branch tracks the merged version from main fixture.MakeACommit(); - fixture.AssertFullSemver("1.1.1-foo.1", this.config); + fixture.AssertFullSemver("1.1.1-foo.1", this.configuration); // adding a commit to main increments patch fixture.Checkout(MainBranch); fixture.MakeACommit(); - fixture.AssertFullSemver("1.1.1", this.config); + fixture.AssertFullSemver("1.1.1", this.configuration); // adding a commit to main doesn't change the feature's version fixture.Checkout("feature/foo"); - fixture.AssertFullSemver("1.1.1-foo.1", this.config); + fixture.AssertFullSemver("1.1.1-foo.1", this.configuration); // merging the feature to develop increments develop fixture.Checkout("develop"); fixture.MergeNoFF("feature/foo"); - fixture.AssertFullSemver("1.2.0-alpha.2", this.config); + fixture.AssertFullSemver("1.2.0-alpha.2", this.configuration); } [Test] @@ -305,7 +305,7 @@ public void VerifyMergingMainToFeatureDoesNotCauseBranchCommitsToIncrementVersio fixture.MakeATaggedCommit("1.0.0"); fixture.MergeNoFF("feature/foo"); - fixture.AssertFullSemver("1.0.1", this.config); + fixture.AssertFullSemver("1.0.1", this.configuration); } [Test] @@ -327,7 +327,7 @@ public void VerifyMergingMainToFeatureDoesNotStopMainCommitsIncrementingVersion( fixture.Checkout(MainBranch); fixture.MergeNoFF("feature/foo"); - fixture.AssertFullSemver("1.0.2", this.config); + fixture.AssertFullSemver("1.0.2", this.configuration); } [Test] @@ -335,7 +335,7 @@ public void VerifyIssue1154CanForwardMergeMainToFeatureBranch() { using var fixture = new EmptyRepositoryFixture(); fixture.MakeACommit(); - fixture.AssertFullSemver("0.0.1", this.config); + fixture.AssertFullSemver("0.0.1", this.configuration); fixture.BranchTo("feature/branch2"); fixture.BranchTo("feature/branch1"); fixture.MakeACommit(); @@ -343,7 +343,7 @@ public void VerifyIssue1154CanForwardMergeMainToFeatureBranch() fixture.Checkout(MainBranch); fixture.MergeNoFF("feature/branch1"); - fixture.AssertFullSemver("0.0.2", this.config); + fixture.AssertFullSemver("0.0.2", this.configuration); fixture.Checkout("feature/branch2"); fixture.MakeACommit(); @@ -351,7 +351,7 @@ public void VerifyIssue1154CanForwardMergeMainToFeatureBranch() fixture.MakeACommit(); fixture.MergeNoFF(MainBranch); - fixture.AssertFullSemver("0.0.3-branch2.4", this.config); + fixture.AssertFullSemver("0.0.3-branch2.4", this.configuration); } [Test] @@ -382,13 +382,13 @@ public void VerifyMergingMainIntoAFeatureBranchWorksWithMultipleBranches() fixture.MergeNoFF("feature/foo"); fixture.MergeNoFF("feature/bar"); - fixture.AssertFullSemver("1.0.2", this.config); + fixture.AssertFullSemver("1.0.2", this.configuration); } [Test] public void MergingFeatureBranchThatIncrementsMinorNumberIncrementsMinorVersionOfMain() { - var currentConfig = new Config { VersioningMode = VersioningMode.Mainline, Branches = new Dictionary { { "feature", new BranchConfig { VersioningMode = VersioningMode.ContinuousDeployment, Increment = IncrementStrategy.Minor } } } }; + var currentConfig = new GitVersionConfiguration { VersioningMode = VersioningMode.Mainline, Branches = new Dictionary { { "feature", new BranchConfiguration { VersioningMode = VersioningMode.ContinuousDeployment, Increment = IncrementStrategy.Minor } } } }; using var fixture = new EmptyRepositoryFixture(); fixture.MakeACommit($"first in {MainBranch}"); @@ -408,14 +408,14 @@ public void MergingFeatureBranchThatIncrementsMinorNumberIncrementsMinorVersionO [Test] public void VerifyIncrementConfigIsHonoured() { - var minorIncrementConfig = new Config + var minorIncrementConfig = new GitVersionConfiguration { VersioningMode = VersioningMode.Mainline, Increment = IncrementStrategy.Minor, - Branches = new Dictionary + Branches = new Dictionary { - { MainBranch, new BranchConfig { Increment = IncrementStrategy.Minor, Name = MainBranch, Regex = MainBranch } }, - { "feature", new BranchConfig { Increment = IncrementStrategy.Minor, Name = "feature", Regex = "features?[/-]" } } + { MainBranch, new BranchConfiguration { Increment = IncrementStrategy.Minor, Name = MainBranch, Regex = MainBranch } }, + { "feature", new BranchConfiguration { Increment = IncrementStrategy.Minor, Name = "feature", Regex = "features?[/-]" } } } }; @@ -455,7 +455,7 @@ public void VerifyIncrementConfigIsHonoured() fixture.AssertFullSemver("2.0.0-foo4.1", minorIncrementConfig); fixture.Checkout(MainBranch); fixture.MergeNoFF("feature/foo4"); - fixture.AssertFullSemver("2.0.0", this.config); + fixture.AssertFullSemver("2.0.0", this.configuration); // We should evaluate any commits not included in merge commit calculations for direct commit/push or squash to merge commits fixture.MakeACommit("6 +semver: major"); @@ -485,7 +485,7 @@ public void VerifyIncrementConfigIsHonoured() [Test] public void BranchWithoutMergeBaseMainlineBranchIsFound() { - var currentConfig = new Config { VersioningMode = VersioningMode.Mainline, AssemblyFileVersioningScheme = AssemblyFileVersioningScheme.MajorMinorPatchTag }; + var currentConfig = new GitVersionConfiguration { VersioningMode = VersioningMode.Mainline, AssemblyFileVersioningScheme = AssemblyFileVersioningScheme.MajorMinorPatchTag }; using var fixture = new EmptyRepositoryFixture(); fixture.Repository.MakeACommit(); @@ -504,12 +504,12 @@ public void BranchWithoutMergeBaseMainlineBranchIsFound() public void GivenARemoteGitRepositoryWithCommitsThenClonedLocalDevelopShouldMatchRemoteVersion() { using var fixture = new RemoteRepositoryFixture(); - fixture.AssertFullSemver("0.0.5", config); // RemoteRepositoryFixture creates 5 commits. + fixture.AssertFullSemver("0.0.5", configuration); // RemoteRepositoryFixture creates 5 commits. fixture.BranchTo("develop"); - fixture.AssertFullSemver("0.1.0-alpha.0", config); + fixture.AssertFullSemver("0.1.0-alpha.0", configuration); Console.WriteLine(fixture.SequenceDiagram.GetDiagram()); var local = fixture.CloneRepository(); - fixture.AssertFullSemver("0.1.0-alpha.0", config, repository: local.Repository); + fixture.AssertFullSemver("0.1.0-alpha.0", configuration, repository: local.Repository); local.Repository.DumpGraph(); } @@ -523,7 +523,7 @@ public void GivenNoMainThrowsWarning() Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("develop")); fixture.Repository.Branches.Remove(fixture.Repository.Branches["main"]); - var exception = Assert.Throws(() => fixture.AssertFullSemver("1.1.0-alpha.1", config)); + var exception = Assert.Throws(() => fixture.AssertFullSemver("1.1.0-alpha.1", configuration)); exception.ShouldNotBeNull(); exception.Message.ShouldMatch("No branches can be found matching the commit .* in the configured Mainline branches: main, support"); } @@ -534,7 +534,7 @@ public void GivenNoMainThrowsWarning() public void NoBumpMessageTakesPrecedenceOverBumpMessage(string commitMessage) { // Same configuration as found here: https://gitversion.net/docs/reference/version-increments#conventional-commit-messages - var conventionalCommitsConfig = new Config + var conventionalCommitsConfig = new GitVersionConfiguration { VersioningMode = VersioningMode.Mainline, MajorVersionBumpMessage = "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\\([\\w\\s-]*\\))?(!:|:.*\\n\\n((.+\\n)+\\n)?BREAKING CHANGE:\\s.+)", diff --git a/src/GitVersion.Core.Tests/IntegrationTests/OtherBranchScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/OtherBranchScenarios.cs index 0525ca66de..acf87bfa42 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/OtherBranchScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/OtherBranchScenarios.cs @@ -1,6 +1,6 @@ using GitTools.Testing; +using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; -using GitVersion.Model.Configuration; using LibGit2Sharp; using NUnit.Framework; using Shouldly; @@ -60,13 +60,13 @@ public void ShouldNotGetVersionFromFeatureBranchIfNotMerged() [TestCase("alpha.{BranchName}", "JIRA-123", "alpha.JIRA-123")] public void TagIsBranchNameForBranchesWithoutPrefixedBranchName(string tag, string branchName, string preReleaseTagName) { - var config = new Config + var configuration = new GitVersionConfiguration { Branches = { { "other", - new BranchConfig + new BranchConfiguration { Increment = IncrementStrategy.Patch, Regex = ".*", @@ -84,6 +84,6 @@ public void TagIsBranchNameForBranchesWithoutPrefixedBranchName(string tag, stri fixture.Repository.MakeCommits(5); var expectedFullSemVer = $"1.0.1-{preReleaseTagName}.1+5"; - fixture.AssertFullSemver(expectedFullSemVer, config); + fixture.AssertFullSemver(expectedFullSemVer, configuration); } } diff --git a/src/GitVersion.Core.Tests/IntegrationTests/ReleaseBranchScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/ReleaseBranchScenarios.cs index 42ef678c35..fbb315f6ad 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/ReleaseBranchScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/ReleaseBranchScenarios.cs @@ -2,7 +2,6 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Extensions; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; using LibGit2Sharp; using NUnit.Framework; @@ -100,7 +99,7 @@ public void CanTakePreReleaseVersionFromReleasesBranchWithNumericPreReleaseTag() [Test] public void ReleaseBranchWithNextVersionSetInConfig() { - var config = new Config + var configuration = new GitVersionConfiguration { NextVersion = "2.0.0" }; @@ -108,19 +107,19 @@ public void ReleaseBranchWithNextVersionSetInConfig() fixture.Repository.MakeCommits(5); fixture.BranchTo("release-2.0.0"); - fixture.AssertFullSemver("2.0.0-beta.1+0", config); + fixture.AssertFullSemver("2.0.0-beta.1+0", configuration); fixture.Repository.MakeCommits(2); - fixture.AssertFullSemver("2.0.0-beta.1+2", config); + fixture.AssertFullSemver("2.0.0-beta.1+2", configuration); } [Test] public void CanTakeVersionFromReleaseBranchWithTagOverridden() { - var config = new Config + var configuration = new GitVersionConfiguration { Branches = { - { "release", new BranchConfig { Tag = "rc" } } + { "release", new BranchConfiguration { Tag = "rc" } } } }; using var fixture = new EmptyRepositoryFixture(); @@ -129,9 +128,9 @@ public void CanTakeVersionFromReleaseBranchWithTagOverridden() fixture.Repository.CreateBranch("release-2.0.0"); fixture.Checkout("release-2.0.0"); - fixture.AssertFullSemver("2.0.0-rc.1+0", config); + fixture.AssertFullSemver("2.0.0-rc.1+0", configuration); fixture.Repository.MakeCommits(2); - fixture.AssertFullSemver("2.0.0-rc.1+2", config); + fixture.AssertFullSemver("2.0.0-rc.1+2", configuration); } [Test] @@ -315,7 +314,7 @@ public void WhenMergingReleaseBackToDevShouldNotResetBetaVersion() [Test] public void HotfixOffReleaseBranchShouldNotResetCount() { - var config = new Config + var configuration = new GitVersionConfiguration { VersioningMode = VersioningMode.ContinuousDeployment }; @@ -331,12 +330,12 @@ public void HotfixOffReleaseBranchShouldNotResetCount() fixture.Checkout("release-2.0.0"); fixture.Repository.MakeCommits(1); - fixture.AssertFullSemver("2.0.0-beta.1", config); + fixture.AssertFullSemver("2.0.0-beta.1", configuration); //tag it to bump to beta 2 fixture.Repository.MakeCommits(4); - fixture.AssertFullSemver("2.0.0-beta.5", config); + fixture.AssertFullSemver("2.0.0-beta.5", configuration); //merge down to develop fixture.Repository.CreateBranch("hotfix-2.0.0"); @@ -346,13 +345,13 @@ public void HotfixOffReleaseBranchShouldNotResetCount() fixture.Checkout("release-2.0.0"); fixture.Repository.MergeNoFF("hotfix-2.0.0", Generate.SignatureNow()); fixture.Repository.Branches.Remove(fixture.Repository.Branches["hotfix-2.0.0"]); - fixture.AssertFullSemver("2.0.0-beta.7", config); + fixture.AssertFullSemver("2.0.0-beta.7", configuration); } [Test] public void MergeOnReleaseBranchShouldNotResetCount() { - var config = new Config + var configuration = new GitVersionConfiguration { AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatchTag, VersioningMode = VersioningMode.ContinuousDeployment @@ -369,20 +368,20 @@ public void MergeOnReleaseBranchShouldNotResetCount() fixture.Repository.CreateBranch("release/2.0.0-xxx"); fixture.Checkout("release/2.0.0-xxx"); fixture.Repository.MakeACommit(); - fixture.AssertFullSemver("2.0.0-beta.1", config); + fixture.AssertFullSemver("2.0.0-beta.1", configuration); fixture.Checkout("release/2.0.0"); fixture.Repository.MakeACommit(); - fixture.AssertFullSemver("2.0.0-beta.1", config); + fixture.AssertFullSemver("2.0.0-beta.1", configuration); fixture.Repository.MergeNoFF("release/2.0.0-xxx"); - fixture.AssertFullSemver("2.0.0-beta.2", config); + fixture.AssertFullSemver("2.0.0-beta.2", configuration); } [Test] public void CommitOnDevelopAfterReleaseBranchMergeToDevelopShouldNotResetCount() { - var config = new Config + var configuration = new GitVersionConfiguration { VersioningMode = VersioningMode.ContinuousDeployment }; @@ -393,12 +392,12 @@ public void CommitOnDevelopAfterReleaseBranchMergeToDevelopShouldNotResetCount() // Create release from develop fixture.BranchTo("release-2.0.0"); - fixture.AssertFullSemver("2.0.0-beta.0", config); + fixture.AssertFullSemver("2.0.0-beta.0", configuration); // Make some commits on release fixture.MakeACommit("release 1"); fixture.MakeACommit("release 2"); - fixture.AssertFullSemver("2.0.0-beta.2", config); + fixture.AssertFullSemver("2.0.0-beta.2", configuration); // First forward merge release to develop fixture.Checkout("develop"); @@ -407,24 +406,24 @@ public void CommitOnDevelopAfterReleaseBranchMergeToDevelopShouldNotResetCount() // Make some new commit on release fixture.Checkout("release-2.0.0"); fixture.Repository.MakeACommit("release 3 - after first merge"); - fixture.AssertFullSemver("2.0.0-beta.3", config); + fixture.AssertFullSemver("2.0.0-beta.3", configuration); // Make new commit on develop fixture.Checkout("develop"); // Checkout to release (no new commits) fixture.Checkout("release-2.0.0"); - fixture.AssertFullSemver("2.0.0-beta.3", config); + fixture.AssertFullSemver("2.0.0-beta.3", configuration); fixture.Checkout("develop"); fixture.Repository.MakeACommit("develop after merge"); // Checkout to release (no new commits) fixture.Checkout("release-2.0.0"); - fixture.AssertFullSemver("2.0.0-beta.3", config); + fixture.AssertFullSemver("2.0.0-beta.3", configuration); // Make some new commit on release fixture.Repository.MakeACommit("release 4"); fixture.Repository.MakeACommit("release 5"); - fixture.AssertFullSemver("2.0.0-beta.5", config); + fixture.AssertFullSemver("2.0.0-beta.5", configuration); // Second merge release to develop fixture.Checkout("develop"); @@ -432,13 +431,13 @@ public void CommitOnDevelopAfterReleaseBranchMergeToDevelopShouldNotResetCount() // Checkout to release (no new commits) fixture.Checkout("release-2.0.0"); - fixture.AssertFullSemver("2.0.0-beta.5", config); + fixture.AssertFullSemver("2.0.0-beta.5", configuration); } [Test] public void CommitBeetweenMergeReleaseToDevelopShouldNotResetCount() { - var config = new Config + var configuration = new GitVersionConfiguration { VersioningMode = VersioningMode.ContinuousDeployment }; @@ -449,12 +448,12 @@ public void CommitBeetweenMergeReleaseToDevelopShouldNotResetCount() Commands.Checkout(fixture.Repository, "develop"); fixture.Repository.CreateBranch("release-2.0.0"); Commands.Checkout(fixture.Repository, "release-2.0.0"); - fixture.AssertFullSemver("2.0.0-beta.0", config); + fixture.AssertFullSemver("2.0.0-beta.0", configuration); // Make some commits on release var commit1 = fixture.Repository.MakeACommit(); fixture.Repository.MakeACommit(); - fixture.AssertFullSemver("2.0.0-beta.2", config); + fixture.AssertFullSemver("2.0.0-beta.2", configuration); // Merge release to develop - emulate commit between other person release commit push and this commit merge to develop Commands.Checkout(fixture.Repository, "develop"); @@ -463,12 +462,12 @@ public void CommitBeetweenMergeReleaseToDevelopShouldNotResetCount() // Check version on release after merge to develop Commands.Checkout(fixture.Repository, "release-2.0.0"); - fixture.AssertFullSemver("2.0.0-beta.2", config); + fixture.AssertFullSemver("2.0.0-beta.2", configuration); // Check version on release after making some new commits fixture.Repository.MakeACommit(); fixture.Repository.MakeACommit(); - fixture.AssertFullSemver("2.0.0-beta.4", config); + fixture.AssertFullSemver("2.0.0-beta.4", configuration); } public static void ReleaseBranchShouldUseBranchNameVersionDespiteBumpInPreviousCommit() @@ -513,7 +512,7 @@ public void ReleaseBranchedAtCommitWithSemverMessageShouldUseBranchNameVersion() [Test] public void FeatureFromReleaseBranchShouldNotResetCount() { - var config = new Config + var configuration = new GitVersionConfiguration { VersioningMode = VersioningMode.ContinuousDeployment }; @@ -524,11 +523,11 @@ public void FeatureFromReleaseBranchShouldNotResetCount() Commands.Checkout(fixture.Repository, "develop"); fixture.Repository.CreateBranch("release-2.0.0"); Commands.Checkout(fixture.Repository, "release-2.0.0"); - fixture.AssertFullSemver("2.0.0-beta.0", config); + fixture.AssertFullSemver("2.0.0-beta.0", configuration); // Make some commits on release fixture.Repository.MakeCommits(10); - fixture.AssertFullSemver("2.0.0-beta.10", config); + fixture.AssertFullSemver("2.0.0-beta.10", configuration); // Create feature from release fixture.BranchTo("feature/xxx"); @@ -537,9 +536,9 @@ public void FeatureFromReleaseBranchShouldNotResetCount() // Check version on release Commands.Checkout(fixture.Repository, "release-2.0.0"); - fixture.AssertFullSemver("2.0.0-beta.10", config); + fixture.AssertFullSemver("2.0.0-beta.10", configuration); fixture.Repository.MakeACommit("release 11"); - fixture.AssertFullSemver("2.0.0-beta.11", config); + fixture.AssertFullSemver("2.0.0-beta.11", configuration); // Make new commit on feature Commands.Checkout(fixture.Repository, "feature/xxx"); @@ -547,27 +546,27 @@ public void FeatureFromReleaseBranchShouldNotResetCount() // Checkout to release (no new commits) Commands.Checkout(fixture.Repository, "release-2.0.0"); - fixture.AssertFullSemver("2.0.0-beta.11", config); + fixture.AssertFullSemver("2.0.0-beta.11", configuration); // Merge feature to release fixture.Repository.MergeNoFF("feature/xxx", Generate.SignatureNow()); - fixture.AssertFullSemver("2.0.0-beta.15", config); + fixture.AssertFullSemver("2.0.0-beta.15", configuration); fixture.Repository.MakeACommit("release 13 - after feature merge"); - fixture.AssertFullSemver("2.0.0-beta.16", config); + fixture.AssertFullSemver("2.0.0-beta.16", configuration); } [Test] public void AssemblySemFileVerShouldBeWeightedByPreReleaseWeight() { - var config = new ConfigurationBuilder() - .Add(new Config + var configuration = new ConfigurationBuilder() + .Add(new GitVersionConfiguration { AssemblyFileVersioningFormat = "{Major}.{Minor}.{Patch}.{WeightedPreReleaseNumber}", Branches = { { - "release", new BranchConfig + "release", new BranchConfiguration { PreReleaseWeight = 1000 } @@ -581,15 +580,15 @@ public void AssemblySemFileVerShouldBeWeightedByPreReleaseWeight() fixture.Repository.CreateBranch("release-2.0.0"); fixture.Checkout("release-2.0.0"); - var variables = fixture.GetVersion(config); + var variables = fixture.GetVersion(configuration); Assert.AreEqual("2.0.0.1001", variables.AssemblySemFileVer); } [Test] public void AssemblySemFileVerShouldBeWeightedByDefaultPreReleaseWeight() { - var config = new ConfigurationBuilder() - .Add(new Config + var configuration = new ConfigurationBuilder() + .Add(new GitVersionConfiguration { AssemblyFileVersioningFormat = "{Major}.{Minor}.{Patch}.{WeightedPreReleaseNumber}" }) @@ -600,7 +599,7 @@ public void AssemblySemFileVerShouldBeWeightedByDefaultPreReleaseWeight() fixture.Repository.MakeCommits(5); fixture.Repository.CreateBranch("release-2.0.0"); fixture.Checkout("release-2.0.0"); - var variables = fixture.GetVersion(config); + var variables = fixture.GetVersion(configuration); Assert.AreEqual("2.0.0.30001", variables.AssemblySemFileVer); } @@ -610,7 +609,7 @@ public void AssemblySemFileVerShouldBeWeightedByDefaultPreReleaseWeight() [Test] public void FeatureOnReleaseFeatureBranchDeleted() { - var config = new Config + var configuration = new GitVersionConfiguration { AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatchTag, VersioningMode = VersioningMode.ContinuousDeployment @@ -627,7 +626,7 @@ public void FeatureOnReleaseFeatureBranchDeleted() // begin the release branch fixture.Repository.CreateBranch(release450); Commands.Checkout(fixture.Repository, release450); - fixture.AssertFullSemver("4.5.0-beta.0", config); + fixture.AssertFullSemver("4.5.0-beta.0", configuration); fixture.Repository.CreateBranch(featureBranch); Commands.Checkout(fixture.Repository, featureBranch); @@ -636,7 +635,7 @@ public void FeatureOnReleaseFeatureBranchDeleted() fixture.Repository.MergeNoFF(featureBranch, Generate.SignatureNow()); // commit 2 fixture.Repository.Branches.Remove(featureBranch); - fixture.AssertFullSemver("4.5.0-beta.2", config); + fixture.AssertFullSemver("4.5.0-beta.2", configuration); } /// @@ -645,7 +644,7 @@ public void FeatureOnReleaseFeatureBranchDeleted() [Test] public void FeatureOnReleaseFeatureBranchNotDeleted() { - var config = new Config + var configuration = new GitVersionConfiguration { AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatchTag, VersioningMode = VersioningMode.ContinuousDeployment @@ -662,7 +661,7 @@ public void FeatureOnReleaseFeatureBranchNotDeleted() // begin the release branch fixture.Repository.CreateBranch(release450); Commands.Checkout(fixture.Repository, release450); - fixture.AssertFullSemver("4.5.0-beta.0", config); + fixture.AssertFullSemver("4.5.0-beta.0", configuration); fixture.Repository.CreateBranch(featureBranch); Commands.Checkout(fixture.Repository, featureBranch); @@ -670,6 +669,6 @@ public void FeatureOnReleaseFeatureBranchNotDeleted() Commands.Checkout(fixture.Repository, release450); fixture.Repository.MergeNoFF(featureBranch, Generate.SignatureNow()); // commit 2 - fixture.AssertFullSemver("4.5.0-beta.2", config); + fixture.AssertFullSemver("4.5.0-beta.2", configuration); } } diff --git a/src/GitVersion.Core.Tests/IntegrationTests/VersionBumpingScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/VersionBumpingScenarios.cs index c119fbefbd..db7aaa1367 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/VersionBumpingScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/VersionBumpingScenarios.cs @@ -1,6 +1,6 @@ using GitTools.Testing; +using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; using LibGit2Sharp; using NUnit.Framework; @@ -13,12 +13,12 @@ public class VersionBumpingScenarios : TestBase [Test] public void AppliedPrereleaseTagCausesBump() { - var configuration = new Config + var configuration = new GitVersionConfiguration { Branches = { { - MainBranch, new BranchConfig + MainBranch, new BranchConfiguration { Tag = "pre", SourceBranches = new HashSet() @@ -90,7 +90,7 @@ public void CanUseCommitMessagesToBumpVersion_TagTakesPriority() [TestCase("feat: Major update\n\nSome descriptive text\nWith a second line\n\nBREAKING CHANGE: A reason", "2.0.0")] public void CanUseConventionalCommitsToBumpVersion(string commitMessage, string expectedVersion) { - var configuration = new Config + var configuration = new GitVersionConfiguration { VersioningMode = VersioningMode.Mainline, diff --git a/src/GitVersion.Core.Tests/IntegrationTests/VersionInCurrentBranchNameScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/VersionInCurrentBranchNameScenarios.cs index a87299d274..e8295948b6 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/VersionInCurrentBranchNameScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/VersionInCurrentBranchNameScenarios.cs @@ -1,6 +1,6 @@ using GitTools.Testing; +using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; -using GitVersion.Model.Configuration; using LibGit2Sharp; using NUnit.Framework; @@ -30,15 +30,15 @@ public void DoesNotTakeVersionFromNameOfNonReleaseBranch() [Test] public void TakesVersionFromNameOfBranchThatIsReleaseByConfig() { - var config = new Config + var configuration = new GitVersionConfiguration { - Branches = new Dictionary { { "support", new BranchConfig { IsReleaseBranch = true } } } + Branches = new Dictionary { { "support", new BranchConfiguration { IsReleaseBranch = true } } } }; using var fixture = new BaseGitFlowRepositoryFixture("1.0.0"); fixture.BranchTo("support/2.0.0"); - fixture.AssertFullSemver("2.0.0+1", config); + fixture.AssertFullSemver("2.0.0+1", configuration); } [Test] diff --git a/src/GitVersion.Core.Tests/IntegrationTests/VersionInMergedBranchNameScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/VersionInMergedBranchNameScenarios.cs index bb58125509..083331b17a 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/VersionInMergedBranchNameScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/VersionInMergedBranchNameScenarios.cs @@ -1,6 +1,6 @@ using GitTools.Testing; +using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; -using GitVersion.Model.Configuration; using LibGit2Sharp; using NUnit.Framework; @@ -31,15 +31,15 @@ public void DoesNotTakeVersionFromNameOfNonReleaseBranch() [Test] public void TakesVersionFromNameOfBranchThatIsReleaseByConfig() { - var config = new Config + var configuration = new GitVersionConfiguration { - Branches = new Dictionary { { "support", new BranchConfig { IsReleaseBranch = true } } } + Branches = new Dictionary { { "support", new BranchConfiguration { IsReleaseBranch = true } } } }; using var fixture = new BaseGitFlowRepositoryFixture("1.0.0"); fixture.CreateAndMergeBranchIntoDevelop("support/2.0.0"); - fixture.AssertFullSemver("2.1.0-alpha.2", config); + fixture.AssertFullSemver("2.1.0-alpha.2", configuration); } [Test] diff --git a/src/GitVersion.Core.Tests/IntegrationTests/VersionInTagScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/VersionInTagScenarios.cs index 0253a5ac5f..5ee487af21 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/VersionInTagScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/VersionInTagScenarios.cs @@ -1,7 +1,6 @@ using GitTools.Testing; using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; using NUnit.Framework; using Shouldly; @@ -15,8 +14,8 @@ internal class VersionInTagScenarios public void TagPreReleaseWeightIsNotConfigured_HeadIsATaggedCommit_WeightedPreReleaseNumberShouldBeTheDefaultValue() { // Arrange - var config = new ConfigurationBuilder() - .Add(new Config + var configuration = new ConfigurationBuilder() + .Add(new GitVersionConfiguration { AssemblyFileVersioningFormat = "{Major}.{Minor}.{Patch}.{WeightedPreReleaseNumber}" }) @@ -25,7 +24,7 @@ public void TagPreReleaseWeightIsNotConfigured_HeadIsATaggedCommit_WeightedPreRe // Act using var fixture = new BaseGitFlowRepositoryFixture("1.0.0"); fixture.MakeATaggedCommit("1.1.0"); - var version = fixture.GetVersion(config); + var version = fixture.GetVersion(configuration); // Assert version.AssemblySemFileVer.ShouldBe("1.1.0.60000"); @@ -35,8 +34,8 @@ public void TagPreReleaseWeightIsNotConfigured_HeadIsATaggedCommit_WeightedPreRe public void TagPreReleaseWeightIsConfigured_HeadIsATaggedCommit_WeightedPreReleaseNumberShouldBeTheSameAsTheTagPreReleaseWeight() { // Arrange - var config = new ConfigurationBuilder() - .Add(new Config + var configuration = new ConfigurationBuilder() + .Add(new GitVersionConfiguration { AssemblyFileVersioningFormat = "{Major}.{Minor}.{Patch}.{WeightedPreReleaseNumber}", TagPreReleaseWeight = 65535 @@ -46,7 +45,7 @@ public void TagPreReleaseWeightIsConfigured_HeadIsATaggedCommit_WeightedPreRelea // Act using var fixture = new BaseGitFlowRepositoryFixture("1.0.0"); fixture.MakeATaggedCommit("1.1.0"); - var version = fixture.GetVersion(config); + var version = fixture.GetVersion(configuration); // Assert version.AssemblySemFileVer.ShouldBe("1.1.0.65535"); @@ -56,8 +55,8 @@ public void TagPreReleaseWeightIsConfigured_HeadIsATaggedCommit_WeightedPreRelea public void TagPreReleaseWeightIsConfigured_GitFlowReleaseIsFinished_WeightedPreReleaseNumberShouldBeTheSameAsTheTagPreReleaseWeight() { // Arrange - var config = new ConfigurationBuilder() - .Add(new Config + var configuration = new ConfigurationBuilder() + .Add(new GitVersionConfiguration { AssemblyFileVersioningFormat = "{Major}.{Minor}.{Patch}.{WeightedPreReleaseNumber}", TagPreReleaseWeight = 65535, @@ -73,9 +72,9 @@ public void TagPreReleaseWeightIsConfigured_GitFlowReleaseIsFinished_WeightedPre fixture.MakeACommit("Feature commit 1"); fixture.BranchTo("release/1.1.0"); fixture.MakeACommit("Release commit 1"); - fixture.AssertFullSemver("1.1.0-beta.1", config); + fixture.AssertFullSemver("1.1.0-beta.1", configuration); fixture.ApplyTag("1.1.0"); - var version = fixture.GetVersion(config); + var version = fixture.GetVersion(configuration); // Assert version.AssemblySemFileVer.ShouldBe("1.1.0.65535"); @@ -85,8 +84,8 @@ public void TagPreReleaseWeightIsConfigured_GitFlowReleaseIsFinished_WeightedPre public void TagPreReleaseWeightIsNotConfigured_GitFlowReleaseIsFinished_WeightedPreReleaseNumberShouldBeTheDefaultValue() { // Arrange - var config = new ConfigurationBuilder() - .Add(new Config + var configuration = new ConfigurationBuilder() + .Add(new GitVersionConfiguration { AssemblyFileVersioningFormat = "{Major}.{Minor}.{Patch}.{WeightedPreReleaseNumber}", VersioningMode = VersioningMode.ContinuousDeployment @@ -101,9 +100,9 @@ public void TagPreReleaseWeightIsNotConfigured_GitFlowReleaseIsFinished_Weighted fixture.MakeACommit("Feature commit 1"); fixture.BranchTo("release/1.1.0"); fixture.MakeACommit("Release commit 1"); - fixture.AssertFullSemver("1.1.0-beta.1", config); + fixture.AssertFullSemver("1.1.0-beta.1", configuration); fixture.ApplyTag("1.1.0"); - var version = fixture.GetVersion(config); + var version = fixture.GetVersion(configuration); // Assert version.AssemblySemFileVer.ShouldBe("1.1.0.60000"); diff --git a/src/GitVersion.Core.Tests/Model/MergeMessageTests.cs b/src/GitVersion.Core.Tests/MergeMessageTests.cs similarity index 91% rename from src/GitVersion.Core.Tests/Model/MergeMessageTests.cs rename to src/GitVersion.Core.Tests/MergeMessageTests.cs index ab4ab72a03..332e2eeaa4 100644 --- a/src/GitVersion.Core.Tests/Model/MergeMessageTests.cs +++ b/src/GitVersion.Core.Tests/MergeMessageTests.cs @@ -1,5 +1,5 @@ +using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; -using GitVersion.Model.Configuration; using NUnit.Framework; using Shouldly; @@ -8,19 +8,19 @@ namespace GitVersion.Core.Tests; [TestFixture] public class MergeMessageTests : TestBase { - private readonly Config config = new() { TagPrefix = "[vV]" }; + private readonly GitVersionConfiguration configuration = new() { TagPrefix = "[vV]" }; [Test] public void NullMessageStringThrows() => // Act / Assert - Should.Throw(() => new MergeMessage(null, this.config)); + Should.Throw(() => new MergeMessage(null, this.configuration)); [TestCase("")] [TestCase("\t\t ")] public void EmptyMessageString(string message) { // Act - var sut = new MergeMessage(message, this.config); + var sut = new MergeMessage(message, this.configuration); // Assert sut.TargetBranch.ShouldBeNull(); @@ -37,7 +37,7 @@ public void EmptyTagPrefix(string prefix) { // Arrange const string message = "Updated some code."; - var conf = new Config { TagPrefix = prefix }; + var conf = new GitVersionConfiguration { TagPrefix = prefix }; // Act var sut = new MergeMessage(message, conf); @@ -69,7 +69,7 @@ public void ParsesMergeMessage( SemanticVersion expectedVersion) { // Act - var sut = new MergeMessage(message, this.config); + var sut = new MergeMessage(message, this.configuration); // Assert sut.FormatName.ShouldBe("Default"); @@ -100,7 +100,7 @@ public void ParsesGitHubPullMergeMessage( int? expectedPullRequestNumber) { // Act - var sut = new MergeMessage(message, this.config); + var sut = new MergeMessage(message, this.configuration); // Assert sut.FormatName.ShouldBe("GitHubPull"); @@ -134,7 +134,7 @@ public void ParsesBitBucketPullMergeMessage( int? expectedPullRequestNumber) { // Act - var sut = new MergeMessage(message, this.config); + var sut = new MergeMessage(message, this.configuration); // Assert sut.FormatName.ShouldBe("BitBucketPull"); @@ -163,7 +163,7 @@ public void ParsesBitBucketPullMergeMessage_v7( int? expectedPullRequestNumber) { // Act - var sut = new MergeMessage(message, this.config); + var sut = new MergeMessage(message, this.configuration); // Assert sut.FormatName.ShouldBe("BitBucketPullv7"); @@ -193,7 +193,7 @@ public void ParsesSmartGitMergeMessage( SemanticVersion expectedVersion) { // Act - var sut = new MergeMessage(message, this.config); + var sut = new MergeMessage(message, this.configuration); // Assert sut.FormatName.ShouldBe("SmartGit"); @@ -223,7 +223,7 @@ public void ParsesRemoteTrackingMergeMessage( SemanticVersion expectedVersion) { // Act - var sut = new MergeMessage(message, this.config); + var sut = new MergeMessage(message, this.configuration); // Assert sut.FormatName.ShouldBe("RemoteTracking"); @@ -250,7 +250,7 @@ public void ParsesInvalidMergeMessage( int? expectedPullRequestNumber) { // Act - var sut = new MergeMessage(message, this.config); + var sut = new MergeMessage(message, this.configuration); // Assert sut.FormatName.ShouldBeNull(); @@ -267,13 +267,13 @@ public void MatchesSingleCustomMessage() // Arrange const string message = "My custom message"; const string definition = "MyCustom"; - this.config.MergeMessageFormats = new Dictionary + this.configuration.MergeMessageFormats = new Dictionary { [definition] = message }; // Act - var sut = new MergeMessage(message, this.config); + var sut = new MergeMessage(message, this.configuration); // Assert sut.FormatName.ShouldBe(definition); @@ -290,7 +290,7 @@ public void MatchesMultipleCustomMessages() // Arrange const string format = "My custom message"; const string definition = "MyCustom"; - this.config.MergeMessageFormats = new Dictionary + this.configuration.MergeMessageFormats = new Dictionary { ["Default2"] = "some example", ["Default3"] = "another example", @@ -298,7 +298,7 @@ public void MatchesMultipleCustomMessages() }; // Act - var sut = new MergeMessage(format, this.config); + var sut = new MergeMessage(format, this.configuration); // Assert sut.FormatName.ShouldBe(definition); @@ -315,7 +315,7 @@ public void MatchesCaptureGroupsFromCustomMessages() // Arrange const string format = @"^Merged PR #(?\d+) into (?[^\s]*) from (?:(?[^\s]*))"; const string definition = "MyCustom"; - this.config.MergeMessageFormats = new Dictionary + this.configuration.MergeMessageFormats = new Dictionary { [definition] = format }; @@ -324,7 +324,7 @@ public void MatchesCaptureGroupsFromCustomMessages() const string source = "feature/2.0.0/example"; // Act - var sut = new MergeMessage($"Merged PR #{pr} into {target} from {source}", this.config); + var sut = new MergeMessage($"Merged PR #{pr} into {target} from {source}", this.configuration); // Assert sut.FormatName.ShouldBe(definition); @@ -341,7 +341,7 @@ public void ReturnsAfterFirstMatchingPattern() // Arrange const string format = @"^Merge (branch|tag) '(?[^']*)'(?: into (?[^\s]*))*"; const string definition = "MyCustom"; - this.config.MergeMessageFormats = new Dictionary + this.configuration.MergeMessageFormats = new Dictionary { [definition] = format, ["Default2"] = format, @@ -349,7 +349,7 @@ public void ReturnsAfterFirstMatchingPattern() }; // Act - var sut = new MergeMessage("Merge branch 'this'", this.config); + var sut = new MergeMessage("Merge branch 'this'", this.configuration); // Assert sut.FormatName.ShouldBe(definition); diff --git a/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs index 43c9a5409f..904d5cdb9b 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs @@ -2,7 +2,6 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Logging; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; using NSubstitute; using NUnit.Framework; @@ -19,7 +18,10 @@ public void When_getting_configurations_of_a_branch_without_versioning_mode_Give { // Arrange var branchMock = GitToolsTestingExtensions.CreateMockBranch("main", GitToolsTestingExtensions.CreateMockCommit()); - var configuration = TestConfigurationBuilder.New.WithVersioningMode(versioningMode).WithoutVersioningMode("main").Build(); + var configuration = GitFlowConfigurationBuilder.New + .WithVersioningMode(versioningMode) + .WithBranch("main", builder => builder.WithVersioningMode(null)) + .Build(); var repositoryStoreMock = Substitute.For(); repositoryStoreMock.GetSourceBranches(branchMock, configuration, Arg.Any>()).Returns(Enumerable.Empty()); @@ -41,8 +43,13 @@ public void When_getting_configurations_of_a_branch_with_versioning_mode_Given_f // Arrange var mainBranchMock = GitToolsTestingExtensions.CreateMockBranch("main", GitToolsTestingExtensions.CreateMockCommit()); var developBranchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); - var configuration = TestConfigurationBuilder.New.WithoutVersioningMode().WithVersioningMode("main", versioningMode) - .WithoutVersioningMode("develop").WithIncrement("develop", IncrementStrategy.Inherit).Build(); + var configuration = GitFlowConfigurationBuilder.New + .WithoutVersioningMode() + .WithBranch("main", builder => builder.WithVersioningMode(versioningMode)) + .WithBranch("develop", builder => builder + .WithVersioningMode(null).WithIncrement(IncrementStrategy.Inherit) + ) + .Build(); var repositoryStoreMock = Substitute.For(); repositoryStoreMock.GetSourceBranches(developBranchMock, configuration, Arg.Any>()).Returns(new[] { mainBranchMock }); @@ -64,8 +71,13 @@ public void When_getting_configurations_of_a_branch_with_versioning_mode_Given_p // Arrange var mainBranchMock = GitToolsTestingExtensions.CreateMockBranch("main", GitToolsTestingExtensions.CreateMockCommit()); var developBranchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); - var configuration = TestConfigurationBuilder.New.WithoutVersioningMode().WithVersioningMode("main", versioningMode) - .WithVersioningMode("develop", VersioningMode.ContinuousDelivery).WithIncrement("develop", IncrementStrategy.Inherit).Build(); + var configuration = GitFlowConfigurationBuilder.New.WithoutVersioningMode() + .WithBranch("main", builder => builder.WithVersioningMode(versioningMode)) + .WithBranch("develop", builder => builder + .WithVersioningMode(VersioningMode.ContinuousDelivery).WithIncrement(IncrementStrategy.Inherit) + ) + .Build(); + var repositoryStoreMock = Substitute.For(); repositoryStoreMock.GetSourceBranches(developBranchMock, configuration, Arg.Any>()).Returns(new[] { mainBranchMock }); @@ -93,8 +105,12 @@ public void When_getting_configurations_of_a_branch_with_tag_alpha_Given_branch_ // Arrange var mainBranchMock = GitToolsTestingExtensions.CreateMockBranch("main", GitToolsTestingExtensions.CreateMockCommit()); var developBranchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); - var configuration = TestConfigurationBuilder.New.WithIncrement("develop", IncrementStrategy.Inherit) - .WithTag("main", string.Empty).WithTag("develop", "alpha").Build(); + var configuration = GitFlowConfigurationBuilder.New + .WithBranch("main", builder => builder.WithTag(string.Empty)) + .WithBranch("develop", builder => builder + .WithIncrement(IncrementStrategy.Inherit).WithTag("alpha") + ) + .Build(); var repositoryStoreMock = Substitute.For(); repositoryStoreMock.GetSourceBranches(developBranchMock, configuration, Arg.Any>()).Returns(new[] { mainBranchMock }); @@ -117,8 +133,12 @@ public void When_getting_configurations_of_a_branch_without_tag_Given_branch_whi // Arrange var mainBranchMock = GitToolsTestingExtensions.CreateMockBranch("main", GitToolsTestingExtensions.CreateMockCommit()); var developBranchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); - var configuration = TestConfigurationBuilder.New.WithIncrement("develop", IncrementStrategy.Inherit) - .WithTag("main", string.Empty).WithoutTag("develop").Build(); + var configuration = GitFlowConfigurationBuilder.New + .WithBranch("main", builder => builder.WithTag(string.Empty)) + .WithBranch("develop", builder => builder + .WithIncrement(IncrementStrategy.Inherit).WithTag(null) + ) + .Build(); var repositoryStoreMock = Substitute.For(); repositoryStoreMock.GetSourceBranches(developBranchMock, configuration, Arg.Any>()).Returns(new[] { mainBranchMock }); @@ -140,7 +160,7 @@ public void UsesFirstBranchConfigWhenMultipleMatch(string branchName, IncrementS { // Arrange var releaseBranchMock = GitToolsTestingExtensions.CreateMockBranch(branchName, GitToolsTestingExtensions.CreateMockCommit()); - var branchConfig = new BranchConfig + var branchConfiguration = new BranchConfiguration { VersioningMode = VersioningMode.Mainline, Increment = IncrementStrategy.None, @@ -150,13 +170,13 @@ public void UsesFirstBranchConfigWhenMultipleMatch(string branchName, IncrementS IsReleaseBranch = false, SourceBranches = new HashSet() }; - var configuration = new ConfigurationBuilder().Add(new Config + var configuration = new ConfigurationBuilder().Add(new GitVersionConfiguration { VersioningMode = VersioningMode.ContinuousDelivery, Branches = { - { "release/latest", new BranchConfig(branchConfig) { Increment = IncrementStrategy.None, Tag = "latest", Regex = "release/latest" } }, - { "release", new BranchConfig(branchConfig) { Increment = IncrementStrategy.Patch, Tag = "not-latest", Regex = "releases?[/-]" } } + { "release/latest", new BranchConfiguration(branchConfiguration) { Increment = IncrementStrategy.None, Tag = "latest", Regex = "release/latest" } }, + { "release", new BranchConfiguration(branchConfiguration) { Increment = IncrementStrategy.Patch, Tag = "not-latest", Regex = "releases?[/-]" } } } }).Build(); @@ -180,7 +200,10 @@ public void When_getting_configurations_of_an_orphaned_branch_Given_fallback_con { // Arrange var branchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); - var configuration = TestConfigurationBuilder.New.WithIncrement(null).WithIncrement("develop", IncrementStrategy.Inherit).Build(); + var configuration = GitFlowConfigurationBuilder.New + .WithIncrement(null) + .WithBranch("develop", builder => builder.WithIncrement(IncrementStrategy.Inherit)) + .Build(); var repositoryStoreMock = Substitute.For(); repositoryStoreMock.GetSourceBranches(branchMock, configuration, Arg.Any>()).Returns(Enumerable.Empty()); @@ -198,7 +221,10 @@ public void When_getting_configurations_of_an_orphaned_branch_Given_fallback_con { // Arrange var branchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); - var configuration = TestConfigurationBuilder.New.WithIncrement(IncrementStrategy.Inherit).WithIncrement("develop", IncrementStrategy.Inherit).Build(); + var configuration = GitFlowConfigurationBuilder.New + .WithIncrement(IncrementStrategy.Inherit) + .WithBranch("develop", builder => builder.WithIncrement(IncrementStrategy.Inherit)) + .Build(); var repositoryStoreMock = Substitute.For(); repositoryStoreMock.GetSourceBranches(branchMock, configuration, Arg.Any>()).Returns(Enumerable.Empty()); @@ -222,7 +248,10 @@ public void When_getting_configurations_of_an_orphaned_branch_Given_fallback_con { // Arrange var branchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); - var configuration = TestConfigurationBuilder.New.WithIncrement(fallbackIncrement).WithIncrement("develop", IncrementStrategy.Inherit).Build(); + var configuration = GitFlowConfigurationBuilder.New + .WithIncrement(fallbackIncrement) + .WithBranch("develop", builder => builder.WithIncrement(IncrementStrategy.Inherit)) + .Build(); var repositoryStoreMock = Substitute.For(); repositoryStoreMock.GetSourceBranches(branchMock, configuration, Arg.Any>()).Returns(Enumerable.Empty()); @@ -242,7 +271,7 @@ public void When_getting_configurations_of_an_unknown_branch_Given_fallback_conf { // Arrange var branchMock = GitToolsTestingExtensions.CreateMockBranch("unknown", GitToolsTestingExtensions.CreateMockCommit()); - var configuration = TestConfigurationBuilder.New.WithIncrement(null).Build(); + var configuration = GitFlowConfigurationBuilder.New.WithIncrement(null).Build(); var repositoryStoreMock = Substitute.For(); repositoryStoreMock.GetSourceBranches(branchMock, configuration, Arg.Any>()).Returns(Enumerable.Empty()); @@ -264,7 +293,7 @@ public void When_getting_configurations_of_an_unknown_branch_Given_fallback_conf { // Arrange var branchMock = GitToolsTestingExtensions.CreateMockBranch("unknown", GitToolsTestingExtensions.CreateMockCommit()); - var configuration = TestConfigurationBuilder.New.WithIncrement(fallbackIncrement).Build(); + var configuration = GitFlowConfigurationBuilder.New.WithIncrement(fallbackIncrement).Build(); var repositoryStoreMock = Substitute.For(); repositoryStoreMock.GetSourceBranches(branchMock, configuration, Arg.Any>()).Returns(Enumerable.Empty()); @@ -285,7 +314,10 @@ public void When_getting_configurations_of_an_unknown_branch_Given_fallback_conf { // Arrange var unknownBranchMock = GitToolsTestingExtensions.CreateMockBranch("unknown", GitToolsTestingExtensions.CreateMockCommit()); - var configuration = TestConfigurationBuilder.New.WithIncrement(fallbackIncrement).WithIncrement("develop", developBranchIncrement).Build(); + var configuration = GitFlowConfigurationBuilder.New + .WithIncrement(fallbackIncrement) + .WithBranch("develop", builder => builder.WithIncrement(developBranchIncrement)) + .Build(); var repositoryStoreMock = Substitute.For(); var developBranchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); repositoryStoreMock.GetSourceBranches(unknownBranchMock, configuration, Arg.Any>()).Returns(new[] { developBranchMock }); @@ -320,7 +352,10 @@ public void When_getting_configurations_of_an_unknown_branch_Given_fallback_conf { // Arrange var unknownBranchMock = GitToolsTestingExtensions.CreateMockBranch("unknown", GitToolsTestingExtensions.CreateMockCommit()); - var configuration = TestConfigurationBuilder.New.WithIncrement(fallbackIncrement).WithIncrement("develop", IncrementStrategy.Inherit).Build(); + var configuration = GitFlowConfigurationBuilder.New + .WithIncrement(fallbackIncrement) + .WithBranch("develop", builder => builder.WithIncrement(IncrementStrategy.Inherit)) + .Build(); var repositoryStoreMock = Substitute.For(); var developBranchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); repositoryStoreMock.GetSourceBranches(unknownBranchMock, configuration, Arg.Any>()).Returns(new[] { developBranchMock }); @@ -350,10 +385,13 @@ public void When_getting_configurations_of_an_unknown_branch_Given_fallback_and_ { // Arrange var unknownBranchMock = GitToolsTestingExtensions.CreateMockBranch("unknown", GitToolsTestingExtensions.CreateMockCommit()); - var configuration = TestConfigurationBuilder.New.WithIncrement(IncrementStrategy.Inherit).WithIncrement("develop", developBranchIncrement).Build(); + var configuration = GitFlowConfigurationBuilder.New + .WithIncrement(IncrementStrategy.Inherit) + .WithBranch("develop", builder => builder.WithIncrement(developBranchIncrement)) + .Build(); var repositoryStoreMock = Substitute.For(); var developBranchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); - repositoryStoreMock.GetSourceBranches(Arg.Any(), Arg.Any(), Arg.Any>()).Returns(new[] { developBranchMock }); + repositoryStoreMock.GetSourceBranches(Arg.Any(), Arg.Any(), Arg.Any>()).Returns(new[] { developBranchMock }); var unitUnderTest = new EffectiveBranchConfigurationFinder(Substitute.For(), repositoryStoreMock); diff --git a/src/GitVersion.Core.Tests/VersionCalculation/JsonVersionBuilderTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/JsonVersionBuilderTests.cs index 6950c2b0d2..46b95d1d08 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/JsonVersionBuilderTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/JsonVersionBuilderTests.cs @@ -24,12 +24,12 @@ public void Json() BuildMetaData = new SemanticVersionBuildMetaData("versionSourceSha", 5, "feature1", "commitSha", "commitShortSha", DateTimeOffset.Parse("2014-03-06 23:59:59Z"), 0) }; - var config = new TestEffectiveConfiguration(); + var configuration = new TestEffectiveConfiguration(); - var sp = ConfigureServices(); + var serviceProvider = ConfigureServices(); - var variableProvider = sp.GetRequiredService(); - var variables = variableProvider.GetVariablesFor(semanticVersion, config, false); + var variableProvider = serviceProvider.GetRequiredService(); + var variables = variableProvider.GetVariablesFor(semanticVersion, configuration, false); var json = variables.ToString(); json.ShouldMatchApproved(c => c.SubFolder("Approved")); } diff --git a/src/GitVersion.Core.Tests/VersionCalculation/NextVersionCalculatorTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/NextVersionCalculatorTests.cs index 19208599d7..7393e7e7f8 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/NextVersionCalculatorTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/NextVersionCalculatorTests.cs @@ -1,9 +1,9 @@ using GitTools.Testing; using GitVersion.Common; +using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Core.Tests.IntegrationTests; using GitVersion.Logging; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; using LibGit2Sharp; using Microsoft.Extensions.DependencyInjection; @@ -36,7 +36,7 @@ public void DoesNotIncrementWhenBaseVersionSaysNotTo() { var contextBuilder = new GitVersionContextBuilder(); - contextBuilder.WithConfig(new Config() { NextVersion = "1.0.0" }).Build(); + contextBuilder.WithConfig(new GitVersionConfiguration() { NextVersion = "1.0.0" }).Build(); contextBuilder.ServicesProvider.ShouldNotBeNull(); var nextVersionCalculator = contextBuilder.ServicesProvider.GetRequiredService(); @@ -67,13 +67,13 @@ public void AppliesBranchPreReleaseTag() [Test] public void PreReleaseTagCanUseBranchName() { - var config = new Config + var configuration = new GitVersionConfiguration { NextVersion = "1.0.0", - Branches = new Dictionary + Branches = new Dictionary { { - "custom", new BranchConfig + "custom", new BranchConfiguration { Regex = "custom/", Tag = "useBranchName", @@ -90,13 +90,13 @@ public void PreReleaseTagCanUseBranchName() fixture.BranchTo("custom/foo"); fixture.MakeACommit(); - fixture.AssertFullSemver("1.0.0-foo.1+3", config); + fixture.AssertFullSemver("1.0.0-foo.1+3", configuration); } [Test] public void PreReleaseVersionMainline() { - var config = new Config + var configuration = new GitVersionConfiguration { VersioningMode = VersioningMode.Mainline, NextVersion = "1.0.0" @@ -107,13 +107,13 @@ public void PreReleaseVersionMainline() fixture.BranchTo("foo"); fixture.MakeACommit(); - fixture.AssertFullSemver("1.0.0-foo.1", config); + fixture.AssertFullSemver("1.0.0-foo.1", configuration); } [Test] public void MergeIntoMainline() { - var config = new Config + var configuration = new GitVersionConfiguration { VersioningMode = VersioningMode.Mainline, NextVersion = "1.0.0" @@ -126,13 +126,13 @@ public void MergeIntoMainline() fixture.Checkout(MainBranch); fixture.MergeNoFF("foo"); - fixture.AssertFullSemver("1.0.0", config); + fixture.AssertFullSemver("1.0.0", configuration); } [Test] public void MergeFeatureIntoMainline() { - var config = new Config + var configuration = new GitVersionConfiguration { VersioningMode = VersioningMode.Mainline }; @@ -140,96 +140,96 @@ public void MergeFeatureIntoMainline() using var fixture = new EmptyRepositoryFixture(); fixture.MakeACommit(); fixture.ApplyTag("1.0.0"); - fixture.AssertFullSemver("1.0.0", config); + fixture.AssertFullSemver("1.0.0", configuration); fixture.BranchTo("feature/foo"); fixture.MakeACommit(); - fixture.AssertFullSemver("1.0.1-foo.1", config); + fixture.AssertFullSemver("1.0.1-foo.1", configuration); fixture.ApplyTag("1.0.1-foo.1"); fixture.Checkout(MainBranch); fixture.MergeNoFF("feature/foo"); - fixture.AssertFullSemver("1.0.1", config); + fixture.AssertFullSemver("1.0.1", configuration); } [Test] public void MergeFeatureIntoMainlineWithMinorIncrement() { - var config = new Config + var configuration = new GitVersionConfiguration { VersioningMode = VersioningMode.Mainline, - Branches = new Dictionary + Branches = new Dictionary { - { "feature", new BranchConfig { Increment = IncrementStrategy.Minor } } + { "feature", new BranchConfiguration { Increment = IncrementStrategy.Minor } } }, - Ignore = new IgnoreConfig { ShAs = new List() }, + Ignore = new IgnoreConfiguration { Shas = new List() }, MergeMessageFormats = new Dictionary() }; using var fixture = new EmptyRepositoryFixture(); fixture.MakeACommit(); fixture.ApplyTag("1.0.0"); - fixture.AssertFullSemver("1.0.0", config); + fixture.AssertFullSemver("1.0.0", configuration); fixture.BranchTo("feature/foo"); fixture.MakeACommit(); - fixture.AssertFullSemver("1.1.0-foo.1", config); + fixture.AssertFullSemver("1.1.0-foo.1", configuration); fixture.ApplyTag("1.1.0-foo.1"); fixture.Checkout(MainBranch); fixture.MergeNoFF("feature/foo"); - fixture.AssertFullSemver("1.1.0", config); + fixture.AssertFullSemver("1.1.0", configuration); } [Test] public void MergeFeatureIntoMainlineWithMinorIncrementAndThenMergeHotfix() { - var config = new Config + var configuration = new GitVersionConfiguration { VersioningMode = VersioningMode.Mainline, - Branches = new Dictionary + Branches = new Dictionary { - { "feature", new BranchConfig { Increment = IncrementStrategy.Minor } } + { "feature", new BranchConfiguration { Increment = IncrementStrategy.Minor } } }, - Ignore = new IgnoreConfig { ShAs = new List() }, + Ignore = new IgnoreConfiguration { Shas = new List() }, MergeMessageFormats = new Dictionary() }; using var fixture = new EmptyRepositoryFixture(); fixture.MakeACommit(); fixture.ApplyTag("1.0.0"); - fixture.AssertFullSemver("1.0.0", config); + fixture.AssertFullSemver("1.0.0", configuration); fixture.BranchTo("feature/foo"); fixture.MakeACommit(); - fixture.AssertFullSemver("1.1.0-foo.1", config); + fixture.AssertFullSemver("1.1.0-foo.1", configuration); fixture.ApplyTag("1.1.0-foo.1"); fixture.Checkout(MainBranch); fixture.MergeNoFF("feature/foo"); - fixture.AssertFullSemver("1.1.0", config); + fixture.AssertFullSemver("1.1.0", configuration); fixture.ApplyTag("1.1.0"); fixture.BranchTo("hotfix/bar"); fixture.MakeACommit(); - fixture.AssertFullSemver("1.1.1-beta.1", config); + fixture.AssertFullSemver("1.1.1-beta.1", configuration); fixture.ApplyTag("1.1.1-beta.1"); fixture.Checkout(MainBranch); fixture.MergeNoFF("hotfix/bar"); - fixture.AssertFullSemver("1.1.1", config); + fixture.AssertFullSemver("1.1.1", configuration); } [Test] public void PreReleaseTagCanUseBranchNameVariable() { - var config = new Config + var configuration = new GitVersionConfiguration { NextVersion = "1.0.0", - Branches = new Dictionary + Branches = new Dictionary { { - "custom", new BranchConfig + "custom", new BranchConfiguration { Regex = "custom/", Tag = "alpha.{BranchName}", @@ -246,19 +246,19 @@ public void PreReleaseTagCanUseBranchNameVariable() fixture.BranchTo("custom/foo"); fixture.MakeACommit(); - fixture.AssertFullSemver("1.0.0-alpha.foo.1+3", config); + fixture.AssertFullSemver("1.0.0-alpha.foo.1+3", configuration); } [Test] public void PreReleaseNumberShouldBeScopeToPreReleaseLabelInContinuousDelivery() { - var config = new Config + var configuration = new GitVersionConfiguration { VersioningMode = VersioningMode.ContinuousDelivery, - Branches = new Dictionary + Branches = new Dictionary { { - MainBranch, new BranchConfig + MainBranch, new BranchConfiguration { Tag = "beta" } @@ -274,18 +274,18 @@ public void PreReleaseNumberShouldBeScopeToPreReleaseLabelInContinuousDelivery() fixture.Repository.MakeATaggedCommit("0.1.0-test.1"); fixture.Repository.MakeACommit(); - fixture.AssertFullSemver("0.1.0-test.2+1", config); + fixture.AssertFullSemver("0.1.0-test.2+1", configuration); Commands.Checkout(fixture.Repository, MainBranch); fixture.Repository.Merge("feature/test", Generate.SignatureNow()); - fixture.AssertFullSemver("0.1.0-beta.1+1", config); // just one commit no fast forward merge here. + fixture.AssertFullSemver("0.1.0-beta.1+1", configuration); // just one commit no fast forward merge here. } [Test] public void GetNextVersionOnNonMainlineBranchWithoutCommitsShouldWorkNormally() { - var config = new Config + var configuration = new GitVersionConfiguration { VersioningMode = VersioningMode.Mainline, NextVersion = "1.0.0" @@ -294,7 +294,7 @@ public void GetNextVersionOnNonMainlineBranchWithoutCommitsShouldWorkNormally() using var fixture = new EmptyRepositoryFixture(); fixture.MakeACommit("initial commit"); fixture.BranchTo("feature/f1"); - fixture.AssertFullSemver("1.0.0-f1.0", config); + fixture.AssertFullSemver("1.0.0-f1.0", configuration); } [Test] @@ -302,7 +302,7 @@ public void ChoosesHighestVersionReturnedFromStrategies() { // Arrange var branchMock = GitToolsTestingExtensions.CreateMockBranch("main", GitToolsTestingExtensions.CreateMockCommit()); - var configuration = TestConfigurationBuilder.New.Build(); + var configuration = GitFlowConfigurationBuilder.New.Build(); var context = new GitVersionContext(branchMock, null, configuration, null, 0); var repositoryStoreMock = Substitute.For(); var effectiveConfiguration = context.GetEffectiveConfiguration(branchMock); @@ -331,7 +331,7 @@ public void UsesWhenFromNextBestMatchIfHighestDoesntHaveWhen() { // Arrange var branchMock = GitToolsTestingExtensions.CreateMockBranch("main", GitToolsTestingExtensions.CreateMockCommit()); - var configuration = TestConfigurationBuilder.New.Build(); + var configuration = GitFlowConfigurationBuilder.New.Build(); var context = new GitVersionContext(branchMock, null, configuration, null, 0); var repositoryStoreMock = Substitute.For(); var effectiveConfiguration = context.GetEffectiveConfiguration(branchMock); @@ -360,7 +360,7 @@ public void UsesWhenFromNextBestMatchIfHighestDoesntHaveWhenReversedOrder() { // Arrange var branchMock = GitToolsTestingExtensions.CreateMockBranch("main", GitToolsTestingExtensions.CreateMockCommit()); - var configuration = TestConfigurationBuilder.New.Build(); + var configuration = GitFlowConfigurationBuilder.New.Build(); var context = new GitVersionContext(branchMock, null, configuration, null, 0); var repositoryStoreMock = Substitute.For(); var effectiveConfiguration = context.GetEffectiveConfiguration(branchMock); @@ -390,7 +390,7 @@ public void ShouldNotFilterVersion() // Arrange var branchMock = GitToolsTestingExtensions.CreateMockBranch("main", GitToolsTestingExtensions.CreateMockCommit()); var fakeIgnoreConfig = new TestIgnoreConfig(new ExcludeSourcesContainingExclude()); - var configuration = TestConfigurationBuilder.New.WithIgnoreConfig(fakeIgnoreConfig).Build(); + var configuration = GitFlowConfigurationBuilder.New.WithIgnoreConfiguration(fakeIgnoreConfig).Build(); var context = new GitVersionContext(branchMock, null, configuration, null, 0); var repositoryStoreMock = Substitute.For(); var effectiveConfiguration = context.GetEffectiveConfiguration(branchMock); @@ -419,7 +419,7 @@ public void ShouldFilterVersion() // Arrange var branchMock = GitToolsTestingExtensions.CreateMockBranch("main", GitToolsTestingExtensions.CreateMockCommit()); var fakeIgnoreConfig = new TestIgnoreConfig(new ExcludeSourcesContainingExclude()); - var configuration = TestConfigurationBuilder.New.WithIgnoreConfig(fakeIgnoreConfig).Build(); + var configuration = GitFlowConfigurationBuilder.New.WithIgnoreConfiguration(fakeIgnoreConfig).Build(); var context = new GitVersionContext(branchMock, null, configuration, null, 0); var repositoryStoreMock = Substitute.For(); var effectiveConfiguration = context.GetEffectiveConfiguration(branchMock); @@ -450,7 +450,7 @@ public void ShouldIgnorePreReleaseVersionInMainlineMode() // Arrange var branchMock = GitToolsTestingExtensions.CreateMockBranch("main", GitToolsTestingExtensions.CreateMockCommit()); var fakeIgnoreConfig = new TestIgnoreConfig(new ExcludeSourcesContainingExclude()); - var configuration = TestConfigurationBuilder.New.WithIgnoreConfig(fakeIgnoreConfig).WithVersioningMode(VersioningMode.Mainline).Build(); + var configuration = GitFlowConfigurationBuilder.New.WithIgnoreConfiguration(fakeIgnoreConfig).WithVersioningMode(VersioningMode.Mainline).Build(); var context = new GitVersionContext(branchMock, null, configuration, null, 0); var repositoryStoreMock = Substitute.For(); var effectiveConfiguration = context.GetEffectiveConfiguration(branchMock); @@ -490,7 +490,7 @@ public void ShouldIgnorePreReleaseVersionInMainlineMode() nextVersion.BaseVersion.SemanticVersion.ShouldBe(lowerVersion.SemanticVersion); } - private class TestIgnoreConfig : IgnoreConfig + private class TestIgnoreConfig : IgnoreConfiguration { private readonly IVersionFilter filter; diff --git a/src/GitVersion.Core.Tests/VersionCalculation/SemanticVersionTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/SemanticVersionTests.cs index d2789ab88e..ec70ad3c52 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/SemanticVersionTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/SemanticVersionTests.cs @@ -1,5 +1,5 @@ +using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; -using GitVersion.Model.Configuration; using NUnit.Framework; using Shouldly; @@ -25,9 +25,9 @@ public class SemanticVersionTests : TestBase [TestCase("1.2.3+4.Branch.Foo", 1, 2, 3, null, null, 4, "Foo", null, null, null, null, SemanticVersionFormat.Strict)] [TestCase("1.2.3+randomMetaData", 1, 2, 3, null, null, null, null, null, "randomMetaData", null, null, SemanticVersionFormat.Strict)] [TestCase("1.2.3-beta.1+4.Sha.12234.Othershiz", 1, 2, 3, "beta", 1, 4, null, "12234", "Othershiz", null, null, SemanticVersionFormat.Strict)] - [TestCase("1.2.3", 1, 2, 3, null, null, null, null, null, null, null, Config.DefaultTagPrefix, SemanticVersionFormat.Strict)] - [TestCase("v1.2.3", 1, 2, 3, null, null, null, null, null, null, "1.2.3", Config.DefaultTagPrefix, SemanticVersionFormat.Strict)] - [TestCase("V1.2.3", 1, 2, 3, null, null, null, null, null, null, "1.2.3", Config.DefaultTagPrefix, SemanticVersionFormat.Strict)] + [TestCase("1.2.3", 1, 2, 3, null, null, null, null, null, null, null, GitVersionConfiguration.DefaultTagPrefix, SemanticVersionFormat.Strict)] + [TestCase("v1.2.3", 1, 2, 3, null, null, null, null, null, null, "1.2.3", GitVersionConfiguration.DefaultTagPrefix, SemanticVersionFormat.Strict)] + [TestCase("V1.2.3", 1, 2, 3, null, null, null, null, null, null, "1.2.3", GitVersionConfiguration.DefaultTagPrefix, SemanticVersionFormat.Strict)] [TestCase("version-1.2.3", 1, 2, 3, null, null, null, null, null, null, "1.2.3", "version-", SemanticVersionFormat.Strict)] [TestCase("1.0.0-develop-20201007113711", 1, 0, 0, "develop-20201007113711", null, null, null, null, null, "1.0.0-develop-20201007113711", null, SemanticVersionFormat.Strict)] [TestCase("20201007113711.658165168461351.64136516984163213-develop-20201007113711.98848747823+65416321321", 20201007113711, 658165168461351, 64136516984163213, "develop-20201007113711", 98848747823, 65416321321, null, null, null, "20201007113711.658165168461351.64136516984163213-develop-20201007113711.98848747823+65416321321", null, SemanticVersionFormat.Strict)] diff --git a/src/GitVersion.Core.Tests/VersionCalculation/Strategies/ConfigNextVersionBaseVersionStrategyTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/Strategies/ConfigNextVersionBaseVersionStrategyTests.cs index 4ad762837b..1f48aa2e24 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/Strategies/ConfigNextVersionBaseVersionStrategyTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/Strategies/ConfigNextVersionBaseVersionStrategyTests.cs @@ -1,7 +1,6 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Extensions; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; using Microsoft.Extensions.DependencyInjection; using NUnit.Framework; @@ -24,7 +23,7 @@ public void ReturnsNullWhenNoNextVersionIsInConfig() [TestCase("2.12.654651698", "2.12.654651698")] public void ConfigNextVersionTest(string nextVersion, string expectedVersion) { - var baseVersion = GetBaseVersion(new Config + var baseVersion = GetBaseVersion(new GitVersionConfiguration { NextVersion = nextVersion }); @@ -34,13 +33,13 @@ public void ConfigNextVersionTest(string nextVersion, string expectedVersion) baseVersion.SemanticVersion.ToString().ShouldBe(expectedVersion); } - private static BaseVersion? GetBaseVersion(Config? config = null) + private static BaseVersion? GetBaseVersion(GitVersionConfiguration? configuration = null) { var contextBuilder = new GitVersionContextBuilder(); - if (config != null) + if (configuration != null) { - contextBuilder = contextBuilder.WithConfig(config); + contextBuilder = contextBuilder.WithConfig(configuration); } contextBuilder.Build(); diff --git a/src/GitVersion.Core.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs index 95c545cf78..396755a2eb 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs @@ -1,7 +1,6 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Extensions; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; using Microsoft.Extensions.DependencyInjection; using NSubstitute; @@ -147,14 +146,14 @@ public void ShouldNotTakeVersionFromUnrelatedMerge(string commitMessage) [TestCase("Merge branch 'release/2.0.0'", null, "2.0.0")] public void TakesVersionFromMergeOfConfiguredReleaseBranch(string message, string? releaseBranch, string expectedVersion) { - var config = new Config(); - if (releaseBranch != null) config.Branches[releaseBranch] = new BranchConfig { IsReleaseBranch = true }; + var configuration = new GitVersionConfiguration(); + if (releaseBranch != null) configuration.Branches[releaseBranch] = new BranchConfiguration { IsReleaseBranch = true }; var parents = GetParents(true); - AssertMergeMessage(message, expectedVersion, parents, config); + AssertMergeMessage(message, expectedVersion, parents, configuration); } - private static void AssertMergeMessage(string message, string? expectedVersion, IEnumerable parents, Config? config = null) + private static void AssertMergeMessage(string message, string? expectedVersion, IEnumerable parents, GitVersionConfiguration? configuration = null) { var commit = GitToolsTestingExtensions.CreateMockCommit(); commit.Message.Returns(message); @@ -167,7 +166,7 @@ private static void AssertMergeMessage(string message, string? expectedVersion, mockRepository.Commits.Returns(mockBranch.Commits); var contextBuilder = new GitVersionContextBuilder() - .WithConfig(config ?? new Config()).WithRepository(mockRepository); + .WithConfig(configuration ?? new GitVersionConfiguration()).WithRepository(mockRepository); contextBuilder.Build(); contextBuilder.ServicesProvider.ShouldNotBeNull(); var strategy = contextBuilder.ServicesProvider.GetServiceForType(); diff --git a/src/GitVersion.Core.Tests/VersionCalculation/Strategies/VersionInBranchNameBaseVersionStrategyTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/Strategies/VersionInBranchNameBaseVersionStrategyTests.cs index 3d46d8d190..da49ec0d21 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/Strategies/VersionInBranchNameBaseVersionStrategyTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/Strategies/VersionInBranchNameBaseVersionStrategyTests.cs @@ -2,7 +2,6 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Extensions; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; using LibGit2Sharp; using NUnit.Framework; @@ -23,7 +22,7 @@ public void CanTakeVersionFromNameOfReleaseBranch(string branchName, string expe var gitRepository = fixture.Repository.ToGitRepository(); var strategy = GetVersionStrategy(fixture.RepositoryPath, gitRepository, branchName); - var configuration = TestConfigurationBuilder.New.Build(); + var configuration = GitFlowConfigurationBuilder.New.Build(); var branchConfiguration = configuration.GetBranchConfiguration(branchName); var effectiveConfiguration = new EffectiveConfiguration(configuration, branchConfiguration); var baseVersion = strategy.GetBaseVersions(new(gitRepository.FindBranch(branchName)!, effectiveConfiguration)).Single(); @@ -43,7 +42,7 @@ public void ShouldNotTakeVersionFromNameOfNonReleaseBranch(string branchName) var gitRepository = fixture.Repository.ToGitRepository(); var strategy = GetVersionStrategy(fixture.RepositoryPath, gitRepository, branchName); - var configuration = TestConfigurationBuilder.New.Build(); + var configuration = GitFlowConfigurationBuilder.New.Build(); var branchConfiguration = configuration.GetBranchConfiguration(branchName); var effectiveConfiguration = new EffectiveConfiguration(configuration, branchConfiguration); var baseVersions = strategy.GetBaseVersions(new(gitRepository.FindBranch(branchName)!, effectiveConfiguration)); @@ -59,14 +58,13 @@ public void CanTakeVersionFromNameOfConfiguredReleaseBranch(string branchName, s fixture.Repository.MakeACommit(); fixture.Repository.CreateBranch(branchName); - var config = new ConfigurationBuilder() - .Add(new Config { Branches = { { "support", new BranchConfig { IsReleaseBranch = true } } } }) - .Build(); + var configurationBuilder = new ConfigurationBuilder() + .Add(new GitVersionConfiguration { Branches = { { "support", new BranchConfiguration { IsReleaseBranch = true } } } }); var gitRepository = fixture.Repository.ToGitRepository(); - var strategy = GetVersionStrategy(fixture.RepositoryPath, gitRepository, branchName, config); + var strategy = GetVersionStrategy(fixture.RepositoryPath, gitRepository, branchName, configurationBuilder.Build()); - var configuration = TestConfigurationBuilder.New.Build(); + var configuration = GitFlowConfigurationBuilder.New.Build(); var branchConfiguration = configuration.GetBranchConfiguration(branchName); var effectiveConfiguration = new EffectiveConfiguration(configuration, branchConfiguration); var baseVersion = strategy.GetBaseVersions(new(gitRepository.FindBranch(branchName)!, effectiveConfiguration)).Single(); @@ -89,7 +87,7 @@ public void CanTakeVersionFromNameOfRemoteReleaseBranch(string branchName, strin var gitRepository = fixture.Repository.ToGitRepository(); var strategy = GetVersionStrategy(fixture.RepositoryPath, gitRepository, branchName); - var configuration = TestConfigurationBuilder.New.Build(); + var configuration = GitFlowConfigurationBuilder.New.Build(); var branchConfiguration = configuration.GetBranchConfiguration(branchName); var effectiveConfiguration = new EffectiveConfiguration(configuration, branchConfiguration); var baseVersion = strategy.GetBaseVersions(new(gitRepository.FindBranch(branchName)!, effectiveConfiguration)).Single(); @@ -97,9 +95,9 @@ public void CanTakeVersionFromNameOfRemoteReleaseBranch(string branchName, strin baseVersion.SemanticVersion.ToString().ShouldBe(expectedBaseVersion); } - private static IVersionStrategy GetVersionStrategy(string workingDirectory, IGitRepository repository, string branch, Config? config = null) + private static IVersionStrategy GetVersionStrategy(string workingDirectory, IGitRepository repository, string branch, GitVersionConfiguration? configuration = null) { - var sp = BuildServiceProvider(workingDirectory, repository, branch, config); + var sp = BuildServiceProvider(workingDirectory, repository, branch, configuration); return sp.GetServiceForType(); } } diff --git a/src/GitVersion.Core.Tests/VersionCalculation/VariableProviderTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/VariableProviderTests.cs index 76e3a95e00..3f3475a7cf 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/VariableProviderTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/VariableProviderTests.cs @@ -47,9 +47,9 @@ public void ProvidesVariablesInContinuousDeliveryModeForPreRelease() semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); - var config = new TestEffectiveConfiguration(); + var configuration = new TestEffectiveConfiguration(); - var vars = this.variableProvider.GetVariablesFor(semVer, config, false); + var vars = this.variableProvider.GetVariablesFor(semVer, configuration, false); vars.ToString().ShouldMatchApproved(c => c.SubFolder("Approved")); } @@ -71,9 +71,9 @@ public void ProvidesVariablesInContinuousDeploymentModeForPreRelease() semVer.BuildMetaData.ShortSha = "commitShortSha"; semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); - var config = new TestEffectiveConfiguration(versioningMode: VersioningMode.ContinuousDeployment); + var configuration = new TestEffectiveConfiguration(versioningMode: VersioningMode.ContinuousDeployment); - var vars = this.variableProvider.GetVariablesFor(semVer, config, false); + var vars = this.variableProvider.GetVariablesFor(semVer, configuration, false); vars.ToString().ShouldMatchApproved(c => c.SubFolder("Approved")); } @@ -94,9 +94,9 @@ public void ProvidesVariablesInContinuousDeliveryModeForStable() semVer.BuildMetaData.ShortSha = "commitShortSha"; semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); - var config = new TestEffectiveConfiguration(); + var configuration = new TestEffectiveConfiguration(); - var vars = this.variableProvider.GetVariablesFor(semVer, config, false); + var vars = this.variableProvider.GetVariablesFor(semVer, configuration, false); vars.ToString().ShouldMatchApproved(c => c.SubFolder("Approved")); } @@ -117,9 +117,9 @@ public void ProvidesVariablesInContinuousDeploymentModeForStable() semVer.BuildMetaData.ShortSha = "commitShortSha"; semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); - var config = new TestEffectiveConfiguration(versioningMode: VersioningMode.ContinuousDeployment); + var configuration = new TestEffectiveConfiguration(versioningMode: VersioningMode.ContinuousDeployment); - var vars = this.variableProvider.GetVariablesFor(semVer, config, false); + var vars = this.variableProvider.GetVariablesFor(semVer, configuration, false); vars.ToString().ShouldMatchApproved(c => c.SubFolder("Approved")); } @@ -143,9 +143,9 @@ public void ProvidesVariablesInContinuousDeploymentModeForStableWhenCurrentCommi } }; - var config = new TestEffectiveConfiguration(versioningMode: VersioningMode.ContinuousDeployment); + var configuration = new TestEffectiveConfiguration(versioningMode: VersioningMode.ContinuousDeployment); - var vars = this.variableProvider.GetVariablesFor(semVer, config, true); + var vars = this.variableProvider.GetVariablesFor(semVer, configuration, true); vars.ToString().ShouldMatchApproved(c => c.SubFolder("Approved")); } @@ -167,8 +167,8 @@ public void ProvidesVariablesInContinuousDeploymentModeWithTagNamePattern() semVer.BuildMetaData.ShortSha = "commitShortSha"; semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); - var config = new TestEffectiveConfiguration(versioningMode: VersioningMode.ContinuousDeployment, tagNumberPattern: @"[/-](?\d+)[-/]"); - var vars = this.variableProvider.GetVariablesFor(semVer, config, false); + var configuration = new TestEffectiveConfiguration(versioningMode: VersioningMode.ContinuousDeployment, tagNumberPattern: @"[/-](?\d+)[-/]"); + var vars = this.variableProvider.GetVariablesFor(semVer, configuration, false); vars.FullSemVer.ShouldBe("1.2.3-PullRequest2.5"); } @@ -189,8 +189,8 @@ public void ProvidesVariablesInContinuousDeploymentModeWithTagSetToUseBranchName semVer.BuildMetaData.ShortSha = "commitShortSha"; semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); - var config = new TestEffectiveConfiguration(versioningMode: VersioningMode.ContinuousDeployment, tag: "useBranchName"); - var vars = this.variableProvider.GetVariablesFor(semVer, config, false); + var configuration = new TestEffectiveConfiguration(versioningMode: VersioningMode.ContinuousDeployment, tag: "useBranchName"); + var vars = this.variableProvider.GetVariablesFor(semVer, configuration, false); vars.FullSemVer.ShouldBe("1.2.3-feature.5"); } @@ -213,9 +213,9 @@ public void ProvidesVariablesInContinuousDeliveryModeForFeatureBranch() semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); - var config = new TestEffectiveConfiguration(); + var configuration = new TestEffectiveConfiguration(); - var vars = this.variableProvider.GetVariablesFor(semVer, config, false); + var vars = this.variableProvider.GetVariablesFor(semVer, configuration, false); vars.ToString().ShouldMatchApproved(c => c.SubFolder("Approved")); } @@ -238,9 +238,9 @@ public void ProvidesVariablesInContinuousDeliveryModeForFeatureBranchWithCustomA semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); - var config = new TestEffectiveConfiguration(assemblyInformationalFormat: "{Major}.{Minor}.{Patch}+{CommitsSinceVersionSource}.Branch.{BranchName}.Sha.{ShortSha}"); + var configuration = new TestEffectiveConfiguration(assemblyInformationalFormat: "{Major}.{Minor}.{Patch}+{CommitsSinceVersionSource}.Branch.{BranchName}.Sha.{ShortSha}"); - var vars = this.variableProvider.GetVariablesFor(semVer, config, false); + var vars = this.variableProvider.GetVariablesFor(semVer, configuration, false); vars.ToString().ShouldMatchApproved(c => c.SubFolder("Approved")); } diff --git a/src/GitVersion.Core.Tests/VersionConverters/AssemblyInfoFileUpdaterTests.cs b/src/GitVersion.Core.Tests/VersionConverters/AssemblyInfoFileUpdaterTests.cs index 86c884f0fe..34a583953f 100644 --- a/src/GitVersion.Core.Tests/VersionConverters/AssemblyInfoFileUpdaterTests.cs +++ b/src/GitVersion.Core.Tests/VersionConverters/AssemblyInfoFileUpdaterTests.cs @@ -444,8 +444,8 @@ private void VerifyAssemblyInfoFile( this.fileSystem.ReadAllText(fileName).Returns(assemblyFileContent); }); - var config = new TestEffectiveConfiguration(versioningScheme); - var variables = this.variableProvider.GetVariablesFor(version, config, false); + var configuration = new TestEffectiveConfiguration(versioningScheme); + var variables = this.variableProvider.GetVariablesFor(version, configuration, false); verify?.Invoke(this.fileSystem, variables); } diff --git a/src/GitVersion.Core.Tests/VersionConverters/ProjectFileUpdaterTests.cs b/src/GitVersion.Core.Tests/VersionConverters/ProjectFileUpdaterTests.cs index 98cbe37411..fec03d1439 100644 --- a/src/GitVersion.Core.Tests/VersionConverters/ProjectFileUpdaterTests.cs +++ b/src/GitVersion.Core.Tests/VersionConverters/ProjectFileUpdaterTests.cs @@ -302,8 +302,8 @@ private void VerifyAssemblyInfoFile( this.fileSystem.ReadAllText(fileName).Returns(projectFileContent); }); - var config = new TestEffectiveConfiguration(versioningScheme); - var variables = this.variableProvider.GetVariablesFor(version, config, false); + var configuration = new TestEffectiveConfiguration(versioningScheme); + var variables = this.variableProvider.GetVariablesFor(version, configuration, false); verify?.Invoke(this.fileSystem, variables); } diff --git a/src/GitVersion.Core.Tests/VersionConverters/WixFileTests.cs b/src/GitVersion.Core.Tests/VersionConverters/WixFileTests.cs index 6aa2c9e478..7a1533c8bf 100644 --- a/src/GitVersion.Core.Tests/VersionConverters/WixFileTests.cs +++ b/src/GitVersion.Core.Tests/VersionConverters/WixFileTests.cs @@ -33,7 +33,7 @@ public void UpdateWixVersionFile() semVer.BuildMetaData.ShortSha = "commitShortSha"; semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2019-02-20 23:59:59Z"); - var config = new TestEffectiveConfiguration(); + var configuration = new TestEffectiveConfiguration(); var stringBuilder = new StringBuilder(); void Action(string s) => stringBuilder.AppendLine(s); @@ -45,7 +45,7 @@ public void UpdateWixVersionFile() var fileSystem = sp.GetRequiredService(); var variableProvider = sp.GetRequiredService(); - var versionVariables = variableProvider.GetVariablesFor(semVer, config, false); + var versionVariables = variableProvider.GetVariablesFor(semVer, configuration, false); using var wixVersionFileUpdater = sp.GetRequiredService(); @@ -74,7 +74,7 @@ public void UpdateWixVersionFileWhenFileAlreadyExists() semVer.BuildMetaData.ShortSha = "commitShortSha"; semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2019-02-20 23:59:59Z"); - var config = new TestEffectiveConfiguration(); + var configuration = new TestEffectiveConfiguration(); var stringBuilder = new StringBuilder(); void Action(string s) => stringBuilder.AppendLine(s); @@ -86,7 +86,7 @@ public void UpdateWixVersionFileWhenFileAlreadyExists() var fileSystem = sp.GetRequiredService(); var variableProvider = sp.GetRequiredService(); - var versionVariables = variableProvider.GetVariablesFor(semVer, config, false); + var versionVariables = variableProvider.GetVariablesFor(semVer, configuration, false); using var wixVersionFileUpdater = sp.GetRequiredService(); diff --git a/src/GitVersion.Core/Model/AssemblyInfoData.cs b/src/GitVersion.Core/AssemblyInfoData.cs similarity index 100% rename from src/GitVersion.Core/Model/AssemblyInfoData.cs rename to src/GitVersion.Core/AssemblyInfoData.cs diff --git a/src/GitVersion.Core/Model/AuthenticationInfo.cs b/src/GitVersion.Core/AuthenticationInfo.cs similarity index 100% rename from src/GitVersion.Core/Model/AuthenticationInfo.cs rename to src/GitVersion.Core/AuthenticationInfo.cs diff --git a/src/GitVersion.Core/Model/BranchCommit.cs b/src/GitVersion.Core/BranchCommit.cs similarity index 90% rename from src/GitVersion.Core/Model/BranchCommit.cs rename to src/GitVersion.Core/BranchCommit.cs index 84e533a122..6b90f2fd30 100644 --- a/src/GitVersion.Core/Model/BranchCommit.cs +++ b/src/GitVersion.Core/BranchCommit.cs @@ -32,7 +32,7 @@ public override int GetHashCode() { unchecked { - return ((Branch != null ? Branch.GetHashCode() : 0) * 397) ^ (Commit != null ? Commit.GetHashCode() : 0); + return (Branch != null ? Branch.GetHashCode() : 0) * 397 ^ (Commit != null ? Commit.GetHashCode() : 0); } } diff --git a/src/GitVersion.Core/Model/Exceptions/BugException.cs b/src/GitVersion.Core/BugException.cs similarity index 100% rename from src/GitVersion.Core/Model/Exceptions/BugException.cs rename to src/GitVersion.Core/BugException.cs diff --git a/src/GitVersion.Core/Model/ConfigInfo.cs b/src/GitVersion.Core/ConfigInfo.cs similarity index 56% rename from src/GitVersion.Core/Model/ConfigInfo.cs rename to src/GitVersion.Core/ConfigInfo.cs index 822a0ba25d..799e1c1378 100644 --- a/src/GitVersion.Core/Model/ConfigInfo.cs +++ b/src/GitVersion.Core/ConfigInfo.cs @@ -1,10 +1,10 @@ -using GitVersion.Model.Configuration; +using GitVersion.Configuration; namespace GitVersion; public class ConfigInfo { public string? ConfigFile; - public Config? OverrideConfig; + public GitVersionConfiguration? OverrideConfig; public bool ShowConfig; } diff --git a/src/GitVersion.Core/Configuration/Abstractions/IConfigProvider.cs b/src/GitVersion.Core/Configuration/Abstractions/IConfigProvider.cs deleted file mode 100644 index d7b26dfae5..0000000000 --- a/src/GitVersion.Core/Configuration/Abstractions/IConfigProvider.cs +++ /dev/null @@ -1,10 +0,0 @@ -using GitVersion.Model.Configuration; - -namespace GitVersion.Configuration; - -public interface IConfigProvider -{ - Config Provide(Config? overrideConfig = null); - Config Provide(string workingDirectory, Config? overrideConfig = null); - void Init(string workingDirectory); -} diff --git a/src/GitVersion.Core/Configuration/Abstractions/IConfigFileLocator.cs b/src/GitVersion.Core/Configuration/Abstractions/IConfigurationFileLocator.cs similarity index 78% rename from src/GitVersion.Core/Configuration/Abstractions/IConfigFileLocator.cs rename to src/GitVersion.Core/Configuration/Abstractions/IConfigurationFileLocator.cs index 3d3b90eda3..d41dc80bbf 100644 --- a/src/GitVersion.Core/Configuration/Abstractions/IConfigFileLocator.cs +++ b/src/GitVersion.Core/Configuration/Abstractions/IConfigurationFileLocator.cs @@ -1,8 +1,6 @@ -using GitVersion.Model.Configuration; - namespace GitVersion.Configuration; -public interface IConfigFileLocator +public interface IConfigurationFileLocator { string FilePath { get; } bool HasConfigFileAt(string workingDirectory); @@ -10,5 +8,5 @@ public interface IConfigFileLocator void Verify(GitVersionOptions gitVersionOptions, IGitRepositoryInfo repositoryInfo); void Verify(string workingDirectory, string projectRootDirectory); string? SelectConfigFilePath(GitVersionOptions gitVersionOptions, IGitRepositoryInfo repositoryInfo); - Config ReadConfig(string workingDirectory); + GitVersionConfiguration ReadConfig(string workingDirectory); } diff --git a/src/GitVersion.Core/Configuration/Abstractions/IConfigurationProvider.cs b/src/GitVersion.Core/Configuration/Abstractions/IConfigurationProvider.cs new file mode 100644 index 0000000000..c74ca1368e --- /dev/null +++ b/src/GitVersion.Core/Configuration/Abstractions/IConfigurationProvider.cs @@ -0,0 +1,8 @@ +namespace GitVersion.Configuration; + +public interface IConfigurationProvider +{ + GitVersionConfiguration Provide(GitVersionConfiguration? overrideConfiguration = null); + GitVersionConfiguration Provide(string workingDirectory, GitVersionConfiguration? overrideConfiguration = null); + void Init(string workingDirectory); +} diff --git a/src/GitVersion.Core/Model/Configuration/BranchConfig.cs b/src/GitVersion.Core/Configuration/BranchConfiguration.cs similarity index 69% rename from src/GitVersion.Core/Model/Configuration/BranchConfig.cs rename to src/GitVersion.Core/Configuration/BranchConfiguration.cs index a33aaf68f0..007dd84bae 100644 --- a/src/GitVersion.Core/Model/Configuration/BranchConfig.cs +++ b/src/GitVersion.Core/Configuration/BranchConfiguration.cs @@ -1,18 +1,18 @@ using GitVersion.VersionCalculation; using YamlDotNet.Serialization; -namespace GitVersion.Model.Configuration; +namespace GitVersion.Configuration; -public class BranchConfig +public class BranchConfiguration { - public BranchConfig() + public BranchConfiguration() { } /// /// Creates a clone of the given . /// - public BranchConfig(BranchConfig branchConfiguration) + public BranchConfiguration(BranchConfiguration branchConfiguration) { VersioningMode = branchConfiguration.VersioningMode; Tag = branchConfiguration.Tag; @@ -43,16 +43,14 @@ public BranchConfig(BranchConfig branchConfiguration) [YamlMember(Alias = "increment")] public IncrementStrategy? Increment { get; set; } - public BranchConfig Inherit(BranchConfig? parentConfig) + public BranchConfiguration Inherit(BranchConfiguration? parentConfig) { if (parentConfig is null) return this; - var result = new BranchConfig(this); + var result = new BranchConfiguration(this); if (result.Increment is null || result.Increment == IncrementStrategy.Inherit) - { result.Increment = parentConfig.Increment; - } result.VersioningMode ??= parentConfig.VersioningMode; result.Tag ??= parentConfig.Tag; result.PreventIncrementOfMergedBranchVersion ??= parentConfig.PreventIncrementOfMergedBranchVersion; @@ -104,32 +102,32 @@ public BranchConfig Inherit(BranchConfig? parentConfig) public int? PreReleaseWeight { get; set; } /// - /// The name given to this configuration in the config file. + /// The name given to this configuration in the configuration file. /// [YamlIgnore] public string Name { get; set; } - public void MergeTo(BranchConfig targetConfig) + public void MergeTo(BranchConfiguration targetConfig) { if (targetConfig == null) throw new ArgumentNullException(nameof(targetConfig)); - targetConfig.VersioningMode = this.VersioningMode ?? targetConfig.VersioningMode; - targetConfig.Tag = this.Tag ?? targetConfig.Tag; - targetConfig.Increment = this.Increment ?? targetConfig.Increment; - targetConfig.PreventIncrementOfMergedBranchVersion = this.PreventIncrementOfMergedBranchVersion ?? targetConfig.PreventIncrementOfMergedBranchVersion; - targetConfig.TagNumberPattern = this.TagNumberPattern ?? targetConfig.TagNumberPattern; - targetConfig.TrackMergeTarget = this.TrackMergeTarget ?? targetConfig.TrackMergeTarget; - targetConfig.CommitMessageIncrementing = this.CommitMessageIncrementing ?? targetConfig.CommitMessageIncrementing; - targetConfig.Regex = this.Regex ?? targetConfig.Regex; - targetConfig.SourceBranches = this.SourceBranches ?? targetConfig.SourceBranches; - targetConfig.IsSourceBranchFor = this.IsSourceBranchFor ?? targetConfig.IsSourceBranchFor; - targetConfig.TracksReleaseBranches = this.TracksReleaseBranches ?? targetConfig.TracksReleaseBranches; - targetConfig.IsReleaseBranch = this.IsReleaseBranch ?? targetConfig.IsReleaseBranch; - targetConfig.IsMainline = this.IsMainline ?? targetConfig.IsMainline; - targetConfig.PreReleaseWeight = this.PreReleaseWeight ?? targetConfig.PreReleaseWeight; + targetConfig.VersioningMode = VersioningMode ?? targetConfig.VersioningMode; + targetConfig.Tag = Tag ?? targetConfig.Tag; + targetConfig.Increment = Increment ?? targetConfig.Increment; + targetConfig.PreventIncrementOfMergedBranchVersion = PreventIncrementOfMergedBranchVersion ?? targetConfig.PreventIncrementOfMergedBranchVersion; + targetConfig.TagNumberPattern = TagNumberPattern ?? targetConfig.TagNumberPattern; + targetConfig.TrackMergeTarget = TrackMergeTarget ?? targetConfig.TrackMergeTarget; + targetConfig.CommitMessageIncrementing = CommitMessageIncrementing ?? targetConfig.CommitMessageIncrementing; + targetConfig.Regex = Regex ?? targetConfig.Regex; + targetConfig.SourceBranches = SourceBranches ?? targetConfig.SourceBranches; + targetConfig.IsSourceBranchFor = IsSourceBranchFor ?? targetConfig.IsSourceBranchFor; + targetConfig.TracksReleaseBranches = TracksReleaseBranches ?? targetConfig.TracksReleaseBranches; + targetConfig.IsReleaseBranch = IsReleaseBranch ?? targetConfig.IsReleaseBranch; + targetConfig.IsMainline = IsMainline ?? targetConfig.IsMainline; + targetConfig.PreReleaseWeight = PreReleaseWeight ?? targetConfig.PreReleaseWeight; } - public BranchConfig Apply(BranchConfig overrides) + public BranchConfiguration Apply(BranchConfiguration overrides) { if (overrides == null) throw new ArgumentNullException(nameof(overrides)); diff --git a/src/GitVersion.Core/Configuration/ConfigurationBuilder.cs b/src/GitVersion.Core/Configuration/ConfigurationBuilder.cs index 044e97829f..333b570c9d 100644 --- a/src/GitVersion.Core/Configuration/ConfigurationBuilder.cs +++ b/src/GitVersion.Core/Configuration/ConfigurationBuilder.cs @@ -1,5 +1,4 @@ using GitVersion.Extensions; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; namespace GitVersion.Configuration; @@ -8,9 +7,9 @@ public class ConfigurationBuilder { private const int DefaultTagPreReleaseWeight = 60000; - private readonly List overrides = new(); + private readonly List overrides = new(); - public ConfigurationBuilder Add(Config configuration) + public ConfigurationBuilder Add(GitVersionConfiguration configuration) { if (configuration == null) throw new ArgumentNullException(nameof(configuration)); @@ -18,91 +17,91 @@ public ConfigurationBuilder Add(Config configuration) return this; } - public Config Build() + public GitVersionConfiguration Build() { - var config = CreateDefaultConfiguration(); + var configuration = CreateDefaultConfiguration(); - foreach (var overrideConfig in this.overrides) + foreach (var overrideConfiguration in this.overrides) { - ApplyOverrides(config, overrideConfig); + ApplyOverrides(configuration, overrideConfiguration); } - FinalizeConfiguration(config); - ValidateConfiguration(config); + FinalizeConfiguration(configuration); + ValidateConfiguration(configuration); - return config; + return configuration; } - private static void ApplyOverrides(Config targetConfig, Config overrideConfig) + private static void ApplyOverrides(GitVersionConfiguration targetConfig, GitVersionConfiguration overrideConfiguration) { - targetConfig.AssemblyVersioningScheme = overrideConfig.AssemblyVersioningScheme ?? targetConfig.AssemblyVersioningScheme; - targetConfig.AssemblyFileVersioningScheme = overrideConfig.AssemblyFileVersioningScheme ?? targetConfig.AssemblyFileVersioningScheme; - targetConfig.AssemblyInformationalFormat = overrideConfig.AssemblyInformationalFormat ?? targetConfig.AssemblyInformationalFormat; - targetConfig.AssemblyVersioningFormat = overrideConfig.AssemblyVersioningFormat ?? targetConfig.AssemblyVersioningFormat; - targetConfig.AssemblyFileVersioningFormat = overrideConfig.AssemblyFileVersioningFormat ?? targetConfig.AssemblyFileVersioningFormat; - targetConfig.VersioningMode = overrideConfig.VersioningMode ?? targetConfig.VersioningMode; - targetConfig.TagPrefix = overrideConfig.TagPrefix ?? targetConfig.TagPrefix; - targetConfig.ContinuousDeploymentFallbackTag = overrideConfig.ContinuousDeploymentFallbackTag ?? targetConfig.ContinuousDeploymentFallbackTag; - targetConfig.NextVersion = overrideConfig.NextVersion ?? targetConfig.NextVersion; - targetConfig.MajorVersionBumpMessage = overrideConfig.MajorVersionBumpMessage ?? targetConfig.MajorVersionBumpMessage; - targetConfig.MinorVersionBumpMessage = overrideConfig.MinorVersionBumpMessage ?? targetConfig.MinorVersionBumpMessage; - targetConfig.PatchVersionBumpMessage = overrideConfig.PatchVersionBumpMessage ?? targetConfig.PatchVersionBumpMessage; - targetConfig.NoBumpMessage = overrideConfig.NoBumpMessage ?? targetConfig.NoBumpMessage; - targetConfig.TagPreReleaseWeight = overrideConfig.TagPreReleaseWeight ?? targetConfig.TagPreReleaseWeight; - targetConfig.CommitMessageIncrementing = overrideConfig.CommitMessageIncrementing ?? targetConfig.CommitMessageIncrementing; - targetConfig.Increment = overrideConfig.Increment ?? targetConfig.Increment; - targetConfig.CommitDateFormat = overrideConfig.CommitDateFormat ?? targetConfig.CommitDateFormat; - targetConfig.MergeMessageFormats = overrideConfig.MergeMessageFormats.Any() ? overrideConfig.MergeMessageFormats : targetConfig.MergeMessageFormats; - targetConfig.UpdateBuildNumber = overrideConfig.UpdateBuildNumber ?? targetConfig.UpdateBuildNumber; - targetConfig.SemanticVersionFormat = overrideConfig.SemanticVersionFormat; - - if (overrideConfig.Ignore is { IsEmpty: false }) + targetConfig.AssemblyVersioningScheme = overrideConfiguration.AssemblyVersioningScheme ?? targetConfig.AssemblyVersioningScheme; + targetConfig.AssemblyFileVersioningScheme = overrideConfiguration.AssemblyFileVersioningScheme ?? targetConfig.AssemblyFileVersioningScheme; + targetConfig.AssemblyInformationalFormat = overrideConfiguration.AssemblyInformationalFormat ?? targetConfig.AssemblyInformationalFormat; + targetConfig.AssemblyVersioningFormat = overrideConfiguration.AssemblyVersioningFormat ?? targetConfig.AssemblyVersioningFormat; + targetConfig.AssemblyFileVersioningFormat = overrideConfiguration.AssemblyFileVersioningFormat ?? targetConfig.AssemblyFileVersioningFormat; + targetConfig.VersioningMode = overrideConfiguration.VersioningMode ?? targetConfig.VersioningMode; + targetConfig.TagPrefix = overrideConfiguration.TagPrefix ?? targetConfig.TagPrefix; + targetConfig.ContinuousDeploymentFallbackTag = overrideConfiguration.ContinuousDeploymentFallbackTag ?? targetConfig.ContinuousDeploymentFallbackTag; + targetConfig.NextVersion = overrideConfiguration.NextVersion ?? targetConfig.NextVersion; + targetConfig.MajorVersionBumpMessage = overrideConfiguration.MajorVersionBumpMessage ?? targetConfig.MajorVersionBumpMessage; + targetConfig.MinorVersionBumpMessage = overrideConfiguration.MinorVersionBumpMessage ?? targetConfig.MinorVersionBumpMessage; + targetConfig.PatchVersionBumpMessage = overrideConfiguration.PatchVersionBumpMessage ?? targetConfig.PatchVersionBumpMessage; + targetConfig.NoBumpMessage = overrideConfiguration.NoBumpMessage ?? targetConfig.NoBumpMessage; + targetConfig.TagPreReleaseWeight = overrideConfiguration.TagPreReleaseWeight ?? targetConfig.TagPreReleaseWeight; + targetConfig.CommitMessageIncrementing = overrideConfiguration.CommitMessageIncrementing ?? targetConfig.CommitMessageIncrementing; + targetConfig.Increment = overrideConfiguration.Increment ?? targetConfig.Increment; + targetConfig.CommitDateFormat = overrideConfiguration.CommitDateFormat ?? targetConfig.CommitDateFormat; + targetConfig.MergeMessageFormats = overrideConfiguration.MergeMessageFormats.Any() ? overrideConfiguration.MergeMessageFormats : targetConfig.MergeMessageFormats; + targetConfig.UpdateBuildNumber = overrideConfiguration.UpdateBuildNumber ?? targetConfig.UpdateBuildNumber; + targetConfig.SemanticVersionFormat = overrideConfiguration.SemanticVersionFormat; + + if (overrideConfiguration.Ignore is { IsEmpty: false }) { - targetConfig.Ignore = overrideConfig.Ignore; + targetConfig.Ignore = overrideConfiguration.Ignore; } - ApplyBranchOverrides(targetConfig, overrideConfig); + ApplyBranchOverrides(targetConfig, overrideConfiguration); } - private static void ApplyBranchOverrides(Config targetConfig, Config overrideConfig) + private static void ApplyBranchOverrides(GitVersionConfiguration targetConfig, GitVersionConfiguration overrideConfiguration) { - if (overrideConfig.Branches is { Count: > 0 }) + if (overrideConfiguration.Branches is { Count: > 0 }) { // We can't just add new configs to the targetConfig.Branches, and have to create a new dictionary. - // The reason is that GitVersion 5.3.x (and earlier) merges default configs into overrides. The new approach is opposite: we merge overrides into default config. + // The reason is that GitVersion 5.3.x (and earlier) merges default configs into overrides. The new approach is opposite: we merge overrides into default configuration. // The important difference of these approaches is the order of branches in a dictionary (we should not rely on Dictionary's implementation details, but we already did that): // Old approach: { new-branch-1, new-branch-2, default-branch-1, default-branch-2, ... } // New approach: { default-branch-1, default-branch-2, ..., new-branch-1, new-branch-2 } // In case when several branch configurations match the current branch (by regex), we choose the first one. // So we have to add new branches to the beginning of a dictionary to preserve 5.3.x behavior. - var newBranches = new Dictionary(); + var newBranches = new Dictionary(); var targetConfigBranches = targetConfig.Branches; - foreach (var (name, branchConfig) in overrideConfig.Branches) + foreach (var (name, branchConfiguration) in overrideConfiguration.Branches) { // for compatibility reason we check if it's master, we rename it to main - var branchName = name == Config.MasterBranchKey ? Config.MainBranchKey : name; + var branchName = name == GitVersionConfiguration.MasterBranchKey ? GitVersionConfiguration.MainBranchKey : name; if (!targetConfigBranches.TryGetValue(branchName, out var target)) { - target = new BranchConfig() { Name = branchName }; + target = new BranchConfiguration() { Name = branchName }; } - branchConfig.MergeTo(target); - if (target.SourceBranches != null && target.SourceBranches.Contains(Config.MasterBranchKey)) + branchConfiguration.MergeTo(target); + if (target.SourceBranches != null && target.SourceBranches.Contains(GitVersionConfiguration.MasterBranchKey)) { - target.SourceBranches.Remove(Config.MasterBranchKey); - target.SourceBranches.Add(Config.MainBranchKey); + target.SourceBranches.Remove(GitVersionConfiguration.MasterBranchKey); + target.SourceBranches.Add(GitVersionConfiguration.MainBranchKey); } newBranches[branchName] = target; } - foreach (var (name, branchConfig) in targetConfigBranches) + foreach (var (name, branchConfiguration) in targetConfigBranches) { if (!newBranches.ContainsKey(name)) { - newBranches[name] = branchConfig; + newBranches[name] = branchConfiguration; } } @@ -110,48 +109,48 @@ private static void ApplyBranchOverrides(Config targetConfig, Config overrideCon } } - private static void FinalizeConfiguration(Config config) + private static void FinalizeConfiguration(GitVersionConfiguration configuration) { - foreach (var (name, branchConfig) in config.Branches) + foreach (var (name, branchConfiguration) in configuration.Branches) { - FinalizeBranchConfiguration(config, name, branchConfig); + FinalizeBranchConfiguration(configuration, name, branchConfiguration); } } - private static void FinalizeBranchConfiguration(Config config, string name, BranchConfig branchConfig) + private static void FinalizeBranchConfiguration(GitVersionConfiguration configuration, string name, BranchConfiguration branchConfiguration) { - branchConfig.Name = name; - branchConfig.Increment ??= config.Increment ?? IncrementStrategy.Inherit; + branchConfiguration.Name = name; + branchConfiguration.Increment ??= configuration.Increment ?? IncrementStrategy.Inherit; - if (branchConfig.VersioningMode == null) + if (branchConfiguration.VersioningMode == null) { - if (name == Config.DevelopBranchKey) + if (name == GitVersionConfiguration.DevelopBranchKey) { // Why this applies only on develop branch? I'm surprised that the value not coming from configuration. - branchConfig.VersioningMode = config.VersioningMode == VersioningMode.Mainline ? VersioningMode.Mainline : VersioningMode.ContinuousDeployment; + branchConfiguration.VersioningMode = configuration.VersioningMode == VersioningMode.Mainline ? VersioningMode.Mainline : VersioningMode.ContinuousDeployment; } else { - branchConfig.VersioningMode = config.VersioningMode; + branchConfiguration.VersioningMode = configuration.VersioningMode; } } - if (branchConfig.IsSourceBranchFor == null) + if (branchConfiguration.IsSourceBranchFor == null) return; - foreach (var targetBranchName in branchConfig.IsSourceBranchFor) + foreach (var targetBranchName in branchConfiguration.IsSourceBranchFor) { - var targetBranchConfig = config.Branches[targetBranchName]; + var targetBranchConfig = configuration.Branches[targetBranchName]; targetBranchConfig.SourceBranches ??= new HashSet(); targetBranchConfig.SourceBranches.Add(name); } } - private static void ValidateConfiguration(Config config) + private static void ValidateConfiguration(GitVersionConfiguration configuration) { - foreach (var (name, branchConfig) in config.Branches) + foreach (var (name, branchConfiguration) in configuration.Branches) { - var regex = branchConfig?.Regex; + var regex = branchConfiguration?.Regex; var helpUrl = $"{System.Environment.NewLine}See https://gitversion.net/docs/reference/configuration for more info"; if (regex == null) @@ -159,25 +158,25 @@ private static void ValidateConfiguration(Config config) throw new ConfigurationException($"Branch configuration '{name}' is missing required configuration 'regex'{helpUrl}"); } - var sourceBranches = branchConfig?.SourceBranches; + var sourceBranches = branchConfiguration?.SourceBranches; if (sourceBranches == null) { throw new ConfigurationException($"Branch configuration '{name}' is missing required configuration 'source-branches'{helpUrl}"); } - var missingSourceBranches = sourceBranches.Where(sb => !config.Branches.ContainsKey(sb)).ToArray(); + var missingSourceBranches = sourceBranches.Where(sb => !configuration.Branches.ContainsKey(sb)).ToArray(); if (missingSourceBranches.Any()) throw new ConfigurationException($"Branch configuration '{name}' defines these 'source-branches' that are not configured: '[{string.Join(",", missingSourceBranches)}]'{helpUrl}"); } } - private static Config CreateDefaultConfiguration() + private static GitVersionConfiguration CreateDefaultConfiguration() { - var config = new Config + var configuration = new GitVersionConfiguration { AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatch, AssemblyFileVersioningScheme = AssemblyFileVersioningScheme.MajorMinorPatch, - TagPrefix = Config.DefaultTagPrefix, + TagPrefix = GitVersionConfiguration.DefaultTagPrefix, VersioningMode = VersioningMode.ContinuousDelivery, ContinuousDeploymentFallbackTag = "ci", MajorVersionBumpMessage = IncrementStrategyFinder.DefaultMajorPattern, @@ -192,11 +191,11 @@ private static Config CreateDefaultConfiguration() Increment = IncrementStrategy.Inherit }; - AddBranchConfig(Config.DevelopBranchKey, - new BranchConfig + AddBranchConfig(GitVersionConfiguration.DevelopBranchKey, + new BranchConfiguration { Increment = IncrementStrategy.Minor, - Regex = Config.DevelopBranchRegex, + Regex = GitVersionConfiguration.DevelopBranchRegex, SourceBranches = new HashSet(), Tag = "alpha", PreventIncrementOfMergedBranchVersion = false, @@ -207,14 +206,14 @@ private static Config CreateDefaultConfiguration() PreReleaseWeight = 0 }); - AddBranchConfig(Config.MainBranchKey, - new BranchConfig + AddBranchConfig(GitVersionConfiguration.MainBranchKey, + new BranchConfiguration { Increment = IncrementStrategy.Patch, - Regex = Config.MainBranchRegex, + Regex = GitVersionConfiguration.MainBranchRegex, SourceBranches = new HashSet { - Config.DevelopBranchKey, - Config.ReleaseBranchKey + GitVersionConfiguration.DevelopBranchKey, + GitVersionConfiguration.ReleaseBranchKey }, Tag = string.Empty, PreventIncrementOfMergedBranchVersion = true, @@ -225,16 +224,16 @@ private static Config CreateDefaultConfiguration() PreReleaseWeight = 55000 }); - AddBranchConfig(Config.ReleaseBranchKey, - new BranchConfig + AddBranchConfig(GitVersionConfiguration.ReleaseBranchKey, + new BranchConfiguration { Increment = IncrementStrategy.None, - Regex = Config.ReleaseBranchRegex, + Regex = GitVersionConfiguration.ReleaseBranchRegex, SourceBranches = new HashSet { - Config.DevelopBranchKey, - Config.MainBranchKey, - Config.SupportBranchKey, - Config.ReleaseBranchKey + GitVersionConfiguration.DevelopBranchKey, + GitVersionConfiguration.MainBranchKey, + GitVersionConfiguration.SupportBranchKey, + GitVersionConfiguration.ReleaseBranchKey }, Tag = "beta", PreventIncrementOfMergedBranchVersion = true, @@ -245,62 +244,62 @@ private static Config CreateDefaultConfiguration() PreReleaseWeight = 30000 }); - AddBranchConfig(Config.FeatureBranchKey, - new BranchConfig + AddBranchConfig(GitVersionConfiguration.FeatureBranchKey, + new BranchConfiguration { Increment = IncrementStrategy.Inherit, - Regex = Config.FeatureBranchRegex, + Regex = GitVersionConfiguration.FeatureBranchRegex, SourceBranches = new HashSet { - Config.DevelopBranchKey, - Config.MainBranchKey, - Config.ReleaseBranchKey, - Config.FeatureBranchKey, - Config.SupportBranchKey, - Config.HotfixBranchKey + GitVersionConfiguration.DevelopBranchKey, + GitVersionConfiguration.MainBranchKey, + GitVersionConfiguration.ReleaseBranchKey, + GitVersionConfiguration.FeatureBranchKey, + GitVersionConfiguration.SupportBranchKey, + GitVersionConfiguration.HotfixBranchKey }, Tag = "{BranchName}", PreReleaseWeight = 30000 }); - AddBranchConfig(Config.PullRequestBranchKey, - new BranchConfig + AddBranchConfig(GitVersionConfiguration.PullRequestBranchKey, + new BranchConfiguration { Increment = IncrementStrategy.Inherit, - Regex = Config.PullRequestRegex, + Regex = GitVersionConfiguration.PullRequestRegex, SourceBranches = new HashSet { - Config.DevelopBranchKey, - Config.MainBranchKey, - Config.ReleaseBranchKey, - Config.FeatureBranchKey, - Config.SupportBranchKey, - Config.HotfixBranchKey + GitVersionConfiguration.DevelopBranchKey, + GitVersionConfiguration.MainBranchKey, + GitVersionConfiguration.ReleaseBranchKey, + GitVersionConfiguration.FeatureBranchKey, + GitVersionConfiguration.SupportBranchKey, + GitVersionConfiguration.HotfixBranchKey }, Tag = "PullRequest", TagNumberPattern = @"[/-](?\d+)", PreReleaseWeight = 30000 }); - AddBranchConfig(Config.HotfixBranchKey, - new BranchConfig + AddBranchConfig(GitVersionConfiguration.HotfixBranchKey, + new BranchConfiguration { Increment = IncrementStrategy.Inherit, - Regex = Config.HotfixBranchRegex, + Regex = GitVersionConfiguration.HotfixBranchRegex, SourceBranches = new HashSet { - Config.ReleaseBranchKey, - Config.MainBranchKey, - Config.SupportBranchKey, - Config.HotfixBranchKey + GitVersionConfiguration.ReleaseBranchKey, + GitVersionConfiguration.MainBranchKey, + GitVersionConfiguration.SupportBranchKey, + GitVersionConfiguration.HotfixBranchKey }, Tag = "beta", PreReleaseWeight = 30000 }); - AddBranchConfig(Config.SupportBranchKey, - new BranchConfig + AddBranchConfig(GitVersionConfiguration.SupportBranchKey, + new BranchConfiguration { Increment = IncrementStrategy.Patch, - Regex = Config.SupportBranchRegex, - SourceBranches = new HashSet { Config.MainBranchKey }, + Regex = GitVersionConfiguration.SupportBranchRegex, + SourceBranches = new HashSet { GitVersionConfiguration.MainBranchKey }, Tag = string.Empty, PreventIncrementOfMergedBranchVersion = true, TrackMergeTarget = false, @@ -310,12 +309,12 @@ private static Config CreateDefaultConfiguration() PreReleaseWeight = 55000 }); - return config; + return configuration; - void AddBranchConfig(string name, BranchConfig branchConfiguration) + void AddBranchConfig(string name, BranchConfiguration branchConfiguration) { branchConfiguration.Name = name; - config.Branches[name] = branchConfiguration; + configuration.Branches[name] = branchConfiguration; } } } diff --git a/src/GitVersion.Core/Model/Exceptions/ConfigurationException.cs b/src/GitVersion.Core/Configuration/ConfigurationException.cs similarity index 100% rename from src/GitVersion.Core/Model/Exceptions/ConfigurationException.cs rename to src/GitVersion.Core/Configuration/ConfigurationException.cs diff --git a/src/GitVersion.Core/Configuration/ConfigExtensions.cs b/src/GitVersion.Core/Configuration/ConfigurationExtensions.cs similarity index 78% rename from src/GitVersion.Core/Configuration/ConfigExtensions.cs rename to src/GitVersion.Core/Configuration/ConfigurationExtensions.cs index 95e50bc0d4..afa95e14b1 100644 --- a/src/GitVersion.Core/Configuration/ConfigExtensions.cs +++ b/src/GitVersion.Core/Configuration/ConfigurationExtensions.cs @@ -1,16 +1,15 @@ using System.Text.RegularExpressions; using GitVersion.Extensions; using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.Configuration; -public static class ConfigExtensions +public static class ConfigurationExtensions { - public static BranchConfig GetBranchConfiguration(this Config configuration, IBranch branch) + public static BranchConfiguration GetBranchConfiguration(this GitVersionConfiguration configuration, IBranch branch) => GetBranchConfiguration(configuration, branch.NotNull().Name.WithoutRemote); - public static BranchConfig GetBranchConfiguration(this Config configuration, string branchName) + public static BranchConfiguration GetBranchConfiguration(this GitVersionConfiguration configuration, string branchName) { var branchConfiguration = ForBranch(configuration, branchName); if (branchConfiguration is null) @@ -22,7 +21,7 @@ public static BranchConfig GetBranchConfiguration(this Config configuration, str } // TODO: Please make the unknown settings also configurable in the yaml. - public static BranchConfig GetUnknownBranchConfiguration(this Config configuration) => new() + public static BranchConfiguration GetUnknownBranchConfiguration(this GitVersionConfiguration configuration) => new() { Name = "Unknown", Regex = "", @@ -32,9 +31,9 @@ public static BranchConfig GetBranchConfiguration(this Config configuration, str }; // TODO: Please make the fallback settings also configurable in the yaml. - public static BranchConfig GetFallbackBranchConfiguration(this Config configuration) + public static BranchConfiguration GetFallbackBranchConfiguration(this GitVersionConfiguration configuration) { - var result = new BranchConfig() + var result = new BranchConfiguration() { Name = "Fallback", Regex = "", @@ -54,7 +53,7 @@ public static BranchConfig GetFallbackBranchConfiguration(this Config configurat return result; } - private static BranchConfig? ForBranch(Config configuration, string branchName) + private static BranchConfiguration? ForBranch(GitVersionConfiguration configuration, string branchName) { var matches = configuration.Branches .Where(b => b.Value?.Regex != null && Regex.IsMatch(branchName, b.Value.Regex, RegexOptions.IgnoreCase)) @@ -82,7 +81,7 @@ public static BranchConfig GetFallbackBranchConfiguration(this Config configurat } } - public static bool IsReleaseBranch(this Config config, string branchName) => config.GetBranchConfiguration(branchName).IsReleaseBranch ?? false; + public static bool IsReleaseBranch(this GitVersionConfiguration configuration, string branchName) => configuration.GetBranchConfiguration(branchName).IsReleaseBranch ?? false; public static string GetBranchSpecificTag(this EffectiveConfiguration configuration, ILog log, string? branchFriendlyName, string? branchNameOverride) { @@ -108,7 +107,7 @@ public static string GetBranchSpecificTag(this EffectiveConfiguration configurat return tagToUse; } - public static List> GetReleaseBranchConfig(this Config configuration) => + public static List> GetReleaseBranchConfiguration(this GitVersionConfiguration configuration) => configuration.Branches .Where(b => b.Value.IsReleaseBranch == true) .ToList(); diff --git a/src/GitVersion.Core/Configuration/ConfigFileLocator.cs b/src/GitVersion.Core/Configuration/ConfigurationFileLocator.cs similarity index 84% rename from src/GitVersion.Core/Configuration/ConfigFileLocator.cs rename to src/GitVersion.Core/Configuration/ConfigurationFileLocator.cs index 77fdc6f33e..9279ea7d99 100644 --- a/src/GitVersion.Core/Configuration/ConfigFileLocator.cs +++ b/src/GitVersion.Core/Configuration/ConfigurationFileLocator.cs @@ -1,16 +1,15 @@ using GitVersion.Extensions; using GitVersion.Helpers; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; using Microsoft.Extensions.Options; namespace GitVersion.Configuration; -public class ConfigFileLocator : IConfigFileLocator +public class ConfigurationFileLocator : IConfigurationFileLocator { public const string DefaultFileName = "GitVersion.yml"; private readonly IFileSystem fileSystem; - public ConfigFileLocator(IFileSystem fileSystem, IOptions options) + public ConfigurationFileLocator(IFileSystem fileSystem, IOptions options) { this.fileSystem = fileSystem; var configFile = options.Value.ConfigInfo.ConfigFile; @@ -39,21 +38,21 @@ public void Verify(string? workingDirectory, string? projectRootDirectory) return GetConfigFilePath(HasConfigFileAt(workingDirectory) ? workingDirectory : projectRootDirectory); } - public Config ReadConfig(string workingDirectory) + public GitVersionConfiguration ReadConfig(string workingDirectory) { var configFilePath = GetConfigFilePath(workingDirectory); if (configFilePath != null && this.fileSystem.Exists(configFilePath)) { var readAllText = this.fileSystem.ReadAllText(configFilePath); - var readConfig = ConfigSerializer.Read(new StringReader(readAllText)); + var readConfig = ConfigurationSerializer.Read(new StringReader(readAllText)); VerifyReadConfig(readConfig); return readConfig; } - return new Config(); + return new GitVersionConfiguration(); } public void Verify(GitVersionOptions gitVersionOptions, IGitRepositoryInfo repositoryInfo) @@ -71,10 +70,10 @@ public void Verify(GitVersionOptions gitVersionOptions, IGitRepositoryInfo repos Verify(workingDirectory, projectRootDirectory); } - private static void VerifyReadConfig(Config config) + private static void VerifyReadConfig(GitVersionConfiguration configuration) { // Verify no branches are set to mainline mode - if (config.Branches.Any(b => b.Value?.VersioningMode == VersioningMode.Mainline)) + if (configuration.Branches.Any(b => b.Value?.VersioningMode == VersioningMode.Mainline)) { throw new ConfigurationException(@"Mainline mode only works at the repository level, a single branch cannot be put into mainline mode @@ -94,7 +93,7 @@ private void WarnAboutAmbiguousConfigFileSelection(string? workingDirectory, str if (hasConfigInProjectRootDirectory && hasConfigInWorkingDirectory) { - throw new WarningException($"Ambiguous config file selection from '{workingConfigFile}' and '{projectRootConfigFile}'"); + throw new WarningException($"Ambiguous configuration file selection from '{workingConfigFile}' and '{projectRootConfigFile}'"); } if (!hasConfigInProjectRootDirectory && !hasConfigInWorkingDirectory) diff --git a/src/GitVersion.Core/Configuration/ConfigurationModule.cs b/src/GitVersion.Core/Configuration/ConfigurationModule.cs index 1bc2b97666..ab3655c0da 100644 --- a/src/GitVersion.Core/Configuration/ConfigurationModule.cs +++ b/src/GitVersion.Core/Configuration/ConfigurationModule.cs @@ -10,7 +10,7 @@ public void RegisterTypes(IServiceCollection services) { services.AddModule(new GitVersionInitModule()); - services.AddSingleton(); - services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); } } diff --git a/src/GitVersion.Core/Configuration/ConfigProvider.cs b/src/GitVersion.Core/Configuration/ConfigurationProvider.cs similarity index 65% rename from src/GitVersion.Core/Configuration/ConfigProvider.cs rename to src/GitVersion.Core/Configuration/ConfigurationProvider.cs index fc6fe0a586..295b7c8bd0 100644 --- a/src/GitVersion.Core/Configuration/ConfigProvider.cs +++ b/src/GitVersion.Core/Configuration/ConfigurationProvider.cs @@ -1,21 +1,20 @@ using GitVersion.Configuration.Init.Wizard; using GitVersion.Extensions; using GitVersion.Logging; -using GitVersion.Model.Configuration; using Microsoft.Extensions.Options; namespace GitVersion.Configuration; -public class ConfigProvider : IConfigProvider +public class ConfigurationProvider : IConfigurationProvider { private readonly IFileSystem fileSystem; private readonly ILog log; - private readonly IConfigFileLocator configFileLocator; + private readonly IConfigurationFileLocator configFileLocator; private readonly IOptions options; private readonly IConfigInitWizard configInitWizard; private readonly IGitRepositoryInfo repositoryInfo; - public ConfigProvider(IFileSystem fileSystem, ILog log, IConfigFileLocator configFileLocator, + public ConfigurationProvider(IFileSystem fileSystem, ILog log, IConfigurationFileLocator configFileLocator, IOptions options, IConfigInitWizard configInitWizard, IGitRepositoryInfo repositoryInfo) { this.fileSystem = fileSystem.NotNull(); @@ -26,24 +25,27 @@ public ConfigProvider(IFileSystem fileSystem, ILog log, IConfigFileLocator confi this.repositoryInfo = repositoryInfo.NotNull(); } - public Config Provide(Config? overrideConfig = null) + public GitVersionConfiguration Provide(GitVersionConfiguration? overrideConfiguration) { var gitVersionOptions = this.options.Value; var workingDirectory = gitVersionOptions.WorkingDirectory; var projectRootDirectory = this.repositoryInfo.ProjectRootDirectory; var rootDirectory = this.configFileLocator.HasConfigFileAt(workingDirectory) ? workingDirectory : projectRootDirectory; - return Provide(rootDirectory, overrideConfig); + return Provide(rootDirectory, overrideConfiguration); } - public Config Provide(string? workingDirectory, Config? overrideConfig = null) + public GitVersionConfiguration Provide(string? workingDirectory, GitVersionConfiguration? overrideConfiguration) { var configurationBuilder = new ConfigurationBuilder(); + if (workingDirectory != null) configurationBuilder = configurationBuilder.Add(this.configFileLocator.ReadConfig(workingDirectory)); - return configurationBuilder - .Add(overrideConfig ?? new Config()) - .Build(); + + if (overrideConfiguration != null) + configurationBuilder.Add(overrideConfiguration); + + return configurationBuilder.Build(); } public void Init(string workingDirectory) @@ -51,13 +53,13 @@ public void Init(string workingDirectory) var configFilePath = this.configFileLocator.GetConfigFilePath(workingDirectory); var currentConfiguration = this.configFileLocator.ReadConfig(workingDirectory); - var config = this.configInitWizard.Run(currentConfiguration, workingDirectory); - if (config == null || configFilePath == null) return; + var configuration = this.configInitWizard.Run(currentConfiguration, workingDirectory); + if (configuration == null || configFilePath == null) return; using var stream = this.fileSystem.OpenWrite(configFilePath); using var writer = new StreamWriter(stream); - this.log.Info("Saving config file"); - ConfigSerializer.Write(config, writer); + this.log.Info("Saving configuration file"); + ConfigurationSerializer.Write(configuration, writer); stream.Flush(); } } diff --git a/src/GitVersion.Core/Configuration/ConfigSerializer.cs b/src/GitVersion.Core/Configuration/ConfigurationSerializer.cs similarity index 56% rename from src/GitVersion.Core/Configuration/ConfigSerializer.cs rename to src/GitVersion.Core/Configuration/ConfigurationSerializer.cs index 47253abb55..b916f60ab5 100644 --- a/src/GitVersion.Core/Configuration/ConfigSerializer.cs +++ b/src/GitVersion.Core/Configuration/ConfigurationSerializer.cs @@ -1,26 +1,25 @@ -using GitVersion.Model.Configuration; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; namespace GitVersion.Configuration; -public class ConfigSerializer +public class ConfigurationSerializer { - public static Config Read(TextReader reader) + public static GitVersionConfiguration Read(TextReader reader) { var deserializer = new DeserializerBuilder() .WithNamingConvention(HyphenatedNamingConvention.Instance) .Build(); - var config = deserializer.Deserialize(reader); - return config ?? new Config(); + var configuration = deserializer.Deserialize(reader); + return configuration ?? new GitVersionConfiguration(); } - public static void Write(Config config, TextWriter writer) + public static void Write(GitVersionConfiguration configuration, TextWriter writer) { var serializer = new SerializerBuilder() .ConfigureDefaultValuesHandling(DefaultValuesHandling.OmitDefaults) .WithNamingConvention(HyphenatedNamingConvention.Instance) .Build(); - serializer.Serialize(writer, config); + serializer.Serialize(writer, configuration); } } diff --git a/src/GitVersion.Core/Model/Configuration/EffectiveBranchConfiguration.cs b/src/GitVersion.Core/Configuration/EffectiveBranchConfiguration.cs similarity index 93% rename from src/GitVersion.Core/Model/Configuration/EffectiveBranchConfiguration.cs rename to src/GitVersion.Core/Configuration/EffectiveBranchConfiguration.cs index e45d1afa6c..dbafef5173 100644 --- a/src/GitVersion.Core/Model/Configuration/EffectiveBranchConfiguration.cs +++ b/src/GitVersion.Core/Configuration/EffectiveBranchConfiguration.cs @@ -1,7 +1,7 @@ using GitVersion.Extensions; using GitVersion.VersionCalculation; -namespace GitVersion.Model.Configuration; +namespace GitVersion.Configuration; public class EffectiveBranchConfiguration { diff --git a/src/GitVersion.Core/Model/Configuration/EffectiveConfiguration.cs b/src/GitVersion.Core/Configuration/EffectiveConfiguration.cs similarity index 98% rename from src/GitVersion.Core/Model/Configuration/EffectiveConfiguration.cs rename to src/GitVersion.Core/Configuration/EffectiveConfiguration.cs index cf24aa7256..c809e89b93 100644 --- a/src/GitVersion.Core/Model/Configuration/EffectiveConfiguration.cs +++ b/src/GitVersion.Core/Configuration/EffectiveConfiguration.cs @@ -1,7 +1,7 @@ using GitVersion.Extensions; using GitVersion.VersionCalculation; -namespace GitVersion.Model.Configuration; +namespace GitVersion.Configuration; /// /// Configuration can be applied to different things, effective configuration is the result after applying the @@ -9,7 +9,7 @@ namespace GitVersion.Model.Configuration; /// public class EffectiveConfiguration { - public EffectiveConfiguration(Config configuration, BranchConfig currentBranchConfig) + public EffectiveConfiguration(GitVersionConfiguration configuration, BranchConfiguration currentBranchConfig) { configuration.NotNull(); currentBranchConfig.NotNull(); diff --git a/src/GitVersion.Core/Model/Configuration/Config.cs b/src/GitVersion.Core/Configuration/GitVersionConfiguration.cs similarity index 87% rename from src/GitVersion.Core/Model/Configuration/Config.cs rename to src/GitVersion.Core/Configuration/GitVersionConfiguration.cs index 4188523fce..497a366258 100644 --- a/src/GitVersion.Core/Model/Configuration/Config.cs +++ b/src/GitVersion.Core/Configuration/GitVersionConfiguration.cs @@ -1,19 +1,18 @@ using System.Globalization; -using GitVersion.Configuration; using GitVersion.Extensions; using GitVersion.VersionCalculation; using YamlDotNet.Serialization; -namespace GitVersion.Model.Configuration; +namespace GitVersion.Configuration; -public class Config +public class GitVersionConfiguration { private string? nextVersion; - public Config() + public GitVersionConfiguration() { - Branches = new Dictionary(); - Ignore = new IgnoreConfig(); + Branches = new Dictionary(); + Ignore = new IgnoreConfiguration(); } [YamlMember(Alias = "assembly-versioning-scheme")] @@ -43,9 +42,9 @@ public Config() [YamlMember(Alias = "next-version")] public string? NextVersion { - get => this.nextVersion; + get => nextVersion; set => - this.nextVersion = int.TryParse(value, NumberStyles.Any, NumberFormatInfo.InvariantInfo, out var major) + nextVersion = int.TryParse(value, NumberStyles.Any, NumberFormatInfo.InvariantInfo, out var major) ? $"{major}.0" : value; } @@ -69,10 +68,10 @@ public string? NextVersion public CommitMessageIncrementMode? CommitMessageIncrementing { get; set; } [YamlMember(Alias = "branches")] - public Dictionary Branches { get; set; } + public Dictionary Branches { get; set; } [YamlMember(Alias = "ignore")] - public IgnoreConfig Ignore { get; set; } + public IgnoreConfiguration Ignore { get; set; } [YamlMember(Alias = "increment")] public IncrementStrategy? Increment { get; set; } @@ -93,7 +92,7 @@ public override string ToString() { var stringBuilder = new StringBuilder(); using var stream = new StringWriter(stringBuilder); - ConfigSerializer.Write(this, stream); + ConfigurationSerializer.Write(this, stream); stream.Flush(); return stringBuilder.ToString(); } diff --git a/src/GitVersion.Core/Model/Configuration/IgnoreConfig.cs b/src/GitVersion.Core/Configuration/IgnoreConfiguration.cs similarity index 54% rename from src/GitVersion.Core/Model/Configuration/IgnoreConfig.cs rename to src/GitVersion.Core/Configuration/IgnoreConfiguration.cs index 43dc60e288..d8c594e54d 100644 --- a/src/GitVersion.Core/Model/Configuration/IgnoreConfig.cs +++ b/src/GitVersion.Core/Configuration/IgnoreConfiguration.cs @@ -1,24 +1,24 @@ using GitVersion.VersionCalculation; using YamlDotNet.Serialization; -namespace GitVersion.Model.Configuration; +namespace GitVersion.Configuration; -public class IgnoreConfig +public class IgnoreConfiguration { - public IgnoreConfig() => ShAs = Enumerable.Empty(); + public IgnoreConfiguration() => Shas = Enumerable.Empty(); [YamlMember(Alias = "commits-before")] public DateTimeOffset? Before { get; set; } [YamlMember(Alias = "sha")] - public IEnumerable ShAs { get; set; } + public IEnumerable Shas { get; set; } [YamlIgnore] - public virtual bool IsEmpty => Before == null && ShAs.Any() == false; + public virtual bool IsEmpty => Before == null && Shas.Any() == false; public virtual IEnumerable ToFilters() { - if (ShAs.Any()) yield return new ShaVersionFilter(ShAs); + if (Shas.Any()) yield return new ShaVersionFilter(Shas); if (Before.HasValue) yield return new MinDateVersionFilter(Before.Value); } } diff --git a/src/GitVersion.Core/Configuration/Init/BuildServer/AppVeyorSetup.cs b/src/GitVersion.Core/Configuration/Init/BuildServer/AppVeyorSetup.cs index f2a9e1e1be..6915946cb3 100644 --- a/src/GitVersion.Core/Configuration/Init/BuildServer/AppVeyorSetup.cs +++ b/src/GitVersion.Core/Configuration/Init/BuildServer/AppVeyorSetup.cs @@ -1,16 +1,9 @@ using GitVersion.Configuration.Init.Wizard; using GitVersion.Helpers; using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.Configuration.Init.BuildServer; -internal enum ProjectVisibility -{ - Public = 0, - Private = 1 -} - internal class AppVeyorSetup : ConfigInitWizardStep { private ProjectVisibility projectVisibility; @@ -25,7 +18,7 @@ public AppVeyorSetup WithData(ProjectVisibility visibility) return this; } - protected override StepResult HandleResult(string? result, Queue steps, Config config, string workingDirectory) + protected override StepResult HandleResult(string? result, Queue steps, GitVersionConfiguration configuration, string workingDirectory) { var editConfigStep = this.StepFactory.CreateStep(); switch (result) @@ -84,19 +77,19 @@ private void WriteConfig(string workingDirectory, IFileSystem fileSystem, string { var outputFilename = GetOutputFilename(workingDirectory, fileSystem); fileSystem.WriteAllText(outputFilename, configContents); - this.Log.Info($"AppVeyor sample config file written to {outputFilename}"); + this.Log.Info($"AppVeyor sample configuration file written to {outputFilename}"); } - protected override string GetPrompt(Config config, string workingDirectory) + protected override string GetPrompt(GitVersionConfiguration configuration, string workingDirectory) { var prompt = new StringBuilder(); if (AppVeyorConfigExists(workingDirectory, this.FileSystem)) { - prompt.AppendLine("GitVersion doesn't support modifying existing appveyor config files. We will generate appveyor.gitversion.yml instead"); + prompt.AppendLine("GitVersion doesn't support modifying existing appveyor configuration files. We will generate appveyor.gitversion.yml instead"); prompt.AppendLine(); } - prompt.Append(@"What sort of config template would you like generated? + prompt.Append(@"What sort of configuration template would you like generated? 0) Go Back 1) Generate basic (gitversion + msbuild) configuration diff --git a/src/GitVersion.Core/Configuration/Init/BuildServer/AppveyorPublicPrivate.cs b/src/GitVersion.Core/Configuration/Init/BuildServer/AppveyorPublicPrivate.cs index 53e0ae5bba..e60167dcae 100644 --- a/src/GitVersion.Core/Configuration/Init/BuildServer/AppveyorPublicPrivate.cs +++ b/src/GitVersion.Core/Configuration/Init/BuildServer/AppveyorPublicPrivate.cs @@ -1,6 +1,5 @@ using GitVersion.Configuration.Init.Wizard; using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.Configuration.Init.BuildServer; @@ -10,7 +9,7 @@ public AppveyorPublicPrivate(IConsole console, IFileSystem fileSystem, ILog log, { } - protected override StepResult HandleResult(string? result, Queue steps, Config config, string workingDirectory) + protected override StepResult HandleResult(string? result, Queue steps, GitVersionConfiguration configuration, string workingDirectory) { switch (result) { @@ -27,7 +26,7 @@ protected override StepResult HandleResult(string? result, Queue @"Is your project public or private? + protected override string GetPrompt(GitVersionConfiguration configuration, string workingDirectory) => @"Is your project public or private? That is ... does it require authentication to clone/pull? diff --git a/src/GitVersion.Core/Configuration/Init/BuildServer/ProjectVisibility.cs b/src/GitVersion.Core/Configuration/Init/BuildServer/ProjectVisibility.cs new file mode 100644 index 0000000000..06c6b8d64f --- /dev/null +++ b/src/GitVersion.Core/Configuration/Init/BuildServer/ProjectVisibility.cs @@ -0,0 +1,7 @@ +namespace GitVersion.Configuration.Init.BuildServer; + +internal enum ProjectVisibility +{ + Public = 0, + Private = 1 +} diff --git a/src/GitVersion.Core/Configuration/Init/BuildServer/SetupBuildScripts.cs b/src/GitVersion.Core/Configuration/Init/BuildServer/SetupBuildScripts.cs index 9cb9dc52c6..bd1624b8f6 100644 --- a/src/GitVersion.Core/Configuration/Init/BuildServer/SetupBuildScripts.cs +++ b/src/GitVersion.Core/Configuration/Init/BuildServer/SetupBuildScripts.cs @@ -1,6 +1,5 @@ using GitVersion.Configuration.Init.Wizard; using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.Configuration.Init.BuildServer; @@ -10,7 +9,7 @@ public SetupBuildScripts(IConsole console, IFileSystem fileSystem, ILog log, ICo { } - protected override StepResult HandleResult(string? result, Queue steps, Config config, string workingDirectory) + protected override StepResult HandleResult(string? result, Queue steps, GitVersionConfiguration configuration, string workingDirectory) { switch (result) { @@ -24,7 +23,7 @@ protected override StepResult HandleResult(string? result, Queue @"What build server are you using? + protected override string GetPrompt(GitVersionConfiguration configuration, string workingDirectory) => @"What build server are you using? Want to see more? Contribute a pull request! diff --git a/src/GitVersion.Core/Configuration/Init/EditConfigStep.cs b/src/GitVersion.Core/Configuration/Init/EditConfigStep.cs index 4ebc2962ed..9c3914f5a0 100644 --- a/src/GitVersion.Core/Configuration/Init/EditConfigStep.cs +++ b/src/GitVersion.Core/Configuration/Init/EditConfigStep.cs @@ -2,7 +2,6 @@ using GitVersion.Configuration.Init.SetConfig; using GitVersion.Configuration.Init.Wizard; using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.Configuration.Init; @@ -12,7 +11,7 @@ public EditConfigStep(IConsole console, IFileSystem fileSystem, ILog log, IConfi { } - protected override StepResult HandleResult(string? result, Queue steps, Config config, string workingDirectory) + protected override StepResult HandleResult(string? result, Queue steps, GitVersionConfiguration configuration, string workingDirectory) { switch (result) { @@ -46,7 +45,7 @@ protected override StepResult HandleResult(string? result, Queue $@"Which would you like to change? + protected override string GetPrompt(GitVersionConfiguration configuration, string workingDirectory) => $@"Which would you like to change? 0) Save changes and exit 1) Exit without saving @@ -55,8 +54,8 @@ protected override string GetPrompt(Config config, string workingDirectory) => $ 3) Set next version number 4) Branch specific configuration -5) Branch Increment mode (per commit/after tag) (Current: {config.VersioningMode}) -6) Assembly versioning scheme (Current: {config.AssemblyVersioningScheme}) +5) Branch Increment mode (per commit/after tag) (Current: {configuration.VersioningMode}) +6) Assembly versioning scheme (Current: {configuration.AssemblyVersioningScheme}) 7) Setup build scripts"; protected override string? DefaultResult => null; diff --git a/src/GitVersion.Core/Configuration/Init/SetConfig/AssemblyVersioningSchemeSetting.cs b/src/GitVersion.Core/Configuration/Init/SetConfig/AssemblyVersioningSchemeSetting.cs index df1ff061f6..f085e5807b 100644 --- a/src/GitVersion.Core/Configuration/Init/SetConfig/AssemblyVersioningSchemeSetting.cs +++ b/src/GitVersion.Core/Configuration/Init/SetConfig/AssemblyVersioningSchemeSetting.cs @@ -1,7 +1,6 @@ using GitVersion.Configuration.Init.Wizard; using GitVersion.Extensions; using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.Configuration.Init.SetConfig; @@ -11,7 +10,7 @@ public AssemblyVersioningSchemeSetting(IConsole console, IFileSystem fileSystem, { } - protected override StepResult HandleResult(string? result, Queue steps, Config config, string workingDirectory) + protected override StepResult HandleResult(string? result, Queue steps, GitVersionConfiguration configuration, string workingDirectory) { var editConfigStep = this.StepFactory.CreateStep(); switch (result) @@ -20,23 +19,23 @@ protected override StepResult HandleResult(string? result, Queue @"What assembly versioning scheme do you want to use: + protected override string GetPrompt(GitVersionConfiguration configuration, string workingDirectory) => @"What assembly versioning scheme do you want to use: 0) Go Back 1) Major.0.0.0 diff --git a/src/GitVersion.Core/Configuration/Init/SetConfig/ConfigureBranch.cs b/src/GitVersion.Core/Configuration/Init/SetConfig/ConfigureBranch.cs index 470257f4ba..a7f14c73b4 100644 --- a/src/GitVersion.Core/Configuration/Init/SetConfig/ConfigureBranch.cs +++ b/src/GitVersion.Core/Configuration/Init/SetConfig/ConfigureBranch.cs @@ -1,26 +1,25 @@ using GitVersion.Configuration.Init.Wizard; using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.Configuration.Init.SetConfig; public class ConfigureBranch : ConfigInitWizardStep { private string name; - private BranchConfig branchConfig; + private BranchConfiguration branchConfiguration; public ConfigureBranch(IConsole console, IFileSystem fileSystem, ILog log, IConfigInitStepFactory stepFactory) : base(console, fileSystem, log, stepFactory) { } - public ConfigureBranch WithData(string configName, BranchConfig config) + public ConfigureBranch WithData(string configName, BranchConfiguration configuration) { - this.branchConfig = config; + this.branchConfiguration = configuration; this.name = configName; return this; } - protected override StepResult HandleResult(string? result, Queue steps, Config config, string workingDirectory) + protected override StepResult HandleResult(string? result, Queue steps, GitVersionConfiguration configuration, string workingDirectory) { switch (result) { @@ -28,21 +27,21 @@ protected override StepResult HandleResult(string? result, Queue()); return StepResult.Ok(); case "1": - steps.Enqueue(this.StepFactory.CreateStep().WithData(name, branchConfig)); + steps.Enqueue(this.StepFactory.CreateStep().WithData(name, branchConfiguration)); return StepResult.Ok(); case "2": - steps.Enqueue(this.StepFactory.CreateStep().WithData(name, branchConfig)); + steps.Enqueue(this.StepFactory.CreateStep().WithData(name, branchConfiguration)); return StepResult.Ok(); } return StepResult.InvalidResponseSelected(); } - protected override string GetPrompt(Config config, string workingDirectory) => $@"What would you like to change for '{this.name}': + protected override string GetPrompt(GitVersionConfiguration configuration, string workingDirectory) => $@"What would you like to change for '{this.name}': 0) Go Back -1) Branch Pre-release tag (Current: {this.branchConfig.Tag}) -2) Branch Increment mode (per commit/after tag) (Current: {this.branchConfig.VersioningMode})"; +1) Branch Pr-release tag (Current: {this.branchConfiguration.Tag}) +2) Branch Increment mode (per commit/after tag) (Current: {this.branchConfiguration.VersioningMode})"; protected override string DefaultResult => "0"; } diff --git a/src/GitVersion.Core/Configuration/Init/SetConfig/ConfigureBranches.cs b/src/GitVersion.Core/Configuration/Init/SetConfig/ConfigureBranches.cs index 4f95a3843f..70b023fea8 100644 --- a/src/GitVersion.Core/Configuration/Init/SetConfig/ConfigureBranches.cs +++ b/src/GitVersion.Core/Configuration/Init/SetConfig/ConfigureBranches.cs @@ -1,6 +1,5 @@ using GitVersion.Configuration.Init.Wizard; using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.Configuration.Init.SetConfig; @@ -10,7 +9,7 @@ public ConfigureBranches(IConsole console, IFileSystem fileSystem, ILog log, ICo { } - protected override StepResult HandleResult(string? result, Queue steps, Config config, string workingDirectory) + protected override StepResult HandleResult(string? result, Queue steps, GitVersionConfiguration configuration, string workingDirectory) { if (int.TryParse(result, out var parsed)) { @@ -22,14 +21,14 @@ protected override StepResult HandleResult(string? result, Queue().WithData(foundBranch.Key, branchConfig)); + steps.Enqueue(this.StepFactory.CreateStep().WithData(foundBranch.Key, branchConfiguration)); return StepResult.Ok(); } catch (ArgumentOutOfRangeException) @@ -39,20 +38,20 @@ protected override StepResult HandleResult(string? result, Queue @"Which branch would you like to configure: + protected override string GetPrompt(GitVersionConfiguration configuration, string workingDirectory) => @"Which branch would you like to configure: 0) Go Back -" + string.Join(System.Environment.NewLine, OrderedBranches(config).Select((c, i) => $"{i + 1}) {c.Key}")); +" + string.Join(System.Environment.NewLine, OrderedBranches(configuration).Select((c, i) => $"{i + 1}) {c.Key}")); - private static IOrderedEnumerable> OrderedBranches(Config config) + private static IOrderedEnumerable> OrderedBranches(GitVersionConfiguration configuration) { var defaultConfig = new ConfigurationBuilder().Build(); var defaultConfigurationBranches = defaultConfig.Branches - .Where(k => !config.Branches.ContainsKey(k.Key)) - // Return an empty branch config - .Select(v => new KeyValuePair(v.Key, new BranchConfig())); - return config.Branches.Union(defaultConfigurationBranches).OrderBy(b => b.Key); + .Where(k => !configuration.Branches.ContainsKey(k.Key)) + // Return an empty branch configuration + .Select(v => new KeyValuePair(v.Key, new BranchConfiguration())); + return configuration.Branches.Union(defaultConfigurationBranches).OrderBy(b => b.Key); } protected override string DefaultResult => "0"; diff --git a/src/GitVersion.Core/Configuration/Init/SetConfig/GlobalModeSetting.cs b/src/GitVersion.Core/Configuration/Init/SetConfig/GlobalModeSetting.cs index 97e33b2389..9497f3689b 100644 --- a/src/GitVersion.Core/Configuration/Init/SetConfig/GlobalModeSetting.cs +++ b/src/GitVersion.Core/Configuration/Init/SetConfig/GlobalModeSetting.cs @@ -1,6 +1,5 @@ using GitVersion.Configuration.Init.Wizard; using GitVersion.Logging; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; namespace GitVersion.Configuration.Init.SetConfig; @@ -21,20 +20,20 @@ public GlobalModeSetting WithData(ConfigInitWizardStep returnStep, bool isPartOf return this; } - protected override StepResult HandleResult(string? result, Queue steps, Config config, string workingDirectory) + protected override StepResult HandleResult(string? result, Queue steps, GitVersionConfiguration configuration, string workingDirectory) { switch (result) { case "1": - config.VersioningMode = VersioningMode.ContinuousDelivery; + configuration.VersioningMode = VersioningMode.ContinuousDelivery; steps.Enqueue(this.returnToStep); return StepResult.Ok(); case "2": - config.VersioningMode = VersioningMode.ContinuousDeployment; + configuration.VersioningMode = VersioningMode.ContinuousDeployment; steps.Enqueue(this.returnToStep); return StepResult.Ok(); case "3": - config.VersioningMode = VersioningMode.Mainline; + configuration.VersioningMode = VersioningMode.Mainline; steps.Enqueue(this.returnToStep); return StepResult.Ok(); case "0": @@ -46,10 +45,10 @@ protected override StepResult HandleResult(string? result, Queue $@"What do you want the default increment mode to be (can be overriden per branch): + protected override string GetPrompt(GitVersionConfiguration configuration, string workingDirectory) => $@"What do you want the default increment mode to be (can be override per branch): {(!this.isPartOfWizard ? "0) Go Back" : string.Empty)} 1) Follow SemVer and only increment when a release has been tagged (continuous delivery mode) -2) Increment based on branch config every commit (continuous deployment mode) +2) Increment based on branch configuration every commit (continuous deployment mode) 3) Each merged branch against main will increment the version (mainline mode) {(this.isPartOfWizard ? "4) Skip" : string.Empty)}"; diff --git a/src/GitVersion.Core/Configuration/Init/SetConfig/SetBranchIncrementMode.cs b/src/GitVersion.Core/Configuration/Init/SetConfig/SetBranchIncrementMode.cs index 21fdfa667d..2598b89de1 100644 --- a/src/GitVersion.Core/Configuration/Init/SetConfig/SetBranchIncrementMode.cs +++ b/src/GitVersion.Core/Configuration/Init/SetConfig/SetBranchIncrementMode.cs @@ -1,6 +1,5 @@ using GitVersion.Configuration.Init.Wizard; using GitVersion.Logging; -using GitVersion.Model.Configuration; using GitVersion.VersionCalculation; namespace GitVersion.Configuration.Init.SetConfig; @@ -8,45 +7,45 @@ namespace GitVersion.Configuration.Init.SetConfig; public class SetBranchIncrementMode : ConfigInitWizardStep { private string name; - private BranchConfig branchConfig; + private BranchConfiguration branchConfiguration; public SetBranchIncrementMode(IConsole console, IFileSystem fileSystem, ILog log, IConfigInitStepFactory stepFactory) : base(console, fileSystem, log, stepFactory) { } - public SetBranchIncrementMode WithData(string configName, BranchConfig config) + public SetBranchIncrementMode WithData(string configName, BranchConfiguration branchConfiguration) { - this.branchConfig = config; + this.branchConfiguration = branchConfiguration; this.name = configName; return this; } - protected override StepResult HandleResult(string? result, Queue steps, Config config, string workingDirectory) + protected override StepResult HandleResult(string? result, Queue steps, GitVersionConfiguration configuration, string workingDirectory) { var configureBranchStep = this.StepFactory.CreateStep(); switch (result) { case "0": - steps.Enqueue(configureBranchStep.WithData(this.name, this.branchConfig)); + steps.Enqueue(configureBranchStep.WithData(this.name, this.branchConfiguration)); return StepResult.Ok(); case "1": - this.branchConfig.VersioningMode = VersioningMode.ContinuousDelivery; - steps.Enqueue(configureBranchStep.WithData(name, this.branchConfig)); + this.branchConfiguration.VersioningMode = VersioningMode.ContinuousDelivery; + steps.Enqueue(configureBranchStep.WithData(name, this.branchConfiguration)); return StepResult.Ok(); case "2": - this.branchConfig.VersioningMode = VersioningMode.ContinuousDeployment; - steps.Enqueue(configureBranchStep.WithData(name, this.branchConfig)); + this.branchConfiguration.VersioningMode = VersioningMode.ContinuousDeployment; + steps.Enqueue(configureBranchStep.WithData(name, this.branchConfiguration)); return StepResult.Ok(); } return StepResult.InvalidResponseSelected(); } - protected override string GetPrompt(Config config, string workingDirectory) => $@"What do you want the increment mode for {this.name} to be? + protected override string GetPrompt(GitVersionConfiguration configuration, string workingDirectory) => $@"What do you want the increment mode for {this.name} to be? 0) Go Back 1) Follow SemVer and only increment when a release has been tagged (continuous delivery mode) -2) Increment based on branch config every commit (continuous deployment mode)"; +2) Increment based on branch configuration every commit (continuous deployment mode)"; protected override string DefaultResult => "0"; } diff --git a/src/GitVersion.Core/Configuration/Init/SetConfig/SetBranchTag.cs b/src/GitVersion.Core/Configuration/Init/SetConfig/SetBranchTag.cs index 1025c8a207..3713082e9a 100644 --- a/src/GitVersion.Core/Configuration/Init/SetConfig/SetBranchTag.cs +++ b/src/GitVersion.Core/Configuration/Init/SetConfig/SetBranchTag.cs @@ -1,27 +1,26 @@ using GitVersion.Configuration.Init.Wizard; using GitVersion.Extensions; using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.Configuration.Init.SetConfig; public class SetBranchTag : ConfigInitWizardStep { private string name; - private BranchConfig branchConfig; + private BranchConfiguration branchConfiguration; public SetBranchTag(IConsole console, IFileSystem fileSystem, ILog log, IConfigInitStepFactory stepFactory) : base(console, fileSystem, log, stepFactory) { } - public SetBranchTag WithData(string configName, BranchConfig config) + public SetBranchTag WithData(string configName, BranchConfiguration configuration) { - this.branchConfig = config; + this.branchConfiguration = configuration; this.name = configName; return this; } - protected override StepResult HandleResult(string? result, Queue steps, Config config, string workingDirectory) + protected override StepResult HandleResult(string? result, Queue steps, GitVersionConfiguration configuration, string workingDirectory) { if (result.IsNullOrWhiteSpace()) { @@ -32,20 +31,20 @@ protected override StepResult HandleResult(string? result, Queue @"This sets the pre-release tag which will be used for versions on this branch (beta, rc etc) + protected override string GetPrompt(GitVersionConfiguration configuration, string workingDirectory) => @"This sets the per-release tag which will be used for versions on this branch (beta, rc etc) 0) Go Back 1) No tag diff --git a/src/GitVersion.Core/Configuration/Init/SetNextVersion.cs b/src/GitVersion.Core/Configuration/Init/SetNextVersion.cs index f9fb5d1012..979dadc236 100644 --- a/src/GitVersion.Core/Configuration/Init/SetNextVersion.cs +++ b/src/GitVersion.Core/Configuration/Init/SetNextVersion.cs @@ -1,7 +1,6 @@ using GitVersion.Configuration.Init.Wizard; using GitVersion.Extensions; using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.Configuration.Init; @@ -11,7 +10,7 @@ public SetNextVersion(IConsole console, IFileSystem fileSystem, ILog log, IConfi { } - protected override StepResult HandleResult(string? result, Queue steps, Config config, string workingDirectory) + protected override StepResult HandleResult(string? result, Queue steps, GitVersionConfiguration configuration, string workingDirectory) { var editConfigStep = this.StepFactory.CreateStep(); if (result.IsNullOrEmpty()) @@ -23,12 +22,12 @@ protected override StepResult HandleResult(string? result, Queue "What would you like to set the next version to (enter nothing to cancel)?"; + protected override string GetPrompt(GitVersionConfiguration configuration, string workingDirectory) => "What would you like to set the next version to (enter nothing to cancel)?"; protected override string? DefaultResult => null; } diff --git a/src/GitVersion.Core/Configuration/Init/Wizard/ConfigInitWizard.cs b/src/GitVersion.Core/Configuration/Init/Wizard/ConfigInitWizard.cs index 08b8efe00a..91a6522634 100644 --- a/src/GitVersion.Core/Configuration/Init/Wizard/ConfigInitWizard.cs +++ b/src/GitVersion.Core/Configuration/Init/Wizard/ConfigInitWizard.cs @@ -1,6 +1,5 @@ using GitVersion.Extensions; using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.Configuration.Init.Wizard; @@ -15,7 +14,7 @@ public ConfigInitWizard(IConsole console, IConfigInitStepFactory stepFactory) this.stepFactory = stepFactory.NotNull(); } - public Config? Run(Config config, string workingDirectory) + public GitVersionConfiguration? Run(GitVersionConfiguration configuration, string workingDirectory) { this.console.WriteLine("GitVersion init will guide you through setting GitVersion up to work for you"); var steps = new Queue(); @@ -24,12 +23,12 @@ public ConfigInitWizard(IConsole console, IConfigInitStepFactory stepFactory) while (steps.Count > 0) { var currentStep = steps.Dequeue(); - if (!currentStep.Apply(steps, config, workingDirectory)) + if (!currentStep.Apply(steps, configuration, workingDirectory)) { return null; } } - return config; + return configuration; } } diff --git a/src/GitVersion.Core/Configuration/Init/Wizard/ConfigInitWizardStep.cs b/src/GitVersion.Core/Configuration/Init/Wizard/ConfigInitWizardStep.cs index 80077e2d23..553785845e 100644 --- a/src/GitVersion.Core/Configuration/Init/Wizard/ConfigInitWizardStep.cs +++ b/src/GitVersion.Core/Configuration/Init/Wizard/ConfigInitWizardStep.cs @@ -1,6 +1,5 @@ using GitVersion.Extensions; using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.Configuration.Init.Wizard; @@ -19,10 +18,10 @@ protected ConfigInitWizardStep(IConsole console, IFileSystem fileSystem, ILog lo this.StepFactory = stepFactory.NotNull(); } - public bool Apply(Queue steps, Config config, string workingDirectory) + public bool Apply(Queue steps, GitVersionConfiguration configuration, string workingDirectory) { this.Console.WriteLine(); - this.Console.WriteLine(GetPrompt(config, workingDirectory)); + this.Console.WriteLine(GetPrompt(configuration, workingDirectory)); this.Console.WriteLine(); this.Console.Write("> "); var input = this.Console.ReadLine(); @@ -41,7 +40,7 @@ public bool Apply(Queue steps, Config config, string worki return true; } var resultWithDefaultApplied = input.IsNullOrEmpty() ? DefaultResult : input; - var stepResult = HandleResult(resultWithDefaultApplied, steps, config, workingDirectory); + var stepResult = HandleResult(resultWithDefaultApplied, steps, configuration, workingDirectory); if (stepResult.InvalidResponse) { InvalidResponse(steps); @@ -64,7 +63,7 @@ private void InvalidResponse(Queue steps) steps.Enqueue(this); } - protected abstract StepResult HandleResult(string? result, Queue steps, Config config, string workingDirectory); - protected abstract string GetPrompt(Config config, string workingDirectory); + protected abstract StepResult HandleResult(string? result, Queue steps, GitVersionConfiguration configuration, string workingDirectory); + protected abstract string GetPrompt(GitVersionConfiguration configuration, string workingDirectory); protected abstract string? DefaultResult { get; } } diff --git a/src/GitVersion.Core/Configuration/Init/Wizard/FinishedSetupStep.cs b/src/GitVersion.Core/Configuration/Init/Wizard/FinishedSetupStep.cs index 185c903125..b872dfcb93 100644 --- a/src/GitVersion.Core/Configuration/Init/Wizard/FinishedSetupStep.cs +++ b/src/GitVersion.Core/Configuration/Init/Wizard/FinishedSetupStep.cs @@ -1,5 +1,4 @@ using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.Configuration.Init.Wizard; @@ -9,5 +8,5 @@ public FinishedSetupStep(IConsole console, IFileSystem fileSystem, ILog log, ICo { } - protected override string GetPrompt(Config config, string workingDirectory) => $"Questions are all done, you can now edit GitVersion's configuration further{System.Environment.NewLine}" + base.GetPrompt(config, workingDirectory); + protected override string GetPrompt(GitVersionConfiguration configuration, string workingDirectory) => $"Questions are all done, you can now edit GitVersion's configuration further{System.Environment.NewLine}" + base.GetPrompt(configuration, workingDirectory); } diff --git a/src/GitVersion.Core/Configuration/Init/Wizard/GitFlowSetupStep.cs b/src/GitVersion.Core/Configuration/Init/Wizard/GitFlowSetupStep.cs index 4df17baa97..03446bee89 100644 --- a/src/GitVersion.Core/Configuration/Init/Wizard/GitFlowSetupStep.cs +++ b/src/GitVersion.Core/Configuration/Init/Wizard/GitFlowSetupStep.cs @@ -1,6 +1,5 @@ using GitVersion.Configuration.Init.SetConfig; using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.Configuration.Init.Wizard; @@ -10,6 +9,6 @@ public GitFlowSetupStep(IConsole console, IFileSystem fileSystem, ILog log, ICon { } - protected override string GetPrompt(Config config, string workingDirectory) => $"By default GitVersion will only increment the version of the 'develop' branch every commit, all other branches will increment when tagged{System.Environment.NewLine}{System.Environment.NewLine}" + - base.GetPrompt(config, workingDirectory); + protected override string GetPrompt(GitVersionConfiguration configuration, string workingDirectory) + => $"By default GitVersion will only increment the version of the 'develop' branch every commit, all other branches will increment when tagged{System.Environment.NewLine}{System.Environment.NewLine}" + base.GetPrompt(configuration, workingDirectory); } diff --git a/src/GitVersion.Core/Configuration/Init/Wizard/GitHubFlowStep.cs b/src/GitVersion.Core/Configuration/Init/Wizard/GitHubFlowStep.cs index e0ea2bc4b5..a04a2f65d7 100644 --- a/src/GitVersion.Core/Configuration/Init/Wizard/GitHubFlowStep.cs +++ b/src/GitVersion.Core/Configuration/Init/Wizard/GitHubFlowStep.cs @@ -1,6 +1,5 @@ using GitVersion.Configuration.Init.SetConfig; using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.Configuration.Init.Wizard; @@ -10,5 +9,5 @@ public GitHubFlowStep(IConsole console, IFileSystem fileSystem, ILog log, IConfi { } - protected override string GetPrompt(Config config, string workingDirectory) => $"By default GitVersion will only increment the version when tagged{System.Environment.NewLine}{System.Environment.NewLine}" + base.GetPrompt(config, workingDirectory); + protected override string GetPrompt(GitVersionConfiguration configuration, string workingDirectory) => $"By default GitVersion will only increment the version when tagged{System.Environment.NewLine}{System.Environment.NewLine}" + base.GetPrompt(configuration, workingDirectory); } diff --git a/src/GitVersion.Core/Configuration/Init/Wizard/IConfigInitWizard.cs b/src/GitVersion.Core/Configuration/Init/Wizard/IConfigInitWizard.cs index 54c67cf81d..482f419926 100644 --- a/src/GitVersion.Core/Configuration/Init/Wizard/IConfigInitWizard.cs +++ b/src/GitVersion.Core/Configuration/Init/Wizard/IConfigInitWizard.cs @@ -1,8 +1,6 @@ -using GitVersion.Model.Configuration; - namespace GitVersion.Configuration.Init.Wizard; public interface IConfigInitWizard { - Config? Run(Config config, string workingDirectory); + GitVersionConfiguration? Run(GitVersionConfiguration configuration, string workingDirectory); } diff --git a/src/GitVersion.Core/Configuration/Init/Wizard/PickBranchingStrategy1Step.cs b/src/GitVersion.Core/Configuration/Init/Wizard/PickBranchingStrategy1Step.cs index 4cef9bcc14..be077d66bd 100644 --- a/src/GitVersion.Core/Configuration/Init/Wizard/PickBranchingStrategy1Step.cs +++ b/src/GitVersion.Core/Configuration/Init/Wizard/PickBranchingStrategy1Step.cs @@ -1,5 +1,4 @@ using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.Configuration.Init.Wizard; @@ -9,7 +8,7 @@ public PickBranchingStrategy1Step(IConsole console, IFileSystem fileSystem, ILog { } - protected override StepResult HandleResult(string? result, Queue steps, Config config, string workingDirectory) + protected override StepResult HandleResult(string? result, Queue steps, GitVersionConfiguration configuration, string workingDirectory) { switch (result?.ToLower()) { @@ -27,7 +26,7 @@ protected override StepResult HandleResult(string? result, Queue @"GitVersion can try to recommend you a branching strategy based on a few questions. + protected override string GetPrompt(GitVersionConfiguration configuration, string workingDirectory) => @"GitVersion can try to recommend you a branching strategy based on a few questions. Do you need to maintain multiple versions of your application simultaneously in production? (y/n)"; diff --git a/src/GitVersion.Core/Configuration/Init/Wizard/PickBranchingStrategy2Step.cs b/src/GitVersion.Core/Configuration/Init/Wizard/PickBranchingStrategy2Step.cs index 0ad218e2a6..8a079ba9cc 100644 --- a/src/GitVersion.Core/Configuration/Init/Wizard/PickBranchingStrategy2Step.cs +++ b/src/GitVersion.Core/Configuration/Init/Wizard/PickBranchingStrategy2Step.cs @@ -1,5 +1,4 @@ using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.Configuration.Init.Wizard; @@ -9,7 +8,7 @@ public PickBranchingStrategy2Step(IConsole console, IFileSystem fileSystem, ILog { } - protected override StepResult HandleResult(string? result, Queue steps, Config config, string workingDirectory) + protected override StepResult HandleResult(string? result, Queue steps, GitVersionConfiguration configuration, string workingDirectory) { switch (result?.ToLower()) { @@ -30,7 +29,7 @@ protected override StepResult HandleResult(string? result, Queue "Do you stabilise releases while continuing work on the next version? (y/n)"; + protected override string GetPrompt(GitVersionConfiguration configuration, string workingDirectory) => "Do you stabilise releases while continuing work on the next version? (y/n)"; protected override string? DefaultResult => null; } diff --git a/src/GitVersion.Core/Configuration/Init/Wizard/PickBranchingStrategy3Step.cs b/src/GitVersion.Core/Configuration/Init/Wizard/PickBranchingStrategy3Step.cs index e42c540bc2..5021af5584 100644 --- a/src/GitVersion.Core/Configuration/Init/Wizard/PickBranchingStrategy3Step.cs +++ b/src/GitVersion.Core/Configuration/Init/Wizard/PickBranchingStrategy3Step.cs @@ -1,5 +1,4 @@ using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.Configuration.Init.Wizard; @@ -9,7 +8,7 @@ public PickBranchingStrategy3Step(IConsole console, IFileSystem fileSystem, ILog { } - protected override StepResult HandleResult(string? result, Queue steps, Config config, string workingDirectory) + protected override StepResult HandleResult(string? result, Queue steps, GitVersionConfiguration configuration, string workingDirectory) { switch (result?.ToLower()) { @@ -31,7 +30,7 @@ protected override StepResult HandleResult(string? result, Queue "Do you need to build nightly or consume packages the CI build creates without releasing those versions? (y/n)"; + protected override string GetPrompt(GitVersionConfiguration configuration, string workingDirectory) => "Do you need to build nightly or consume packages the CI build creates without releasing those versions? (y/n)"; protected override string? DefaultResult => null; } diff --git a/src/GitVersion.Core/Configuration/Init/Wizard/PickBranchingStrategyStep.cs b/src/GitVersion.Core/Configuration/Init/Wizard/PickBranchingStrategyStep.cs index 458b75d6c9..081679f8cc 100644 --- a/src/GitVersion.Core/Configuration/Init/Wizard/PickBranchingStrategyStep.cs +++ b/src/GitVersion.Core/Configuration/Init/Wizard/PickBranchingStrategyStep.cs @@ -1,5 +1,4 @@ using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.Configuration.Init.Wizard; @@ -9,7 +8,7 @@ public PickBranchingStrategyStep(IConsole console, IFileSystem fileSystem, ILog { } - protected override StepResult HandleResult(string? result, Queue steps, Config config, string workingDirectory) + protected override StepResult HandleResult(string? result, Queue steps, GitVersionConfiguration configuration, string workingDirectory) { var returnToStep = this.StepFactory.CreateStep(); switch (result) @@ -30,7 +29,7 @@ protected override StepResult HandleResult(string? result, Queue @"The way you will use GitVersion will change a lot based on your branching strategy. What branching strategy will you be using: + protected override string GetPrompt(GitVersionConfiguration configuration, string workingDirectory) => @"The way you will use GitVersion will change a lot based on your branching strategy. What branching strategy will you be using: 1) GitFlow (or similar) 2) GitHubFlow diff --git a/src/GitVersion.Core/Core/Abstractions/IRepositoryStore.cs b/src/GitVersion.Core/Core/Abstractions/IRepositoryStore.cs index aca3832ed7..6f524517b2 100644 --- a/src/GitVersion.Core/Core/Abstractions/IRepositoryStore.cs +++ b/src/GitVersion.Core/Core/Abstractions/IRepositoryStore.cs @@ -1,4 +1,4 @@ -using GitVersion.Model.Configuration; +using GitVersion.Configuration; namespace GitVersion.Common; @@ -17,26 +17,26 @@ public interface IRepositoryStore IBranch GetTargetBranch(string? targetBranchName); IBranch? FindBranch(string? branchName); - IBranch? FindMainBranch(Config configuration); - IEnumerable GetReleaseBranches(IEnumerable> releaseBranchConfig); + IBranch? FindMainBranch(GitVersionConfiguration configuration); + IEnumerable GetReleaseBranches(IEnumerable> releaseBranchConfig); IEnumerable ExcludingBranches(IEnumerable branchesToExclude); IEnumerable GetBranchesContainingCommit(ICommit? commit, IEnumerable? branches = null, bool onlyTrackedBranches = false); - IDictionary> GetMainlineBranches(ICommit commit, Config configuration); + IDictionary> GetMainlineBranches(ICommit commit, GitVersionConfiguration configuration); /// /// Find the commit where the given branch was branched from another branch. /// If there are multiple such commits and branches, tries to guess based on commit histories. /// - BranchCommit FindCommitBranchWasBranchedFrom(IBranch? branch, Config configuration, params IBranch[] excludedBranches); + BranchCommit FindCommitBranchWasBranchedFrom(IBranch? branch, GitVersionConfiguration configuration, params IBranch[] excludedBranches); - IEnumerable FindCommitBranchesWasBranchedFrom(IBranch branch, Config configuration, params IBranch[] excludedBranches); + IEnumerable FindCommitBranchesWasBranchedFrom(IBranch branch, GitVersionConfiguration configuration, params IBranch[] excludedBranches); - IEnumerable FindCommitBranchesWasBranchedFrom(IBranch branch, Config configuration, IEnumerable excludedBranches); + IEnumerable FindCommitBranchesWasBranchedFrom(IBranch branch, GitVersionConfiguration configuration, IEnumerable excludedBranches); - IEnumerable GetSourceBranches(IBranch branch, Config configuration, params IBranch[] excludedBranches); + IEnumerable GetSourceBranches(IBranch branch, GitVersionConfiguration configuration, params IBranch[] excludedBranches); - IEnumerable GetSourceBranches(IBranch branch, Config configuration, IEnumerable excludedBranches); + IEnumerable GetSourceBranches(IBranch branch, GitVersionConfiguration configuration, IEnumerable excludedBranches); SemanticVersion? GetCurrentCommitTaggedVersion(ICommit? commit, string? tagPrefix); diff --git a/src/GitVersion.Core/Core/GitPreparer.cs b/src/GitVersion.Core/Core/GitPreparer.cs index 47436d041a..af97418d27 100644 --- a/src/GitVersion.Core/Core/GitPreparer.cs +++ b/src/GitVersion.Core/Core/GitPreparer.cs @@ -1,8 +1,8 @@ using GitVersion.BuildAgents; +using GitVersion.Configuration; using GitVersion.Extensions; using GitVersion.Helpers; using GitVersion.Logging; -using GitVersion.Model.Configuration; using Microsoft.Extensions.Options; namespace GitVersion; @@ -250,11 +250,11 @@ private void ChooseLocalBranchToAttach(string? headSha, IReadOnlyCollection n.Name.EquivalentTo(Config.MainBranchKey)); + var mainBranch = localBranches.SingleOrDefault(n => n.Name.EquivalentTo(GitVersionConfiguration.MainBranchKey)); if (mainBranch != null) { this.log.Warning("Because one of the branches is 'main', will build main." + moveBranchMsg); - Checkout(Config.MainBranchKey); + Checkout(GitVersionConfiguration.MainBranchKey); } else { diff --git a/src/GitVersion.Core/Core/GitVersionContextFactory.cs b/src/GitVersion.Core/Core/GitVersionContextFactory.cs index 0343656554..56b717b9ac 100644 --- a/src/GitVersion.Core/Core/GitVersionContextFactory.cs +++ b/src/GitVersion.Core/Core/GitVersionContextFactory.cs @@ -7,13 +7,13 @@ namespace GitVersion; public class GitVersionContextFactory : IGitVersionContextFactory { - private readonly IConfigProvider configProvider; + private readonly IConfigurationProvider configurationProvider; private readonly IRepositoryStore repositoryStore; private readonly IOptions options; - public GitVersionContextFactory(IConfigProvider configProvider, IRepositoryStore repositoryStore, IOptions options) + public GitVersionContextFactory(IConfigurationProvider configurationProvider, IRepositoryStore repositoryStore, IOptions options) { - this.configProvider = configProvider.NotNull(); + this.configurationProvider = configurationProvider.NotNull(); this.repositoryStore = repositoryStore.NotNull(); this.options = options.NotNull(); } @@ -26,7 +26,7 @@ public GitVersionContext Create(GitVersionOptions gitVersionOptions) var currentCommit = this.repositoryStore.GetCurrentCommit(currentBranch, gitVersionOptions.RepositoryInfo.CommitId); - var configuration = this.configProvider.Provide(this.options.Value.ConfigInfo.OverrideConfig); + var configuration = this.configurationProvider.Provide(this.options.Value.ConfigInfo.OverrideConfig); if (currentBranch.IsDetachedHead) { var branchForCommit = this.repositoryStore.GetBranchesContainingCommit(currentCommit, onlyTrackedBranches: gitVersionOptions.Settings.OnlyTrackedBranches).OnlyOrDefault(); diff --git a/src/GitVersion.Core/Core/MainlineBranchFinder.cs b/src/GitVersion.Core/Core/MainlineBranchFinder.cs index e7837c0879..9b92739be5 100644 --- a/src/GitVersion.Core/Core/MainlineBranchFinder.cs +++ b/src/GitVersion.Core/Core/MainlineBranchFinder.cs @@ -1,23 +1,22 @@ using System.Text.RegularExpressions; using GitVersion.Common; +using GitVersion.Configuration; using GitVersion.Extensions; using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion; internal class MainlineBranchFinder { - private readonly Config configuration; + private readonly GitVersionConfiguration configuration; private readonly ILog log; - private readonly List mainlineBranchConfigurations; + private readonly List mainlineBranchConfigurations; private readonly IGitRepository repository; private readonly IRepositoryStore repositoryStore; - public MainlineBranchFinder(IRepositoryStore repositoryStore, IGitRepository repository, - Config configuration, + GitVersionConfiguration configuration, ILog log) { this.repositoryStore = repositoryStore.NotNull(); @@ -57,7 +56,7 @@ public MainlineConfigBranchMatcher(INamedReference branch, ILog log) this.log = log; } - public bool IsMainline(BranchConfig value) + public bool IsMainline(BranchConfiguration value) { if (value?.Regex == null) return false; @@ -74,11 +73,11 @@ public bool IsMainline(BranchConfig value) private class BranchOriginFinder { private readonly ICommit commit; - private readonly Config configuration; + private readonly GitVersionConfiguration configuration; private readonly ILog log; private readonly IRepositoryStore repositoryStore; - public BranchOriginFinder(ICommit commit, IRepositoryStore repositoryStore, Config configuration, ILog log) + public BranchOriginFinder(ICommit commit, IRepositoryStore repositoryStore, GitVersionConfiguration configuration, ILog log) { this.repositoryStore = repositoryStore; this.commit = commit; diff --git a/src/GitVersion.Core/Core/MergeCommitFinder.cs b/src/GitVersion.Core/Core/MergeCommitFinder.cs index 20e496f6a3..a37cd031ab 100644 --- a/src/GitVersion.Core/Core/MergeCommitFinder.cs +++ b/src/GitVersion.Core/Core/MergeCommitFinder.cs @@ -1,6 +1,6 @@ +using GitVersion.Configuration; using GitVersion.Extensions; using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion; @@ -10,9 +10,9 @@ internal class MergeCommitFinder private readonly ILog log; private readonly Dictionary> mergeBaseCommitsCache = new(); private readonly RepositoryStore repositoryStore; - private readonly Config configuration; + private readonly GitVersionConfiguration configuration; - public MergeCommitFinder(RepositoryStore repositoryStore, Config configuration, IEnumerable excludedBranches, ILog log) + public MergeCommitFinder(RepositoryStore repositoryStore, GitVersionConfiguration configuration, IEnumerable excludedBranches, ILog log) { this.repositoryStore = repositoryStore.NotNull(); this.configuration = configuration.NotNull(); diff --git a/src/GitVersion.Core/Core/RepositoryStore.cs b/src/GitVersion.Core/Core/RepositoryStore.cs index 14492f47de..b8899a5308 100644 --- a/src/GitVersion.Core/Core/RepositoryStore.cs +++ b/src/GitVersion.Core/Core/RepositoryStore.cs @@ -1,8 +1,8 @@ using System.Text.RegularExpressions; using GitVersion.Common; +using GitVersion.Configuration; using GitVersion.Extensions; using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion; @@ -107,21 +107,21 @@ public IBranch GetTargetBranch(string? targetBranchName) public IBranch? FindBranch(string? branchName) => this.repository.Branches.FirstOrDefault(x => x.Name.EquivalentTo(branchName)); - public IBranch? FindMainBranch(Config configuration) + public IBranch? FindMainBranch(GitVersionConfiguration configuration) { - var mainBranchRegex = configuration.Branches[Config.MainBranchKey]?.Regex - ?? configuration.Branches[Config.MasterBranchKey]?.Regex; + var mainBranchRegex = configuration.Branches[GitVersionConfiguration.MainBranchKey]?.Regex + ?? configuration.Branches[GitVersionConfiguration.MasterBranchKey]?.Regex; if (mainBranchRegex == null) { - return FindBranch(Config.MainBranchKey) ?? FindBranch(Config.MasterBranchKey); + return FindBranch(GitVersionConfiguration.MainBranchKey) ?? FindBranch(GitVersionConfiguration.MasterBranchKey); } return this.repository.Branches.FirstOrDefault(b => Regex.IsMatch(b.Name.Friendly, mainBranchRegex, RegexOptions.IgnoreCase)); } - public IEnumerable GetReleaseBranches(IEnumerable> releaseBranchConfig) + public IEnumerable GetReleaseBranches(IEnumerable> releaseBranchConfig) => this.repository.Branches.Where(b => IsReleaseBranch(b, releaseBranchConfig)); public IEnumerable ExcludingBranches(IEnumerable branchesToExclude) => this.repository.Branches.ExcludeBranches(branchesToExclude); @@ -132,16 +132,16 @@ public IEnumerable GetBranchesContainingCommit(ICommit? commit, IEnumer return branchesContainingCommitFinder.GetBranchesContainingCommit(commit, branches, onlyTrackedBranches); } - public IDictionary> GetMainlineBranches(ICommit commit, Config configuration) + public IDictionary> GetMainlineBranches(ICommit commit, GitVersionConfiguration configuration) { var mainlineBranchFinder = new MainlineBranchFinder(this, this.repository, configuration, this.log); return mainlineBranchFinder.FindMainlineBranches(commit); } - public IEnumerable GetSourceBranches(IBranch branch, Config configuration, params IBranch[] excludedBranches) + public IEnumerable GetSourceBranches(IBranch branch, GitVersionConfiguration configuration, params IBranch[] excludedBranches) => GetSourceBranches(branch, configuration, (IEnumerable)excludedBranches); - public IEnumerable GetSourceBranches(IBranch branch, Config configuration, IEnumerable excludedBranches) + public IEnumerable GetSourceBranches(IBranch branch, GitVersionConfiguration configuration, IEnumerable excludedBranches) { var referenceLookup = this.repository.Refs.ToLookup(r => r.TargetIdentifier); @@ -166,7 +166,7 @@ public IEnumerable GetSourceBranches(IBranch branch, Config configurati /// Find the commit where the given branch was branched from another branch. /// If there are multiple such commits and branches, tries to guess based on commit histories. /// - public BranchCommit FindCommitBranchWasBranchedFrom(IBranch? branch, Config configuration, params IBranch[] excludedBranches) + public BranchCommit FindCommitBranchWasBranchedFrom(IBranch? branch, GitVersionConfiguration configuration, params IBranch[] excludedBranches) { branch = branch.NotNull(); @@ -194,10 +194,10 @@ public BranchCommit FindCommitBranchWasBranchedFrom(IBranch? branch, Config conf } } - public IEnumerable FindCommitBranchesWasBranchedFrom(IBranch branch, Config configuration, params IBranch[] excludedBranches) + public IEnumerable FindCommitBranchesWasBranchedFrom(IBranch branch, GitVersionConfiguration configuration, params IBranch[] excludedBranches) => FindCommitBranchesWasBranchedFrom(branch, configuration, (IEnumerable)excludedBranches); - public IEnumerable FindCommitBranchesWasBranchedFrom(IBranch branch, Config configuration, IEnumerable excludedBranches) + public IEnumerable FindCommitBranchesWasBranchedFrom(IBranch branch, GitVersionConfiguration configuration, IEnumerable excludedBranches) { using (this.log.IndentLog($"Finding branches source of '{branch}'")) { @@ -287,7 +287,7 @@ public bool IsCommitOnBranch(ICommit? baseVersionSource, IBranch branch, ICommit public int GetNumberOfUncommittedChanges() => this.repository.GetNumberOfUncommittedChanges(); - private static bool IsReleaseBranch(INamedReference branch, IEnumerable> releaseBranchConfig) + private static bool IsReleaseBranch(INamedReference branch, IEnumerable> releaseBranchConfig) => releaseBranchConfig.Any(c => c.Value?.Regex != null && Regex.IsMatch(branch.Name.Friendly, c.Value.Regex)); private static IEnumerable GetCurrentCommitSemanticVersions(ICommit? commit, string? tagPrefix, ITag tag) diff --git a/src/GitVersion.Core/Core/SourceBranchFinder.cs b/src/GitVersion.Core/Core/SourceBranchFinder.cs index d462b38c40..a6f7b17e40 100644 --- a/src/GitVersion.Core/Core/SourceBranchFinder.cs +++ b/src/GitVersion.Core/Core/SourceBranchFinder.cs @@ -1,16 +1,15 @@ using System.Text.RegularExpressions; using GitVersion.Configuration; using GitVersion.Extensions; -using GitVersion.Model.Configuration; namespace GitVersion; internal class SourceBranchFinder { - private readonly Config configuration; + private readonly GitVersionConfiguration configuration; private readonly IEnumerable excludedBranches; - public SourceBranchFinder(IEnumerable excludedBranches, Config configuration) + public SourceBranchFinder(IEnumerable excludedBranches, GitVersionConfiguration configuration) { this.excludedBranches = excludedBranches.NotNull(); this.configuration = configuration.NotNull(); @@ -27,7 +26,7 @@ private class SourceBranchPredicate private readonly IBranch branch; private readonly IEnumerable sourceBranchRegexes; - public SourceBranchPredicate(IBranch branch, Config configuration) + public SourceBranchPredicate(IBranch branch, GitVersionConfiguration configuration) { this.branch = branch; this.sourceBranchRegexes = GetSourceBranchRegexes(branch, configuration); @@ -44,7 +43,7 @@ public bool IsSourceBranch(INamedReference sourceBranchCandidate) .Any(regex => Regex.IsMatch(branchName, regex)); } - private static IEnumerable GetSourceBranchRegexes(INamedReference branch, Config configuration) + private static IEnumerable GetSourceBranchRegexes(INamedReference branch, GitVersionConfiguration configuration) { var branchName = branch.Name.WithoutRemote; var currentBranchConfig = configuration.GetBranchConfiguration(branchName); diff --git a/src/GitVersion.Core/Extensions/AssemblyFileVersioningScheme.cs b/src/GitVersion.Core/Extensions/AssemblyFileVersioningScheme.cs new file mode 100644 index 0000000000..59b42e2923 --- /dev/null +++ b/src/GitVersion.Core/Extensions/AssemblyFileVersioningScheme.cs @@ -0,0 +1,10 @@ +namespace GitVersion.Extensions; + +public enum AssemblyFileVersioningScheme +{ + MajorMinorPatchTag, + MajorMinorPatch, + MajorMinor, + Major, + None +} diff --git a/src/GitVersion.Core/Extensions/AssemblyVersioningScheme.cs b/src/GitVersion.Core/Extensions/AssemblyVersioningScheme.cs new file mode 100644 index 0000000000..e867035dce --- /dev/null +++ b/src/GitVersion.Core/Extensions/AssemblyVersioningScheme.cs @@ -0,0 +1,10 @@ +namespace GitVersion.Extensions; + +public enum AssemblyVersioningScheme +{ + MajorMinorPatchTag, + MajorMinorPatch, + MajorMinor, + Major, + None +} diff --git a/src/GitVersion.Core/Extensions/AssemblyVersionsGeneratorExtensions.cs b/src/GitVersion.Core/Extensions/AssemblyVersionsGeneratorExtensions.cs index d92d63d559..8f9a7486ae 100644 --- a/src/GitVersion.Core/Extensions/AssemblyVersionsGeneratorExtensions.cs +++ b/src/GitVersion.Core/Extensions/AssemblyVersionsGeneratorExtensions.cs @@ -1,23 +1,5 @@ namespace GitVersion.Extensions; -public enum AssemblyFileVersioningScheme -{ - MajorMinorPatchTag, - MajorMinorPatch, - MajorMinor, - Major, - None -} - -public enum AssemblyVersioningScheme -{ - MajorMinorPatchTag, - MajorMinorPatch, - MajorMinor, - Major, - None -} - public static class AssemblyVersionsGeneratorExtensions { public static string? GetAssemblyVersion(this SemanticVersion sv, AssemblyVersioningScheme scheme) => diff --git a/src/GitVersion.Core/Model/FileWriteInfo.cs b/src/GitVersion.Core/FileWriteInfo.cs similarity index 100% rename from src/GitVersion.Core/Model/FileWriteInfo.cs rename to src/GitVersion.Core/FileWriteInfo.cs diff --git a/src/GitVersion.Core/Model/Exceptions/GitToolsException.cs b/src/GitVersion.Core/GitToolsException.cs similarity index 100% rename from src/GitVersion.Core/Model/Exceptions/GitToolsException.cs rename to src/GitVersion.Core/GitToolsException.cs diff --git a/src/GitVersion.Core/Model/GitVersionContext.cs b/src/GitVersion.Core/GitVersionContext.cs similarity index 75% rename from src/GitVersion.Core/Model/GitVersionContext.cs rename to src/GitVersion.Core/GitVersionContext.cs index f172642c33..dac7b982ab 100644 --- a/src/GitVersion.Core/Model/GitVersionContext.cs +++ b/src/GitVersion.Core/GitVersionContext.cs @@ -1,5 +1,4 @@ using GitVersion.Configuration; -using GitVersion.Model.Configuration; namespace GitVersion; @@ -9,9 +8,9 @@ namespace GitVersion; public class GitVersionContext { /// - /// Contains the raw configuration, use Configuration for specific config based on the current GitVersion context. + /// Contains the raw configuration, use Configuration for specific configuration based on the current GitVersion context. /// - public Config Configuration { get; } + public GitVersionConfiguration Configuration { get; } public SemanticVersion? CurrentCommitTaggedVersion { get; } @@ -24,7 +23,7 @@ public class GitVersionContext public int NumberOfUncommittedChanges { get; } public GitVersionContext(IBranch currentBranch, ICommit? currentCommit, - Config configuration, SemanticVersion? currentCommitTaggedVersion, int numberOfUncommittedChanges) + GitVersionConfiguration configuration, SemanticVersion? currentCommitTaggedVersion, int numberOfUncommittedChanges) { CurrentBranch = currentBranch; CurrentCommit = currentCommit; @@ -35,7 +34,7 @@ public GitVersionContext(IBranch currentBranch, ICommit? currentCommit, public EffectiveConfiguration GetEffectiveConfiguration(IBranch branch) { - BranchConfig branchConfiguration = Configuration.GetBranchConfiguration(branch); + BranchConfiguration branchConfiguration = Configuration.GetBranchConfiguration(branch); return new EffectiveConfiguration(Configuration, branchConfiguration); } } diff --git a/src/GitVersion.Core/Model/Exceptions/GitVersionException.cs b/src/GitVersion.Core/GitVersionException.cs similarity index 100% rename from src/GitVersion.Core/Model/Exceptions/GitVersionException.cs rename to src/GitVersion.Core/GitVersionException.cs diff --git a/src/GitVersion.Core/Model/GitVersionOptions.cs b/src/GitVersion.Core/GitVersionOptions.cs similarity index 97% rename from src/GitVersion.Core/Model/GitVersionOptions.cs rename to src/GitVersion.Core/GitVersionOptions.cs index b0cba50076..d282e8b30a 100644 --- a/src/GitVersion.Core/Model/GitVersionOptions.cs +++ b/src/GitVersion.Core/GitVersionOptions.cs @@ -1,5 +1,4 @@ using GitVersion.Logging; -using GitVersion.Model; namespace GitVersion; diff --git a/src/GitVersion.Core/Model/Exceptions/LockedFileException.cs b/src/GitVersion.Core/LockedFileException.cs similarity index 100% rename from src/GitVersion.Core/Model/Exceptions/LockedFileException.cs rename to src/GitVersion.Core/LockedFileException.cs diff --git a/src/GitVersion.Core/Model/MergeMessage.cs b/src/GitVersion.Core/MergeMessage.cs similarity index 89% rename from src/GitVersion.Core/Model/MergeMessage.cs rename to src/GitVersion.Core/MergeMessage.cs index 97a5c425f0..8baf7cbf95 100644 --- a/src/GitVersion.Core/Model/MergeMessage.cs +++ b/src/GitVersion.Core/MergeMessage.cs @@ -1,5 +1,5 @@ using System.Text.RegularExpressions; -using GitVersion.Model.Configuration; +using GitVersion.Configuration; namespace GitVersion; @@ -15,14 +15,14 @@ public class MergeMessage new("RemoteTracking", @"^Merge remote-tracking branch '(?[^\s]*)'(?: into (?[^\s]*))*") }; - public MergeMessage(string? mergeMessage, Config config) + public MergeMessage(string? mergeMessage, GitVersionConfiguration configuration) { if (mergeMessage == null) throw new NullReferenceException(); - // Concat config formats with the defaults. - // Ensure configs are processed first. - var allFormats = config.MergeMessageFormats + // Concatenate configuration formats with the defaults. + // Ensure configurations are processed first. + var allFormats = configuration.MergeMessageFormats .Select(x => new MergeMessageFormat(x.Key, x.Value)) .Concat(DefaultFormats); @@ -44,7 +44,7 @@ public MergeMessage(string? mergeMessage, Config config) PullRequestNumber = pullNumber; } - Version = ParseVersion(config.TagPrefix); + Version = ParseVersion(configuration.TagPrefix); break; } diff --git a/src/GitVersion.Core/Model/Exceptions/InfiniteLoopProtectionException.cs b/src/GitVersion.Core/Model/Exceptions/InfiniteLoopProtectionException.cs deleted file mode 100644 index 0828ae18c1..0000000000 --- a/src/GitVersion.Core/Model/Exceptions/InfiniteLoopProtectionException.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace GitVersion.Model.Exceptions -{ - public class InfiniteLoopProtectionException : Exception - { - public InfiniteLoopProtectionException(string messageFormat) - : base(messageFormat) - { - } - } -} diff --git a/src/GitVersion.Core/Model/OutputType.cs b/src/GitVersion.Core/OutputType.cs similarity index 69% rename from src/GitVersion.Core/Model/OutputType.cs rename to src/GitVersion.Core/OutputType.cs index e7cea06b7d..bb72800fc7 100644 --- a/src/GitVersion.Core/Model/OutputType.cs +++ b/src/GitVersion.Core/OutputType.cs @@ -1,4 +1,4 @@ -namespace GitVersion.Model; +namespace GitVersion; public enum OutputType { diff --git a/src/GitVersion.Core/Model/VersionVariables.cs b/src/GitVersion.Core/OutputVariables/VersionVariables.cs similarity index 100% rename from src/GitVersion.Core/Model/VersionVariables.cs rename to src/GitVersion.Core/OutputVariables/VersionVariables.cs diff --git a/src/GitVersion.Core/Model/VersionVariablesJsonModel.cs b/src/GitVersion.Core/OutputVariables/VersionVariablesJsonModel.cs similarity index 100% rename from src/GitVersion.Core/Model/VersionVariablesJsonModel.cs rename to src/GitVersion.Core/OutputVariables/VersionVariablesJsonModel.cs diff --git a/src/GitVersion.Core/Model/VersionVariablesJsonNumberConverter.cs b/src/GitVersion.Core/OutputVariables/VersionVariablesJsonNumberConverter.cs similarity index 100% rename from src/GitVersion.Core/Model/VersionVariablesJsonNumberConverter.cs rename to src/GitVersion.Core/OutputVariables/VersionVariablesJsonNumberConverter.cs diff --git a/src/GitVersion.Core/Model/VersionVariablesJsonStringConverter.cs b/src/GitVersion.Core/OutputVariables/VersionVariablesJsonStringConverter.cs similarity index 100% rename from src/GitVersion.Core/Model/VersionVariablesJsonStringConverter.cs rename to src/GitVersion.Core/OutputVariables/VersionVariablesJsonStringConverter.cs diff --git a/src/GitVersion.Core/PublicAPI.Shipped.txt b/src/GitVersion.Core/PublicAPI.Shipped.txt index fbe53e2f4c..a05ee98e2e 100644 --- a/src/GitVersion.Core/PublicAPI.Shipped.txt +++ b/src/GitVersion.Core/PublicAPI.Shipped.txt @@ -3,10 +3,10 @@ abstract GitVersion.BuildAgents.BuildAgentBase.EnvironmentVariable.get -> string abstract GitVersion.BuildAgents.BuildAgentBase.GenerateSetParameterMessage(string! name, string! value) -> string![]! abstract GitVersion.BuildAgents.BuildAgentBase.GenerateSetVersionMessage(GitVersion.OutputVariables.VersionVariables! variables) -> string? abstract GitVersion.Configuration.Init.Wizard.ConfigInitWizardStep.DefaultResult.get -> string? -abstract GitVersion.Configuration.Init.Wizard.ConfigInitWizardStep.GetPrompt(GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> string! -abstract GitVersion.Configuration.Init.Wizard.ConfigInitWizardStep.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! +abstract GitVersion.Configuration.Init.Wizard.ConfigInitWizardStep.GetPrompt(GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> string! +abstract GitVersion.Configuration.Init.Wizard.ConfigInitWizardStep.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! abstract GitVersion.GitVersionModule.RegisterTypes(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void -abstract GitVersion.VersionCalculation.VersionStrategyBase.GetBaseVersions(GitVersion.Model.Configuration.EffectiveBranchConfiguration! configuration) -> System.Collections.Generic.IEnumerable! +abstract GitVersion.VersionCalculation.VersionStrategyBase.GetBaseVersions(GitVersion.Configuration.EffectiveBranchConfiguration! configuration) -> System.Collections.Generic.IEnumerable! const GitVersion.BuildAgents.AppVeyor.EnvironmentVariableName = "APPVEYOR" -> string! const GitVersion.BuildAgents.AzurePipelines.EnvironmentVariableName = "TF_BUILD" -> string! const GitVersion.BuildAgents.BitBucketPipelines.BranchEnvironmentVariableName = "BITBUCKET_BRANCH" -> string! @@ -27,23 +27,23 @@ const GitVersion.BuildAgents.MyGet.EnvironmentVariableName = "BuildRunner" -> st const GitVersion.BuildAgents.SpaceAutomation.EnvironmentVariableName = "JB_SPACE_PROJECT_KEY" -> string! const GitVersion.BuildAgents.TeamCity.EnvironmentVariableName = "TEAMCITY_VERSION" -> string! const GitVersion.BuildAgents.TravisCi.EnvironmentVariableName = "TRAVIS" -> string! -const GitVersion.Configuration.ConfigFileLocator.DefaultFileName = "GitVersion.yml" -> string! -const GitVersion.Model.Configuration.Config.DefaultTagPrefix = "[vV]" -> string! -const GitVersion.Model.Configuration.Config.DevelopBranchKey = "develop" -> string! -const GitVersion.Model.Configuration.Config.DevelopBranchRegex = "^dev(elop)?(ment)?$" -> string! -const GitVersion.Model.Configuration.Config.FeatureBranchKey = "feature" -> string! -const GitVersion.Model.Configuration.Config.FeatureBranchRegex = "^features?[/-]" -> string! -const GitVersion.Model.Configuration.Config.HotfixBranchKey = "hotfix" -> string! -const GitVersion.Model.Configuration.Config.HotfixBranchRegex = "^hotfix(es)?[/-]" -> string! -const GitVersion.Model.Configuration.Config.MainBranchKey = "main" -> string! -const GitVersion.Model.Configuration.Config.MainBranchRegex = "^master$|^main$" -> string! -const GitVersion.Model.Configuration.Config.MasterBranchKey = "master" -> string! -const GitVersion.Model.Configuration.Config.PullRequestBranchKey = "pull-request" -> string! -const GitVersion.Model.Configuration.Config.PullRequestRegex = "^(pull|pull\\-requests|pr)[/-]" -> string! -const GitVersion.Model.Configuration.Config.ReleaseBranchKey = "release" -> string! -const GitVersion.Model.Configuration.Config.ReleaseBranchRegex = "^releases?[/-]" -> string! -const GitVersion.Model.Configuration.Config.SupportBranchKey = "support" -> string! -const GitVersion.Model.Configuration.Config.SupportBranchRegex = "^support[/-]" -> string! +const GitVersion.Configuration.ConfigurationFileLocator.DefaultFileName = "GitVersion.yml" -> string! +const GitVersion.Configuration.GitVersionConfiguration.DefaultTagPrefix = "[vV]" -> string! +const GitVersion.Configuration.GitVersionConfiguration.DevelopBranchKey = "develop" -> string! +const GitVersion.Configuration.GitVersionConfiguration.DevelopBranchRegex = "^dev(elop)?(ment)?$" -> string! +const GitVersion.Configuration.GitVersionConfiguration.FeatureBranchKey = "feature" -> string! +const GitVersion.Configuration.GitVersionConfiguration.FeatureBranchRegex = "^features?[/-]" -> string! +const GitVersion.Configuration.GitVersionConfiguration.HotfixBranchKey = "hotfix" -> string! +const GitVersion.Configuration.GitVersionConfiguration.HotfixBranchRegex = "^hotfix(es)?[/-]" -> string! +const GitVersion.Configuration.GitVersionConfiguration.MainBranchKey = "main" -> string! +const GitVersion.Configuration.GitVersionConfiguration.MainBranchRegex = "^master$|^main$" -> string! +const GitVersion.Configuration.GitVersionConfiguration.MasterBranchKey = "master" -> string! +const GitVersion.Configuration.GitVersionConfiguration.PullRequestBranchKey = "pull-request" -> string! +const GitVersion.Configuration.GitVersionConfiguration.PullRequestRegex = "^(pull|pull\\-requests|pr)[/-]" -> string! +const GitVersion.Configuration.GitVersionConfiguration.ReleaseBranchKey = "release" -> string! +const GitVersion.Configuration.GitVersionConfiguration.ReleaseBranchRegex = "^releases?[/-]" -> string! +const GitVersion.Configuration.GitVersionConfiguration.SupportBranchKey = "support" -> string! +const GitVersion.Configuration.GitVersionConfiguration.SupportBranchRegex = "^support[/-]" -> string! const GitVersion.VersionCalculation.IncrementStrategyFinder.DefaultMajorPattern = "\\+semver:\\s?(breaking|major)" -> string! const GitVersion.VersionCalculation.IncrementStrategyFinder.DefaultMinorPattern = "\\+semver:\\s?(feature|minor)" -> string! const GitVersion.VersionCalculation.IncrementStrategyFinder.DefaultNoBumpPattern = "\\+semver:\\s?(none|skip)" -> string! @@ -126,9 +126,9 @@ GitVersion.BuildAgents.TeamCity GitVersion.BuildAgents.TeamCity.TeamCity(GitVersion.IEnvironment! environment, GitVersion.Logging.ILog! log) -> void GitVersion.BuildAgents.TravisCi GitVersion.BuildAgents.TravisCi.TravisCi(GitVersion.IEnvironment! environment, GitVersion.Logging.ILog! log) -> void -GitVersion.Cache.GitVersionCacheKey -GitVersion.Cache.GitVersionCacheKey.GitVersionCacheKey(string! value) -> void -GitVersion.Cache.GitVersionCacheKey.Value.get -> string! +GitVersion.VersionCalculation.Cache.GitVersionCacheKey +GitVersion.VersionCalculation.Cache.GitVersionCacheKey.GitVersionCacheKey(string! value) -> void +GitVersion.VersionCalculation.Cache.GitVersionCacheKey.Value.get -> string! GitVersion.CommitFilter GitVersion.CommitFilter.CommitFilter() -> void GitVersion.CommitFilter.ExcludeReachableFrom.get -> object? @@ -147,23 +147,23 @@ GitVersion.CommitSortStrategies.Topological = 1 -> GitVersion.CommitSortStrategi GitVersion.Common.IRepositoryStore GitVersion.Common.IRepositoryStore.ExcludingBranches(System.Collections.Generic.IEnumerable! branchesToExclude) -> System.Collections.Generic.IEnumerable! GitVersion.Common.IRepositoryStore.FindBranch(string? branchName) -> GitVersion.IBranch? -GitVersion.Common.IRepositoryStore.FindCommitBranchesWasBranchedFrom(GitVersion.IBranch! branch, GitVersion.Model.Configuration.Config! configuration, params GitVersion.IBranch![]! excludedBranches) -> System.Collections.Generic.IEnumerable! -GitVersion.Common.IRepositoryStore.FindCommitBranchesWasBranchedFrom(GitVersion.IBranch! branch, GitVersion.Model.Configuration.Config! configuration, System.Collections.Generic.IEnumerable! excludedBranches) -> System.Collections.Generic.IEnumerable! -GitVersion.Common.IRepositoryStore.FindCommitBranchWasBranchedFrom(GitVersion.IBranch? branch, GitVersion.Model.Configuration.Config! configuration, params GitVersion.IBranch![]! excludedBranches) -> GitVersion.BranchCommit -GitVersion.Common.IRepositoryStore.FindMainBranch(GitVersion.Model.Configuration.Config! configuration) -> GitVersion.IBranch? +GitVersion.Common.IRepositoryStore.FindCommitBranchesWasBranchedFrom(GitVersion.IBranch! branch, GitVersion.Configuration.GitVersionConfiguration! configuration, params GitVersion.IBranch![]! excludedBranches) -> System.Collections.Generic.IEnumerable! +GitVersion.Common.IRepositoryStore.FindCommitBranchesWasBranchedFrom(GitVersion.IBranch! branch, GitVersion.Configuration.GitVersionConfiguration! configuration, System.Collections.Generic.IEnumerable! excludedBranches) -> System.Collections.Generic.IEnumerable! +GitVersion.Common.IRepositoryStore.FindCommitBranchWasBranchedFrom(GitVersion.IBranch? branch, GitVersion.Configuration.GitVersionConfiguration! configuration, params GitVersion.IBranch![]! excludedBranches) -> GitVersion.BranchCommit +GitVersion.Common.IRepositoryStore.FindMainBranch(GitVersion.Configuration.GitVersionConfiguration! configuration) -> GitVersion.IBranch? GitVersion.Common.IRepositoryStore.FindMergeBase(GitVersion.IBranch? branch, GitVersion.IBranch? otherBranch) -> GitVersion.ICommit? GitVersion.Common.IRepositoryStore.FindMergeBase(GitVersion.ICommit! commit, GitVersion.ICommit! mainlineTip) -> GitVersion.ICommit? GitVersion.Common.IRepositoryStore.GetBranchesContainingCommit(GitVersion.ICommit? commit, System.Collections.Generic.IEnumerable? branches = null, bool onlyTrackedBranches = false) -> System.Collections.Generic.IEnumerable! GitVersion.Common.IRepositoryStore.GetCommitLog(GitVersion.ICommit? baseVersionSource, GitVersion.ICommit? currentCommit) -> System.Collections.Generic.IEnumerable! GitVersion.Common.IRepositoryStore.GetCurrentCommit(GitVersion.IBranch! currentBranch, string? commitId) -> GitVersion.ICommit? GitVersion.Common.IRepositoryStore.GetCurrentCommitTaggedVersion(GitVersion.ICommit? commit, string? tagPrefix) -> GitVersion.SemanticVersion? -GitVersion.Common.IRepositoryStore.GetMainlineBranches(GitVersion.ICommit! commit, GitVersion.Model.Configuration.Config! configuration) -> System.Collections.Generic.IDictionary!>! +GitVersion.Common.IRepositoryStore.GetMainlineBranches(GitVersion.ICommit! commit, GitVersion.Configuration.GitVersionConfiguration! configuration) -> System.Collections.Generic.IDictionary!>! GitVersion.Common.IRepositoryStore.GetMainlineCommitLog(GitVersion.ICommit? baseVersionSource, GitVersion.ICommit? mainlineTip) -> System.Collections.Generic.IEnumerable! GitVersion.Common.IRepositoryStore.GetMergeBaseCommits(GitVersion.ICommit? mergeCommit, GitVersion.ICommit? mergedHead, GitVersion.ICommit? findMergeBase) -> System.Collections.Generic.IEnumerable! GitVersion.Common.IRepositoryStore.GetNumberOfUncommittedChanges() -> int -GitVersion.Common.IRepositoryStore.GetReleaseBranches(System.Collections.Generic.IEnumerable>! releaseBranchConfig) -> System.Collections.Generic.IEnumerable! -GitVersion.Common.IRepositoryStore.GetSourceBranches(GitVersion.IBranch! branch, GitVersion.Model.Configuration.Config! configuration, params GitVersion.IBranch![]! excludedBranches) -> System.Collections.Generic.IEnumerable! -GitVersion.Common.IRepositoryStore.GetSourceBranches(GitVersion.IBranch! branch, GitVersion.Model.Configuration.Config! configuration, System.Collections.Generic.IEnumerable! excludedBranches) -> System.Collections.Generic.IEnumerable! +GitVersion.Common.IRepositoryStore.GetReleaseBranches(System.Collections.Generic.IEnumerable>! releaseBranchConfig) -> System.Collections.Generic.IEnumerable! +GitVersion.Common.IRepositoryStore.GetSourceBranches(GitVersion.IBranch! branch, GitVersion.Configuration.GitVersionConfiguration! configuration, params GitVersion.IBranch![]! excludedBranches) -> System.Collections.Generic.IEnumerable! +GitVersion.Common.IRepositoryStore.GetSourceBranches(GitVersion.IBranch! branch, GitVersion.Configuration.GitVersionConfiguration! configuration, System.Collections.Generic.IEnumerable! excludedBranches) -> System.Collections.Generic.IEnumerable! GitVersion.Common.IRepositoryStore.GetTargetBranch(string? targetBranchName) -> GitVersion.IBranch! GitVersion.Common.IRepositoryStore.GetValidVersionTags(string? tagPrefixRegex, System.DateTimeOffset? olderThan = null) -> System.Collections.Generic.IEnumerable<(GitVersion.ITag! Tag, GitVersion.SemanticVersion! Semver, GitVersion.ICommit! Commit)>! GitVersion.Common.IRepositoryStore.GetVersionTagsOnBranch(GitVersion.IBranch! branch, string? tagPrefixRegex) -> System.Collections.Generic.IEnumerable! @@ -171,46 +171,172 @@ GitVersion.Common.IRepositoryStore.IsCommitOnBranch(GitVersion.ICommit? baseVers GitVersion.ConfigInfo GitVersion.ConfigInfo.ConfigFile -> string? GitVersion.ConfigInfo.ConfigInfo() -> void -GitVersion.ConfigInfo.OverrideConfig -> GitVersion.Model.Configuration.Config? +GitVersion.ConfigInfo.OverrideConfig -> GitVersion.Configuration.GitVersionConfiguration? GitVersion.ConfigInfo.ShowConfig -> bool -GitVersion.Configuration.ConfigExtensions -GitVersion.Configuration.ConfigFileLocator -GitVersion.Configuration.ConfigFileLocator.ConfigFileLocator(GitVersion.IFileSystem! fileSystem, Microsoft.Extensions.Options.IOptions! options) -> void -GitVersion.Configuration.ConfigFileLocator.FilePath.get -> string! -GitVersion.Configuration.ConfigFileLocator.GetConfigFilePath(string? workingDirectory) -> string? -GitVersion.Configuration.ConfigFileLocator.HasConfigFileAt(string! workingDirectory) -> bool -GitVersion.Configuration.ConfigFileLocator.ReadConfig(string! workingDirectory) -> GitVersion.Model.Configuration.Config! -GitVersion.Configuration.ConfigFileLocator.SelectConfigFilePath(GitVersion.GitVersionOptions! gitVersionOptions, GitVersion.IGitRepositoryInfo! repositoryInfo) -> string? -GitVersion.Configuration.ConfigFileLocator.Verify(GitVersion.GitVersionOptions! gitVersionOptions, GitVersion.IGitRepositoryInfo! repositoryInfo) -> void -GitVersion.Configuration.ConfigFileLocator.Verify(string? workingDirectory, string? projectRootDirectory) -> void -GitVersion.Configuration.ConfigProvider -GitVersion.Configuration.ConfigProvider.ConfigProvider(GitVersion.IFileSystem! fileSystem, GitVersion.Logging.ILog! log, GitVersion.Configuration.IConfigFileLocator! configFileLocator, Microsoft.Extensions.Options.IOptions! options, GitVersion.Configuration.Init.Wizard.IConfigInitWizard! configInitWizard, GitVersion.IGitRepositoryInfo! repositoryInfo) -> void -GitVersion.Configuration.ConfigProvider.Init(string! workingDirectory) -> void -GitVersion.Configuration.ConfigProvider.Provide(GitVersion.Model.Configuration.Config? overrideConfig = null) -> GitVersion.Model.Configuration.Config! -GitVersion.Configuration.ConfigProvider.Provide(string? workingDirectory, GitVersion.Model.Configuration.Config? overrideConfig = null) -> GitVersion.Model.Configuration.Config! -GitVersion.Configuration.ConfigSerializer -GitVersion.Configuration.ConfigSerializer.ConfigSerializer() -> void +GitVersion.Configuration.BranchConfiguration +GitVersion.Configuration.BranchConfiguration.Apply(GitVersion.Configuration.BranchConfiguration! overrides) -> GitVersion.Configuration.BranchConfiguration! +GitVersion.Configuration.BranchConfiguration.BranchConfiguration() -> void +GitVersion.Configuration.BranchConfiguration.BranchConfiguration(GitVersion.Configuration.BranchConfiguration! branchConfiguration) -> void +GitVersion.Configuration.BranchConfiguration.CommitMessageIncrementing.get -> GitVersion.VersionCalculation.CommitMessageIncrementMode? +GitVersion.Configuration.BranchConfiguration.CommitMessageIncrementing.set -> void +GitVersion.Configuration.BranchConfiguration.Increment.get -> GitVersion.IncrementStrategy? +GitVersion.Configuration.BranchConfiguration.Increment.set -> void +GitVersion.Configuration.BranchConfiguration.Inherit(GitVersion.Configuration.BranchConfiguration? parentConfig) -> GitVersion.Configuration.BranchConfiguration! +GitVersion.Configuration.BranchConfiguration.IsMainline.get -> bool? +GitVersion.Configuration.BranchConfiguration.IsMainline.set -> void +GitVersion.Configuration.BranchConfiguration.IsReleaseBranch.get -> bool? +GitVersion.Configuration.BranchConfiguration.IsReleaseBranch.set -> void +GitVersion.Configuration.BranchConfiguration.IsSourceBranchFor.get -> System.Collections.Generic.HashSet? +GitVersion.Configuration.BranchConfiguration.IsSourceBranchFor.set -> void +GitVersion.Configuration.BranchConfiguration.MergeTo(GitVersion.Configuration.BranchConfiguration! targetConfig) -> void +GitVersion.Configuration.BranchConfiguration.Name.get -> string! +GitVersion.Configuration.BranchConfiguration.Name.set -> void +GitVersion.Configuration.BranchConfiguration.PreReleaseWeight.get -> int? +GitVersion.Configuration.BranchConfiguration.PreReleaseWeight.set -> void +GitVersion.Configuration.BranchConfiguration.PreventIncrementOfMergedBranchVersion.get -> bool? +GitVersion.Configuration.BranchConfiguration.PreventIncrementOfMergedBranchVersion.set -> void +GitVersion.Configuration.BranchConfiguration.Regex.get -> string? +GitVersion.Configuration.BranchConfiguration.Regex.set -> void +GitVersion.Configuration.BranchConfiguration.SourceBranches.get -> System.Collections.Generic.HashSet? +GitVersion.Configuration.BranchConfiguration.SourceBranches.set -> void +GitVersion.Configuration.BranchConfiguration.Tag.get -> string? +GitVersion.Configuration.BranchConfiguration.Tag.set -> void +GitVersion.Configuration.BranchConfiguration.TagNumberPattern.get -> string? +GitVersion.Configuration.BranchConfiguration.TagNumberPattern.set -> void +GitVersion.Configuration.BranchConfiguration.TrackMergeTarget.get -> bool? +GitVersion.Configuration.BranchConfiguration.TrackMergeTarget.set -> void +GitVersion.Configuration.BranchConfiguration.TracksReleaseBranches.get -> bool? +GitVersion.Configuration.BranchConfiguration.TracksReleaseBranches.set -> void +GitVersion.Configuration.BranchConfiguration.VersioningMode.get -> GitVersion.VersionCalculation.VersioningMode? +GitVersion.Configuration.BranchConfiguration.VersioningMode.set -> void GitVersion.Configuration.ConfigurationBuilder -GitVersion.Configuration.ConfigurationBuilder.Add(GitVersion.Model.Configuration.Config! configuration) -> GitVersion.Configuration.ConfigurationBuilder! -GitVersion.Configuration.ConfigurationBuilder.Build() -> GitVersion.Model.Configuration.Config! +GitVersion.Configuration.ConfigurationBuilder.Add(GitVersion.Configuration.GitVersionConfiguration! configuration) -> GitVersion.Configuration.ConfigurationBuilder! +GitVersion.Configuration.ConfigurationBuilder.Build() -> GitVersion.Configuration.GitVersionConfiguration! GitVersion.Configuration.ConfigurationBuilder.ConfigurationBuilder() -> void GitVersion.Configuration.ConfigurationException GitVersion.Configuration.ConfigurationException.ConfigurationException(string! msg) -> void +GitVersion.Configuration.ConfigurationExtensions +GitVersion.Configuration.ConfigurationFileLocator +GitVersion.Configuration.ConfigurationFileLocator.ConfigurationFileLocator(GitVersion.IFileSystem! fileSystem, Microsoft.Extensions.Options.IOptions! options) -> void +GitVersion.Configuration.ConfigurationFileLocator.FilePath.get -> string! +GitVersion.Configuration.ConfigurationFileLocator.GetConfigFilePath(string? workingDirectory) -> string? +GitVersion.Configuration.ConfigurationFileLocator.HasConfigFileAt(string! workingDirectory) -> bool +GitVersion.Configuration.ConfigurationFileLocator.ReadConfig(string! workingDirectory) -> GitVersion.Configuration.GitVersionConfiguration! +GitVersion.Configuration.ConfigurationFileLocator.SelectConfigFilePath(GitVersion.GitVersionOptions! gitVersionOptions, GitVersion.IGitRepositoryInfo! repositoryInfo) -> string? +GitVersion.Configuration.ConfigurationFileLocator.Verify(GitVersion.GitVersionOptions! gitVersionOptions, GitVersion.IGitRepositoryInfo! repositoryInfo) -> void +GitVersion.Configuration.ConfigurationFileLocator.Verify(string? workingDirectory, string? projectRootDirectory) -> void GitVersion.Configuration.ConfigurationModule GitVersion.Configuration.ConfigurationModule.ConfigurationModule() -> void GitVersion.Configuration.ConfigurationModule.RegisterTypes(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void -GitVersion.Configuration.IConfigFileLocator -GitVersion.Configuration.IConfigFileLocator.FilePath.get -> string! -GitVersion.Configuration.IConfigFileLocator.GetConfigFilePath(string! workingDirectory) -> string? -GitVersion.Configuration.IConfigFileLocator.HasConfigFileAt(string! workingDirectory) -> bool -GitVersion.Configuration.IConfigFileLocator.ReadConfig(string! workingDirectory) -> GitVersion.Model.Configuration.Config! -GitVersion.Configuration.IConfigFileLocator.SelectConfigFilePath(GitVersion.GitVersionOptions! gitVersionOptions, GitVersion.IGitRepositoryInfo! repositoryInfo) -> string? -GitVersion.Configuration.IConfigFileLocator.Verify(GitVersion.GitVersionOptions! gitVersionOptions, GitVersion.IGitRepositoryInfo! repositoryInfo) -> void -GitVersion.Configuration.IConfigFileLocator.Verify(string! workingDirectory, string! projectRootDirectory) -> void -GitVersion.Configuration.IConfigProvider -GitVersion.Configuration.IConfigProvider.Init(string! workingDirectory) -> void -GitVersion.Configuration.IConfigProvider.Provide(GitVersion.Model.Configuration.Config? overrideConfig = null) -> GitVersion.Model.Configuration.Config! -GitVersion.Configuration.IConfigProvider.Provide(string! workingDirectory, GitVersion.Model.Configuration.Config? overrideConfig = null) -> GitVersion.Model.Configuration.Config! +GitVersion.Configuration.ConfigurationProvider +GitVersion.Configuration.ConfigurationProvider.ConfigurationProvider(GitVersion.IFileSystem! fileSystem, GitVersion.Logging.ILog! log, GitVersion.Configuration.IConfigurationFileLocator! configFileLocator, Microsoft.Extensions.Options.IOptions! options, GitVersion.Configuration.Init.Wizard.IConfigInitWizard! configInitWizard, GitVersion.IGitRepositoryInfo! repositoryInfo) -> void +GitVersion.Configuration.ConfigurationProvider.Init(string! workingDirectory) -> void +GitVersion.Configuration.ConfigurationProvider.Provide(GitVersion.Configuration.GitVersionConfiguration? overrideConfiguration) -> GitVersion.Configuration.GitVersionConfiguration! +GitVersion.Configuration.ConfigurationProvider.Provide(string? workingDirectory, GitVersion.Configuration.GitVersionConfiguration? overrideConfiguration) -> GitVersion.Configuration.GitVersionConfiguration! +GitVersion.Configuration.ConfigurationSerializer +GitVersion.Configuration.ConfigurationSerializer.ConfigurationSerializer() -> void +GitVersion.Configuration.EffectiveBranchConfiguration +GitVersion.Configuration.EffectiveBranchConfiguration.Branch.get -> GitVersion.IBranch! +GitVersion.Configuration.EffectiveBranchConfiguration.CreateNextVersion(GitVersion.VersionCalculation.BaseVersion! baseVersion, GitVersion.SemanticVersion! incrementedVersion) -> GitVersion.VersionCalculation.NextVersion! +GitVersion.Configuration.EffectiveBranchConfiguration.EffectiveBranchConfiguration(GitVersion.IBranch! branch, GitVersion.Configuration.EffectiveConfiguration! value) -> void +GitVersion.Configuration.EffectiveBranchConfiguration.Value.get -> GitVersion.Configuration.EffectiveConfiguration! +GitVersion.Configuration.EffectiveConfiguration +GitVersion.Configuration.EffectiveConfiguration.AssemblyFileVersioningFormat.get -> string? +GitVersion.Configuration.EffectiveConfiguration.AssemblyFileVersioningScheme.get -> GitVersion.Extensions.AssemblyFileVersioningScheme +GitVersion.Configuration.EffectiveConfiguration.AssemblyInformationalFormat.get -> string? +GitVersion.Configuration.EffectiveConfiguration.AssemblyVersioningFormat.get -> string? +GitVersion.Configuration.EffectiveConfiguration.AssemblyVersioningScheme.get -> GitVersion.Extensions.AssemblyVersioningScheme +GitVersion.Configuration.EffectiveConfiguration.BranchPrefixToTrim.get -> string? +GitVersion.Configuration.EffectiveConfiguration.CommitDateFormat.get -> string? +GitVersion.Configuration.EffectiveConfiguration.CommitMessageIncrementing.get -> GitVersion.VersionCalculation.CommitMessageIncrementMode +GitVersion.Configuration.EffectiveConfiguration.ContinuousDeploymentFallbackTag.get -> string? +GitVersion.Configuration.EffectiveConfiguration.EffectiveConfiguration(GitVersion.Configuration.GitVersionConfiguration! configuration, GitVersion.Configuration.BranchConfiguration! currentBranchConfig) -> void +GitVersion.Configuration.EffectiveConfiguration.EffectiveConfiguration(GitVersion.Extensions.AssemblyVersioningScheme assemblyVersioningScheme, GitVersion.Extensions.AssemblyFileVersioningScheme assemblyFileVersioningScheme, string? assemblyInformationalFormat, string? assemblyVersioningFormat, string? assemblyFileVersioningFormat, GitVersion.VersionCalculation.VersioningMode versioningMode, string? tagPrefix, string! tag, string? nextVersion, GitVersion.IncrementStrategy increment, string? branchPrefixToTrim, bool preventIncrementOfMergedBranchVersion, string? tagNumberPattern, string? continuousDeploymentFallbackTag, bool trackMergeTarget, string? majorVersionBumpMessage, string? minorVersionBumpMessage, string? patchVersionBumpMessage, string? noBumpMessage, GitVersion.VersionCalculation.CommitMessageIncrementMode commitMessageIncrementing, System.Collections.Generic.IEnumerable! versionFilters, bool tracksReleaseBranches, bool isReleaseBranch, bool isMainline, string? commitDateFormat, bool updateBuildNumber, GitVersion.SemanticVersionFormat semanticVersionFormat, int preReleaseWeight, int tagPreReleaseWeight) -> void +GitVersion.Configuration.EffectiveConfiguration.Increment.get -> GitVersion.IncrementStrategy +GitVersion.Configuration.EffectiveConfiguration.IsMainline.get -> bool +GitVersion.Configuration.EffectiveConfiguration.IsReleaseBranch.get -> bool +GitVersion.Configuration.EffectiveConfiguration.MajorVersionBumpMessage.get -> string? +GitVersion.Configuration.EffectiveConfiguration.MinorVersionBumpMessage.get -> string? +GitVersion.Configuration.EffectiveConfiguration.NextVersion.get -> string? +GitVersion.Configuration.EffectiveConfiguration.NoBumpMessage.get -> string? +GitVersion.Configuration.EffectiveConfiguration.PatchVersionBumpMessage.get -> string? +GitVersion.Configuration.EffectiveConfiguration.PreReleaseWeight.get -> int +GitVersion.Configuration.EffectiveConfiguration.PreventIncrementOfMergedBranchVersion.get -> bool +GitVersion.Configuration.EffectiveConfiguration.SemanticVersionFormat.get -> GitVersion.SemanticVersionFormat +GitVersion.Configuration.EffectiveConfiguration.SemanticVersionFormat.set -> void +GitVersion.Configuration.EffectiveConfiguration.Tag.get -> string! +GitVersion.Configuration.EffectiveConfiguration.TagNumberPattern.get -> string? +GitVersion.Configuration.EffectiveConfiguration.TagPrefix.get -> string? +GitVersion.Configuration.EffectiveConfiguration.TagPreReleaseWeight.get -> int +GitVersion.Configuration.EffectiveConfiguration.TrackMergeTarget.get -> bool +GitVersion.Configuration.EffectiveConfiguration.TracksReleaseBranches.get -> bool +GitVersion.Configuration.EffectiveConfiguration.UpdateBuildNumber.get -> bool +GitVersion.Configuration.EffectiveConfiguration.VersionFilters.get -> System.Collections.Generic.IEnumerable! +GitVersion.Configuration.EffectiveConfiguration.VersioningMode.get -> GitVersion.VersionCalculation.VersioningMode +GitVersion.Configuration.GitVersionConfiguration +GitVersion.Configuration.GitVersionConfiguration.AssemblyFileVersioningFormat.get -> string? +GitVersion.Configuration.GitVersionConfiguration.AssemblyFileVersioningFormat.set -> void +GitVersion.Configuration.GitVersionConfiguration.AssemblyFileVersioningScheme.get -> GitVersion.Extensions.AssemblyFileVersioningScheme? +GitVersion.Configuration.GitVersionConfiguration.AssemblyFileVersioningScheme.set -> void +GitVersion.Configuration.GitVersionConfiguration.AssemblyInformationalFormat.get -> string? +GitVersion.Configuration.GitVersionConfiguration.AssemblyInformationalFormat.set -> void +GitVersion.Configuration.GitVersionConfiguration.AssemblyVersioningFormat.get -> string? +GitVersion.Configuration.GitVersionConfiguration.AssemblyVersioningFormat.set -> void +GitVersion.Configuration.GitVersionConfiguration.AssemblyVersioningScheme.get -> GitVersion.Extensions.AssemblyVersioningScheme? +GitVersion.Configuration.GitVersionConfiguration.AssemblyVersioningScheme.set -> void +GitVersion.Configuration.GitVersionConfiguration.Branches.get -> System.Collections.Generic.Dictionary! +GitVersion.Configuration.GitVersionConfiguration.Branches.set -> void +GitVersion.Configuration.GitVersionConfiguration.CommitDateFormat.get -> string? +GitVersion.Configuration.GitVersionConfiguration.CommitDateFormat.set -> void +GitVersion.Configuration.GitVersionConfiguration.CommitMessageIncrementing.get -> GitVersion.VersionCalculation.CommitMessageIncrementMode? +GitVersion.Configuration.GitVersionConfiguration.CommitMessageIncrementing.set -> void +GitVersion.Configuration.GitVersionConfiguration.ContinuousDeploymentFallbackTag.get -> string? +GitVersion.Configuration.GitVersionConfiguration.ContinuousDeploymentFallbackTag.set -> void +GitVersion.Configuration.GitVersionConfiguration.GitVersionConfiguration() -> void +GitVersion.Configuration.GitVersionConfiguration.Ignore.get -> GitVersion.Configuration.IgnoreConfiguration! +GitVersion.Configuration.GitVersionConfiguration.Ignore.set -> void +GitVersion.Configuration.GitVersionConfiguration.Increment.get -> GitVersion.IncrementStrategy? +GitVersion.Configuration.GitVersionConfiguration.Increment.set -> void +GitVersion.Configuration.GitVersionConfiguration.MajorVersionBumpMessage.get -> string? +GitVersion.Configuration.GitVersionConfiguration.MajorVersionBumpMessage.set -> void +GitVersion.Configuration.GitVersionConfiguration.MergeMessageFormats.get -> System.Collections.Generic.Dictionary! +GitVersion.Configuration.GitVersionConfiguration.MergeMessageFormats.set -> void +GitVersion.Configuration.GitVersionConfiguration.MinorVersionBumpMessage.get -> string? +GitVersion.Configuration.GitVersionConfiguration.MinorVersionBumpMessage.set -> void +GitVersion.Configuration.GitVersionConfiguration.NextVersion.get -> string? +GitVersion.Configuration.GitVersionConfiguration.NextVersion.set -> void +GitVersion.Configuration.GitVersionConfiguration.NoBumpMessage.get -> string? +GitVersion.Configuration.GitVersionConfiguration.NoBumpMessage.set -> void +GitVersion.Configuration.GitVersionConfiguration.PatchVersionBumpMessage.get -> string? +GitVersion.Configuration.GitVersionConfiguration.PatchVersionBumpMessage.set -> void +GitVersion.Configuration.GitVersionConfiguration.SemanticVersionFormat.get -> GitVersion.SemanticVersionFormat +GitVersion.Configuration.GitVersionConfiguration.SemanticVersionFormat.set -> void +GitVersion.Configuration.GitVersionConfiguration.TagPrefix.get -> string? +GitVersion.Configuration.GitVersionConfiguration.TagPrefix.set -> void +GitVersion.Configuration.GitVersionConfiguration.TagPreReleaseWeight.get -> int? +GitVersion.Configuration.GitVersionConfiguration.TagPreReleaseWeight.set -> void +GitVersion.Configuration.GitVersionConfiguration.UpdateBuildNumber.get -> bool? +GitVersion.Configuration.GitVersionConfiguration.UpdateBuildNumber.set -> void +GitVersion.Configuration.GitVersionConfiguration.VersioningMode.get -> GitVersion.VersionCalculation.VersioningMode? +GitVersion.Configuration.GitVersionConfiguration.VersioningMode.set -> void +GitVersion.Configuration.IConfigurationFileLocator +GitVersion.Configuration.IConfigurationFileLocator.FilePath.get -> string! +GitVersion.Configuration.IConfigurationFileLocator.GetConfigFilePath(string! workingDirectory) -> string? +GitVersion.Configuration.IConfigurationFileLocator.HasConfigFileAt(string! workingDirectory) -> bool +GitVersion.Configuration.IConfigurationFileLocator.ReadConfig(string! workingDirectory) -> GitVersion.Configuration.GitVersionConfiguration! +GitVersion.Configuration.IConfigurationFileLocator.SelectConfigFilePath(GitVersion.GitVersionOptions! gitVersionOptions, GitVersion.IGitRepositoryInfo! repositoryInfo) -> string? +GitVersion.Configuration.IConfigurationFileLocator.Verify(GitVersion.GitVersionOptions! gitVersionOptions, GitVersion.IGitRepositoryInfo! repositoryInfo) -> void +GitVersion.Configuration.IConfigurationFileLocator.Verify(string! workingDirectory, string! projectRootDirectory) -> void +GitVersion.Configuration.IConfigurationProvider +GitVersion.Configuration.IConfigurationProvider.Init(string! workingDirectory) -> void +GitVersion.Configuration.IConfigurationProvider.Provide(GitVersion.Configuration.GitVersionConfiguration? overrideConfiguration = null) -> GitVersion.Configuration.GitVersionConfiguration! +GitVersion.Configuration.IConfigurationProvider.Provide(string! workingDirectory, GitVersion.Configuration.GitVersionConfiguration? overrideConfiguration = null) -> GitVersion.Configuration.GitVersionConfiguration! +GitVersion.Configuration.IgnoreConfiguration +GitVersion.Configuration.IgnoreConfiguration.Before.get -> System.DateTimeOffset? +GitVersion.Configuration.IgnoreConfiguration.Before.set -> void +GitVersion.Configuration.IgnoreConfiguration.IgnoreConfiguration() -> void +GitVersion.Configuration.IgnoreConfiguration.ShAs.get -> System.Collections.Generic.IEnumerable! +GitVersion.Configuration.IgnoreConfiguration.ShAs.set -> void GitVersion.Configuration.Init.EditConfigStep GitVersion.Configuration.Init.EditConfigStep.EditConfigStep(GitVersion.Logging.IConsole! console, GitVersion.IFileSystem! fileSystem, GitVersion.Logging.ILog! log, GitVersion.Configuration.Init.Wizard.IConfigInitStepFactory! stepFactory) -> void GitVersion.Configuration.Init.GitVersionInitModule @@ -219,7 +345,7 @@ GitVersion.Configuration.Init.SetConfig.AssemblyVersioningSchemeSetting GitVersion.Configuration.Init.SetConfig.AssemblyVersioningSchemeSetting.AssemblyVersioningSchemeSetting(GitVersion.Logging.IConsole! console, GitVersion.IFileSystem! fileSystem, GitVersion.Logging.ILog! log, GitVersion.Configuration.Init.Wizard.IConfigInitStepFactory! stepFactory) -> void GitVersion.Configuration.Init.SetConfig.ConfigureBranch GitVersion.Configuration.Init.SetConfig.ConfigureBranch.ConfigureBranch(GitVersion.Logging.IConsole! console, GitVersion.IFileSystem! fileSystem, GitVersion.Logging.ILog! log, GitVersion.Configuration.Init.Wizard.IConfigInitStepFactory! stepFactory) -> void -GitVersion.Configuration.Init.SetConfig.ConfigureBranch.WithData(string! configName, GitVersion.Model.Configuration.BranchConfig! config) -> GitVersion.Configuration.Init.SetConfig.ConfigureBranch! +GitVersion.Configuration.Init.SetConfig.ConfigureBranch.WithData(string! configName, GitVersion.Configuration.BranchConfiguration! configuration) -> GitVersion.Configuration.Init.SetConfig.ConfigureBranch! GitVersion.Configuration.Init.SetConfig.ConfigureBranches GitVersion.Configuration.Init.SetConfig.ConfigureBranches.ConfigureBranches(GitVersion.Logging.IConsole! console, GitVersion.IFileSystem! fileSystem, GitVersion.Logging.ILog! log, GitVersion.Configuration.Init.Wizard.IConfigInitStepFactory! stepFactory) -> void GitVersion.Configuration.Init.SetConfig.GlobalModeSetting @@ -227,10 +353,10 @@ GitVersion.Configuration.Init.SetConfig.GlobalModeSetting.GlobalModeSetting(GitV GitVersion.Configuration.Init.SetConfig.GlobalModeSetting.WithData(GitVersion.Configuration.Init.Wizard.ConfigInitWizardStep! returnStep, bool isPartOfTheWizard) -> GitVersion.Configuration.Init.SetConfig.GlobalModeSetting! GitVersion.Configuration.Init.SetConfig.SetBranchIncrementMode GitVersion.Configuration.Init.SetConfig.SetBranchIncrementMode.SetBranchIncrementMode(GitVersion.Logging.IConsole! console, GitVersion.IFileSystem! fileSystem, GitVersion.Logging.ILog! log, GitVersion.Configuration.Init.Wizard.IConfigInitStepFactory! stepFactory) -> void -GitVersion.Configuration.Init.SetConfig.SetBranchIncrementMode.WithData(string! configName, GitVersion.Model.Configuration.BranchConfig! config) -> GitVersion.Configuration.Init.SetConfig.SetBranchIncrementMode! +GitVersion.Configuration.Init.SetConfig.SetBranchIncrementMode.WithData(string! configName, GitVersion.Configuration.BranchConfiguration! branchConfiguration) -> GitVersion.Configuration.Init.SetConfig.SetBranchIncrementMode! GitVersion.Configuration.Init.SetConfig.SetBranchTag GitVersion.Configuration.Init.SetConfig.SetBranchTag.SetBranchTag(GitVersion.Logging.IConsole! console, GitVersion.IFileSystem! fileSystem, GitVersion.Logging.ILog! log, GitVersion.Configuration.Init.Wizard.IConfigInitStepFactory! stepFactory) -> void -GitVersion.Configuration.Init.SetConfig.SetBranchTag.WithData(string! configName, GitVersion.Model.Configuration.BranchConfig! config) -> GitVersion.Configuration.Init.SetConfig.SetBranchTag! +GitVersion.Configuration.Init.SetConfig.SetBranchTag.WithData(string! configName, GitVersion.Configuration.BranchConfiguration! configuration) -> GitVersion.Configuration.Init.SetConfig.SetBranchTag! GitVersion.Configuration.Init.SetNextVersion GitVersion.Configuration.Init.SetNextVersion.SetNextVersion(GitVersion.Logging.IConsole! console, GitVersion.IFileSystem! fileSystem, GitVersion.Logging.ILog! log, GitVersion.Configuration.Init.Wizard.IConfigInitStepFactory! stepFactory) -> void GitVersion.Configuration.Init.StepResult @@ -243,9 +369,9 @@ GitVersion.Configuration.Init.Wizard.ConfigInitStepFactory.ConfigInitStepFactory GitVersion.Configuration.Init.Wizard.ConfigInitStepFactory.CreateStep() -> T GitVersion.Configuration.Init.Wizard.ConfigInitWizard GitVersion.Configuration.Init.Wizard.ConfigInitWizard.ConfigInitWizard(GitVersion.Logging.IConsole! console, GitVersion.Configuration.Init.Wizard.IConfigInitStepFactory! stepFactory) -> void -GitVersion.Configuration.Init.Wizard.ConfigInitWizard.Run(GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> GitVersion.Model.Configuration.Config? +GitVersion.Configuration.Init.Wizard.ConfigInitWizard.Run(GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> GitVersion.Configuration.GitVersionConfiguration? GitVersion.Configuration.Init.Wizard.ConfigInitWizardStep -GitVersion.Configuration.Init.Wizard.ConfigInitWizardStep.Apply(System.Collections.Generic.Queue! steps, GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> bool +GitVersion.Configuration.Init.Wizard.ConfigInitWizardStep.Apply(System.Collections.Generic.Queue! steps, GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> bool GitVersion.Configuration.Init.Wizard.ConfigInitWizardStep.ConfigInitWizardStep(GitVersion.Logging.IConsole! console, GitVersion.IFileSystem! fileSystem, GitVersion.Logging.ILog! log, GitVersion.Configuration.Init.Wizard.IConfigInitStepFactory! stepFactory) -> void GitVersion.Configuration.Init.Wizard.FinishedSetupStep GitVersion.Configuration.Init.Wizard.FinishedSetupStep.FinishedSetupStep(GitVersion.Logging.IConsole! console, GitVersion.IFileSystem! fileSystem, GitVersion.Logging.ILog! log, GitVersion.Configuration.Init.Wizard.IConfigInitStepFactory! stepFactory) -> void @@ -256,7 +382,7 @@ GitVersion.Configuration.Init.Wizard.GitHubFlowStep.GitHubFlowStep(GitVersion.Lo GitVersion.Configuration.Init.Wizard.IConfigInitStepFactory GitVersion.Configuration.Init.Wizard.IConfigInitStepFactory.CreateStep() -> T GitVersion.Configuration.Init.Wizard.IConfigInitWizard -GitVersion.Configuration.Init.Wizard.IConfigInitWizard.Run(GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> GitVersion.Model.Configuration.Config? +GitVersion.Configuration.Init.Wizard.IConfigInitWizard.Run(GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> GitVersion.Configuration.GitVersionConfiguration? GitVersion.Configuration.Init.Wizard.PickBranchingStrategy1Step GitVersion.Configuration.Init.Wizard.PickBranchingStrategy1Step.PickBranchingStrategy1Step(GitVersion.Logging.IConsole! console, GitVersion.IFileSystem! fileSystem, GitVersion.Logging.ILog! log, GitVersion.Configuration.Init.Wizard.IConfigInitStepFactory! stepFactory) -> void GitVersion.Configuration.Init.Wizard.PickBranchingStrategy2Step @@ -322,17 +448,17 @@ GitVersion.GitVersionCalculateTool GitVersion.GitVersionCalculateTool.CalculateVersionVariables() -> GitVersion.OutputVariables.VersionVariables! GitVersion.GitVersionCalculateTool.GitVersionCalculateTool(GitVersion.Logging.ILog! log, GitVersion.VersionCalculation.INextVersionCalculator! nextVersionCalculator, GitVersion.VersionCalculation.IVariableProvider! variableProvider, GitVersion.IGitPreparer! gitPreparer, GitVersion.VersionCalculation.Cache.IGitVersionCache! gitVersionCache, GitVersion.VersionCalculation.Cache.IGitVersionCacheKeyFactory! cacheKeyFactory, Microsoft.Extensions.Options.IOptions! options, System.Lazy! versionContext) -> void GitVersion.GitVersionContext -GitVersion.GitVersionContext.Configuration.get -> GitVersion.Model.Configuration.Config! +GitVersion.GitVersionContext.Configuration.get -> GitVersion.Configuration.GitVersionConfiguration! GitVersion.GitVersionContext.CurrentBranch.get -> GitVersion.IBranch! GitVersion.GitVersionContext.CurrentCommit.get -> GitVersion.ICommit? GitVersion.GitVersionContext.CurrentCommitTaggedVersion.get -> GitVersion.SemanticVersion? -GitVersion.GitVersionContext.GetEffectiveConfiguration(GitVersion.IBranch! branch) -> GitVersion.Model.Configuration.EffectiveConfiguration! -GitVersion.GitVersionContext.GitVersionContext(GitVersion.IBranch! currentBranch, GitVersion.ICommit? currentCommit, GitVersion.Model.Configuration.Config! configuration, GitVersion.SemanticVersion? currentCommitTaggedVersion, int numberOfUncommittedChanges) -> void +GitVersion.GitVersionContext.GetEffectiveConfiguration(GitVersion.IBranch! branch) -> GitVersion.Configuration.EffectiveConfiguration! +GitVersion.GitVersionContext.GitVersionContext(GitVersion.IBranch! currentBranch, GitVersion.ICommit? currentCommit, GitVersion.Configuration.GitVersionConfiguration! configuration, GitVersion.SemanticVersion? currentCommitTaggedVersion, int numberOfUncommittedChanges) -> void GitVersion.GitVersionContext.IsCurrentCommitTagged.get -> bool GitVersion.GitVersionContext.NumberOfUncommittedChanges.get -> int GitVersion.GitVersionContextFactory GitVersion.GitVersionContextFactory.Create(GitVersion.GitVersionOptions! gitVersionOptions) -> GitVersion.GitVersionContext! -GitVersion.GitVersionContextFactory.GitVersionContextFactory(GitVersion.Configuration.IConfigProvider! configProvider, GitVersion.Common.IRepositoryStore! repositoryStore, Microsoft.Extensions.Options.IOptions! options) -> void +GitVersion.GitVersionContextFactory.GitVersionContextFactory(GitVersion.Configuration.IConfigurationProvider! configurationProvider, GitVersion.Common.IRepositoryStore! repositoryStore, Microsoft.Extensions.Options.IOptions! options) -> void GitVersion.GitVersionCoreModule GitVersion.GitVersionCoreModule.GitVersionCoreModule() -> void GitVersion.GitVersionCoreModule.RegisterTypes(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void @@ -351,7 +477,7 @@ GitVersion.GitVersionOptions.Init -> bool GitVersion.GitVersionOptions.IsHelp -> bool GitVersion.GitVersionOptions.IsVersion -> bool GitVersion.GitVersionOptions.LogFilePath -> string? -GitVersion.GitVersionOptions.Output -> System.Collections.Generic.ISet! +GitVersion.GitVersionOptions.Output -> System.Collections.Generic.ISet! GitVersion.GitVersionOptions.OutputFile -> string? GitVersion.GitVersionOptions.RepositoryInfo.get -> GitVersion.RepositoryInfo! GitVersion.GitVersionOptions.Settings.get -> GitVersion.Settings! @@ -567,142 +693,14 @@ GitVersion.MergeMessage GitVersion.MergeMessage.FormatName.get -> string? GitVersion.MergeMessage.IsMergedPullRequest.get -> bool GitVersion.MergeMessage.MergedBranch.get -> string! -GitVersion.MergeMessage.MergeMessage(string? mergeMessage, GitVersion.Model.Configuration.Config! config) -> void +GitVersion.MergeMessage.MergeMessage(string? mergeMessage, GitVersion.Configuration.GitVersionConfiguration! configuration) -> void GitVersion.MergeMessage.PullRequestNumber.get -> int? GitVersion.MergeMessage.TargetBranch.get -> string? GitVersion.MergeMessage.Version.get -> GitVersion.SemanticVersion? -GitVersion.Model.Configuration.BranchConfig -GitVersion.Model.Configuration.BranchConfig.Apply(GitVersion.Model.Configuration.BranchConfig! overrides) -> GitVersion.Model.Configuration.BranchConfig! -GitVersion.Model.Configuration.BranchConfig.BranchConfig() -> void -GitVersion.Model.Configuration.BranchConfig.BranchConfig(GitVersion.Model.Configuration.BranchConfig! branchConfiguration) -> void -GitVersion.Model.Configuration.BranchConfig.CommitMessageIncrementing.get -> GitVersion.VersionCalculation.CommitMessageIncrementMode? -GitVersion.Model.Configuration.BranchConfig.CommitMessageIncrementing.set -> void -GitVersion.Model.Configuration.BranchConfig.Increment.get -> GitVersion.IncrementStrategy? -GitVersion.Model.Configuration.BranchConfig.Increment.set -> void -GitVersion.Model.Configuration.BranchConfig.Inherit(GitVersion.Model.Configuration.BranchConfig? parentConfig) -> GitVersion.Model.Configuration.BranchConfig! -GitVersion.Model.Configuration.BranchConfig.IsMainline.get -> bool? -GitVersion.Model.Configuration.BranchConfig.IsMainline.set -> void -GitVersion.Model.Configuration.BranchConfig.IsReleaseBranch.get -> bool? -GitVersion.Model.Configuration.BranchConfig.IsReleaseBranch.set -> void -GitVersion.Model.Configuration.BranchConfig.IsSourceBranchFor.get -> System.Collections.Generic.HashSet? -GitVersion.Model.Configuration.BranchConfig.IsSourceBranchFor.set -> void -GitVersion.Model.Configuration.BranchConfig.MergeTo(GitVersion.Model.Configuration.BranchConfig! targetConfig) -> void -GitVersion.Model.Configuration.BranchConfig.Name.get -> string! -GitVersion.Model.Configuration.BranchConfig.Name.set -> void -GitVersion.Model.Configuration.BranchConfig.PreReleaseWeight.get -> int? -GitVersion.Model.Configuration.BranchConfig.PreReleaseWeight.set -> void -GitVersion.Model.Configuration.BranchConfig.PreventIncrementOfMergedBranchVersion.get -> bool? -GitVersion.Model.Configuration.BranchConfig.PreventIncrementOfMergedBranchVersion.set -> void -GitVersion.Model.Configuration.BranchConfig.Regex.get -> string? -GitVersion.Model.Configuration.BranchConfig.Regex.set -> void -GitVersion.Model.Configuration.BranchConfig.SourceBranches.get -> System.Collections.Generic.HashSet? -GitVersion.Model.Configuration.BranchConfig.SourceBranches.set -> void -GitVersion.Model.Configuration.BranchConfig.Tag.get -> string? -GitVersion.Model.Configuration.BranchConfig.Tag.set -> void -GitVersion.Model.Configuration.BranchConfig.TagNumberPattern.get -> string? -GitVersion.Model.Configuration.BranchConfig.TagNumberPattern.set -> void -GitVersion.Model.Configuration.BranchConfig.TrackMergeTarget.get -> bool? -GitVersion.Model.Configuration.BranchConfig.TrackMergeTarget.set -> void -GitVersion.Model.Configuration.BranchConfig.TracksReleaseBranches.get -> bool? -GitVersion.Model.Configuration.BranchConfig.TracksReleaseBranches.set -> void -GitVersion.Model.Configuration.BranchConfig.VersioningMode.get -> GitVersion.VersionCalculation.VersioningMode? -GitVersion.Model.Configuration.BranchConfig.VersioningMode.set -> void -GitVersion.Model.Configuration.Config -GitVersion.Model.Configuration.Config.AssemblyFileVersioningFormat.get -> string? -GitVersion.Model.Configuration.Config.AssemblyFileVersioningFormat.set -> void -GitVersion.Model.Configuration.Config.AssemblyFileVersioningScheme.get -> GitVersion.Extensions.AssemblyFileVersioningScheme? -GitVersion.Model.Configuration.Config.AssemblyFileVersioningScheme.set -> void -GitVersion.Model.Configuration.Config.AssemblyInformationalFormat.get -> string? -GitVersion.Model.Configuration.Config.AssemblyInformationalFormat.set -> void -GitVersion.Model.Configuration.Config.AssemblyVersioningFormat.get -> string? -GitVersion.Model.Configuration.Config.AssemblyVersioningFormat.set -> void -GitVersion.Model.Configuration.Config.AssemblyVersioningScheme.get -> GitVersion.Extensions.AssemblyVersioningScheme? -GitVersion.Model.Configuration.Config.AssemblyVersioningScheme.set -> void -GitVersion.Model.Configuration.Config.Branches.get -> System.Collections.Generic.Dictionary! -GitVersion.Model.Configuration.Config.Branches.set -> void -GitVersion.Model.Configuration.Config.CommitDateFormat.get -> string? -GitVersion.Model.Configuration.Config.CommitDateFormat.set -> void -GitVersion.Model.Configuration.Config.CommitMessageIncrementing.get -> GitVersion.VersionCalculation.CommitMessageIncrementMode? -GitVersion.Model.Configuration.Config.CommitMessageIncrementing.set -> void -GitVersion.Model.Configuration.Config.Config() -> void -GitVersion.Model.Configuration.Config.ContinuousDeploymentFallbackTag.get -> string? -GitVersion.Model.Configuration.Config.ContinuousDeploymentFallbackTag.set -> void -GitVersion.Model.Configuration.Config.Ignore.get -> GitVersion.Model.Configuration.IgnoreConfig! -GitVersion.Model.Configuration.Config.Ignore.set -> void -GitVersion.Model.Configuration.Config.Increment.get -> GitVersion.IncrementStrategy? -GitVersion.Model.Configuration.Config.Increment.set -> void -GitVersion.Model.Configuration.Config.MajorVersionBumpMessage.get -> string? -GitVersion.Model.Configuration.Config.MajorVersionBumpMessage.set -> void -GitVersion.Model.Configuration.Config.MergeMessageFormats.get -> System.Collections.Generic.Dictionary! -GitVersion.Model.Configuration.Config.MergeMessageFormats.set -> void -GitVersion.Model.Configuration.Config.MinorVersionBumpMessage.get -> string? -GitVersion.Model.Configuration.Config.MinorVersionBumpMessage.set -> void -GitVersion.Model.Configuration.Config.NextVersion.get -> string? -GitVersion.Model.Configuration.Config.NextVersion.set -> void -GitVersion.Model.Configuration.Config.NoBumpMessage.get -> string? -GitVersion.Model.Configuration.Config.NoBumpMessage.set -> void -GitVersion.Model.Configuration.Config.PatchVersionBumpMessage.get -> string? -GitVersion.Model.Configuration.Config.PatchVersionBumpMessage.set -> void -GitVersion.Model.Configuration.Config.SemanticVersionFormat.get -> GitVersion.SemanticVersionFormat -GitVersion.Model.Configuration.Config.SemanticVersionFormat.set -> void -GitVersion.Model.Configuration.Config.TagPrefix.get -> string? -GitVersion.Model.Configuration.Config.TagPrefix.set -> void -GitVersion.Model.Configuration.Config.TagPreReleaseWeight.get -> int? -GitVersion.Model.Configuration.Config.TagPreReleaseWeight.set -> void -GitVersion.Model.Configuration.Config.UpdateBuildNumber.get -> bool? -GitVersion.Model.Configuration.Config.UpdateBuildNumber.set -> void -GitVersion.Model.Configuration.Config.VersioningMode.get -> GitVersion.VersionCalculation.VersioningMode? -GitVersion.Model.Configuration.Config.VersioningMode.set -> void -GitVersion.Model.Configuration.EffectiveBranchConfiguration -GitVersion.Model.Configuration.EffectiveBranchConfiguration.Branch.get -> GitVersion.IBranch! -GitVersion.Model.Configuration.EffectiveBranchConfiguration.CreateNextVersion(GitVersion.VersionCalculation.BaseVersion! baseVersion, GitVersion.SemanticVersion! incrementedVersion) -> GitVersion.VersionCalculation.NextVersion! -GitVersion.Model.Configuration.EffectiveBranchConfiguration.EffectiveBranchConfiguration(GitVersion.IBranch! branch, GitVersion.Model.Configuration.EffectiveConfiguration! value) -> void -GitVersion.Model.Configuration.EffectiveBranchConfiguration.Value.get -> GitVersion.Model.Configuration.EffectiveConfiguration! -GitVersion.Model.Configuration.EffectiveConfiguration -GitVersion.Model.Configuration.EffectiveConfiguration.AssemblyFileVersioningFormat.get -> string? -GitVersion.Model.Configuration.EffectiveConfiguration.AssemblyFileVersioningScheme.get -> GitVersion.Extensions.AssemblyFileVersioningScheme -GitVersion.Model.Configuration.EffectiveConfiguration.AssemblyInformationalFormat.get -> string? -GitVersion.Model.Configuration.EffectiveConfiguration.AssemblyVersioningFormat.get -> string? -GitVersion.Model.Configuration.EffectiveConfiguration.AssemblyVersioningScheme.get -> GitVersion.Extensions.AssemblyVersioningScheme -GitVersion.Model.Configuration.EffectiveConfiguration.BranchPrefixToTrim.get -> string? -GitVersion.Model.Configuration.EffectiveConfiguration.CommitDateFormat.get -> string? -GitVersion.Model.Configuration.EffectiveConfiguration.CommitMessageIncrementing.get -> GitVersion.VersionCalculation.CommitMessageIncrementMode -GitVersion.Model.Configuration.EffectiveConfiguration.ContinuousDeploymentFallbackTag.get -> string? -GitVersion.Model.Configuration.EffectiveConfiguration.EffectiveConfiguration(GitVersion.Extensions.AssemblyVersioningScheme assemblyVersioningScheme, GitVersion.Extensions.AssemblyFileVersioningScheme assemblyFileVersioningScheme, string? assemblyInformationalFormat, string? assemblyVersioningFormat, string? assemblyFileVersioningFormat, GitVersion.VersionCalculation.VersioningMode versioningMode, string? tagPrefix, string! tag, string? nextVersion, GitVersion.IncrementStrategy increment, string? branchPrefixToTrim, bool preventIncrementOfMergedBranchVersion, string? tagNumberPattern, string? continuousDeploymentFallbackTag, bool trackMergeTarget, string? majorVersionBumpMessage, string? minorVersionBumpMessage, string? patchVersionBumpMessage, string? noBumpMessage, GitVersion.VersionCalculation.CommitMessageIncrementMode commitMessageIncrementing, System.Collections.Generic.IEnumerable! versionFilters, bool tracksReleaseBranches, bool isReleaseBranch, bool isMainline, string? commitDateFormat, bool updateBuildNumber, GitVersion.SemanticVersionFormat semanticVersionFormat, int preReleaseWeight, int tagPreReleaseWeight) -> void -GitVersion.Model.Configuration.EffectiveConfiguration.EffectiveConfiguration(GitVersion.Model.Configuration.Config! configuration, GitVersion.Model.Configuration.BranchConfig! currentBranchConfig) -> void -GitVersion.Model.Configuration.EffectiveConfiguration.Increment.get -> GitVersion.IncrementStrategy -GitVersion.Model.Configuration.EffectiveConfiguration.IsMainline.get -> bool -GitVersion.Model.Configuration.EffectiveConfiguration.IsReleaseBranch.get -> bool -GitVersion.Model.Configuration.EffectiveConfiguration.MajorVersionBumpMessage.get -> string? -GitVersion.Model.Configuration.EffectiveConfiguration.MinorVersionBumpMessage.get -> string? -GitVersion.Model.Configuration.EffectiveConfiguration.NextVersion.get -> string? -GitVersion.Model.Configuration.EffectiveConfiguration.NoBumpMessage.get -> string? -GitVersion.Model.Configuration.EffectiveConfiguration.PatchVersionBumpMessage.get -> string? -GitVersion.Model.Configuration.EffectiveConfiguration.PreReleaseWeight.get -> int -GitVersion.Model.Configuration.EffectiveConfiguration.PreventIncrementOfMergedBranchVersion.get -> bool -GitVersion.Model.Configuration.EffectiveConfiguration.SemanticVersionFormat.get -> GitVersion.SemanticVersionFormat -GitVersion.Model.Configuration.EffectiveConfiguration.SemanticVersionFormat.set -> void -GitVersion.Model.Configuration.EffectiveConfiguration.Tag.get -> string! -GitVersion.Model.Configuration.EffectiveConfiguration.TagNumberPattern.get -> string? -GitVersion.Model.Configuration.EffectiveConfiguration.TagPrefix.get -> string? -GitVersion.Model.Configuration.EffectiveConfiguration.TagPreReleaseWeight.get -> int -GitVersion.Model.Configuration.EffectiveConfiguration.TrackMergeTarget.get -> bool -GitVersion.Model.Configuration.EffectiveConfiguration.TracksReleaseBranches.get -> bool -GitVersion.Model.Configuration.EffectiveConfiguration.UpdateBuildNumber.get -> bool -GitVersion.Model.Configuration.EffectiveConfiguration.VersionFilters.get -> System.Collections.Generic.IEnumerable! -GitVersion.Model.Configuration.EffectiveConfiguration.VersioningMode.get -> GitVersion.VersionCalculation.VersioningMode -GitVersion.Model.Configuration.IgnoreConfig -GitVersion.Model.Configuration.IgnoreConfig.Before.get -> System.DateTimeOffset? -GitVersion.Model.Configuration.IgnoreConfig.Before.set -> void -GitVersion.Model.Configuration.IgnoreConfig.IgnoreConfig() -> void -GitVersion.Model.Configuration.IgnoreConfig.ShAs.get -> System.Collections.Generic.IEnumerable! -GitVersion.Model.Configuration.IgnoreConfig.ShAs.set -> void -GitVersion.Model.Exceptions.InfiniteLoopProtectionException -GitVersion.Model.Exceptions.InfiniteLoopProtectionException.InfiniteLoopProtectionException(string! messageFormat) -> void -GitVersion.Model.OutputType -GitVersion.Model.OutputType.BuildServer = 0 -> GitVersion.Model.OutputType -GitVersion.Model.OutputType.File = 2 -> GitVersion.Model.OutputType -GitVersion.Model.OutputType.Json = 1 -> GitVersion.Model.OutputType +GitVersion.OutputType +GitVersion.OutputType.BuildServer = 0 -> GitVersion.OutputType +GitVersion.OutputType.File = 2 -> GitVersion.OutputType +GitVersion.OutputType.Json = 1 -> GitVersion.OutputType GitVersion.OutputVariables.VersionVariables GitVersion.OutputVariables.VersionVariables.AssemblySemFileVer.get -> string? GitVersion.OutputVariables.VersionVariables.AssemblySemVer.get -> string? @@ -816,23 +814,23 @@ GitVersion.RepositoryInfo.TargetUrl -> string? GitVersion.RepositoryStore GitVersion.RepositoryStore.ExcludingBranches(System.Collections.Generic.IEnumerable! branchesToExclude) -> System.Collections.Generic.IEnumerable! GitVersion.RepositoryStore.FindBranch(string? branchName) -> GitVersion.IBranch? -GitVersion.RepositoryStore.FindCommitBranchesWasBranchedFrom(GitVersion.IBranch! branch, GitVersion.Model.Configuration.Config! configuration, params GitVersion.IBranch![]! excludedBranches) -> System.Collections.Generic.IEnumerable! -GitVersion.RepositoryStore.FindCommitBranchesWasBranchedFrom(GitVersion.IBranch! branch, GitVersion.Model.Configuration.Config! configuration, System.Collections.Generic.IEnumerable! excludedBranches) -> System.Collections.Generic.IEnumerable! -GitVersion.RepositoryStore.FindCommitBranchWasBranchedFrom(GitVersion.IBranch? branch, GitVersion.Model.Configuration.Config! configuration, params GitVersion.IBranch![]! excludedBranches) -> GitVersion.BranchCommit -GitVersion.RepositoryStore.FindMainBranch(GitVersion.Model.Configuration.Config! configuration) -> GitVersion.IBranch? +GitVersion.RepositoryStore.FindCommitBranchesWasBranchedFrom(GitVersion.IBranch! branch, GitVersion.Configuration.GitVersionConfiguration! configuration, params GitVersion.IBranch![]! excludedBranches) -> System.Collections.Generic.IEnumerable! +GitVersion.RepositoryStore.FindCommitBranchesWasBranchedFrom(GitVersion.IBranch! branch, GitVersion.Configuration.GitVersionConfiguration! configuration, System.Collections.Generic.IEnumerable! excludedBranches) -> System.Collections.Generic.IEnumerable! +GitVersion.RepositoryStore.FindCommitBranchWasBranchedFrom(GitVersion.IBranch? branch, GitVersion.Configuration.GitVersionConfiguration! configuration, params GitVersion.IBranch![]! excludedBranches) -> GitVersion.BranchCommit +GitVersion.RepositoryStore.FindMainBranch(GitVersion.Configuration.GitVersionConfiguration! configuration) -> GitVersion.IBranch? GitVersion.RepositoryStore.FindMergeBase(GitVersion.IBranch? branch, GitVersion.IBranch? otherBranch) -> GitVersion.ICommit? GitVersion.RepositoryStore.FindMergeBase(GitVersion.ICommit! commit, GitVersion.ICommit! mainlineTip) -> GitVersion.ICommit? GitVersion.RepositoryStore.GetBranchesContainingCommit(GitVersion.ICommit? commit, System.Collections.Generic.IEnumerable? branches = null, bool onlyTrackedBranches = false) -> System.Collections.Generic.IEnumerable! GitVersion.RepositoryStore.GetCommitLog(GitVersion.ICommit? baseVersionSource, GitVersion.ICommit? currentCommit) -> System.Collections.Generic.IEnumerable! GitVersion.RepositoryStore.GetCurrentCommit(GitVersion.IBranch! currentBranch, string? commitId) -> GitVersion.ICommit? GitVersion.RepositoryStore.GetCurrentCommitTaggedVersion(GitVersion.ICommit? commit, string? tagPrefix) -> GitVersion.SemanticVersion? -GitVersion.RepositoryStore.GetMainlineBranches(GitVersion.ICommit! commit, GitVersion.Model.Configuration.Config! configuration) -> System.Collections.Generic.IDictionary!>! +GitVersion.RepositoryStore.GetMainlineBranches(GitVersion.ICommit! commit, GitVersion.Configuration.GitVersionConfiguration! configuration) -> System.Collections.Generic.IDictionary!>! GitVersion.RepositoryStore.GetMainlineCommitLog(GitVersion.ICommit? baseVersionSource, GitVersion.ICommit? mainlineTip) -> System.Collections.Generic.IEnumerable! GitVersion.RepositoryStore.GetMergeBaseCommits(GitVersion.ICommit? mergeCommit, GitVersion.ICommit? mergedHead, GitVersion.ICommit? findMergeBase) -> System.Collections.Generic.IEnumerable! GitVersion.RepositoryStore.GetNumberOfUncommittedChanges() -> int -GitVersion.RepositoryStore.GetReleaseBranches(System.Collections.Generic.IEnumerable>! releaseBranchConfig) -> System.Collections.Generic.IEnumerable! -GitVersion.RepositoryStore.GetSourceBranches(GitVersion.IBranch! branch, GitVersion.Model.Configuration.Config! configuration, params GitVersion.IBranch![]! excludedBranches) -> System.Collections.Generic.IEnumerable! -GitVersion.RepositoryStore.GetSourceBranches(GitVersion.IBranch! branch, GitVersion.Model.Configuration.Config! configuration, System.Collections.Generic.IEnumerable! excludedBranches) -> System.Collections.Generic.IEnumerable! +GitVersion.RepositoryStore.GetReleaseBranches(System.Collections.Generic.IEnumerable>! releaseBranchConfig) -> System.Collections.Generic.IEnumerable! +GitVersion.RepositoryStore.GetSourceBranches(GitVersion.IBranch! branch, GitVersion.Configuration.GitVersionConfiguration! configuration, params GitVersion.IBranch![]! excludedBranches) -> System.Collections.Generic.IEnumerable! +GitVersion.RepositoryStore.GetSourceBranches(GitVersion.IBranch! branch, GitVersion.Configuration.GitVersionConfiguration! configuration, System.Collections.Generic.IEnumerable! excludedBranches) -> System.Collections.Generic.IEnumerable! GitVersion.RepositoryStore.GetTargetBranch(string? targetBranchName) -> GitVersion.IBranch! GitVersion.RepositoryStore.GetValidVersionTags(string? tagPrefixRegex, System.DateTimeOffset? olderThan = null) -> System.Collections.Generic.IEnumerable<(GitVersion.ITag! Tag, GitVersion.SemanticVersion! Semver, GitVersion.ICommit! Commit)>! GitVersion.RepositoryStore.GetVersionTagsOnBranch(GitVersion.IBranch! branch, string? tagPrefixRegex) -> System.Collections.Generic.IEnumerable! @@ -893,7 +891,7 @@ GitVersion.SemanticVersionFormatValues.PreReleaseLabelWithDash.get -> string? GitVersion.SemanticVersionFormatValues.PreReleaseNumber.get -> string? GitVersion.SemanticVersionFormatValues.PreReleaseTag.get -> string? GitVersion.SemanticVersionFormatValues.PreReleaseTagWithDash.get -> string? -GitVersion.SemanticVersionFormatValues.SemanticVersionFormatValues(GitVersion.SemanticVersion! semver, GitVersion.Model.Configuration.EffectiveConfiguration! config) -> void +GitVersion.SemanticVersionFormatValues.SemanticVersionFormatValues(GitVersion.SemanticVersion! semver, GitVersion.Configuration.EffectiveConfiguration! configuration) -> void GitVersion.SemanticVersionFormatValues.SemVer.get -> string! GitVersion.SemanticVersionFormatValues.Sha.get -> string? GitVersion.SemanticVersionFormatValues.ShortSha.get -> string? @@ -931,17 +929,17 @@ GitVersion.VersionCalculation.BaseVersion.Source.get -> string! GitVersion.VersionCalculation.Cache.GitVersionCache GitVersion.VersionCalculation.Cache.GitVersionCache.GetCacheDirectory() -> string! GitVersion.VersionCalculation.Cache.GitVersionCache.GitVersionCache(GitVersion.IFileSystem! fileSystem, GitVersion.Logging.ILog! log, GitVersion.IGitRepositoryInfo! repositoryInfo) -> void -GitVersion.VersionCalculation.Cache.GitVersionCache.LoadVersionVariablesFromDiskCache(GitVersion.Cache.GitVersionCacheKey! key) -> GitVersion.OutputVariables.VersionVariables? -GitVersion.VersionCalculation.Cache.GitVersionCache.WriteVariablesToDiskCache(GitVersion.Cache.GitVersionCacheKey! cacheKey, GitVersion.OutputVariables.VersionVariables! variablesFromCache) -> void +GitVersion.VersionCalculation.Cache.GitVersionCache.LoadVersionVariablesFromDiskCache(GitVersion.VersionCalculation.Cache.GitVersionCacheKey! key) -> GitVersion.OutputVariables.VersionVariables? +GitVersion.VersionCalculation.Cache.GitVersionCache.WriteVariablesToDiskCache(GitVersion.VersionCalculation.Cache.GitVersionCacheKey! cacheKey, GitVersion.OutputVariables.VersionVariables! variablesFromCache) -> void GitVersion.VersionCalculation.Cache.GitVersionCacheKeyFactory -GitVersion.VersionCalculation.Cache.GitVersionCacheKeyFactory.Create(GitVersion.Model.Configuration.Config? overrideConfig) -> GitVersion.Cache.GitVersionCacheKey! -GitVersion.VersionCalculation.Cache.GitVersionCacheKeyFactory.GitVersionCacheKeyFactory(GitVersion.IFileSystem! fileSystem, GitVersion.Logging.ILog! log, Microsoft.Extensions.Options.IOptions! options, GitVersion.Configuration.IConfigFileLocator! configFileLocator, GitVersion.IGitRepository! gitRepository, GitVersion.IGitRepositoryInfo! repositoryInfo) -> void +GitVersion.VersionCalculation.Cache.GitVersionCacheKeyFactory.Create(GitVersion.Configuration.GitVersionConfiguration? overrideConfiguration) -> GitVersion.VersionCalculation.Cache.GitVersionCacheKey! +GitVersion.VersionCalculation.Cache.GitVersionCacheKeyFactory.GitVersionCacheKeyFactory(GitVersion.IFileSystem! fileSystem, GitVersion.Logging.ILog! log, Microsoft.Extensions.Options.IOptions! options, GitVersion.Configuration.IConfigurationFileLocator! configFileLocator, GitVersion.IGitRepository! gitRepository, GitVersion.IGitRepositoryInfo! repositoryInfo) -> void GitVersion.VersionCalculation.Cache.IGitVersionCache GitVersion.VersionCalculation.Cache.IGitVersionCache.GetCacheDirectory() -> string! -GitVersion.VersionCalculation.Cache.IGitVersionCache.LoadVersionVariablesFromDiskCache(GitVersion.Cache.GitVersionCacheKey! key) -> GitVersion.OutputVariables.VersionVariables? -GitVersion.VersionCalculation.Cache.IGitVersionCache.WriteVariablesToDiskCache(GitVersion.Cache.GitVersionCacheKey! cacheKey, GitVersion.OutputVariables.VersionVariables! variablesFromCache) -> void +GitVersion.VersionCalculation.Cache.IGitVersionCache.LoadVersionVariablesFromDiskCache(GitVersion.VersionCalculation.Cache.GitVersionCacheKey! key) -> GitVersion.OutputVariables.VersionVariables? +GitVersion.VersionCalculation.Cache.IGitVersionCache.WriteVariablesToDiskCache(GitVersion.VersionCalculation.Cache.GitVersionCacheKey! cacheKey, GitVersion.OutputVariables.VersionVariables! variablesFromCache) -> void GitVersion.VersionCalculation.Cache.IGitVersionCacheKeyFactory -GitVersion.VersionCalculation.Cache.IGitVersionCacheKeyFactory.Create(GitVersion.Model.Configuration.Config? overrideConfig) -> GitVersion.Cache.GitVersionCacheKey! +GitVersion.VersionCalculation.Cache.IGitVersionCacheKeyFactory.Create(GitVersion.Configuration.GitVersionConfiguration? overrideConfiguration) -> GitVersion.VersionCalculation.Cache.GitVersionCacheKey! GitVersion.VersionCalculation.CommitMessageIncrementMode GitVersion.VersionCalculation.CommitMessageIncrementMode.Disabled = 1 -> GitVersion.VersionCalculation.CommitMessageIncrementMode GitVersion.VersionCalculation.CommitMessageIncrementMode.Enabled = 0 -> GitVersion.VersionCalculation.CommitMessageIncrementMode @@ -953,25 +951,25 @@ GitVersion.VersionCalculation.EffectiveBranchConfigurationFinder.EffectiveBranch GitVersion.VersionCalculation.FallbackVersionStrategy GitVersion.VersionCalculation.FallbackVersionStrategy.FallbackVersionStrategy() -> void GitVersion.VersionCalculation.IEffectiveBranchConfigurationFinder -GitVersion.VersionCalculation.IEffectiveBranchConfigurationFinder.GetConfigurations(GitVersion.IBranch! branch, GitVersion.Model.Configuration.Config! configuration) -> System.Collections.Generic.IEnumerable! +GitVersion.VersionCalculation.IEffectiveBranchConfigurationFinder.GetConfigurations(GitVersion.IBranch! branch, GitVersion.Configuration.GitVersionConfiguration! configuration) -> System.Collections.Generic.IEnumerable! GitVersion.VersionCalculation.IIncrementStrategyFinder -GitVersion.VersionCalculation.IIncrementStrategyFinder.DetermineIncrementedField(GitVersion.GitVersionContext! context, GitVersion.VersionCalculation.BaseVersion! baseVersion, GitVersion.Model.Configuration.EffectiveConfiguration! configuration) -> GitVersion.VersionField -GitVersion.VersionCalculation.IIncrementStrategyFinder.GetIncrementForCommits(GitVersion.Model.Configuration.Config! configuration, System.Collections.Generic.IEnumerable! commits) -> GitVersion.VersionField? +GitVersion.VersionCalculation.IIncrementStrategyFinder.DetermineIncrementedField(GitVersion.GitVersionContext! context, GitVersion.VersionCalculation.BaseVersion! baseVersion, GitVersion.Configuration.EffectiveConfiguration! configuration) -> GitVersion.VersionField +GitVersion.VersionCalculation.IIncrementStrategyFinder.GetIncrementForCommits(GitVersion.Configuration.GitVersionConfiguration! configuration, System.Collections.Generic.IEnumerable! commits) -> GitVersion.VersionField? GitVersion.VersionCalculation.IMainlineVersionCalculator GitVersion.VersionCalculation.IMainlineVersionCalculator.CreateVersionBuildMetaData(GitVersion.ICommit? baseVersionSource) -> GitVersion.SemanticVersionBuildMetaData! GitVersion.VersionCalculation.IMainlineVersionCalculator.FindMainlineModeVersion(GitVersion.VersionCalculation.BaseVersion! baseVersion) -> GitVersion.SemanticVersion! GitVersion.VersionCalculation.IncrementStrategyFinder -GitVersion.VersionCalculation.IncrementStrategyFinder.DetermineIncrementedField(GitVersion.GitVersionContext! context, GitVersion.VersionCalculation.BaseVersion! baseVersion, GitVersion.Model.Configuration.EffectiveConfiguration! configuration) -> GitVersion.VersionField -GitVersion.VersionCalculation.IncrementStrategyFinder.GetIncrementForCommits(GitVersion.Model.Configuration.Config! configuration, System.Collections.Generic.IEnumerable! commits) -> GitVersion.VersionField? +GitVersion.VersionCalculation.IncrementStrategyFinder.DetermineIncrementedField(GitVersion.GitVersionContext! context, GitVersion.VersionCalculation.BaseVersion! baseVersion, GitVersion.Configuration.EffectiveConfiguration! configuration) -> GitVersion.VersionField +GitVersion.VersionCalculation.IncrementStrategyFinder.GetIncrementForCommits(GitVersion.Configuration.GitVersionConfiguration! configuration, System.Collections.Generic.IEnumerable! commits) -> GitVersion.VersionField? GitVersion.VersionCalculation.IncrementStrategyFinder.IncrementStrategyFinder(GitVersion.IGitRepository! repository) -> void GitVersion.VersionCalculation.INextVersionCalculator GitVersion.VersionCalculation.INextVersionCalculator.FindVersion() -> GitVersion.VersionCalculation.NextVersion! GitVersion.VersionCalculation.IVariableProvider -GitVersion.VersionCalculation.IVariableProvider.GetVariablesFor(GitVersion.SemanticVersion! semanticVersion, GitVersion.Model.Configuration.EffectiveConfiguration! config, bool isCurrentCommitTagged) -> GitVersion.OutputVariables.VersionVariables! +GitVersion.VersionCalculation.IVariableProvider.GetVariablesFor(GitVersion.SemanticVersion! semanticVersion, GitVersion.Configuration.EffectiveConfiguration! configuration, bool isCurrentCommitTagged) -> GitVersion.OutputVariables.VersionVariables! GitVersion.VersionCalculation.IVersionFilter GitVersion.VersionCalculation.IVersionFilter.Exclude(GitVersion.VersionCalculation.BaseVersion! version, out string? reason) -> bool GitVersion.VersionCalculation.IVersionStrategy -GitVersion.VersionCalculation.IVersionStrategy.GetBaseVersions(GitVersion.Model.Configuration.EffectiveBranchConfiguration! configuration) -> System.Collections.Generic.IEnumerable! +GitVersion.VersionCalculation.IVersionStrategy.GetBaseVersions(GitVersion.Configuration.EffectiveBranchConfiguration! configuration) -> System.Collections.Generic.IEnumerable! GitVersion.VersionCalculation.MergeMessageVersionStrategy GitVersion.VersionCalculation.MergeMessageVersionStrategy.MergeMessageVersionStrategy(GitVersion.Logging.ILog! log, System.Lazy! versionContext, GitVersion.Common.IRepositoryStore! repositoryStore) -> void GitVersion.VersionCalculation.MinDateVersionFilter @@ -981,11 +979,11 @@ GitVersion.VersionCalculation.NextVersion GitVersion.VersionCalculation.NextVersion.BaseVersion.get -> GitVersion.VersionCalculation.BaseVersion! GitVersion.VersionCalculation.NextVersion.Branch.get -> GitVersion.IBranch! GitVersion.VersionCalculation.NextVersion.CompareTo(GitVersion.VersionCalculation.NextVersion! other) -> int -GitVersion.VersionCalculation.NextVersion.Configuration.get -> GitVersion.Model.Configuration.EffectiveConfiguration! +GitVersion.VersionCalculation.NextVersion.Configuration.get -> GitVersion.Configuration.EffectiveConfiguration! GitVersion.VersionCalculation.NextVersion.Equals(GitVersion.VersionCalculation.NextVersion! other) -> bool GitVersion.VersionCalculation.NextVersion.IncrementedVersion.get -> GitVersion.SemanticVersion! -GitVersion.VersionCalculation.NextVersion.NextVersion(GitVersion.SemanticVersion! incrementedVersion, GitVersion.VersionCalculation.BaseVersion! baseVersion, GitVersion.IBranch! branch, GitVersion.Model.Configuration.EffectiveConfiguration! configuration) -> void -GitVersion.VersionCalculation.NextVersion.NextVersion(GitVersion.SemanticVersion! incrementedVersion, GitVersion.VersionCalculation.BaseVersion! baseVersion, GitVersion.Model.Configuration.EffectiveBranchConfiguration! configuration) -> void +GitVersion.VersionCalculation.NextVersion.NextVersion(GitVersion.SemanticVersion! incrementedVersion, GitVersion.VersionCalculation.BaseVersion! baseVersion, GitVersion.Configuration.EffectiveBranchConfiguration! configuration) -> void +GitVersion.VersionCalculation.NextVersion.NextVersion(GitVersion.SemanticVersion! incrementedVersion, GitVersion.VersionCalculation.BaseVersion! baseVersion, GitVersion.IBranch! branch, GitVersion.Configuration.EffectiveConfiguration! configuration) -> void GitVersion.VersionCalculation.NextVersionCalculator GitVersion.VersionCalculation.NextVersionCalculator.NextVersionCalculator(GitVersion.Logging.ILog! log, GitVersion.VersionCalculation.IMainlineVersionCalculator! mainlineVersionCalculator, GitVersion.Common.IRepositoryStore! repositoryStore, System.Lazy! versionContext, System.Collections.Generic.IEnumerable! versionStrategies, GitVersion.VersionCalculation.IEffectiveBranchConfigurationFinder! effectiveBranchConfigurationFinder, GitVersion.VersionCalculation.IIncrementStrategyFinder! incrementStrategyFinder) -> void GitVersion.VersionCalculation.ShaVersionFilter @@ -1001,7 +999,7 @@ GitVersion.VersionCalculation.TaggedCommitVersionStrategy.VersionTaggedCommit.Ve GitVersion.VersionCalculation.TrackReleaseBranchesVersionStrategy GitVersion.VersionCalculation.TrackReleaseBranchesVersionStrategy.TrackReleaseBranchesVersionStrategy(GitVersion.Common.IRepositoryStore! repositoryStore, System.Lazy! versionContext) -> void GitVersion.VersionCalculation.VariableProvider -GitVersion.VersionCalculation.VariableProvider.GetVariablesFor(GitVersion.SemanticVersion! semanticVersion, GitVersion.Model.Configuration.EffectiveConfiguration! config, bool isCurrentCommitTagged) -> GitVersion.OutputVariables.VersionVariables! +GitVersion.VersionCalculation.VariableProvider.GetVariablesFor(GitVersion.SemanticVersion! semanticVersion, GitVersion.Configuration.EffectiveConfiguration! configuration, bool isCurrentCommitTagged) -> GitVersion.OutputVariables.VersionVariables! GitVersion.VersionCalculation.VariableProvider.VariableProvider(GitVersion.IEnvironment! environment, GitVersion.Logging.ILog! log) -> void GitVersion.VersionCalculation.VersionCalculationModule GitVersion.VersionCalculation.VersionCalculationModule.RegisterTypes(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void @@ -1170,49 +1168,49 @@ override GitVersion.BuildAgents.TravisCi.EnvironmentVariable.get -> string! override GitVersion.BuildAgents.TravisCi.GenerateSetParameterMessage(string! name, string! value) -> string![]! override GitVersion.BuildAgents.TravisCi.GenerateSetVersionMessage(GitVersion.OutputVariables.VersionVariables! variables) -> string! override GitVersion.BuildAgents.TravisCi.PreventFetch() -> bool +override GitVersion.Configuration.GitVersionConfiguration.ToString() -> string! override GitVersion.Configuration.Init.EditConfigStep.DefaultResult.get -> string? -override GitVersion.Configuration.Init.EditConfigStep.GetPrompt(GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> string! -override GitVersion.Configuration.Init.EditConfigStep.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! +override GitVersion.Configuration.Init.EditConfigStep.GetPrompt(GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> string! +override GitVersion.Configuration.Init.EditConfigStep.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! override GitVersion.Configuration.Init.GitVersionInitModule.RegisterTypes(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void override GitVersion.Configuration.Init.SetConfig.AssemblyVersioningSchemeSetting.DefaultResult.get -> string! -override GitVersion.Configuration.Init.SetConfig.AssemblyVersioningSchemeSetting.GetPrompt(GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> string! -override GitVersion.Configuration.Init.SetConfig.AssemblyVersioningSchemeSetting.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! +override GitVersion.Configuration.Init.SetConfig.AssemblyVersioningSchemeSetting.GetPrompt(GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> string! +override GitVersion.Configuration.Init.SetConfig.AssemblyVersioningSchemeSetting.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! override GitVersion.Configuration.Init.SetConfig.ConfigureBranch.DefaultResult.get -> string! -override GitVersion.Configuration.Init.SetConfig.ConfigureBranch.GetPrompt(GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> string! -override GitVersion.Configuration.Init.SetConfig.ConfigureBranch.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! +override GitVersion.Configuration.Init.SetConfig.ConfigureBranch.GetPrompt(GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> string! +override GitVersion.Configuration.Init.SetConfig.ConfigureBranch.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! override GitVersion.Configuration.Init.SetConfig.ConfigureBranches.DefaultResult.get -> string! -override GitVersion.Configuration.Init.SetConfig.ConfigureBranches.GetPrompt(GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> string! -override GitVersion.Configuration.Init.SetConfig.ConfigureBranches.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! +override GitVersion.Configuration.Init.SetConfig.ConfigureBranches.GetPrompt(GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> string! +override GitVersion.Configuration.Init.SetConfig.ConfigureBranches.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! override GitVersion.Configuration.Init.SetConfig.GlobalModeSetting.DefaultResult.get -> string! -override GitVersion.Configuration.Init.SetConfig.GlobalModeSetting.GetPrompt(GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> string! -override GitVersion.Configuration.Init.SetConfig.GlobalModeSetting.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! +override GitVersion.Configuration.Init.SetConfig.GlobalModeSetting.GetPrompt(GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> string! +override GitVersion.Configuration.Init.SetConfig.GlobalModeSetting.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! override GitVersion.Configuration.Init.SetConfig.SetBranchIncrementMode.DefaultResult.get -> string! -override GitVersion.Configuration.Init.SetConfig.SetBranchIncrementMode.GetPrompt(GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> string! -override GitVersion.Configuration.Init.SetConfig.SetBranchIncrementMode.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! +override GitVersion.Configuration.Init.SetConfig.SetBranchIncrementMode.GetPrompt(GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> string! +override GitVersion.Configuration.Init.SetConfig.SetBranchIncrementMode.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! override GitVersion.Configuration.Init.SetConfig.SetBranchTag.DefaultResult.get -> string! -override GitVersion.Configuration.Init.SetConfig.SetBranchTag.GetPrompt(GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> string! -override GitVersion.Configuration.Init.SetConfig.SetBranchTag.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! +override GitVersion.Configuration.Init.SetConfig.SetBranchTag.GetPrompt(GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> string! +override GitVersion.Configuration.Init.SetConfig.SetBranchTag.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! override GitVersion.Configuration.Init.SetNextVersion.DefaultResult.get -> string? -override GitVersion.Configuration.Init.SetNextVersion.GetPrompt(GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> string! -override GitVersion.Configuration.Init.SetNextVersion.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! -override GitVersion.Configuration.Init.Wizard.FinishedSetupStep.GetPrompt(GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> string! -override GitVersion.Configuration.Init.Wizard.GitFlowSetupStep.GetPrompt(GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> string! -override GitVersion.Configuration.Init.Wizard.GitHubFlowStep.GetPrompt(GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> string! +override GitVersion.Configuration.Init.SetNextVersion.GetPrompt(GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> string! +override GitVersion.Configuration.Init.SetNextVersion.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! +override GitVersion.Configuration.Init.Wizard.FinishedSetupStep.GetPrompt(GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> string! +override GitVersion.Configuration.Init.Wizard.GitFlowSetupStep.GetPrompt(GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> string! +override GitVersion.Configuration.Init.Wizard.GitHubFlowStep.GetPrompt(GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> string! override GitVersion.Configuration.Init.Wizard.PickBranchingStrategy1Step.DefaultResult.get -> string? -override GitVersion.Configuration.Init.Wizard.PickBranchingStrategy1Step.GetPrompt(GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> string! -override GitVersion.Configuration.Init.Wizard.PickBranchingStrategy1Step.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! +override GitVersion.Configuration.Init.Wizard.PickBranchingStrategy1Step.GetPrompt(GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> string! +override GitVersion.Configuration.Init.Wizard.PickBranchingStrategy1Step.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! override GitVersion.Configuration.Init.Wizard.PickBranchingStrategy2Step.DefaultResult.get -> string? -override GitVersion.Configuration.Init.Wizard.PickBranchingStrategy2Step.GetPrompt(GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> string! -override GitVersion.Configuration.Init.Wizard.PickBranchingStrategy2Step.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! +override GitVersion.Configuration.Init.Wizard.PickBranchingStrategy2Step.GetPrompt(GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> string! +override GitVersion.Configuration.Init.Wizard.PickBranchingStrategy2Step.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! override GitVersion.Configuration.Init.Wizard.PickBranchingStrategy3Step.DefaultResult.get -> string? -override GitVersion.Configuration.Init.Wizard.PickBranchingStrategy3Step.GetPrompt(GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> string! -override GitVersion.Configuration.Init.Wizard.PickBranchingStrategy3Step.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! +override GitVersion.Configuration.Init.Wizard.PickBranchingStrategy3Step.GetPrompt(GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> string! +override GitVersion.Configuration.Init.Wizard.PickBranchingStrategy3Step.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! override GitVersion.Configuration.Init.Wizard.PickBranchingStrategyStep.DefaultResult.get -> string? -override GitVersion.Configuration.Init.Wizard.PickBranchingStrategyStep.GetPrompt(GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> string! -override GitVersion.Configuration.Init.Wizard.PickBranchingStrategyStep.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Model.Configuration.Config! config, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! +override GitVersion.Configuration.Init.Wizard.PickBranchingStrategyStep.GetPrompt(GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> string! +override GitVersion.Configuration.Init.Wizard.PickBranchingStrategyStep.HandleResult(string? result, System.Collections.Generic.Queue! steps, GitVersion.Configuration.GitVersionConfiguration! configuration, string! workingDirectory) -> GitVersion.Configuration.Init.StepResult! override GitVersion.Helpers.LambdaKeyComparer.Compare(TSource? x, TSource? y) -> int override GitVersion.Logging.Log.ToString() -> string! -override GitVersion.Model.Configuration.Config.ToString() -> string! override GitVersion.OutputVariables.VersionVariables.ToString() -> string! override GitVersion.OutputVariables.VersionVariablesJsonNumberConverter.CanConvert(System.Type! typeToConvert) -> bool override GitVersion.OutputVariables.VersionVariablesJsonNumberConverter.HandleNull.get -> bool @@ -1235,15 +1233,15 @@ override GitVersion.SemanticVersionPreReleaseTag.Equals(object? obj) -> bool override GitVersion.SemanticVersionPreReleaseTag.GetHashCode() -> int override GitVersion.SemanticVersionPreReleaseTag.ToString() -> string! override GitVersion.VersionCalculation.BaseVersion.ToString() -> string! -override GitVersion.VersionCalculation.ConfigNextVersionVersionStrategy.GetBaseVersions(GitVersion.Model.Configuration.EffectiveBranchConfiguration! configuration) -> System.Collections.Generic.IEnumerable! -override GitVersion.VersionCalculation.MergeMessageVersionStrategy.GetBaseVersions(GitVersion.Model.Configuration.EffectiveBranchConfiguration! configuration) -> System.Collections.Generic.IEnumerable! +override GitVersion.VersionCalculation.ConfigNextVersionVersionStrategy.GetBaseVersions(GitVersion.Configuration.EffectiveBranchConfiguration! configuration) -> System.Collections.Generic.IEnumerable! +override GitVersion.VersionCalculation.MergeMessageVersionStrategy.GetBaseVersions(GitVersion.Configuration.EffectiveBranchConfiguration! configuration) -> System.Collections.Generic.IEnumerable! override GitVersion.VersionCalculation.NextVersion.Equals(object! other) -> bool override GitVersion.VersionCalculation.NextVersion.GetHashCode() -> int override GitVersion.VersionCalculation.NextVersion.ToString() -> string! -override GitVersion.VersionCalculation.TaggedCommitVersionStrategy.GetBaseVersions(GitVersion.Model.Configuration.EffectiveBranchConfiguration! configuration) -> System.Collections.Generic.IEnumerable! +override GitVersion.VersionCalculation.TaggedCommitVersionStrategy.GetBaseVersions(GitVersion.Configuration.EffectiveBranchConfiguration! configuration) -> System.Collections.Generic.IEnumerable! override GitVersion.VersionCalculation.TaggedCommitVersionStrategy.VersionTaggedCommit.ToString() -> string! -override GitVersion.VersionCalculation.TrackReleaseBranchesVersionStrategy.GetBaseVersions(GitVersion.Model.Configuration.EffectiveBranchConfiguration! configuration) -> System.Collections.Generic.IEnumerable! -override GitVersion.VersionCalculation.VersionInBranchNameVersionStrategy.GetBaseVersions(GitVersion.Model.Configuration.EffectiveBranchConfiguration! configuration) -> System.Collections.Generic.IEnumerable! +override GitVersion.VersionCalculation.TrackReleaseBranchesVersionStrategy.GetBaseVersions(GitVersion.Configuration.EffectiveBranchConfiguration! configuration) -> System.Collections.Generic.IEnumerable! +override GitVersion.VersionCalculation.VersionInBranchNameVersionStrategy.GetBaseVersions(GitVersion.Configuration.EffectiveBranchConfiguration! configuration) -> System.Collections.Generic.IEnumerable! override GitVersion.VersionCalculation.VersionStrategyModule.RegisterTypes(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void readonly GitVersion.BuildAgents.BuildAgentBase.Log -> GitVersion.Logging.ILog! readonly GitVersion.Configuration.Init.Wizard.ConfigInitWizardStep.Console -> GitVersion.Logging.IConsole! @@ -1252,15 +1250,15 @@ readonly GitVersion.Configuration.Init.Wizard.ConfigInitWizardStep.Log -> GitVer readonly GitVersion.Configuration.Init.Wizard.ConfigInitWizardStep.StepFactory -> GitVersion.Configuration.Init.Wizard.IConfigInitStepFactory! static GitVersion.BranchCommit.operator !=(GitVersion.BranchCommit left, GitVersion.BranchCommit right) -> bool static GitVersion.BranchCommit.operator ==(GitVersion.BranchCommit left, GitVersion.BranchCommit right) -> bool -static GitVersion.Configuration.ConfigExtensions.GetBranchConfiguration(this GitVersion.Model.Configuration.Config! configuration, GitVersion.IBranch! branch) -> GitVersion.Model.Configuration.BranchConfig! -static GitVersion.Configuration.ConfigExtensions.GetBranchConfiguration(this GitVersion.Model.Configuration.Config! configuration, string! branchName) -> GitVersion.Model.Configuration.BranchConfig! -static GitVersion.Configuration.ConfigExtensions.GetBranchSpecificTag(this GitVersion.Model.Configuration.EffectiveConfiguration! configuration, GitVersion.Logging.ILog! log, string? branchFriendlyName, string? branchNameOverride) -> string! -static GitVersion.Configuration.ConfigExtensions.GetFallbackBranchConfiguration(this GitVersion.Model.Configuration.Config! configuration) -> GitVersion.Model.Configuration.BranchConfig! -static GitVersion.Configuration.ConfigExtensions.GetReleaseBranchConfig(this GitVersion.Model.Configuration.Config! configuration) -> System.Collections.Generic.List>! -static GitVersion.Configuration.ConfigExtensions.GetUnknownBranchConfiguration(this GitVersion.Model.Configuration.Config! configuration) -> GitVersion.Model.Configuration.BranchConfig! -static GitVersion.Configuration.ConfigExtensions.IsReleaseBranch(this GitVersion.Model.Configuration.Config! config, string! branchName) -> bool -static GitVersion.Configuration.ConfigSerializer.Read(System.IO.TextReader! reader) -> GitVersion.Model.Configuration.Config! -static GitVersion.Configuration.ConfigSerializer.Write(GitVersion.Model.Configuration.Config! config, System.IO.TextWriter! writer) -> void +static GitVersion.Configuration.ConfigurationExtensions.GetBranchConfiguration(this GitVersion.Configuration.GitVersionConfiguration! configuration, GitVersion.IBranch! branch) -> GitVersion.Configuration.BranchConfiguration! +static GitVersion.Configuration.ConfigurationExtensions.GetBranchConfiguration(this GitVersion.Configuration.GitVersionConfiguration! configuration, string! branchName) -> GitVersion.Configuration.BranchConfiguration! +static GitVersion.Configuration.ConfigurationExtensions.GetBranchSpecificTag(this GitVersion.Configuration.EffectiveConfiguration! configuration, GitVersion.Logging.ILog! log, string? branchFriendlyName, string? branchNameOverride) -> string! +static GitVersion.Configuration.ConfigurationExtensions.GetFallbackBranchConfiguration(this GitVersion.Configuration.GitVersionConfiguration! configuration) -> GitVersion.Configuration.BranchConfiguration! +static GitVersion.Configuration.ConfigurationExtensions.GetReleaseBranchConfiguration(this GitVersion.Configuration.GitVersionConfiguration! configuration) -> System.Collections.Generic.List>! +static GitVersion.Configuration.ConfigurationExtensions.GetUnknownBranchConfiguration(this GitVersion.Configuration.GitVersionConfiguration! configuration) -> GitVersion.Configuration.BranchConfiguration! +static GitVersion.Configuration.ConfigurationExtensions.IsReleaseBranch(this GitVersion.Configuration.GitVersionConfiguration! configuration, string! branchName) -> bool +static GitVersion.Configuration.ConfigurationSerializer.Read(System.IO.TextReader! reader) -> GitVersion.Configuration.GitVersionConfiguration! +static GitVersion.Configuration.ConfigurationSerializer.Write(GitVersion.Configuration.GitVersionConfiguration! configuration, System.IO.TextWriter! writer) -> void static GitVersion.Configuration.Init.StepResult.ExitWithoutSaving() -> GitVersion.Configuration.Init.StepResult! static GitVersion.Configuration.Init.StepResult.InvalidResponseSelected() -> GitVersion.Configuration.Init.StepResult! static GitVersion.Configuration.Init.StepResult.Ok() -> GitVersion.Configuration.Init.StepResult! @@ -1377,9 +1375,9 @@ virtual GitVersion.BuildAgents.BuildAgentBase.GetCurrentBranch(bool usingDynamic virtual GitVersion.BuildAgents.BuildAgentBase.PreventFetch() -> bool virtual GitVersion.BuildAgents.BuildAgentBase.ShouldCleanUpRemotes() -> bool virtual GitVersion.BuildAgents.BuildAgentBase.WriteIntegration(System.Action! writer, GitVersion.OutputVariables.VersionVariables! variables, bool updateBuildNumber = true) -> void -virtual GitVersion.Model.Configuration.IgnoreConfig.IsEmpty.get -> bool -virtual GitVersion.Model.Configuration.IgnoreConfig.ToFilters() -> System.Collections.Generic.IEnumerable! -virtual GitVersion.VersionCalculation.EffectiveBranchConfigurationFinder.GetConfigurations(GitVersion.IBranch! branch, GitVersion.Model.Configuration.Config! configuration) -> System.Collections.Generic.IEnumerable! -virtual GitVersion.VersionCalculation.FallbackVersionStrategy.GetBaseVersions(GitVersion.Model.Configuration.EffectiveBranchConfiguration! configuration) -> System.Collections.Generic.IEnumerable! +virtual GitVersion.Configuration.IgnoreConfiguration.IsEmpty.get -> bool +virtual GitVersion.Configuration.IgnoreConfiguration.ToFilters() -> System.Collections.Generic.IEnumerable! +virtual GitVersion.VersionCalculation.EffectiveBranchConfigurationFinder.GetConfigurations(GitVersion.IBranch! branch, GitVersion.Configuration.GitVersionConfiguration! configuration) -> System.Collections.Generic.IEnumerable! +virtual GitVersion.VersionCalculation.FallbackVersionStrategy.GetBaseVersions(GitVersion.Configuration.EffectiveBranchConfiguration! configuration) -> System.Collections.Generic.IEnumerable! virtual GitVersion.VersionCalculation.NextVersionCalculator.FindVersion() -> GitVersion.VersionCalculation.NextVersion! virtual GitVersion.VersionCalculation.TaggedCommitVersionStrategy.FormatSource(GitVersion.VersionCalculation.TaggedCommitVersionStrategy.VersionTaggedCommit! version) -> string! diff --git a/src/GitVersion.Core/Model/RepositoryInfo.cs b/src/GitVersion.Core/RepositoryInfo.cs similarity index 100% rename from src/GitVersion.Core/Model/RepositoryInfo.cs rename to src/GitVersion.Core/RepositoryInfo.cs diff --git a/src/GitVersion.Core/Model/Settings.cs b/src/GitVersion.Core/Settings.cs similarity index 100% rename from src/GitVersion.Core/Model/Settings.cs rename to src/GitVersion.Core/Settings.cs diff --git a/src/GitVersion.Core/VersionCalculation/Abstractions/IIncrementStrategyFinder.cs b/src/GitVersion.Core/VersionCalculation/Abstractions/IIncrementStrategyFinder.cs index 5616a13286..b51456df02 100644 --- a/src/GitVersion.Core/VersionCalculation/Abstractions/IIncrementStrategyFinder.cs +++ b/src/GitVersion.Core/VersionCalculation/Abstractions/IIncrementStrategyFinder.cs @@ -1,4 +1,4 @@ -using GitVersion.Model.Configuration; +using GitVersion.Configuration; namespace GitVersion.VersionCalculation; @@ -6,5 +6,5 @@ public interface IIncrementStrategyFinder { VersionField DetermineIncrementedField(GitVersionContext context, BaseVersion baseVersion, EffectiveConfiguration configuration); - VersionField? GetIncrementForCommits(Config configuration, IEnumerable commits); + VersionField? GetIncrementForCommits(GitVersionConfiguration configuration, IEnumerable commits); } diff --git a/src/GitVersion.Core/VersionCalculation/Abstractions/IVariableProvider.cs b/src/GitVersion.Core/VersionCalculation/Abstractions/IVariableProvider.cs index 05500e8e7f..0cfeec8562 100644 --- a/src/GitVersion.Core/VersionCalculation/Abstractions/IVariableProvider.cs +++ b/src/GitVersion.Core/VersionCalculation/Abstractions/IVariableProvider.cs @@ -1,9 +1,9 @@ -using GitVersion.Model.Configuration; +using GitVersion.Configuration; using GitVersion.OutputVariables; namespace GitVersion.VersionCalculation; public interface IVariableProvider { - VersionVariables GetVariablesFor(SemanticVersion semanticVersion, EffectiveConfiguration config, bool isCurrentCommitTagged); + VersionVariables GetVariablesFor(SemanticVersion semanticVersion, EffectiveConfiguration configuration, bool isCurrentCommitTagged); } diff --git a/src/GitVersion.Core/VersionCalculation/Abstractions/IVersionStrategy.cs b/src/GitVersion.Core/VersionCalculation/Abstractions/IVersionStrategy.cs index a3b27fbc10..1050941f7c 100644 --- a/src/GitVersion.Core/VersionCalculation/Abstractions/IVersionStrategy.cs +++ b/src/GitVersion.Core/VersionCalculation/Abstractions/IVersionStrategy.cs @@ -1,4 +1,4 @@ -using GitVersion.Model.Configuration; +using GitVersion.Configuration; namespace GitVersion.VersionCalculation; diff --git a/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/ConfigNextVersionVersionStrategy.cs b/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/ConfigNextVersionVersionStrategy.cs index 895e451c17..ab83daf5f0 100644 --- a/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/ConfigNextVersionVersionStrategy.cs +++ b/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/ConfigNextVersionVersionStrategy.cs @@ -1,5 +1,5 @@ +using GitVersion.Configuration; using GitVersion.Extensions; -using GitVersion.Model.Configuration; namespace GitVersion.VersionCalculation; diff --git a/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/FallbackVersionStrategy.cs b/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/FallbackVersionStrategy.cs index 81b57f4322..8d1915c41b 100644 --- a/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/FallbackVersionStrategy.cs +++ b/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/FallbackVersionStrategy.cs @@ -1,4 +1,4 @@ -using GitVersion.Model.Configuration; +using GitVersion.Configuration; namespace GitVersion.VersionCalculation; diff --git a/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/MergeMessageVersionStrategy.cs b/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/MergeMessageVersionStrategy.cs index 6c106330e6..4a0f1013e1 100644 --- a/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/MergeMessageVersionStrategy.cs +++ b/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/MergeMessageVersionStrategy.cs @@ -4,14 +4,13 @@ using GitVersion.Configuration; using GitVersion.Extensions; using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.VersionCalculation; /// /// Version is extracted from older commits' merge messages. /// BaseVersionSource is the commit where the message was found. -/// Increments if PreventIncrementOfMergedBranchVersion (from the branch config) is false. +/// Increments if PreventIncrementOfMergedBranchVersion (from the branch configuration) is false. /// public class MergeMessageVersionStrategy : VersionStrategyBase { diff --git a/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/TaggedCommitVersionStrategy.cs b/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/TaggedCommitVersionStrategy.cs index 8695402dce..1f9c5d0a14 100644 --- a/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/TaggedCommitVersionStrategy.cs +++ b/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/TaggedCommitVersionStrategy.cs @@ -1,6 +1,6 @@ using GitVersion.Common; +using GitVersion.Configuration; using GitVersion.Extensions; -using GitVersion.Model.Configuration; namespace GitVersion.VersionCalculation; diff --git a/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/TrackReleaseBranchesVersionStrategy.cs b/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/TrackReleaseBranchesVersionStrategy.cs index 8bdb686f69..fbd05a5038 100644 --- a/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/TrackReleaseBranchesVersionStrategy.cs +++ b/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/TrackReleaseBranchesVersionStrategy.cs @@ -1,7 +1,6 @@ using GitVersion.Common; using GitVersion.Configuration; using GitVersion.Extensions; -using GitVersion.Model.Configuration; namespace GitVersion.VersionCalculation; @@ -51,7 +50,7 @@ private IEnumerable MainTagsVersions() private IEnumerable ReleaseBranchBaseVersions() { - var releaseBranchConfig = Context.Configuration.GetReleaseBranchConfig(); + var releaseBranchConfig = Context.Configuration.GetReleaseBranchConfiguration(); if (!releaseBranchConfig.Any()) return Array.Empty(); diff --git a/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/VersionInBranchNameVersionStrategy.cs b/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/VersionInBranchNameVersionStrategy.cs index 1061eaa215..5b812a4f05 100644 --- a/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/VersionInBranchNameVersionStrategy.cs +++ b/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/VersionInBranchNameVersionStrategy.cs @@ -1,7 +1,6 @@ using GitVersion.Common; using GitVersion.Configuration; using GitVersion.Extensions; -using GitVersion.Model.Configuration; namespace GitVersion.VersionCalculation; diff --git a/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/VersionStrategyBase.cs b/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/VersionStrategyBase.cs index 8161fdb518..e45e7757ae 100644 --- a/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/VersionStrategyBase.cs +++ b/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/VersionStrategyBase.cs @@ -1,5 +1,5 @@ +using GitVersion.Configuration; using GitVersion.Extensions; -using GitVersion.Model.Configuration; namespace GitVersion.VersionCalculation; diff --git a/src/GitVersion.Core/VersionCalculation/Cache/GitVersionCache.cs b/src/GitVersion.Core/VersionCalculation/Cache/GitVersionCache.cs index 598da5bb65..2c99942f57 100644 --- a/src/GitVersion.Core/VersionCalculation/Cache/GitVersionCache.cs +++ b/src/GitVersion.Core/VersionCalculation/Cache/GitVersionCache.cs @@ -1,4 +1,3 @@ -using GitVersion.Cache; using GitVersion.Extensions; using GitVersion.Helpers; using GitVersion.Logging; diff --git a/src/GitVersion.Core/Model/GitVersionCacheKey.cs b/src/GitVersion.Core/VersionCalculation/Cache/GitVersionCacheKey.cs similarity index 85% rename from src/GitVersion.Core/Model/GitVersionCacheKey.cs rename to src/GitVersion.Core/VersionCalculation/Cache/GitVersionCacheKey.cs index d12e85c9ca..37be3562a9 100644 --- a/src/GitVersion.Core/Model/GitVersionCacheKey.cs +++ b/src/GitVersion.Core/VersionCalculation/Cache/GitVersionCacheKey.cs @@ -1,15 +1,13 @@ using GitVersion.Extensions; -namespace GitVersion.Cache; +namespace GitVersion.VersionCalculation.Cache; public class GitVersionCacheKey { public GitVersionCacheKey(string value) { if (value.IsNullOrEmpty()) - { throw new ArgumentNullException(nameof(value)); - } Value = value; } diff --git a/src/GitVersion.Core/VersionCalculation/Cache/GitVersionCacheKeyFactory.cs b/src/GitVersion.Core/VersionCalculation/Cache/GitVersionCacheKeyFactory.cs index cf07e84f73..2c01745f89 100644 --- a/src/GitVersion.Core/VersionCalculation/Cache/GitVersionCacheKeyFactory.cs +++ b/src/GitVersion.Core/VersionCalculation/Cache/GitVersionCacheKeyFactory.cs @@ -1,10 +1,8 @@ using System.Security.Cryptography; -using GitVersion.Cache; using GitVersion.Configuration; using GitVersion.Extensions; using GitVersion.Helpers; using GitVersion.Logging; -using GitVersion.Model.Configuration; using Microsoft.Extensions.Options; namespace GitVersion.VersionCalculation.Cache; @@ -14,12 +12,12 @@ public class GitVersionCacheKeyFactory : IGitVersionCacheKeyFactory private readonly IFileSystem fileSystem; private readonly ILog log; private readonly IOptions options; - private readonly IConfigFileLocator configFileLocator; + private readonly IConfigurationFileLocator configFileLocator; private readonly IGitRepository gitRepository; private readonly IGitRepositoryInfo repositoryInfo; public GitVersionCacheKeyFactory(IFileSystem fileSystem, ILog log, - IOptions options, IConfigFileLocator configFileLocator, + IOptions options, IConfigurationFileLocator configFileLocator, IGitRepository gitRepository, IGitRepositoryInfo repositoryInfo) { this.fileSystem = fileSystem.NotNull(); @@ -30,12 +28,12 @@ public GitVersionCacheKeyFactory(IFileSystem fileSystem, ILog log, this.repositoryInfo = repositoryInfo.NotNull(); } - public GitVersionCacheKey Create(Config? overrideConfig) + public GitVersionCacheKey Create(GitVersionConfiguration? overrideConfiguration) { var gitSystemHash = GetGitSystemHash(); var configFileHash = GetConfigFileHash(); var repositorySnapshotHash = GetRepositorySnapshotHash(); - var overrideConfigHash = GetOverrideConfigHash(overrideConfig); + var overrideConfigHash = GetOverrideConfigHash(overrideConfiguration); var compositeHash = GetHash(gitSystemHash, configFileHash, repositorySnapshotHash, overrideConfigHash); return new GitVersionCacheKey(compositeHash); @@ -152,9 +150,9 @@ private string GetRepositorySnapshotHash() return GetHash(hash); } - private static string GetOverrideConfigHash(Config? overrideConfig) + private static string GetOverrideConfigHash(GitVersionConfiguration? overrideConfiguration) { - if (overrideConfig == null) + if (overrideConfiguration == null) { return string.Empty; } @@ -164,7 +162,7 @@ private static string GetOverrideConfigHash(Config? overrideConfig) var stringBuilder = new StringBuilder(); using (var stream = new StringWriter(stringBuilder)) { - ConfigSerializer.Write(overrideConfig, stream); + ConfigurationSerializer.Write(overrideConfiguration, stream); stream.Flush(); } var configContent = stringBuilder.ToString(); @@ -174,8 +172,8 @@ private static string GetOverrideConfigHash(Config? overrideConfig) private string GetConfigFileHash() { - // will return the same hash even when config file will be moved - // from workingDirectory to rootProjectDirectory. It's OK. Config essentially is the same. + // will return the same hash even when configuration file will be moved + // from workingDirectory to rootProjectDirectory. It's OK. Configuration essentially is the same. var configFilePath = this.configFileLocator.SelectConfigFilePath(this.options.Value, this.repositoryInfo); if (configFilePath == null || !this.fileSystem.Exists(configFilePath)) { diff --git a/src/GitVersion.Core/VersionCalculation/Cache/IGitVersionCache.cs b/src/GitVersion.Core/VersionCalculation/Cache/IGitVersionCache.cs index 33e275f90f..950212b1be 100644 --- a/src/GitVersion.Core/VersionCalculation/Cache/IGitVersionCache.cs +++ b/src/GitVersion.Core/VersionCalculation/Cache/IGitVersionCache.cs @@ -1,4 +1,3 @@ -using GitVersion.Cache; using GitVersion.OutputVariables; namespace GitVersion.VersionCalculation.Cache; diff --git a/src/GitVersion.Core/VersionCalculation/Cache/IGitVersionCacheKeyFactory.cs b/src/GitVersion.Core/VersionCalculation/Cache/IGitVersionCacheKeyFactory.cs index 812676962d..71f975f91c 100644 --- a/src/GitVersion.Core/VersionCalculation/Cache/IGitVersionCacheKeyFactory.cs +++ b/src/GitVersion.Core/VersionCalculation/Cache/IGitVersionCacheKeyFactory.cs @@ -1,9 +1,8 @@ -using GitVersion.Cache; -using GitVersion.Model.Configuration; +using GitVersion.Configuration; namespace GitVersion.VersionCalculation.Cache; public interface IGitVersionCacheKeyFactory { - GitVersionCacheKey Create(Config? overrideConfig); + GitVersionCacheKey Create(GitVersionConfiguration? overrideConfiguration); } diff --git a/src/GitVersion.Core/VersionCalculation/EffectiveBranchConfigurationFinder.cs b/src/GitVersion.Core/VersionCalculation/EffectiveBranchConfigurationFinder.cs index f5cce1ee0e..d666bfc800 100644 --- a/src/GitVersion.Core/VersionCalculation/EffectiveBranchConfigurationFinder.cs +++ b/src/GitVersion.Core/VersionCalculation/EffectiveBranchConfigurationFinder.cs @@ -2,7 +2,6 @@ using GitVersion.Configuration; using GitVersion.Extensions; using GitVersion.Logging; -using GitVersion.Model.Configuration; namespace GitVersion.VersionCalculation; @@ -17,7 +16,7 @@ public EffectiveBranchConfigurationFinder(ILog log, IRepositoryStore repositoryS this.repositoryStore = repositoryStore.NotNull(); } - public virtual IEnumerable GetConfigurations(IBranch branch, Config configuration) + public virtual IEnumerable GetConfigurations(IBranch branch, GitVersionConfiguration configuration) { branch.NotNull(); configuration.NotNull(); @@ -26,7 +25,7 @@ public virtual IEnumerable GetConfigurations(IBran } private IEnumerable GetEffectiveConfigurationsRecursive( - IBranch branch, Config configuration, BranchConfig? childBranchConfiguration, HashSet traversedBranches) + IBranch branch, GitVersionConfiguration configuration, BranchConfiguration? childBranchConfiguration, HashSet traversedBranches) { if (!traversedBranches.Add(branch)) yield break; // This should never happen!! But it is good to have a circuit breaker. diff --git a/src/GitVersion.Core/VersionCalculation/IEffectiveBranchConfigurationFinder.cs b/src/GitVersion.Core/VersionCalculation/IEffectiveBranchConfigurationFinder.cs index dc5acaa59c..4de433b65e 100644 --- a/src/GitVersion.Core/VersionCalculation/IEffectiveBranchConfigurationFinder.cs +++ b/src/GitVersion.Core/VersionCalculation/IEffectiveBranchConfigurationFinder.cs @@ -1,9 +1,9 @@ -using GitVersion.Model.Configuration; +using GitVersion.Configuration; namespace GitVersion.VersionCalculation { public interface IEffectiveBranchConfigurationFinder { - IEnumerable GetConfigurations(IBranch branch, Config configuration); + IEnumerable GetConfigurations(IBranch branch, GitVersionConfiguration configuration); } } diff --git a/src/GitVersion.Core/VersionCalculation/IncrementStrategy.cs b/src/GitVersion.Core/VersionCalculation/IncrementStrategy.cs index 45aa90e5c5..5cfe27da4c 100644 --- a/src/GitVersion.Core/VersionCalculation/IncrementStrategy.cs +++ b/src/GitVersion.Core/VersionCalculation/IncrementStrategy.cs @@ -1,4 +1,4 @@ -using GitVersion.Model.Configuration; +using GitVersion.Configuration; namespace GitVersion; @@ -9,7 +9,7 @@ public enum IncrementStrategy Minor, Patch, /// - /// Uses the , and + /// Uses the , and /// of the "parent" branch (i.e. the branch where the current branch was branched from). /// Inherit diff --git a/src/GitVersion.Core/VersionCalculation/IncrementStrategyFinder.cs b/src/GitVersion.Core/VersionCalculation/IncrementStrategyFinder.cs index 30b0fabd62..73b72b4ccf 100644 --- a/src/GitVersion.Core/VersionCalculation/IncrementStrategyFinder.cs +++ b/src/GitVersion.Core/VersionCalculation/IncrementStrategyFinder.cs @@ -1,7 +1,7 @@ using System.Collections.Concurrent; using System.Text.RegularExpressions; +using GitVersion.Configuration; using GitVersion.Extensions; -using GitVersion.Model.Configuration; namespace GitVersion.VersionCalculation; @@ -34,7 +34,7 @@ public VersionField DetermineIncrementedField(GitVersionContext context, BaseVer var defaultIncrement = configuration.Increment.ToVersionField(); - // use the default branch config increment strategy if there are no commit message overrides + // use the default branch configuration increment strategy if there are no commit message overrides if (commitMessageIncrement == null) { return baseVersion.ShouldIncrement ? defaultIncrement : VersionField.None; @@ -46,7 +46,7 @@ public VersionField DetermineIncrementedField(GitVersionContext context, BaseVer commitMessageIncrement = VersionField.Minor; } - // don't increment for less than the branch config increment, if the absence of commit messages would have + // don't increment for less than the branch configuration increment, if the absence of commit messages would have // still resulted in an increment of configuration.Increment if (baseVersion.ShouldIncrement && commitMessageIncrement < defaultIncrement) { @@ -56,7 +56,7 @@ public VersionField DetermineIncrementedField(GitVersionContext context, BaseVer return commitMessageIncrement.Value; } - public VersionField? GetIncrementForCommits(Config configuration, IEnumerable commits) + public VersionField? GetIncrementForCommits(GitVersionConfiguration configuration, IEnumerable commits) { var majorRegex = TryGetRegexOrDefault(configuration.MajorVersionBumpMessage, DefaultMajorPatternRegex); var minorRegex = TryGetRegexOrDefault(configuration.MinorVersionBumpMessage, DefaultMinorPatternRegex); diff --git a/src/GitVersion.Core/VersionCalculation/MainlineVersionCalculator.cs b/src/GitVersion.Core/VersionCalculation/MainlineVersionCalculator.cs index 6fdf1b28fc..237a1d48e0 100644 --- a/src/GitVersion.Core/VersionCalculation/MainlineVersionCalculator.cs +++ b/src/GitVersion.Core/VersionCalculation/MainlineVersionCalculator.cs @@ -93,7 +93,7 @@ public SemanticVersionBuildMetaData CreateVersionBuildMetaData(ICommit? baseVers var ignore = context.Configuration.Ignore; if (!ignore.IsEmpty) { - var shasToIgnore = new HashSet(ignore.ShAs); + var shasToIgnore = new HashSet(ignore.Shas); commitLogs = commitLogs .Where(c => ignore.Before is null || c.When > ignore.Before && !shasToIgnore.Contains(c.Sha)); } @@ -135,8 +135,8 @@ private SemanticVersion AggregateMergeCommitIncrement(ICommit commit, List lastTag.Major == baseVersion.Major && lastTag.Minor == baseVersion.Minor && lastTag.Patch == baseVersion.Patch; - private NextVersion Calculate(IBranch branch, Config configuration) + private NextVersion Calculate(IBranch branch, GitVersionConfiguration configuration) { using (log.IndentLog("Calculating the base versions")) { @@ -222,7 +221,7 @@ static NextVersion CompareVersions( } } - private IEnumerable GetNextVersions(IBranch branch, Config configuration) + private IEnumerable GetNextVersions(IBranch branch, GitVersionConfiguration configuration) { if (branch.Tip == null) throw new GitVersionException("No commits found on the current branch."); @@ -268,7 +267,7 @@ private IEnumerable GetNextVersions(IBranch branch, Config configur } } - private bool IncludeVersion(BaseVersion baseVersion, IgnoreConfig ignoreConfiguration) + private bool IncludeVersion(BaseVersion baseVersion, IgnoreConfiguration ignoreConfiguration) { foreach (var versionFilter in ignoreConfiguration.ToFilters()) { diff --git a/src/GitVersion.Core/VersionCalculation/SemanticVersioning/SemanticVersionFormatValues.cs b/src/GitVersion.Core/VersionCalculation/SemanticVersioning/SemanticVersionFormatValues.cs index db7be5524b..745daab0ef 100644 --- a/src/GitVersion.Core/VersionCalculation/SemanticVersioning/SemanticVersionFormatValues.cs +++ b/src/GitVersion.Core/VersionCalculation/SemanticVersioning/SemanticVersionFormatValues.cs @@ -1,18 +1,18 @@ using System.Globalization; +using GitVersion.Configuration; using GitVersion.Extensions; -using GitVersion.Model.Configuration; namespace GitVersion; public class SemanticVersionFormatValues { private readonly SemanticVersion semver; - private readonly EffectiveConfiguration config; + private readonly EffectiveConfiguration configuration; - public SemanticVersionFormatValues(SemanticVersion semver, EffectiveConfiguration config) + public SemanticVersionFormatValues(SemanticVersion semver, EffectiveConfiguration configuration) { this.semver = semver; - this.config = config; + this.configuration = configuration; } public string Major => this.semver.Major.ToString(); @@ -41,9 +41,9 @@ public SemanticVersionFormatValues(SemanticVersion semver, EffectiveConfiguratio public string SemVer => this.semver.ToString(); - public string? AssemblySemVer => this.semver.GetAssemblyVersion(this.config.AssemblyVersioningScheme); + public string? AssemblySemVer => this.semver.GetAssemblyVersion(this.configuration.AssemblyVersioningScheme); - public string? AssemblyFileSemVer => this.semver.GetAssemblyFileVersion(this.config.AssemblyFileVersioningScheme); + public string? AssemblyFileSemVer => this.semver.GetAssemblyFileVersion(this.configuration.AssemblyFileVersioningScheme); public string FullSemVer => this.semver.ToString("f"); @@ -55,7 +55,7 @@ public SemanticVersionFormatValues(SemanticVersion semver, EffectiveConfiguratio public string? ShortSha => this.semver.BuildMetaData?.ShortSha; - public string? CommitDate => this.semver.BuildMetaData?.CommitDate?.UtcDateTime.ToString(this.config.CommitDateFormat, CultureInfo.InvariantCulture); + public string? CommitDate => this.semver.BuildMetaData?.CommitDate?.UtcDateTime.ToString(this.configuration.CommitDateFormat, CultureInfo.InvariantCulture); public string InformationalVersion => this.semver.ToString("i"); @@ -68,10 +68,10 @@ public SemanticVersionFormatValues(SemanticVersion semver, EffectiveConfiguratio private string GetWeightedPreReleaseNumber() { var weightedPreReleaseNumber = - this.semver.PreReleaseTag?.HasTag() == true ? (this.semver.PreReleaseTag.Number + this.config.PreReleaseWeight).ToString() : null; + this.semver.PreReleaseTag?.HasTag() == true ? (this.semver.PreReleaseTag.Number + this.configuration.PreReleaseWeight).ToString() : null; return weightedPreReleaseNumber.IsNullOrEmpty() - ? $"{this.config.TagPreReleaseWeight}" + ? $"{this.configuration.TagPreReleaseWeight}" : weightedPreReleaseNumber; } } diff --git a/src/GitVersion.Core/VersionCalculation/VariableProvider.cs b/src/GitVersion.Core/VersionCalculation/VariableProvider.cs index 20cfbf1f9e..dcfb7b73c4 100644 --- a/src/GitVersion.Core/VersionCalculation/VariableProvider.cs +++ b/src/GitVersion.Core/VersionCalculation/VariableProvider.cs @@ -3,7 +3,6 @@ using GitVersion.Extensions; using GitVersion.Helpers; using GitVersion.Logging; -using GitVersion.Model.Configuration; using GitVersion.OutputVariables; namespace GitVersion.VersionCalculation; @@ -19,32 +18,32 @@ public VariableProvider(IEnvironment environment, ILog log) this.log = log.NotNull(); } - public VersionVariables GetVariablesFor(SemanticVersion semanticVersion, EffectiveConfiguration config, bool isCurrentCommitTagged) + public VersionVariables GetVariablesFor(SemanticVersion semanticVersion, EffectiveConfiguration configuration, bool isCurrentCommitTagged) { - var isContinuousDeploymentMode = config.VersioningMode == VersioningMode.ContinuousDeployment && !isCurrentCommitTagged; + var isContinuousDeploymentMode = configuration.VersioningMode == VersioningMode.ContinuousDeployment && !isCurrentCommitTagged; if (isContinuousDeploymentMode) { semanticVersion = new SemanticVersion(semanticVersion); // Continuous Deployment always requires a pre-release tag unless the commit is tagged if (semanticVersion.PreReleaseTag != null && semanticVersion.PreReleaseTag.HasTag() != true) { - semanticVersion.PreReleaseTag.Name = config.GetBranchSpecificTag(this.log, semanticVersion.BuildMetaData?.Branch, null); + semanticVersion.PreReleaseTag.Name = configuration.GetBranchSpecificTag(this.log, semanticVersion.BuildMetaData?.Branch, null); if (semanticVersion.PreReleaseTag.Name.IsNullOrEmpty()) { // TODO: Why do we manipulating the semantic version here in the VariableProvider? The method name is GET not MANIPULATE. // What is about the separation of concern and single-responsibility principle? - semanticVersion.PreReleaseTag.Name = config.ContinuousDeploymentFallbackTag; + semanticVersion.PreReleaseTag.Name = configuration.ContinuousDeploymentFallbackTag; } } } // Evaluate tag number pattern and append to prerelease tag, preserving build metadata - var appendTagNumberPattern = !config.TagNumberPattern.IsNullOrEmpty() && semanticVersion.PreReleaseTag?.HasTag() == true; + var appendTagNumberPattern = !configuration.TagNumberPattern.IsNullOrEmpty() && semanticVersion.PreReleaseTag?.HasTag() == true; if (appendTagNumberPattern) { - if (semanticVersion.BuildMetaData?.Branch != null && config.TagNumberPattern != null) + if (semanticVersion.BuildMetaData?.Branch != null && configuration.TagNumberPattern != null) { - var match = Regex.Match(semanticVersion.BuildMetaData.Branch, config.TagNumberPattern); + var match = Regex.Match(semanticVersion.BuildMetaData.Branch, configuration.TagNumberPattern); var numberGroup = match.Groups["number"]; if (numberGroup.Success && semanticVersion.PreReleaseTag != null) { @@ -55,20 +54,20 @@ public VersionVariables GetVariablesFor(SemanticVersion semanticVersion, Effecti } } - if (isContinuousDeploymentMode || appendTagNumberPattern || config.VersioningMode == VersioningMode.Mainline) + if (isContinuousDeploymentMode || appendTagNumberPattern || configuration.VersioningMode == VersioningMode.Mainline) { // TODO: Why do we manipulating the semantic version here in the VariableProvider? The method name is GET not MANIPULATE. // What is about the separation of concern and single-responsibility principle? PromoteNumberOfCommitsToTagNumber(semanticVersion); } - var semverFormatValues = new SemanticVersionFormatValues(semanticVersion, config); + var semverFormatValues = new SemanticVersionFormatValues(semanticVersion, configuration); - var informationalVersion = CheckAndFormatString(config.AssemblyInformationalFormat, semverFormatValues, semverFormatValues.InformationalVersion, "AssemblyInformationalVersion"); + var informationalVersion = CheckAndFormatString(configuration.AssemblyInformationalFormat, semverFormatValues, semverFormatValues.InformationalVersion, "AssemblyInformationalVersion"); - var assemblyFileSemVer = CheckAndFormatString(config.AssemblyFileVersioningFormat, semverFormatValues, semverFormatValues.AssemblyFileSemVer, "AssemblyFileVersioningFormat"); + var assemblyFileSemVer = CheckAndFormatString(configuration.AssemblyFileVersioningFormat, semverFormatValues, semverFormatValues.AssemblyFileSemVer, "AssemblyFileVersioningFormat"); - var assemblySemVer = CheckAndFormatString(config.AssemblyVersioningFormat, semverFormatValues, semverFormatValues.AssemblySemVer, "AssemblyVersioningFormat"); + var assemblySemVer = CheckAndFormatString(configuration.AssemblyVersioningFormat, semverFormatValues, semverFormatValues.AssemblySemVer, "AssemblyVersioningFormat"); var variables = new VersionVariables( semverFormatValues.Major, diff --git a/src/GitVersion.Core/VersionConverters/OutputGenerator/OutputGenerator.cs b/src/GitVersion.Core/VersionConverters/OutputGenerator/OutputGenerator.cs index 52c4f61feb..f4c9eb67f8 100644 --- a/src/GitVersion.Core/VersionConverters/OutputGenerator/OutputGenerator.cs +++ b/src/GitVersion.Core/VersionConverters/OutputGenerator/OutputGenerator.cs @@ -2,7 +2,6 @@ using GitVersion.Extensions; using GitVersion.Helpers; using GitVersion.Logging; -using GitVersion.Model; using GitVersion.OutputVariables; using Microsoft.Extensions.Options; diff --git a/src/GitVersion.Core/Model/Exceptions/WarningException.cs b/src/GitVersion.Core/WarningException.cs similarity index 100% rename from src/GitVersion.Core/Model/Exceptions/WarningException.cs rename to src/GitVersion.Core/WarningException.cs diff --git a/src/GitVersion.Core/Model/WixInfo.cs b/src/GitVersion.Core/WixInfo.cs similarity index 100% rename from src/GitVersion.Core/Model/WixInfo.cs rename to src/GitVersion.Core/WixInfo.cs diff --git a/src/GitVersion.MsBuild.Tests/Tasks/TestTaskBase.cs b/src/GitVersion.MsBuild.Tests/Tasks/TestTaskBase.cs index 53d826f351..16dfc011a2 100644 --- a/src/GitVersion.MsBuild.Tests/Tasks/TestTaskBase.cs +++ b/src/GitVersion.MsBuild.Tests/Tasks/TestTaskBase.cs @@ -118,7 +118,7 @@ private static RemoteRepositoryFixture CreateRemoteRepositoryFixture() private static void CreateConfiguration(string repoFolder, string content) { - var configFilePath = PathHelper.Combine(repoFolder, ConfigFileLocator.DefaultFileName); + var configFilePath = PathHelper.Combine(repoFolder, ConfigurationFileLocator.DefaultFileName); File.WriteAllText(configFilePath, content); } } diff --git a/src/GitVersion.MsBuild/GitVersionTasks.cs b/src/GitVersion.MsBuild/GitVersionTasks.cs index 577ab6c65d..5164ce6008 100644 --- a/src/GitVersion.MsBuild/GitVersionTasks.cs +++ b/src/GitVersion.MsBuild/GitVersionTasks.cs @@ -1,7 +1,6 @@ using GitVersion.BuildAgents; using GitVersion.Extensions; using GitVersion.Logging; -using GitVersion.Model; using GitVersion.MsBuild.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options;