diff --git a/new-cli/GitVersion.Calculation/CalculateCommand.cs b/new-cli/GitVersion.Calculation/CalculateCommand.cs index 33299f91e5..56dae32c90 100644 --- a/new-cli/GitVersion.Calculation/CalculateCommand.cs +++ b/new-cli/GitVersion.Calculation/CalculateCommand.cs @@ -1,4 +1,5 @@ using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.Infrastructure; namespace GitVersion.Commands; diff --git a/new-cli/GitVersion.Cli/Program.cs b/new-cli/GitVersion.Cli/Program.cs index ef5c7de7d4..46cbdc1ad8 100644 --- a/new-cli/GitVersion.Cli/Program.cs +++ b/new-cli/GitVersion.Cli/Program.cs @@ -1,6 +1,7 @@ using GitVersion; using GitVersion.Extensions; using GitVersion.Generated; +using GitVersion.Git; using GitVersion.Infrastructure; var modules = new IGitVersionModule[] diff --git a/new-cli/GitVersion.Core.Libgit2Sharp/Git/GitRepository.extended.cs b/new-cli/GitVersion.Core.Libgit2Sharp/Git/GitRepository.extended.cs index b97c010aab..d54427f263 100644 --- a/new-cli/GitVersion.Core.Libgit2Sharp/Git/GitRepository.extended.cs +++ b/new-cli/GitVersion.Core.Libgit2Sharp/Git/GitRepository.extended.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; internal sealed partial class GitRepository : IGitRepository { diff --git a/new-cli/GitVersion.Core.Libgit2Sharp/LibGit2SharpCoreModule.cs b/new-cli/GitVersion.Core.Libgit2Sharp/LibGit2SharpCoreModule.cs index 2879233216..bc06d9bd32 100644 --- a/new-cli/GitVersion.Core.Libgit2Sharp/LibGit2SharpCoreModule.cs +++ b/new-cli/GitVersion.Core.Libgit2Sharp/LibGit2SharpCoreModule.cs @@ -1,6 +1,6 @@ using GitVersion.Infrastructure; -namespace GitVersion; +namespace GitVersion.Git; public class LibGit2SharpCoreModule : IGitVersionModule { diff --git a/new-cli/GitVersion.Core.Tester/GitVersionApp.cs b/new-cli/GitVersion.Core.Tester/GitVersionApp.cs index 68bd82d371..83e4a7a31a 100644 --- a/new-cli/GitVersion.Core.Tester/GitVersionApp.cs +++ b/new-cli/GitVersion.Core.Tester/GitVersionApp.cs @@ -1,3 +1,4 @@ +using GitVersion.Git; using GitVersion.Infrastructure; namespace GitVersion; diff --git a/new-cli/GitVersion.Core.Tester/Program.cs b/new-cli/GitVersion.Core.Tester/Program.cs index 4c1ae3e56e..2325f7d0d2 100644 --- a/new-cli/GitVersion.Core.Tester/Program.cs +++ b/new-cli/GitVersion.Core.Tester/Program.cs @@ -1,5 +1,6 @@ using GitVersion; using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.Infrastructure; var assemblies = new IGitVersionModule[] diff --git a/schemas/6.0/GitVersion.configuration.json b/schemas/6.0/GitVersion.configuration.json index c0ccdb4e88..ea2cc03003 100644 --- a/schemas/6.0/GitVersion.configuration.json +++ b/schemas/6.0/GitVersion.configuration.json @@ -126,11 +126,8 @@ "pre-release-weight": { "$ref": "#/$defs/nullableOfInt32" }, - "prevent-increment-of-merged-branch-version": { - "$ref": "#/$defs/nullableOfBoolean2" - }, - "prevent-increment-when-current-commit-tagged": { - "$ref": "#/$defs/nullableOfBoolean3" + "prevent-increment": { + "$ref": "#/$defs/preventIncrementConfiguration" }, "regex": { "$ref": "#/$defs/string2" @@ -186,6 +183,7 @@ "description": "Specifies which version strategies (one or more) will be used to determine the next version. Following values are available: 'ConfiguredNextVersion', 'MergeMessage', 'TaggedCommit', 'TrackReleaseBranches', 'VersionInBranchName' and 'TrunkBased'.", "enum": [ "None", + "Fallback", "ConfiguredNextVersion", "MergeMessage", "TaggedCommit", @@ -231,11 +229,8 @@ "pre-release-weight": { "$ref": "#/$defs/nullableOfInt32" }, - "prevent-increment-of-merged-branch-version": { - "$ref": "#/$defs/nullableOfBoolean2" - }, - "prevent-increment-when-current-commit-tagged": { - "$ref": "#/$defs/nullableOfBoolean3" + "prevent-increment": { + "$ref": "#/$defs/preventIncrementConfiguration" }, "regex": { "$ref": "#/$defs/string2" @@ -319,8 +314,23 @@ "null" ] }, + "preventIncrementConfiguration": { + "description": "The prevent increment configuration section.", + "type": "object", + "properties": { + "of-merged-branch": { + "$ref": "#/$defs/nullableOfBoolean2" + }, + "when-branch-merged": { + "$ref": "#/$defs/nullableOfBoolean2" + }, + "when-current-commit-tagged": { + "$ref": "#/$defs/nullableOfBoolean3" + } + } + }, "nullableOfBoolean2": { - "description": "Prevent increment of merged branch version.", + "description": "Prevent increment when branch merged.", "type": [ "boolean", "null" diff --git a/src/Directory.Build.props b/src/Directory.Build.props index be54e7ba0a..ef2ef736ca 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -41,7 +41,6 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/GitVersion.App.Tests/ArgumentParserTests.cs b/src/GitVersion.App.Tests/ArgumentParserTests.cs index 181578019e..d8456c7d12 100644 --- a/src/GitVersion.App.Tests/ArgumentParserTests.cs +++ b/src/GitVersion.App.Tests/ArgumentParserTests.cs @@ -1,6 +1,5 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; -using GitVersion.Extensions; using GitVersion.Helpers; using GitVersion.Logging; using GitVersion.VersionCalculation; diff --git a/src/GitVersion.App.Tests/Helpers/ProgramFixture.cs b/src/GitVersion.App.Tests/Helpers/ProgramFixture.cs index f4518a777f..1fa2d6268c 100644 --- a/src/GitVersion.App.Tests/Helpers/ProgramFixture.cs +++ b/src/GitVersion.App.Tests/Helpers/ProgramFixture.cs @@ -8,7 +8,7 @@ namespace GitVersion.App.Tests; public sealed class ProgramFixture { private readonly IEnvironment environment; - private List> Overrides { get; } = new(); + private List> Overrides { get; } = []; private readonly Lazy logger; private readonly Lazy output; diff --git a/src/GitVersion.App.Tests/PullRequestInBuildAgentTest.cs b/src/GitVersion.App.Tests/PullRequestInBuildAgentTest.cs index 38a3cc95d6..9fb5e7db11 100644 --- a/src/GitVersion.App.Tests/PullRequestInBuildAgentTest.cs +++ b/src/GitVersion.App.Tests/PullRequestInBuildAgentTest.cs @@ -1,6 +1,7 @@ using GitVersion.Agents; using GitVersion.Core.Tests.Helpers; using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.Helpers; using GitVersion.Output; using LibGit2Sharp; diff --git a/src/GitVersion.App/ArgumentParserExtensions.cs b/src/GitVersion.App/ArgumentParserExtensions.cs new file mode 100644 index 0000000000..35bc3ef10d --- /dev/null +++ b/src/GitVersion.App/ArgumentParserExtensions.cs @@ -0,0 +1,78 @@ +using System.Text.RegularExpressions; +using GitVersion.Helpers; + +namespace GitVersion; + +internal static class ArgumentParserExtensions +{ + private static readonly string[] TrueValues = ["1", "true"]; + private static readonly string[] FalseValues = ["0", "false"]; + + public static bool IsTrue(this string? value) => TrueValues.Contains(value, StringComparer.OrdinalIgnoreCase); + + public static bool IsFalse(this string? value) => FalseValues.Contains(value, StringComparer.OrdinalIgnoreCase); + + public static bool IsValidPath(this string? path) + { + if (path == null) + return false; + + try + { + _ = PathHelper.GetFullPath(path); + } + catch + { + path = PathHelper.Combine(SysEnv.CurrentDirectory, path); + + try + { + _ = PathHelper.GetFullPath(path); + } + catch + { + return false; + } + } + + return Directory.Exists(path); + } + + public static bool IsSwitchArgument(this string? value) + => value != null + && (value.StartsWith('-') || value.StartsWith('/')) + && !Regex.Match(value, @"/\w+:").Success; //Exclude msbuild & project parameters in form /blah:, which should be parsed as values, not switch names. + + public static bool IsSwitch(this string? value, string switchName) + { + if (value == null) + return false; + + if (value.StartsWith('-')) + { + value = value[1..]; + } + + if (value.StartsWith('/')) + { + value = value[1..]; + } + + return string.Equals(switchName, value, StringComparison.OrdinalIgnoreCase); + } + + public static bool IsHelp(this string singleArgument) => (singleArgument == "?") || singleArgument.IsSwitch("h") || singleArgument.IsSwitch("help") || singleArgument.IsSwitch("?"); + + public static bool ArgumentRequiresValue(this string argument, int argumentIndex) + { + var booleanArguments = new[] { "init", "updateassemblyinfo", "ensureassemblyinfo", "nofetch", "nonormalize", "nocache" }; + + var argumentMightRequireValue = !booleanArguments.Contains(argument[1..], StringComparer.OrdinalIgnoreCase); + + // If this is the first argument that might be a target path, the argument starts with slash and we're on an OS that supports paths with slashes, the argument does not require a value. + if (argumentMightRequireValue && argumentIndex == 0 && argument.StartsWith('/') && Path.DirectorySeparatorChar == '/' && argument.IsValidPath()) + return false; + + return argumentMightRequireValue; + } +} diff --git a/src/GitVersion.App/Arguments.cs b/src/GitVersion.App/Arguments.cs index 03e7714b9d..8f5f977a67 100644 --- a/src/GitVersion.App/Arguments.cs +++ b/src/GitVersion.App/Arguments.cs @@ -1,3 +1,4 @@ +using GitVersion.Git; using GitVersion.Logging; namespace GitVersion; diff --git a/src/GitVersion.App/GitVersionExecutor.cs b/src/GitVersion.App/GitVersionExecutor.cs index 0ff21108a9..0d07fc82bc 100644 --- a/src/GitVersion.App/GitVersionExecutor.cs +++ b/src/GitVersion.App/GitVersionExecutor.cs @@ -1,5 +1,6 @@ using GitVersion.Configuration; using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.Helpers; using GitVersion.Logging; @@ -10,6 +11,7 @@ internal class GitVersionExecutor( IConsole console, IConfigurationFileLocator configurationFileLocator, IConfigurationProvider configurationProvider, + IConfigurationSerializer configurationSerializer, IGitVersionCalculateTool gitVersionCalculateTool, IGitVersionOutputTool gitVersionOutputTool, IVersionWriter versionWriter, @@ -21,6 +23,8 @@ internal class GitVersionExecutor( private readonly IConsole console = console.NotNull(); private readonly IConfigurationFileLocator configurationFileLocator = configurationFileLocator.NotNull(); private readonly IConfigurationProvider configurationProvider = configurationProvider.NotNull(); + private readonly IConfigurationSerializer configurationSerializer = configurationSerializer.NotNull(); + private readonly IGitVersionCalculateTool gitVersionCalculateTool = gitVersionCalculateTool.NotNull(); private readonly IGitVersionOutputTool gitVersionOutputTool = gitVersionOutputTool.NotNull(); private readonly IVersionWriter versionWriter = versionWriter.NotNull(); @@ -143,7 +147,8 @@ private bool HandleNonMainCommand(GitVersionOptions gitVersionOptions, out int e this.configurationFileLocator.Verify(workingDirectory, this.repositoryInfo.ProjectRootDirectory); } var configuration = this.configurationProvider.Provide(); - this.console.WriteLine(configuration.ToJsonString()); + var configurationString = configurationSerializer.Serialize(configuration); + this.console.WriteLine(configurationString); exitCode = 0; return true; } diff --git a/src/GitVersion.App/OverrideConfigurationOptionParser.cs b/src/GitVersion.App/OverrideConfigurationOptionParser.cs index c258fd93d3..9b85428f71 100644 --- a/src/GitVersion.App/OverrideConfigurationOptionParser.cs +++ b/src/GitVersion.App/OverrideConfigurationOptionParser.cs @@ -4,7 +4,7 @@ namespace GitVersion; internal class OverrideConfigurationOptionParser { - private readonly Dictionary overrideConfiguration = new(); + private readonly Dictionary overrideConfiguration = []; private static readonly Lazy> _lazySupportedProperties = new(GetSupportedProperties, true); diff --git a/src/GitVersion.BuildAgents.Tests/Agents/BuildServerBaseTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/BuildServerBaseTests.cs index 1e5c220baf..9666ef0e79 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/BuildServerBaseTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/BuildServerBaseTests.cs @@ -43,7 +43,7 @@ public void BuildNumberIsFullSemVer() writes[1].ShouldBe("1.2.3-beta.1+5"); - writes = new List(); + writes = []; buildAgent.WriteIntegration(writes.Add, variables, false); writes.ShouldNotContain(x => x != null && x.StartsWith("Executing GenerateSetVersionMessage for ")); } diff --git a/src/GitVersion.BuildAgents/Agents/BuildKite.cs b/src/GitVersion.BuildAgents/Agents/BuildKite.cs index 87bc2dbc85..2b5a1bf12d 100644 --- a/src/GitVersion.BuildAgents/Agents/BuildKite.cs +++ b/src/GitVersion.BuildAgents/Agents/BuildKite.cs @@ -27,7 +27,7 @@ public override string[] GenerateSetParameterMessage(string name, string? value) // For pull requests BUILDKITE_BRANCH refers to the head, so adjust the // branch name for pull request versioning to function as expected - return string.Format("refs/pull/{0}/head", pullRequest); + return $"refs/pull/{pullRequest}/head"; } public override bool PreventFetch() => true; diff --git a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationExtensionsTests.cs b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationExtensionsTests.cs index ff54caa0c2..4edbae0b4e 100644 --- a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationExtensionsTests.cs +++ b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationExtensionsTests.cs @@ -1,5 +1,6 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; +using GitVersion.Git; namespace GitVersion.Core.Tests.Configuration; diff --git a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs index 9151a39a62..7ea7a66aff 100644 --- a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs +++ b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs @@ -2,7 +2,6 @@ using GitVersion.Configuration; using GitVersion.Configuration.Tests.Configuration; using GitVersion.Core.Tests.Helpers; -using GitVersion.Extensions; using GitVersion.Helpers; using GitVersion.Logging; using GitVersion.VersionCalculation; @@ -183,7 +182,7 @@ public void CanWriteOutEffectiveConfiguration() { var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath); - configuration.ToJsonString().ShouldMatchApproved(); + new ConfigurationSerializer().Serialize(configuration).ShouldMatchApproved(); } [Test] diff --git a/src/GitVersion.Configuration.Tests/Configuration/IgnoreConfigurationTests.cs b/src/GitVersion.Configuration.Tests/Configuration/IgnoreConfigurationTests.cs index 68a3160ae7..3cc5e9d43c 100644 --- a/src/GitVersion.Configuration.Tests/Configuration/IgnoreConfigurationTests.cs +++ b/src/GitVersion.Configuration.Tests/Configuration/IgnoreConfigurationTests.cs @@ -7,52 +7,54 @@ namespace GitVersion.Core.Tests.Configuration; [TestFixture] public class IgnoreConfigurationTests : TestBase { + private readonly ConfigurationSerializer serializer = new(); + [Test] public void CanDeserialize() { - const string yaml = @" -ignore: - sha: [b6c0c9fda88830ebcd563e500a5a7da5a1658e98] - commits-before: 2015-10-23T12:23:15 -"; + const string yaml = + """ + ignore: + sha: [b6c0c9fda88830ebcd563e500a5a7da5a1658e98] + commits-before: 2015-10-23T12:23:15 + """; - using var reader = new StringReader(yaml); - var configuration = ConfigurationSerializer.Read(reader); + var configuration = serializer.ReadConfiguration(yaml); + configuration.ShouldNotBeNull(); configuration.Ignore.ShouldNotBeNull(); configuration.Ignore.Shas.ShouldNotBeEmpty(); - configuration.Ignore.Shas.ShouldBe(new[] { "b6c0c9fda88830ebcd563e500a5a7da5a1658e98" }); + configuration.Ignore.Shas.ShouldBe(["b6c0c9fda88830ebcd563e500a5a7da5a1658e98"]); configuration.Ignore.Before.ShouldBe(DateTimeOffset.Parse("2015-10-23T12:23:15")); } [Test] public void ShouldSupportsOtherSequenceFormat() { - const string yaml = @" -ignore: - sha: - - b6c0c9fda88830ebcd563e500a5a7da5a1658e98 - - 6c19c7c219ecf8dbc468042baefa73a1b213e8b1 -"; + const string yaml = + """ + ignore: + sha: + - b6c0c9fda88830ebcd563e500a5a7da5a1658e98 + - 6c19c7c219ecf8dbc468042baefa73a1b213e8b1 + """; - using var reader = new StringReader(yaml); - var configuration = ConfigurationSerializer.Read(reader); + var configuration = serializer.ReadConfiguration(yaml); + configuration.ShouldNotBeNull(); configuration.Ignore.ShouldNotBeNull(); configuration.Ignore.Shas.ShouldNotBeEmpty(); - configuration.Ignore.Shas.ShouldBe(new[] { "b6c0c9fda88830ebcd563e500a5a7da5a1658e98", "6c19c7c219ecf8dbc468042baefa73a1b213e8b1" }); + configuration.Ignore.Shas.ShouldBe(["b6c0c9fda88830ebcd563e500a5a7da5a1658e98", "6c19c7c219ecf8dbc468042baefa73a1b213e8b1"]); } [Test] public void WhenNotInConfigShouldHaveDefaults() { - const string yaml = @" -next-version: 1.0 -"; + const string yaml = "next-version: 1.0"; - using var reader = new StringReader(yaml); - var configuration = ConfigurationSerializer.Read(reader); + var configuration = serializer.ReadConfiguration(yaml); + configuration.ShouldNotBeNull(); configuration.Ignore.ShouldNotBeNull(); configuration.Ignore.Shas.ShouldBeEmpty(); configuration.Ignore.Before.ShouldBe(null); @@ -61,13 +63,13 @@ public void WhenNotInConfigShouldHaveDefaults() [Test] public void WhenBadDateFormatShouldFail() { - const string yaml = @" -ignore: - commits-before: bad format date -"; + const string yaml = + """ + ignore: + commits-before: bad format date + """; - using var reader = new StringReader(yaml); - Should.Throw(() => ConfigurationSerializer.Read(reader)); + Should.Throw(() => serializer.ReadConfiguration(yaml)); } [Test] diff --git a/src/GitVersion.Core/Core/Attributes/JsonPropertyDefaultAttribute.cs b/src/GitVersion.Configuration/Attributes/JsonPropertyDefaultAttribute.cs similarity index 97% rename from src/GitVersion.Core/Core/Attributes/JsonPropertyDefaultAttribute.cs rename to src/GitVersion.Configuration/Attributes/JsonPropertyDefaultAttribute.cs index f2a8f01fd6..375a8ca093 100644 --- a/src/GitVersion.Core/Core/Attributes/JsonPropertyDefaultAttribute.cs +++ b/src/GitVersion.Configuration/Attributes/JsonPropertyDefaultAttribute.cs @@ -1,6 +1,4 @@ -using GitVersion.Extensions; - -namespace GitVersion.Attributes; +namespace GitVersion.Configuration.Attributes; [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] public sealed class JsonPropertyDefaultAttribute : JsonAttribute diff --git a/src/GitVersion.Configuration/Attributes/JsonPropertyDescriptionAttribute.cs b/src/GitVersion.Configuration/Attributes/JsonPropertyDescriptionAttribute.cs new file mode 100644 index 0000000000..5fdc9de548 --- /dev/null +++ b/src/GitVersion.Configuration/Attributes/JsonPropertyDescriptionAttribute.cs @@ -0,0 +1,14 @@ +#if GITVERSION_CONFIGURATION +namespace GitVersion.Configuration.Attributes; +#elif GITVERSION_OUTPUT +namespace GitVersion.Output.Attributes; +#endif + +[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] +public sealed class JsonPropertyDescriptionAttribute(string description) : JsonAttribute +{ + /// + /// The description of the property. + /// + public string Description { get; } = description; +} diff --git a/src/GitVersion.Core/Core/Attributes/JsonPropertyFormatAttribute.cs b/src/GitVersion.Configuration/Attributes/JsonPropertyFormatAttribute.cs similarity index 68% rename from src/GitVersion.Core/Core/Attributes/JsonPropertyFormatAttribute.cs rename to src/GitVersion.Configuration/Attributes/JsonPropertyFormatAttribute.cs index 9ce8825a39..d8307d1754 100644 --- a/src/GitVersion.Core/Core/Attributes/JsonPropertyFormatAttribute.cs +++ b/src/GitVersion.Configuration/Attributes/JsonPropertyFormatAttribute.cs @@ -1,4 +1,4 @@ -namespace GitVersion.Attributes; +namespace GitVersion.Configuration.Attributes; /// /// The format keyword allows for basic semantic identification of certain kinds of string values that are commonly used. For example, because JSON doesn't have a "DateTime" type, dates need to be encoded as strings. format allows the schema author to indicate that the string value should be interpreted as a date. By default, format is just an annotation and does not effect validation. @@ -6,18 +6,12 @@ namespace GitVersion.Attributes; /// /// [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] -public sealed class JsonPropertyFormatAttribute : JsonAttribute +public sealed class JsonPropertyFormatAttribute(Format format) : JsonAttribute { - /// - /// Initializes a new instance of with the specified format for string-encoded property values. JSON validators may use this annotation to constrain properties to certain pre-define, string-encoded types. - /// - /// The string format. - public JsonPropertyFormatAttribute(Format format) => Format = format; - /// /// The format of the string. /// - public Format Format { get; } + public Format Format { get; } = format; } /// diff --git a/src/GitVersion.Configuration/BranchConfiguration.cs b/src/GitVersion.Configuration/BranchConfiguration.cs index a323c42e1b..4a55cf7e4b 100644 --- a/src/GitVersion.Configuration/BranchConfiguration.cs +++ b/src/GitVersion.Configuration/BranchConfiguration.cs @@ -1,4 +1,4 @@ -using GitVersion.Attributes; +using GitVersion.Configuration.Attributes; using GitVersion.Extensions; using GitVersion.VersionCalculation; @@ -53,14 +53,14 @@ internal record BranchConfiguration : IBranchConfiguration [JsonPropertyName("source-branches")] [JsonPropertyDescription("The source branches for this branch.")] - public HashSet SourceBranches { get; internal set; } = new(); + public HashSet SourceBranches { get; internal set; } = []; [JsonIgnore] IReadOnlyCollection IBranchConfiguration.SourceBranches => SourceBranches; [JsonPropertyName("is-source-branch-for")] [JsonPropertyDescription("The branches that this branch is a source branch.")] - public HashSet IsSourceBranchFor { get; internal set; } = new(); + public HashSet IsSourceBranchFor { get; internal set; } = []; [JsonIgnore] IReadOnlyCollection IBranchConfiguration.IsSourceBranchFor => IsSourceBranchFor; diff --git a/src/GitVersion.Configuration/BranchConfigurationBuilder.cs b/src/GitVersion.Configuration/Builders/BranchConfigurationBuilder.cs similarity index 100% rename from src/GitVersion.Configuration/BranchConfigurationBuilder.cs rename to src/GitVersion.Configuration/Builders/BranchConfigurationBuilder.cs diff --git a/src/GitVersion.Configuration/ConfigurationBuilder.cs b/src/GitVersion.Configuration/Builders/ConfigurationBuilder.cs similarity index 100% rename from src/GitVersion.Configuration/ConfigurationBuilder.cs rename to src/GitVersion.Configuration/Builders/ConfigurationBuilder.cs diff --git a/src/GitVersion.Configuration/ConfigurationBuilderBase.cs b/src/GitVersion.Configuration/Builders/ConfigurationBuilderBase.cs similarity index 98% rename from src/GitVersion.Configuration/ConfigurationBuilderBase.cs rename to src/GitVersion.Configuration/Builders/ConfigurationBuilderBase.cs index 6503ce0991..bef65714d7 100644 --- a/src/GitVersion.Configuration/ConfigurationBuilderBase.cs +++ b/src/GitVersion.Configuration/Builders/ConfigurationBuilderBase.cs @@ -25,9 +25,9 @@ internal abstract class ConfigurationBuilderBase : IConfi private bool updateBuildNumber; private SemanticVersionFormat semanticVersionFormat; private VersionStrategies[] versionStrategies; - private Dictionary mergeMessageFormats = new(); - private readonly List> overrides = new(); - private readonly Dictionary branchConfigurationBuilders = new(); + private Dictionary mergeMessageFormats = []; + private readonly List> overrides = []; + private readonly Dictionary branchConfigurationBuilders = []; private DeploymentMode? versioningMode; private string? label; private IncrementStrategy increment = IncrementStrategy.Inherit; @@ -384,7 +384,7 @@ public void AddOverride(IReadOnlyDictionary value) public virtual IGitVersionConfiguration Build() { - Dictionary branches = new(); + Dictionary branches = []; foreach (var (name, branchConfigurationBuilder) in this.branchConfigurationBuilders) { branches.Add(name, (BranchConfiguration)branchConfigurationBuilder.Build()); diff --git a/src/GitVersion.Configuration/EmptyConfigurationBuilder.cs b/src/GitVersion.Configuration/Builders/EmptyConfigurationBuilder.cs similarity index 96% rename from src/GitVersion.Configuration/EmptyConfigurationBuilder.cs rename to src/GitVersion.Configuration/Builders/EmptyConfigurationBuilder.cs index 0ecd655721..b5431ee613 100644 --- a/src/GitVersion.Configuration/EmptyConfigurationBuilder.cs +++ b/src/GitVersion.Configuration/Builders/EmptyConfigurationBuilder.cs @@ -1,4 +1,3 @@ -using GitVersion.Extensions; using GitVersion.VersionCalculation; namespace GitVersion.Configuration; diff --git a/src/GitVersion.Configuration/GitFlowConfigurationBuilder.cs b/src/GitVersion.Configuration/Builders/GitFlowConfigurationBuilder.cs similarity index 100% rename from src/GitVersion.Configuration/GitFlowConfigurationBuilder.cs rename to src/GitVersion.Configuration/Builders/GitFlowConfigurationBuilder.cs diff --git a/src/GitVersion.Configuration/GitHubFlowConfigurationBuilder.cs b/src/GitVersion.Configuration/Builders/GitHubFlowConfigurationBuilder.cs similarity index 100% rename from src/GitVersion.Configuration/GitHubFlowConfigurationBuilder.cs rename to src/GitVersion.Configuration/Builders/GitHubFlowConfigurationBuilder.cs diff --git a/src/GitVersion.Configuration/IgnoreConfigurationBuilder.cs b/src/GitVersion.Configuration/Builders/IgnoreConfigurationBuilder.cs similarity index 100% rename from src/GitVersion.Configuration/IgnoreConfigurationBuilder.cs rename to src/GitVersion.Configuration/Builders/IgnoreConfigurationBuilder.cs diff --git a/src/GitVersion.Configuration/TrunkBasedConfigurationBuilder.cs b/src/GitVersion.Configuration/Builders/TrunkBasedConfigurationBuilder.cs similarity index 100% rename from src/GitVersion.Configuration/TrunkBasedConfigurationBuilder.cs rename to src/GitVersion.Configuration/Builders/TrunkBasedConfigurationBuilder.cs diff --git a/src/GitVersion.Configuration/ConfigurationFileLocator.cs b/src/GitVersion.Configuration/ConfigurationFileLocator.cs index 478de79755..374c6efa1a 100644 --- a/src/GitVersion.Configuration/ConfigurationFileLocator.cs +++ b/src/GitVersion.Configuration/ConfigurationFileLocator.cs @@ -4,7 +4,7 @@ namespace GitVersion.Configuration; -internal class ConfigurationFileLocator(IFileSystem fileSystem, IOptions options) +internal class ConfigurationFileLocator(IFileSystem fileSystem, IConfigurationSerializer configurationSerializer, IOptions options) : IConfigurationFileLocator { public const string DefaultFileName = "GitVersion.yml"; @@ -29,7 +29,9 @@ public IGitVersionConfiguration ReadConfiguration(string? configFilePath) if (configFilePath == null || !fileSystem.Exists(configFilePath)) return GitHubFlowConfigurationBuilder.New.Build(); var readAllText = fileSystem.ReadAllText(configFilePath); - return ConfigurationSerializer.Read(new StringReader(readAllText)); + var configuration = configurationSerializer.ReadConfiguration(readAllText) + ?? GitHubFlowConfigurationBuilder.New.Build(); + return configuration; } public IReadOnlyDictionary? ReadOverrideConfiguration(string? configFilePath) @@ -38,7 +40,7 @@ public IGitVersionConfiguration ReadConfiguration(string? configFilePath) var readAllText = fileSystem.ReadAllText(configFilePath); - return ConfigurationSerializer.Deserialize>(readAllText); + return configurationSerializer.Deserialize>(readAllText); } private bool HasConfigurationFile(string? workingDirectory, out string? path) diff --git a/src/GitVersion.Configuration/ConfigurationHelper.cs b/src/GitVersion.Configuration/ConfigurationHelper.cs index a7a82f4536..66e2bd5bea 100644 --- a/src/GitVersion.Configuration/ConfigurationHelper.cs +++ b/src/GitVersion.Configuration/ConfigurationHelper.cs @@ -4,31 +4,32 @@ namespace GitVersion.Configuration; internal class ConfigurationHelper { - private string Yaml => this._yaml ??= this._dictionary == null - ? ConfigurationSerializer.Serialize(this.configuration!) - : ConfigurationSerializer.Serialize(this._dictionary); - private string? _yaml; + private static ConfigurationSerializer Serializer => new(); + private string Yaml => this.yaml ??= this.dictionary == null + ? Serializer.Serialize(this.configuration!) + : Serializer.Serialize(this.dictionary); + private string? yaml; internal IReadOnlyDictionary Dictionary { get { - if (this._dictionary == null) + if (this.dictionary == null) { - this._yaml ??= ConfigurationSerializer.Serialize(this.configuration!); - this._dictionary = ConfigurationSerializer.Deserialize>(this._yaml); + this.yaml ??= Serializer.Serialize(this.configuration!); + this.dictionary = Serializer.Deserialize>(this.yaml); } - return this._dictionary; + return this.dictionary; } } - private IReadOnlyDictionary? _dictionary; + private IReadOnlyDictionary? dictionary; - public IGitVersionConfiguration Configuration => this.configuration ??= ConfigurationSerializer.Deserialize(Yaml); + public IGitVersionConfiguration Configuration => this.configuration ??= Serializer.Deserialize(Yaml); private IGitVersionConfiguration? configuration; - internal ConfigurationHelper(string yaml) => this._yaml = yaml.NotNull(); + internal ConfigurationHelper(string yaml) => this.yaml = yaml.NotNull(); - internal ConfigurationHelper(IReadOnlyDictionary dictionary) => this._dictionary = dictionary.NotNull(); + internal ConfigurationHelper(IReadOnlyDictionary dictionary) => this.dictionary = dictionary.NotNull(); public ConfigurationHelper(IGitVersionConfiguration configuration) => this.configuration = configuration.NotNull(); @@ -38,10 +39,10 @@ public void Override(IReadOnlyDictionary value) if (value.Any()) { - var dictionary = Dictionary.ToDictionary(element => element.Key, element => element.Value); - Merge(dictionary, value); - this._dictionary = dictionary; - this._yaml = null; + var map = Dictionary.ToDictionary(element => element.Key, element => element.Value); + Merge(map, value); + this.dictionary = map; + this.yaml = null; this.configuration = null; } } @@ -72,7 +73,7 @@ private static void Merge(IDictionary dictionary, IReadOnlyDict { if (!dictionary.ContainsKey(item.Key)) { - Dictionary anotherDictionaryValue = new(); + Dictionary anotherDictionaryValue = []; Merge(anotherDictionaryValue, dictionaryValue); dictionary.Add(item.Key, anotherDictionaryValue); } diff --git a/src/GitVersion.Configuration/ConfigurationProvider.cs b/src/GitVersion.Configuration/ConfigurationProvider.cs index 6481e72304..c00b15ddcc 100644 --- a/src/GitVersion.Configuration/ConfigurationProvider.cs +++ b/src/GitVersion.Configuration/ConfigurationProvider.cs @@ -1,4 +1,4 @@ -using GitVersion.Configuration.SupportedWorkflows; +using GitVersion.Configuration.Workflows; using GitVersion.Extensions; using Microsoft.Extensions.Options; using YamlDotNet.Core; diff --git a/src/GitVersion.Configuration/ConfigurationSerializer.cs b/src/GitVersion.Configuration/ConfigurationSerializer.cs index bec88eac52..75b30caddd 100644 --- a/src/GitVersion.Configuration/ConfigurationSerializer.cs +++ b/src/GitVersion.Configuration/ConfigurationSerializer.cs @@ -4,7 +4,7 @@ namespace GitVersion.Configuration; -internal static class ConfigurationSerializer +internal class ConfigurationSerializer : IConfigurationSerializer { private static IDeserializer Deserializer => new DeserializerBuilder() .WithNamingConvention(HyphenatedNamingConvention.Instance) @@ -16,35 +16,26 @@ internal static class ConfigurationSerializer .WithTypeInspector(inspector => new JsonPropertyNameInspector(inspector)) .WithNamingConvention(HyphenatedNamingConvention.Instance).Build(); - public static T Deserialize(string input) => Deserializer.Deserialize(input); + public T Deserialize(string input) => Deserializer.Deserialize(input); + public string Serialize(object graph) => Serializer.Serialize(graph); + public IGitVersionConfiguration? ReadConfiguration(string input) => Deserialize(input); - public static string Serialize(object graph) => Serializer.Serialize(graph); - - public static IGitVersionConfiguration Read(TextReader reader) + private sealed class JsonPropertyNameInspector(ITypeInspector innerTypeDescriptor) : TypeInspectorSkeleton { - var configuration = Deserializer.Deserialize(reader); - return configuration ?? GitHubFlowConfigurationBuilder.New.Build(); - } - - public static void Write(IGitVersionConfiguration configuration, TextWriter writer) - => Serializer.Serialize(writer, configuration); -} - -internal sealed class JsonPropertyNameInspector(ITypeInspector innerTypeDescriptor) : TypeInspectorSkeleton -{ - public override IEnumerable GetProperties(Type type, object? container) => - innerTypeDescriptor.GetProperties(type, container) - .Where(p => p.GetCustomAttribute() == null) - .Select(p => - { - var descriptor = new PropertyDescriptor(p); - var member = p.GetCustomAttribute(); - if (member is { Name: not null }) + public override IEnumerable GetProperties(Type type, object? container) => + innerTypeDescriptor.GetProperties(type, container) + .Where(p => p.GetCustomAttribute() == null) + .Select(p => { - descriptor.Name = member.Name; - } - - return (IPropertyDescriptor)descriptor; - }) - .OrderBy(p => p.Order); + var descriptor = new PropertyDescriptor(p); + var member = p.GetCustomAttribute(); + if (member is { Name: not null }) + { + descriptor.Name = member.Name; + } + + return (IPropertyDescriptor)descriptor; + }) + .OrderBy(p => p.Order); + } } diff --git a/src/GitVersion.Configuration/GitVersion.Configuration.csproj b/src/GitVersion.Configuration/GitVersion.Configuration.csproj index e8d05c7f3a..9047c953a2 100644 --- a/src/GitVersion.Configuration/GitVersion.Configuration.csproj +++ b/src/GitVersion.Configuration/GitVersion.Configuration.csproj @@ -1,16 +1,22 @@ + + + GITVERSION_CONFIGURATION + + + - - - + + + diff --git a/src/GitVersion.Configuration/GitVersionConfiguration.cs b/src/GitVersion.Configuration/GitVersionConfiguration.cs index 2ab0c5f57d..079fd14b11 100644 --- a/src/GitVersion.Configuration/GitVersionConfiguration.cs +++ b/src/GitVersion.Configuration/GitVersionConfiguration.cs @@ -1,6 +1,6 @@ using System.Globalization; using System.Text.RegularExpressions; -using GitVersion.Attributes; +using GitVersion.Configuration.Attributes; using GitVersion.Extensions; using GitVersion.VersionCalculation; using static GitVersion.Configuration.ConfigurationConstants; @@ -109,7 +109,7 @@ public string? NextVersion [JsonPropertyName("merge-message-formats")] [JsonPropertyDescription("Custom merge message formats to enable identification of merge messages that do not follow the built-in conventions.")] - public Dictionary MergeMessageFormats { get; internal set; } = new(); + public Dictionary MergeMessageFormats { get; internal set; } = []; [JsonIgnore] IReadOnlyDictionary IGitVersionConfiguration.MergeMessageFormats => MergeMessageFormats; @@ -138,7 +138,7 @@ IReadOnlyDictionary IGitVersionConfiguration.Branc [JsonPropertyName("branches")] [JsonPropertyDescription("The header for all the individual branch configuration.")] - public Dictionary Branches { get; internal set; } = new(); + public Dictionary Branches { get; internal set; } = []; [JsonIgnore] IIgnoreConfiguration IGitVersionConfiguration.Ignore => Ignore; @@ -149,19 +149,10 @@ IReadOnlyDictionary IGitVersionConfiguration.Branc public override IBranchConfiguration Inherit(IBranchConfiguration configuration) => throw new NotSupportedException(); - public string ToJsonString() - { - var stringBuilder = new StringBuilder(); - using var stream = new StringWriter(stringBuilder); - ConfigurationSerializer.Write(this, stream); - stream.Flush(); - return stringBuilder.ToString(); - } - public IBranchConfiguration GetEmptyBranchConfiguration() => new BranchConfiguration { RegularExpression = string.Empty, - Label = ConfigurationConstants.BranchNamePlaceholder, + Label = BranchNamePlaceholder, Increment = IncrementStrategy.Inherit }; } diff --git a/src/GitVersion.Configuration/GitVersionConfigurationModule.cs b/src/GitVersion.Configuration/GitVersionConfigurationModule.cs index b8c8cae713..684b0a8b78 100644 --- a/src/GitVersion.Configuration/GitVersionConfigurationModule.cs +++ b/src/GitVersion.Configuration/GitVersionConfigurationModule.cs @@ -8,6 +8,7 @@ public class GitVersionConfigurationModule : IGitVersionModule public void RegisterTypes(IServiceCollection services) { services.AddSingleton(); + services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); } diff --git a/src/GitVersion.Configuration/IgnoreConfiguration.cs b/src/GitVersion.Configuration/IgnoreConfiguration.cs index 00d4df88ec..9ec97e2b0a 100644 --- a/src/GitVersion.Configuration/IgnoreConfiguration.cs +++ b/src/GitVersion.Configuration/IgnoreConfiguration.cs @@ -1,4 +1,4 @@ -using GitVersion.Attributes; +using GitVersion.Configuration.Attributes; namespace GitVersion.Configuration; @@ -21,5 +21,5 @@ public string? BeforeString [JsonPropertyName("sha")] [JsonPropertyDescription("A sequence of SHAs to be excluded from the version calculations.")] - public HashSet Shas { get; init; } = new(); + public HashSet Shas { get; init; } = []; } diff --git a/src/GitVersion.Configuration/PreventIncrementConfiguration.cs b/src/GitVersion.Configuration/PreventIncrementConfiguration.cs index a2d2b919fb..45c187ae55 100644 --- a/src/GitVersion.Configuration/PreventIncrementConfiguration.cs +++ b/src/GitVersion.Configuration/PreventIncrementConfiguration.cs @@ -1,4 +1,4 @@ -using GitVersion.Attributes; +using GitVersion.Configuration.Attributes; namespace GitVersion.Configuration; diff --git a/src/GitVersion.Configuration/PublicAPI.Unshipped.txt b/src/GitVersion.Configuration/PublicAPI.Unshipped.txt index 22844134c1..66f6115d77 100644 --- a/src/GitVersion.Configuration/PublicAPI.Unshipped.txt +++ b/src/GitVersion.Configuration/PublicAPI.Unshipped.txt @@ -1,4 +1,38 @@ #nullable enable +GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.Format.Date = 0 -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.Format.DateTime = 1 -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.Format.Duration = 2 -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.Format.Email = 3 -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.Format.Hostname = 4 -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.Format.IdnEmail = 5 -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.Format.IdnHostname = 6 -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.Format.Ipv4 = 7 -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.Format.Ipv6 = 8 -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.Format.Iri = 9 -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.Format.IriReference = 10 -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.Format.JsonPointer = 11 -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.Format.Regex = 12 -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.Format.RelativeJsonPointer = 13 -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.Format.Time = 14 -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.Format.Uri = 15 -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.Format.UriReference = 16 -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.Format.UriTemplate = 17 -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.Format.Uuid = 18 -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.JsonPropertyDefaultAttribute +GitVersion.Configuration.Attributes.JsonPropertyDefaultAttribute.JsonPropertyDefaultAttribute(bool value) -> void +GitVersion.Configuration.Attributes.JsonPropertyDefaultAttribute.JsonPropertyDefaultAttribute(GitVersion.Configuration.AssemblyFileVersioningScheme value) -> void +GitVersion.Configuration.Attributes.JsonPropertyDefaultAttribute.JsonPropertyDefaultAttribute(GitVersion.Configuration.AssemblyVersioningScheme value) -> void +GitVersion.Configuration.Attributes.JsonPropertyDefaultAttribute.JsonPropertyDefaultAttribute(GitVersion.SemanticVersionFormat value) -> void +GitVersion.Configuration.Attributes.JsonPropertyDefaultAttribute.JsonPropertyDefaultAttribute(object? boxedValue) -> void +GitVersion.Configuration.Attributes.JsonPropertyDefaultAttribute.JsonPropertyDefaultAttribute(string? value) -> void +GitVersion.Configuration.Attributes.JsonPropertyDefaultAttribute.Value.get -> string! +GitVersion.Configuration.Attributes.JsonPropertyDescriptionAttribute +GitVersion.Configuration.Attributes.JsonPropertyDescriptionAttribute.Description.get -> string! +GitVersion.Configuration.Attributes.JsonPropertyDescriptionAttribute.JsonPropertyDescriptionAttribute(string! description) -> void +GitVersion.Configuration.Attributes.JsonPropertyFormatAttribute +GitVersion.Configuration.Attributes.JsonPropertyFormatAttribute.Format.get -> GitVersion.Configuration.Attributes.Format +GitVersion.Configuration.Attributes.JsonPropertyFormatAttribute.JsonPropertyFormatAttribute(GitVersion.Configuration.Attributes.Format format) -> void GitVersion.Configuration.ConfigurationException GitVersion.Configuration.ConfigurationException.ConfigurationException() -> void GitVersion.Configuration.ConfigurationException.ConfigurationException(string! message, System.Exception! innerException) -> void diff --git a/src/GitVersion.Configuration/SupportedWorkflows/GitFlow/v1.yml b/src/GitVersion.Configuration/Workflows/GitFlow/v1.yml similarity index 100% rename from src/GitVersion.Configuration/SupportedWorkflows/GitFlow/v1.yml rename to src/GitVersion.Configuration/Workflows/GitFlow/v1.yml diff --git a/src/GitVersion.Configuration/SupportedWorkflows/GitHubFlow/v1.yml b/src/GitVersion.Configuration/Workflows/GitHubFlow/v1.yml similarity index 100% rename from src/GitVersion.Configuration/SupportedWorkflows/GitHubFlow/v1.yml rename to src/GitVersion.Configuration/Workflows/GitHubFlow/v1.yml diff --git a/src/GitVersion.Configuration/SupportedWorkflows/TrunkBased/v1.yml b/src/GitVersion.Configuration/Workflows/TrunkBased/v1.yml similarity index 100% rename from src/GitVersion.Configuration/SupportedWorkflows/TrunkBased/v1.yml rename to src/GitVersion.Configuration/Workflows/TrunkBased/v1.yml diff --git a/src/GitVersion.Configuration/SupportedWorkflows/WorkflowManager.cs b/src/GitVersion.Configuration/Workflows/WorkflowManager.cs similarity index 82% rename from src/GitVersion.Configuration/SupportedWorkflows/WorkflowManager.cs rename to src/GitVersion.Configuration/Workflows/WorkflowManager.cs index 51a9cd3fe0..b22a9222b1 100644 --- a/src/GitVersion.Configuration/SupportedWorkflows/WorkflowManager.cs +++ b/src/GitVersion.Configuration/Workflows/WorkflowManager.cs @@ -1,10 +1,11 @@ using GitVersion.Extensions; -namespace GitVersion.Configuration.SupportedWorkflows; +namespace GitVersion.Configuration.Workflows; internal static class WorkflowManager { private static readonly string ResourceNameTemplate = DetermineResourceNameTemplate(); + private static ConfigurationSerializer Serializer => new(); private static string DetermineResourceNameTemplate() { @@ -19,7 +20,7 @@ private static string DetermineResourceNameTemplate() var resourceName = GetResourceName(workflow); var embeddedResource = resourceName.ReadAsStringFromEmbeddedResource(typeof(WorkflowManager).Assembly); - return ConfigurationSerializer.Deserialize>(embeddedResource); + return Serializer.Deserialize>(embeddedResource); } private static string GetResourceName(string workflow) diff --git a/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs b/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs index 07235e287e..e1e52ae9e6 100644 --- a/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs +++ b/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs @@ -1,6 +1,7 @@ using GitVersion.Agents; using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; +using GitVersion.Git; using GitVersion.Helpers; using GitVersion.Logging; using GitVersion.VersionCalculation.Caching; @@ -16,7 +17,7 @@ public class GitVersionExecutorTests : TestBase { private IFileSystem fileSystem; private ILog log; - private GitVersionCache gitVersionCache; + private GitVersionCacheProvider gitVersionCacheProvider; private IServiceProvider sp; [Test] @@ -79,7 +80,8 @@ public void CacheKeyForWorktree() var preparer = this.sp.GetRequiredService(); preparer.Prepare(); - var cacheKey = this.sp.GetRequiredService().Create(null); + var cacheKeyFactory = this.sp.GetRequiredService(); + var cacheKey = cacheKeyFactory.Create(null); cacheKey.Value.ShouldNotBeEmpty(); } finally @@ -139,7 +141,7 @@ public void CacheFileExistsOnDisk() var cacheKeyFactory = this.sp.GetRequiredService(); var cacheKey = cacheKeyFactory.Create(null); - var cacheFileName = this.gitVersionCache.GetCacheFileName(cacheKey); + var cacheFileName = this.gitVersionCacheProvider.GetCacheFileName(cacheKey); this.fileSystem.WriteAllText(cacheFileName, versionCacheFileContent); versionVariables = gitVersionCalculator.CalculateVersionVariables(); @@ -192,10 +194,10 @@ public void CacheFileExistsOnDiskWhenOverrideConfigIsSpecifiedVersionShouldBeDyn var cacheKeyFactory = this.sp.GetRequiredService(); var cacheKey = cacheKeyFactory.Create(null); - var cacheFileName = this.gitVersionCache.GetCacheFileName(cacheKey); + var cacheFileName = this.gitVersionCacheProvider.GetCacheFileName(cacheKey); this.fileSystem.WriteAllText(cacheFileName, versionCacheFileContent); - var cacheDirectory = this.gitVersionCache.GetCacheDirectory(); + var cacheDirectory = this.gitVersionCacheProvider.GetCacheDirectory(); var cacheDirectoryTimestamp = this.fileSystem.GetLastDirectoryWrite(cacheDirectory); @@ -282,7 +284,7 @@ public void ConfigChangeInvalidatesCache(string configFileName) var cacheKeyFactory = this.sp.GetRequiredService(); var cacheKey = cacheKeyFactory.Create(null); - var cacheFileName = this.gitVersionCache.GetCacheFileName(cacheKey); + var cacheFileName = this.gitVersionCacheProvider.GetCacheFileName(cacheKey); this.fileSystem.WriteAllText(cacheFileName, versionCacheFileContent); @@ -344,7 +346,7 @@ public void NoCacheBypassesCache() var cacheKeyFactory = this.sp.GetRequiredService(); var cacheKey = cacheKeyFactory.Create(null); - var cacheFileName = this.gitVersionCache.GetCacheFileName(cacheKey); + var cacheFileName = this.gitVersionCacheProvider.GetCacheFileName(cacheKey); this.fileSystem.WriteAllText(cacheFileName, versionCacheFileContent); versionVariables = gitVersionCalculator.CalculateVersionVariables(); @@ -579,7 +581,7 @@ private IGitVersionCalculateTool GetGitVersionCalculator(GitVersionOptions gitVe this.fileSystem = this.sp.GetRequiredService(); this.log = this.sp.GetRequiredService(); - this.gitVersionCache = (GitVersionCache)this.sp.GetRequiredService(); + this.gitVersionCacheProvider = (GitVersionCacheProvider)this.sp.GetRequiredService(); return this.sp.GetRequiredService(); } diff --git a/src/GitVersion.Core.Tests/Core/RepositoryExtensionsTests.cs b/src/GitVersion.Core.Tests/Core/RepositoryExtensionsTests.cs index ee86c14f5a..47258223f8 100644 --- a/src/GitVersion.Core.Tests/Core/RepositoryExtensionsTests.cs +++ b/src/GitVersion.Core.Tests/Core/RepositoryExtensionsTests.cs @@ -1,4 +1,5 @@ using GitVersion.Core.Tests.Helpers; +using GitVersion.Git; namespace GitVersion.Core.Tests; diff --git a/src/GitVersion.Core.Tests/Core/RepositoryStoreTests.cs b/src/GitVersion.Core.Tests/Core/RepositoryStoreTests.cs index 00ed164fc6..e795732a57 100644 --- a/src/GitVersion.Core.Tests/Core/RepositoryStoreTests.cs +++ b/src/GitVersion.Core.Tests/Core/RepositoryStoreTests.cs @@ -1,6 +1,7 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Core.Tests.IntegrationTests; +using GitVersion.Git; using GitVersion.Logging; using Microsoft.Extensions.DependencyInjection; diff --git a/src/GitVersion.Core.Tests/Extensions/GitToolsTestingExtensions.cs b/src/GitVersion.Core.Tests/Extensions/GitToolsTestingExtensions.cs index 6c80ddcc5c..947d4e6fc4 100644 --- a/src/GitVersion.Core.Tests/Extensions/GitToolsTestingExtensions.cs +++ b/src/GitVersion.Core.Tests/Extensions/GitToolsTestingExtensions.cs @@ -2,6 +2,7 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.Logging; using GitVersion.OutputVariables; using GitVersion.VersionCalculation; diff --git a/src/GitVersion.Core.Tests/Helpers/GitVersionContextBuilder.cs b/src/GitVersion.Core.Tests/Helpers/GitVersionContextBuilder.cs index abce552ffd..eb76416658 100644 --- a/src/GitVersion.Core.Tests/Helpers/GitVersionContextBuilder.cs +++ b/src/GitVersion.Core.Tests/Helpers/GitVersionContextBuilder.cs @@ -1,5 +1,6 @@ using GitVersion.Core.Tests.Helpers; using GitVersion.Extensions; +using GitVersion.Git; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; diff --git a/src/GitVersion.Core.Tests/Helpers/TestBase.cs b/src/GitVersion.Core.Tests/Helpers/TestBase.cs index ff7d695671..cd25bd8a27 100644 --- a/src/GitVersion.Core.Tests/Helpers/TestBase.cs +++ b/src/GitVersion.Core.Tests/Helpers/TestBase.cs @@ -1,4 +1,5 @@ using GitVersion.Extensions; +using GitVersion.Git; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; diff --git a/src/GitVersion.Core.Tests/IntegrationTests/FeatureBranchScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/FeatureBranchScenarios.cs index caba8424e3..e0db3bb7ee 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/FeatureBranchScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/FeatureBranchScenarios.cs @@ -1,6 +1,5 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; -using GitVersion.Extensions; using GitVersion.VersionCalculation; using LibGit2Sharp; diff --git a/src/GitVersion.Core.Tests/IntegrationTests/HotfixBranchScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/HotfixBranchScenarios.cs index cd3658f260..2369e1c58b 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/HotfixBranchScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/HotfixBranchScenarios.cs @@ -1,6 +1,5 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; -using GitVersion.Extensions; using LibGit2Sharp; namespace GitVersion.Core.Tests.IntegrationTests; @@ -54,7 +53,7 @@ public void CanTakeVersionFromHotfixesBranch() }); // Merge hotfix branch to support var branch = fixture.Repository.CreateBranch( - "support-1.1", (LibGit2Sharp.Commit)fixture.Repository.Tags.Single(t => t.FriendlyName == "1.1.0").Target + "support-1.1", (Commit)fixture.Repository.Tags.Single(t => t.FriendlyName == "1.1.0").Target ); Commands.Checkout(fixture.Repository, branch); fixture.AssertFullSemver("1.1.0"); @@ -81,7 +80,7 @@ public void PatchOlderReleaseExample() // Merge hotfix branch to support fixture.Checkout(MainBranch); var tag = fixture.Repository.Tags.Single(t => t.FriendlyName == "1.1.0"); - fixture.Repository.CreateBranch("support-1.1", (LibGit2Sharp.Commit)tag.Target); + fixture.Repository.CreateBranch("support-1.1", (Commit)tag.Target); fixture.Checkout("support-1.1"); fixture.AssertFullSemver("1.1.0"); diff --git a/src/GitVersion.Core.Tests/IntegrationTests/ReleaseBranchScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/ReleaseBranchScenarios.cs index 4684491768..315cfad80c 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/ReleaseBranchScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/ReleaseBranchScenarios.cs @@ -1,6 +1,5 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; -using GitVersion.Extensions; using LibGit2Sharp; namespace GitVersion.Core.Tests.IntegrationTests; diff --git a/src/GitVersion.Core.Tests/IntegrationTests/TrunkBasedDevelopmentScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/TrunkBasedDevelopmentScenarios.cs index 6e62cdf6cd..90f814a906 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/TrunkBasedDevelopmentScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/TrunkBasedDevelopmentScenarios.cs @@ -1,6 +1,5 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; -using GitVersion.Extensions; using GitVersion.VersionCalculation; namespace GitVersion.Core.Tests.IntegrationTests; diff --git a/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs index 15d63aa968..1e66d278ca 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs @@ -1,5 +1,6 @@ using GitVersion.Common; using GitVersion.Configuration; +using GitVersion.Git; using GitVersion.Logging; using GitVersion.VersionCalculation; diff --git a/src/GitVersion.Core.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs index 6dac15a836..f1c09f2f30 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs @@ -1,6 +1,7 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.VersionCalculation; using Microsoft.Extensions.DependencyInjection; diff --git a/src/GitVersion.Core.Tests/VersionCalculation/Strategies/VersionInBranchNameBaseVersionStrategyTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/Strategies/VersionInBranchNameBaseVersionStrategyTests.cs index e006162870..86aba6e7d3 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/Strategies/VersionInBranchNameBaseVersionStrategyTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/Strategies/VersionInBranchNameBaseVersionStrategyTests.cs @@ -1,6 +1,7 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.VersionCalculation; namespace GitVersion.Core.Tests.VersionCalculation.Strategies; diff --git a/src/GitVersion.Core.Tests/VersionCalculation/VariableProviderTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/VariableProviderTests.cs index aa9fe03aa4..76e33af068 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/VariableProviderTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/VariableProviderTests.cs @@ -1,5 +1,6 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; +using GitVersion.Git; using GitVersion.Logging; using GitVersion.VersionCalculation; using Microsoft.Extensions.DependencyInjection; diff --git a/src/GitVersion.Core.Tests/VersionCalculation/VersionSourceTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/VersionSourceTests.cs index 3bb50fbf16..f4618e6d40 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/VersionSourceTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/VersionSourceTests.cs @@ -1,4 +1,5 @@ using GitVersion.Core.Tests.Helpers; +using GitVersion.Git; using GitVersion.VersionCalculation; using Microsoft.Extensions.DependencyInjection; diff --git a/src/GitVersion.Core/Agents/BuildAgentBase.cs b/src/GitVersion.Core/Agents/BuildAgentBase.cs index b1f2fc19eb..29840605bb 100644 --- a/src/GitVersion.Core/Agents/BuildAgentBase.cs +++ b/src/GitVersion.Core/Agents/BuildAgentBase.cs @@ -4,10 +4,10 @@ namespace GitVersion.Agents; -public abstract class BuildAgentBase(IEnvironment environment, ILog log) : ICurrentBuildAgent +internal abstract class BuildAgentBase(IEnvironment environment, ILog log) : ICurrentBuildAgent { - protected readonly ILog Log = log; - protected IEnvironment Environment { get; } = environment; + protected readonly ILog Log = log.NotNull(); + protected IEnvironment Environment { get; } = environment.NotNull(); protected abstract string EnvironmentVariable { get; } public virtual bool IsDefault => false; diff --git a/src/GitVersion.Core/Agents/IBuildAgent.cs b/src/GitVersion.Core/Agents/IBuildAgent.cs index 8b575934eb..b6f7b36725 100644 --- a/src/GitVersion.Core/Agents/IBuildAgent.cs +++ b/src/GitVersion.Core/Agents/IBuildAgent.cs @@ -14,4 +14,4 @@ public interface IBuildAgent void WriteIntegration(Action writer, GitVersionVariables variables, bool updateBuildNumber = true); } -public interface ICurrentBuildAgent : IBuildAgent { } +public interface ICurrentBuildAgent : IBuildAgent; diff --git a/src/GitVersion.Core/Agents/LocalBuild.cs b/src/GitVersion.Core/Agents/LocalBuild.cs index 4e84646401..11a636b352 100644 --- a/src/GitVersion.Core/Agents/LocalBuild.cs +++ b/src/GitVersion.Core/Agents/LocalBuild.cs @@ -3,7 +3,7 @@ namespace GitVersion.Agents; -public class LocalBuild(IEnvironment environment, ILog log) : BuildAgentBase(environment, log) +internal class LocalBuild(IEnvironment environment, ILog log) : BuildAgentBase(environment, log) { public override bool IsDefault => true; diff --git a/src/GitVersion.Core/Extensions/AssemblyFileVersioningScheme.cs b/src/GitVersion.Core/Configuration/AssemblyFileVersioningScheme.cs similarity index 77% rename from src/GitVersion.Core/Extensions/AssemblyFileVersioningScheme.cs rename to src/GitVersion.Core/Configuration/AssemblyFileVersioningScheme.cs index 59b42e2923..1593116fba 100644 --- a/src/GitVersion.Core/Extensions/AssemblyFileVersioningScheme.cs +++ b/src/GitVersion.Core/Configuration/AssemblyFileVersioningScheme.cs @@ -1,4 +1,4 @@ -namespace GitVersion.Extensions; +namespace GitVersion.Configuration; public enum AssemblyFileVersioningScheme { diff --git a/src/GitVersion.Core/Extensions/AssemblyVersioningScheme.cs b/src/GitVersion.Core/Configuration/AssemblyVersioningScheme.cs similarity index 77% rename from src/GitVersion.Core/Extensions/AssemblyVersioningScheme.cs rename to src/GitVersion.Core/Configuration/AssemblyVersioningScheme.cs index e867035dce..596decd681 100644 --- a/src/GitVersion.Core/Extensions/AssemblyVersioningScheme.cs +++ b/src/GitVersion.Core/Configuration/AssemblyVersioningScheme.cs @@ -1,4 +1,4 @@ -namespace GitVersion.Extensions; +namespace GitVersion.Configuration; public enum AssemblyVersioningScheme { diff --git a/src/GitVersion.Core/Configuration/ConfigurationConstants.cs b/src/GitVersion.Core/Configuration/ConfigurationConstants.cs index ffbd1cea2b..231633c927 100644 --- a/src/GitVersion.Core/Configuration/ConfigurationConstants.cs +++ b/src/GitVersion.Core/Configuration/ConfigurationConstants.cs @@ -1,4 +1,3 @@ -using GitVersion.Extensions; using GitVersion.VersionCalculation; namespace GitVersion.Configuration; diff --git a/src/GitVersion.Core/Configuration/EffectiveBranchConfiguration.cs b/src/GitVersion.Core/Configuration/EffectiveBranchConfiguration.cs index f9e1ababce..1ad5c523b1 100644 --- a/src/GitVersion.Core/Configuration/EffectiveBranchConfiguration.cs +++ b/src/GitVersion.Core/Configuration/EffectiveBranchConfiguration.cs @@ -1,4 +1,5 @@ using GitVersion.Extensions; +using GitVersion.Git; namespace GitVersion.Configuration; diff --git a/src/GitVersion.Core/Configuration/IConfigurationSerializer.cs b/src/GitVersion.Core/Configuration/IConfigurationSerializer.cs new file mode 100644 index 0000000000..312e0e3feb --- /dev/null +++ b/src/GitVersion.Core/Configuration/IConfigurationSerializer.cs @@ -0,0 +1,8 @@ +namespace GitVersion.Configuration; + +internal interface IConfigurationSerializer +{ + public T Deserialize(string input); + string Serialize(object graph); + public IGitVersionConfiguration? ReadConfiguration(string input); +} diff --git a/src/GitVersion.Core/Configuration/IGitVersionConfiguration.cs b/src/GitVersion.Core/Configuration/IGitVersionConfiguration.cs index 6680f5aea0..60307b3cd1 100644 --- a/src/GitVersion.Core/Configuration/IGitVersionConfiguration.cs +++ b/src/GitVersion.Core/Configuration/IGitVersionConfiguration.cs @@ -1,5 +1,4 @@ using System.Text.RegularExpressions; -using GitVersion.Extensions; using GitVersion.VersionCalculation; namespace GitVersion.Configuration; @@ -50,7 +49,5 @@ public interface IGitVersionConfiguration : IBranchConfiguration IIgnoreConfiguration Ignore { get; } - string ToJsonString(); - IBranchConfiguration GetEmptyBranchConfiguration(); } diff --git a/src/GitVersion.Core/Configuration/IgnoreConfigurationExtensions.cs b/src/GitVersion.Core/Configuration/IgnoreConfigurationExtensions.cs index 4308b39254..d99c33db76 100644 --- a/src/GitVersion.Core/Configuration/IgnoreConfigurationExtensions.cs +++ b/src/GitVersion.Core/Configuration/IgnoreConfigurationExtensions.cs @@ -1,8 +1,9 @@ using GitVersion.Extensions; +using GitVersion.Git; namespace GitVersion.Configuration; -public static class IgnoreConfigurationExtensions +internal static class IgnoreConfigurationExtensions { public static IEnumerable Filter(this IIgnoreConfiguration ignore, IEnumerable source) { diff --git a/src/GitVersion.Core/Core/Abstractions/IGitPreparer.cs b/src/GitVersion.Core/Core/Abstractions/IGitPreparer.cs index 8fede694f1..8e47f43328 100644 --- a/src/GitVersion.Core/Core/Abstractions/IGitPreparer.cs +++ b/src/GitVersion.Core/Core/Abstractions/IGitPreparer.cs @@ -1,3 +1,5 @@ +using GitVersion.Git; + namespace GitVersion; public interface IGitPreparer diff --git a/src/GitVersion.Core/Core/Abstractions/IRepositoryStore.cs b/src/GitVersion.Core/Core/Abstractions/IRepositoryStore.cs index d8f71c94e5..58571cc06d 100644 --- a/src/GitVersion.Core/Core/Abstractions/IRepositoryStore.cs +++ b/src/GitVersion.Core/Core/Abstractions/IRepositoryStore.cs @@ -1,4 +1,5 @@ using GitVersion.Configuration; +using GitVersion.Git; namespace GitVersion.Common; diff --git a/src/GitVersion.Core/Core/Attributes/JsonPropertyDescriptionAttribute.cs b/src/GitVersion.Core/Core/Attributes/JsonPropertyDescriptionAttribute.cs deleted file mode 100644 index b64b79c2f3..0000000000 --- a/src/GitVersion.Core/Core/Attributes/JsonPropertyDescriptionAttribute.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace GitVersion.Attributes; - -[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] -public sealed class JsonPropertyDescriptionAttribute : JsonAttribute -{ - /// - /// Initializes a new instance of with the specified property description. - /// - /// The description of the property. - public JsonPropertyDescriptionAttribute(string description) => Description = description; - - /// - /// The description of the property. - /// - public string Description { get; } -} diff --git a/src/GitVersion.Core/Core/BranchRepository.cs b/src/GitVersion.Core/Core/BranchRepository.cs index 1e7223198a..3a3832e5ff 100644 --- a/src/GitVersion.Core/Core/BranchRepository.cs +++ b/src/GitVersion.Core/Core/BranchRepository.cs @@ -1,5 +1,6 @@ using GitVersion.Configuration; using GitVersion.Extensions; +using GitVersion.Git; namespace GitVersion.Core; diff --git a/src/GitVersion.Core/Core/BranchesContainingCommitFinder.cs b/src/GitVersion.Core/Core/BranchesContainingCommitFinder.cs index e12aafe18b..4ce67ba6de 100644 --- a/src/GitVersion.Core/Core/BranchesContainingCommitFinder.cs +++ b/src/GitVersion.Core/Core/BranchesContainingCommitFinder.cs @@ -1,4 +1,5 @@ using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.Logging; namespace GitVersion; diff --git a/src/GitVersion.Core/Core/GitPreparer.cs b/src/GitVersion.Core/Core/GitPreparer.cs index ec583dcbf3..e33d236d4d 100644 --- a/src/GitVersion.Core/Core/GitPreparer.cs +++ b/src/GitVersion.Core/Core/GitPreparer.cs @@ -1,36 +1,33 @@ using GitVersion.Agents; using GitVersion.Configuration; using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.Helpers; using GitVersion.Logging; using Microsoft.Extensions.Options; namespace GitVersion; -internal class GitPreparer : IGitPreparer +internal class GitPreparer( + ILog log, + IEnvironment environment, + ICurrentBuildAgent buildAgent, + IOptions options, + IMutatingGitRepository repository, + IGitRepositoryInfo repositoryInfo, + Lazy versionContext) + : IGitPreparer { - private readonly ILog log; - private readonly IEnvironment environment; - private readonly IMutatingGitRepository repository; - private readonly IOptions options; - private readonly IGitRepositoryInfo repositoryInfo; - private readonly ICurrentBuildAgent buildAgent; - private readonly RetryAction retryAction; - private readonly Lazy versionContext; - private const string DefaultRemoteName = "origin"; + private readonly ILog log = log.NotNull(); + private readonly IEnvironment environment = environment.NotNull(); + private readonly IMutatingGitRepository repository = repository.NotNull(); + private readonly IOptions options = options.NotNull(); + private readonly IGitRepositoryInfo repositoryInfo = repositoryInfo.NotNull(); + private readonly ICurrentBuildAgent buildAgent = buildAgent.NotNull(); + private readonly RetryAction retryAction = new(); + private readonly Lazy versionContext = versionContext.NotNull(); - public GitPreparer(ILog log, IEnvironment environment, ICurrentBuildAgent buildAgent, IOptions options, - IMutatingGitRepository repository, IGitRepositoryInfo repositoryInfo, Lazy versionContext) - { - this.log = log.NotNull(); - this.environment = environment.NotNull(); - this.repository = repository.NotNull(); - this.options = options.NotNull(); - this.repositoryInfo = repositoryInfo.NotNull(); - this.buildAgent = buildAgent.NotNull(); - this.retryAction = new(); - this.versionContext = versionContext.NotNull(); - } + private const string DefaultRemoteName = "origin"; public void Prepare() { diff --git a/src/GitVersion.Core/Core/GitVersionCalculateTool.cs b/src/GitVersion.Core/Core/GitVersionCalculateTool.cs index 53331f05ae..92c48bd78b 100644 --- a/src/GitVersion.Core/Core/GitVersionCalculateTool.cs +++ b/src/GitVersion.Core/Core/GitVersionCalculateTool.cs @@ -9,46 +9,36 @@ namespace GitVersion; -internal class GitVersionCalculateTool : IGitVersionCalculateTool +internal class GitVersionCalculateTool( + ILog log, + INextVersionCalculator nextVersionCalculator, + IVariableProvider variableProvider, + IGitPreparer gitPreparer, + IGitVersionCacheProvider gitVersionCacheProvider, + IOptions options, + Lazy versionContext) + : IGitVersionCalculateTool { - private readonly ILog log; - private readonly IGitVersionCache gitVersionCache; - private readonly INextVersionCalculator nextVersionCalculator; - private readonly IVariableProvider variableProvider; - private readonly IGitPreparer gitPreparer; - private readonly IGitVersionCacheKeyFactory cacheKeyFactory; + private readonly ILog log = log.NotNull(); + private readonly IGitVersionCacheProvider gitVersionCacheProvider = gitVersionCacheProvider.NotNull(); + private readonly INextVersionCalculator nextVersionCalculator = nextVersionCalculator.NotNull(); + private readonly IVariableProvider variableProvider = variableProvider.NotNull(); + private readonly IGitPreparer gitPreparer = gitPreparer.NotNull(); - private readonly IOptions options; - private readonly Lazy versionContext; + private readonly IOptions options = options.NotNull(); + private readonly Lazy versionContext = versionContext.NotNull(); private GitVersionContext Context => this.versionContext.Value; - public GitVersionCalculateTool(ILog log, INextVersionCalculator nextVersionCalculator, - IVariableProvider variableProvider, IGitPreparer gitPreparer, - IGitVersionCache gitVersionCache, IGitVersionCacheKeyFactory cacheKeyFactory, - IOptions options, Lazy versionContext) - { - this.log = log.NotNull(); - - this.nextVersionCalculator = nextVersionCalculator.NotNull(); - this.variableProvider = variableProvider.NotNull(); - this.gitPreparer = gitPreparer.NotNull(); - - this.cacheKeyFactory = cacheKeyFactory.NotNull(); - this.gitVersionCache = gitVersionCache.NotNull(); - - this.options = options.NotNull(); - this.versionContext = versionContext.NotNull(); - } - public GitVersionVariables CalculateVersionVariables() { this.gitPreparer.Prepare(); //we need to prepare the repository before using it for version calculation var gitVersionOptions = this.options.Value; - var cacheKey = this.cacheKeyFactory.Create(gitVersionOptions.ConfigurationInfo.OverrideConfiguration); - var versionVariables = gitVersionOptions.Settings.NoCache ? default : this.gitVersionCache.LoadVersionVariablesFromDiskCache(cacheKey); + var versionVariables = !gitVersionOptions.Settings.NoCache + ? this.gitVersionCacheProvider.LoadVersionVariablesFromDiskCache() + : default; if (versionVariables != null) return versionVariables; @@ -62,7 +52,7 @@ public GitVersionVariables CalculateVersionVariables() if (gitVersionOptions.Settings.NoCache) return versionVariables; try { - this.gitVersionCache.WriteVariablesToDiskCache(cacheKey, versionVariables); + this.gitVersionCacheProvider.WriteVariablesToDiskCache(versionVariables); } catch (AggregateException e) { diff --git a/src/GitVersion.Core/Core/GitVersionContextFactory.cs b/src/GitVersion.Core/Core/GitVersionContextFactory.cs index 46a60faf7c..b4a17d25d1 100644 --- a/src/GitVersion.Core/Core/GitVersionContextFactory.cs +++ b/src/GitVersion.Core/Core/GitVersionContextFactory.cs @@ -6,21 +6,17 @@ namespace GitVersion; -internal class GitVersionContextFactory : IGitVersionContextFactory +internal class GitVersionContextFactory( + IConfigurationProvider configurationProvider, + IRepositoryStore repositoryStore, + ITaggedSemanticVersionRepository taggedSemanticVersionRepository, + IOptions options) + : IGitVersionContextFactory { - private readonly IConfigurationProvider configurationProvider; - private readonly IRepositoryStore repositoryStore; - private readonly ITaggedSemanticVersionRepository taggedSemanticVersionRepository; - private readonly IOptions options; - - public GitVersionContextFactory(IConfigurationProvider configurationProvider, IRepositoryStore repositoryStore, - ITaggedSemanticVersionRepository taggedSemanticVersionRepository, IOptions options) - { - this.configurationProvider = configurationProvider.NotNull(); - this.repositoryStore = repositoryStore.NotNull(); - this.taggedSemanticVersionRepository = taggedSemanticVersionRepository.NotNull(); - this.options = options.NotNull(); - } + private readonly IConfigurationProvider configurationProvider = configurationProvider.NotNull(); + private readonly IRepositoryStore repositoryStore = repositoryStore.NotNull(); + private readonly ITaggedSemanticVersionRepository taggedSemanticVersionRepository = taggedSemanticVersionRepository.NotNull(); + private readonly IOptions options = options.NotNull(); public GitVersionContext Create(GitVersionOptions gitVersionOptions) { diff --git a/src/GitVersion.Core/Core/IBranchRepository.cs b/src/GitVersion.Core/Core/IBranchRepository.cs index 95887c6f37..a58e603988 100644 --- a/src/GitVersion.Core/Core/IBranchRepository.cs +++ b/src/GitVersion.Core/Core/IBranchRepository.cs @@ -1,4 +1,5 @@ using GitVersion.Configuration; +using GitVersion.Git; namespace GitVersion.Core; diff --git a/src/GitVersion.Core/Core/ITaggedSemanticVersionRepository.cs b/src/GitVersion.Core/Core/ITaggedSemanticVersionRepository.cs index 6ab34a5835..a93a6f42d5 100644 --- a/src/GitVersion.Core/Core/ITaggedSemanticVersionRepository.cs +++ b/src/GitVersion.Core/Core/ITaggedSemanticVersionRepository.cs @@ -1,4 +1,5 @@ using GitVersion.Configuration; +using GitVersion.Git; namespace GitVersion.Core; diff --git a/src/GitVersion.Core/Core/MainlineBranchFinder.cs b/src/GitVersion.Core/Core/MainlineBranchFinder.cs index fa9596d07f..7d7521e0e2 100644 --- a/src/GitVersion.Core/Core/MainlineBranchFinder.cs +++ b/src/GitVersion.Core/Core/MainlineBranchFinder.cs @@ -2,29 +2,23 @@ using GitVersion.Common; using GitVersion.Configuration; using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.Logging; namespace GitVersion; -internal class MainlineBranchFinder +internal class MainlineBranchFinder( + IRepositoryStore repositoryStore, + IGitRepository repository, + IGitVersionConfiguration configuration, + ILog log) { - private readonly IGitVersionConfiguration configuration; - private readonly ILog log; - private readonly List mainlineBranchConfigurations; - private readonly IGitRepository repository; - private readonly IRepositoryStore repositoryStore; - - public MainlineBranchFinder(IRepositoryStore repositoryStore, - IGitRepository repository, - IGitVersionConfiguration configuration, - ILog log) - { - this.repositoryStore = repositoryStore.NotNull(); - this.repository = repository.NotNull(); - this.configuration = configuration.NotNull(); - mainlineBranchConfigurations = configuration.Branches.Select(e => e.Value).Where(b => b.IsMainBranch == true).ToList(); - this.log = log.NotNull(); - } + private readonly IGitVersionConfiguration configuration = configuration.NotNull(); + private readonly ILog log = log.NotNull(); + private readonly IGitRepository repository = repository.NotNull(); + private readonly IRepositoryStore repositoryStore = repositoryStore.NotNull(); + private readonly List mainlineBranchConfigurations = + configuration.Branches.Select(e => e.Value).Where(b => b.IsMainBranch == true).ToList(); public IDictionary> FindMainlineBranches(ICommit commit) { @@ -43,16 +37,10 @@ private bool IsMainBranch(INamedReference branch) return this.mainlineBranchConfigurations.Any(matcher.IsMainBranch); } - private class MainlineConfigBranchMatcher + private class MainlineConfigBranchMatcher(INamedReference branch, ILog log) { - private readonly INamedReference branch; - private readonly ILog log; - - public MainlineConfigBranchMatcher(INamedReference branch, ILog log) - { - this.branch = branch; - this.log = log; - } + private readonly INamedReference branch = branch.NotNull(); + private readonly ILog log = log.NotNull(); public bool IsMainBranch(IBranchConfiguration value) { @@ -67,20 +55,12 @@ public bool IsMainBranch(IBranchConfiguration value) } } - private class BranchOriginFinder + private class BranchOriginFinder(ICommit commit, IRepositoryStore repositoryStore, IGitVersionConfiguration configuration, ILog log) { - private readonly ICommit commit; - private readonly IGitVersionConfiguration configuration; - private readonly ILog log; - private readonly IRepositoryStore repositoryStore; - - public BranchOriginFinder(ICommit commit, IRepositoryStore repositoryStore, IGitVersionConfiguration configuration, ILog log) - { - this.repositoryStore = repositoryStore; - this.commit = commit; - this.configuration = configuration; - this.log = log; - } + private readonly ICommit commit = commit.NotNull(); + private readonly IGitVersionConfiguration configuration = configuration.NotNull(); + private readonly ILog log = log.NotNull(); + private readonly IRepositoryStore repositoryStore = repositoryStore.NotNull(); public BranchCommit BranchOrigin(IBranch branch) { diff --git a/src/GitVersion.Core/Core/MergeBaseFinder.cs b/src/GitVersion.Core/Core/MergeBaseFinder.cs index ff4c3dcb31..36f0ca1329 100644 --- a/src/GitVersion.Core/Core/MergeBaseFinder.cs +++ b/src/GitVersion.Core/Core/MergeBaseFinder.cs @@ -1,22 +1,16 @@ using GitVersion.Common; using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.Logging; namespace GitVersion; -internal class MergeBaseFinder +internal class MergeBaseFinder(IRepositoryStore repositoryStore, IGitRepository gitRepository, ILog log) { - private readonly ILog log; - private readonly Dictionary, ICommit> mergeBaseCache = new(); - private readonly IGitRepository repository; - private readonly IRepositoryStore repositoryStore; - - public MergeBaseFinder(IRepositoryStore repositoryStore, IGitRepository gitRepository, ILog log) - { - this.repositoryStore = repositoryStore.NotNull(); - this.repository = gitRepository.NotNull(); - this.log = log.NotNull(); - } + private readonly ILog log = log.NotNull(); + private readonly IGitRepository repository = gitRepository.NotNull(); + private readonly IRepositoryStore repositoryStore = repositoryStore.NotNull(); + private readonly Dictionary, ICommit> mergeBaseCache = []; public ICommit? FindMergeBaseOf(IBranch? first, IBranch? second) { diff --git a/src/GitVersion.Core/Core/MergeCommitFinder.cs b/src/GitVersion.Core/Core/MergeCommitFinder.cs index 1a268e20a2..1a5a42e3c8 100644 --- a/src/GitVersion.Core/Core/MergeCommitFinder.cs +++ b/src/GitVersion.Core/Core/MergeCommitFinder.cs @@ -1,24 +1,17 @@ using GitVersion.Configuration; using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.Logging; namespace GitVersion; -internal class MergeCommitFinder +internal class MergeCommitFinder(RepositoryStore repositoryStore, IGitVersionConfiguration configuration, IEnumerable excludedBranches, ILog log) { - private readonly IEnumerable branches; - private readonly ILog log; - private readonly Dictionary> mergeBaseCommitsCache = new(); - private readonly RepositoryStore repositoryStore; - private readonly IGitVersionConfiguration configuration; - - public MergeCommitFinder(RepositoryStore repositoryStore, IGitVersionConfiguration configuration, IEnumerable excludedBranches, ILog log) - { - this.repositoryStore = repositoryStore.NotNull(); - this.configuration = configuration.NotNull(); - this.branches = repositoryStore.ExcludingBranches(excludedBranches.NotNull()); - this.log = log.NotNull(); - } + private readonly ILog log = log.NotNull(); + private readonly IEnumerable branches = repositoryStore.ExcludingBranches(excludedBranches.NotNull()); + private readonly RepositoryStore repositoryStore = repositoryStore.NotNull(); + private readonly IGitVersionConfiguration configuration = configuration.NotNull(); + private readonly Dictionary> mergeBaseCommitsCache = []; public IEnumerable FindMergeCommitsFor(IBranch branch) { diff --git a/src/GitVersion.Core/Core/RepositoryStore.cs b/src/GitVersion.Core/Core/RepositoryStore.cs index dba9aa7c3e..43a2115734 100644 --- a/src/GitVersion.Core/Core/RepositoryStore.cs +++ b/src/GitVersion.Core/Core/RepositoryStore.cs @@ -1,6 +1,7 @@ using GitVersion.Common; using GitVersion.Configuration; using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.Helpers; using GitVersion.Logging; diff --git a/src/GitVersion.Core/Core/SourceBranchFinder.cs b/src/GitVersion.Core/Core/SourceBranchFinder.cs index 903412b5e3..98dc0491c0 100644 --- a/src/GitVersion.Core/Core/SourceBranchFinder.cs +++ b/src/GitVersion.Core/Core/SourceBranchFinder.cs @@ -1,19 +1,14 @@ using System.Text.RegularExpressions; using GitVersion.Configuration; using GitVersion.Extensions; +using GitVersion.Git; namespace GitVersion; -internal class SourceBranchFinder +internal class SourceBranchFinder(IEnumerable excludedBranches, IGitVersionConfiguration configuration) { - private readonly IGitVersionConfiguration configuration; - private readonly IEnumerable excludedBranches; - - public SourceBranchFinder(IEnumerable excludedBranches, IGitVersionConfiguration configuration) - { - this.excludedBranches = excludedBranches.NotNull(); - this.configuration = configuration.NotNull(); - } + private readonly IGitVersionConfiguration configuration = configuration.NotNull(); + private readonly IEnumerable excludedBranches = excludedBranches.NotNull(); public IEnumerable FindSourceBranchesOf(IBranch branch) { diff --git a/src/GitVersion.Core/Core/TaggedSemanticVersionRepository.cs b/src/GitVersion.Core/Core/TaggedSemanticVersionRepository.cs index fd147cd494..9ed2ee7144 100644 --- a/src/GitVersion.Core/Core/TaggedSemanticVersionRepository.cs +++ b/src/GitVersion.Core/Core/TaggedSemanticVersionRepository.cs @@ -1,6 +1,7 @@ using System.Collections.Concurrent; using GitVersion.Configuration; using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.Logging; namespace GitVersion.Core; diff --git a/src/GitVersion.Core/Extensions/AssemblyVersionsGeneratorExtensions.cs b/src/GitVersion.Core/Extensions/AssemblyVersionsGeneratorExtensions.cs index 1ef7f96637..d4465c8eac 100644 --- a/src/GitVersion.Core/Extensions/AssemblyVersionsGeneratorExtensions.cs +++ b/src/GitVersion.Core/Extensions/AssemblyVersionsGeneratorExtensions.cs @@ -1,3 +1,5 @@ +using GitVersion.Configuration; + namespace GitVersion.Extensions; public static class AssemblyVersionsGeneratorExtensions diff --git a/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs b/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs index 3f0532639b..78fb1521b3 100644 --- a/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs +++ b/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs @@ -1,10 +1,11 @@ using System.Text.RegularExpressions; using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.VersionCalculation; namespace GitVersion.Configuration; -public static class ConfigurationExtensions +internal static class ConfigurationExtensions { public static EffectiveBranchConfiguration GetEffectiveBranchConfiguration(this IGitVersionConfiguration configuration, IBranch branch) { diff --git a/src/GitVersion.Core/VersionCalculation/IncrementStrategyExtensions.cs b/src/GitVersion.Core/Extensions/IncrementStrategyExtensions.cs similarity index 93% rename from src/GitVersion.Core/VersionCalculation/IncrementStrategyExtensions.cs rename to src/GitVersion.Core/Extensions/IncrementStrategyExtensions.cs index b535bef79b..eb84a57dce 100644 --- a/src/GitVersion.Core/VersionCalculation/IncrementStrategyExtensions.cs +++ b/src/GitVersion.Core/Extensions/IncrementStrategyExtensions.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Extensions; public static class IncrementStrategyExtensions { diff --git a/src/GitVersion.Core/Extensions/StringExtensions.cs b/src/GitVersion.Core/Extensions/StringExtensions.cs index 7fcd563d95..b45126b8c2 100644 --- a/src/GitVersion.Core/Extensions/StringExtensions.cs +++ b/src/GitVersion.Core/Extensions/StringExtensions.cs @@ -1,89 +1,10 @@ using System.Diagnostics.CodeAnalysis; using System.Text.RegularExpressions; -using GitVersion.Helpers; namespace GitVersion.Extensions; public static class StringExtensions { - private static readonly string[] Trues = ["1", "true"]; - private static readonly string[] Falses = ["0", "false"]; - - public static bool IsTrue(this string? value) => Trues.Contains(value, StringComparer.OrdinalIgnoreCase); - - public static bool IsFalse(this string? value) => Falses.Contains(value, StringComparer.OrdinalIgnoreCase); - - public static bool IsValidPath(this string? path) - { - if (path == null) - return false; - - try - { - _ = PathHelper.GetFullPath(path); - } - catch - { - path = PathHelper.Combine(System.Environment.CurrentDirectory, path); - - try - { - _ = PathHelper.GetFullPath(path); - } - catch - { - return false; - } - } - - return Directory.Exists(path); - } - - public static bool IsSwitchArgument(this string? value) => value != null - && (value.StartsWith('-') || value.StartsWith('/')) - && !Regex.Match(value, @"/\w+:").Success; //Exclude msbuild & project parameters in form /blah:, which should be parsed as values, not switch names. - - public static bool IsSwitch(this string? value, string switchName) - { - if (value == null) - return false; - - if (value.StartsWith('-')) - { - value = value[1..]; - } - - if (value.StartsWith('/')) - { - value = value[1..]; - } - - return string.Equals(switchName, value, StringComparison.OrdinalIgnoreCase); - } - - public static bool IsHelp(this string singleArgument) => (singleArgument == "?") || singleArgument.IsSwitch("h") || singleArgument.IsSwitch("help") || singleArgument.IsSwitch("?"); - - public static bool ArgumentRequiresValue(this string argument, int argumentIndex) - { - var booleanArguments = new[] - { - "init", - "updateassemblyinfo", - "ensureassemblyinfo", - "nofetch", - "nonormalize", - "nocache" - }; - - var argumentMightRequireValue = !booleanArguments.Contains(argument[1..], StringComparer.OrdinalIgnoreCase); - - // If this is the first argument that might be a target path, the argument starts with slash and we're on an OS that supports paths with slashes, the argument does not require a value. - if (argumentMightRequireValue && argumentIndex == 0 && argument.StartsWith('/') && Path.DirectorySeparatorChar == '/' && argument.IsValidPath()) - return false; - - return argumentMightRequireValue; - } - public static void AppendLineFormat(this StringBuilder stringBuilder, string format, params object[] args) { stringBuilder.AppendFormat(format, args); diff --git a/src/GitVersion.Core/Git/AuthenticationInfo.cs b/src/GitVersion.Core/Git/AuthenticationInfo.cs index 925dedfdad..24d6798735 100644 --- a/src/GitVersion.Core/Git/AuthenticationInfo.cs +++ b/src/GitVersion.Core/Git/AuthenticationInfo.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; public record AuthenticationInfo { diff --git a/src/GitVersion.Core/Git/BranchCommit.cs b/src/GitVersion.Core/Git/BranchCommit.cs index 7a12c027d0..ccc926033a 100644 --- a/src/GitVersion.Core/Git/BranchCommit.cs +++ b/src/GitVersion.Core/Git/BranchCommit.cs @@ -1,6 +1,6 @@ using GitVersion.Extensions; -namespace GitVersion; +namespace GitVersion.Git; /// /// A commit, together with the branch to which the commit belongs. diff --git a/src/GitVersion.Core/Git/CommitExtensions.cs b/src/GitVersion.Core/Git/CommitExtensions.cs index 6cd5c9f460..9b8971ac54 100644 --- a/src/GitVersion.Core/Git/CommitExtensions.cs +++ b/src/GitVersion.Core/Git/CommitExtensions.cs @@ -1,6 +1,6 @@ using GitVersion.Extensions; -namespace GitVersion; +namespace GitVersion.Git; public static class CommitExtensions { diff --git a/src/GitVersion.Core/Git/CommitFilter.cs b/src/GitVersion.Core/Git/CommitFilter.cs index 4992f1715a..f8c05c5261 100644 --- a/src/GitVersion.Core/Git/CommitFilter.cs +++ b/src/GitVersion.Core/Git/CommitFilter.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; public record CommitFilter { diff --git a/src/GitVersion.Core/Git/IBranch.cs b/src/GitVersion.Core/Git/IBranch.cs index e0745b87c2..4c78171180 100644 --- a/src/GitVersion.Core/Git/IBranch.cs +++ b/src/GitVersion.Core/Git/IBranch.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; public interface IBranch : IEquatable, IComparable, INamedReference { diff --git a/src/GitVersion.Core/Git/IBranchCollection.cs b/src/GitVersion.Core/Git/IBranchCollection.cs index ffb86439ad..5943bdf7d8 100644 --- a/src/GitVersion.Core/Git/IBranchCollection.cs +++ b/src/GitVersion.Core/Git/IBranchCollection.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; public interface IBranchCollection : IEnumerable { diff --git a/src/GitVersion.Core/Git/ICommit.cs b/src/GitVersion.Core/Git/ICommit.cs index 0c9484c395..6d54ecb78d 100644 --- a/src/GitVersion.Core/Git/ICommit.cs +++ b/src/GitVersion.Core/Git/ICommit.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; public interface ICommit : IEquatable, IComparable, IGitObject { diff --git a/src/GitVersion.Core/Git/ICommitCollection.cs b/src/GitVersion.Core/Git/ICommitCollection.cs index 10d9723156..8bf6267f37 100644 --- a/src/GitVersion.Core/Git/ICommitCollection.cs +++ b/src/GitVersion.Core/Git/ICommitCollection.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; public interface ICommitCollection : IEnumerable { diff --git a/src/GitVersion.Core/Git/IGitObject.cs b/src/GitVersion.Core/Git/IGitObject.cs index d125066ad7..1965547a30 100644 --- a/src/GitVersion.Core/Git/IGitObject.cs +++ b/src/GitVersion.Core/Git/IGitObject.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; public interface IGitObject : IEquatable, IComparable { diff --git a/src/GitVersion.Core/Git/IGitRepository.cs b/src/GitVersion.Core/Git/IGitRepository.cs index abc2317c3a..9f25193b0d 100644 --- a/src/GitVersion.Core/Git/IGitRepository.cs +++ b/src/GitVersion.Core/Git/IGitRepository.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; public interface IGitRepository : IDisposable { diff --git a/src/GitVersion.Core/Git/IGitRepositoryInfo.cs b/src/GitVersion.Core/Git/IGitRepositoryInfo.cs index 4e39080ee1..4aff8edd97 100644 --- a/src/GitVersion.Core/Git/IGitRepositoryInfo.cs +++ b/src/GitVersion.Core/Git/IGitRepositoryInfo.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; public interface IGitRepositoryInfo { diff --git a/src/GitVersion.Core/Git/IMutatingGitRepository.cs b/src/GitVersion.Core/Git/IMutatingGitRepository.cs index 3924c4326e..b7dc7bf811 100644 --- a/src/GitVersion.Core/Git/IMutatingGitRepository.cs +++ b/src/GitVersion.Core/Git/IMutatingGitRepository.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; public interface IMutatingGitRepository : IGitRepository { diff --git a/src/GitVersion.Core/Git/INamedReference.cs b/src/GitVersion.Core/Git/INamedReference.cs index a138984514..2c41175783 100644 --- a/src/GitVersion.Core/Git/INamedReference.cs +++ b/src/GitVersion.Core/Git/INamedReference.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; public interface INamedReference { diff --git a/src/GitVersion.Core/Git/IObjectId.cs b/src/GitVersion.Core/Git/IObjectId.cs index 1140e04f1f..b303cc953d 100644 --- a/src/GitVersion.Core/Git/IObjectId.cs +++ b/src/GitVersion.Core/Git/IObjectId.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; public interface IObjectId : IEquatable, IComparable { diff --git a/src/GitVersion.Core/Git/IRefSpec.cs b/src/GitVersion.Core/Git/IRefSpec.cs index d21969e32a..777641c1b4 100644 --- a/src/GitVersion.Core/Git/IRefSpec.cs +++ b/src/GitVersion.Core/Git/IRefSpec.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; public interface IRefSpec : IEquatable, IComparable { diff --git a/src/GitVersion.Core/Git/IRefSpecCollection.cs b/src/GitVersion.Core/Git/IRefSpecCollection.cs index 3ff492c0a3..d007874d8c 100644 --- a/src/GitVersion.Core/Git/IRefSpecCollection.cs +++ b/src/GitVersion.Core/Git/IRefSpecCollection.cs @@ -1,5 +1,3 @@ -namespace GitVersion; +namespace GitVersion.Git; -public interface IRefSpecCollection : IEnumerable -{ -} +public interface IRefSpecCollection : IEnumerable; diff --git a/src/GitVersion.Core/Git/IReference.cs b/src/GitVersion.Core/Git/IReference.cs index 7cb6132d1d..6b560af39b 100644 --- a/src/GitVersion.Core/Git/IReference.cs +++ b/src/GitVersion.Core/Git/IReference.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; public interface IReference : IEquatable, IComparable, INamedReference { diff --git a/src/GitVersion.Core/Git/IReferenceCollection.cs b/src/GitVersion.Core/Git/IReferenceCollection.cs index e3aafe1d50..6b4f639386 100644 --- a/src/GitVersion.Core/Git/IReferenceCollection.cs +++ b/src/GitVersion.Core/Git/IReferenceCollection.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; public interface IReferenceCollection : IEnumerable { diff --git a/src/GitVersion.Core/Git/IRemote.cs b/src/GitVersion.Core/Git/IRemote.cs index 896b3edfda..53b51eaad0 100644 --- a/src/GitVersion.Core/Git/IRemote.cs +++ b/src/GitVersion.Core/Git/IRemote.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; public interface IRemote : IEquatable, IComparable { diff --git a/src/GitVersion.Core/Git/IRemoteCollection.cs b/src/GitVersion.Core/Git/IRemoteCollection.cs index 614177ac81..531eee8546 100644 --- a/src/GitVersion.Core/Git/IRemoteCollection.cs +++ b/src/GitVersion.Core/Git/IRemoteCollection.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; public interface IRemoteCollection : IEnumerable { diff --git a/src/GitVersion.Core/Git/ITag.cs b/src/GitVersion.Core/Git/ITag.cs index 3a450e7cb9..c37dec97f4 100644 --- a/src/GitVersion.Core/Git/ITag.cs +++ b/src/GitVersion.Core/Git/ITag.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; public interface ITag : IEquatable, IComparable, INamedReference { diff --git a/src/GitVersion.Core/Git/ITagCollection.cs b/src/GitVersion.Core/Git/ITagCollection.cs index c5e189c6b5..3065430e39 100644 --- a/src/GitVersion.Core/Git/ITagCollection.cs +++ b/src/GitVersion.Core/Git/ITagCollection.cs @@ -1,5 +1,3 @@ -namespace GitVersion; +namespace GitVersion.Git; -public interface ITagCollection : IEnumerable -{ -} +public interface ITagCollection : IEnumerable; diff --git a/src/GitVersion.Core/Git/RefSpecDirection.cs b/src/GitVersion.Core/Git/RefSpecDirection.cs index 9cca4404f6..97070104f8 100644 --- a/src/GitVersion.Core/Git/RefSpecDirection.cs +++ b/src/GitVersion.Core/Git/RefSpecDirection.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; public enum RefSpecDirection { diff --git a/src/GitVersion.Core/Git/ReferenceName.cs b/src/GitVersion.Core/Git/ReferenceName.cs index 601ddc1348..630511dda2 100644 --- a/src/GitVersion.Core/Git/ReferenceName.cs +++ b/src/GitVersion.Core/Git/ReferenceName.cs @@ -3,7 +3,7 @@ using GitVersion.Extensions; using GitVersion.Helpers; -namespace GitVersion; +namespace GitVersion.Git; public class ReferenceName : IEquatable, IComparable { diff --git a/src/GitVersion.Core/GitVersion.Core.csproj b/src/GitVersion.Core/GitVersion.Core.csproj index 564781044c..a11a076110 100644 --- a/src/GitVersion.Core/GitVersion.Core.csproj +++ b/src/GitVersion.Core/GitVersion.Core.csproj @@ -21,6 +21,7 @@ + diff --git a/src/GitVersion.Core/GitVersionContext.cs b/src/GitVersion.Core/GitVersionContext.cs index fd654d5dc1..7264abe4c5 100644 --- a/src/GitVersion.Core/GitVersionContext.cs +++ b/src/GitVersion.Core/GitVersionContext.cs @@ -1,5 +1,6 @@ using GitVersion.Configuration; using GitVersion.Extensions; +using GitVersion.Git; namespace GitVersion; diff --git a/src/GitVersion.Core/GitVersionCoreModule.cs b/src/GitVersion.Core/GitVersionCoreModule.cs index c996abb27c..573e91f141 100644 --- a/src/GitVersion.Core/GitVersionCoreModule.cs +++ b/src/GitVersion.Core/GitVersionCoreModule.cs @@ -12,7 +12,7 @@ public class GitVersionCoreModule : IGitVersionModule { public void RegisterTypes(IServiceCollection services) { - services.AddSingleton(); + services.AddSingleton(); services.AddSingleton(); diff --git a/src/GitVersion.Core/Logging/ConsoleAppender.cs b/src/GitVersion.Core/Logging/ConsoleAppender.cs index 1a3f8f6190..13d424ae07 100644 --- a/src/GitVersion.Core/Logging/ConsoleAppender.cs +++ b/src/GitVersion.Core/Logging/ConsoleAppender.cs @@ -2,13 +2,9 @@ namespace GitVersion.Logging; internal class ConsoleAppender : ILogAppender { - private readonly object locker; - private readonly IDictionary palettes; - public ConsoleAppender() - { - this.locker = new(); - this.palettes = CreatePalette(); - } + private readonly object locker = new(); + private readonly IDictionary palettes = CreatePalette(); + public void WriteTo(LogLevel level, string message) { lock (this.locker) diff --git a/src/GitVersion.Core/MergeMessage.cs b/src/GitVersion.Core/MergeMessage.cs index f7b8c24ebe..d1d808ce6c 100644 --- a/src/GitVersion.Core/MergeMessage.cs +++ b/src/GitVersion.Core/MergeMessage.cs @@ -2,22 +2,23 @@ using System.Text.RegularExpressions; using GitVersion.Configuration; using GitVersion.Extensions; +using GitVersion.Git; namespace GitVersion; public class MergeMessage { - private static readonly IList DefaultFormats = new List - { + private static readonly IList DefaultFormats = + [ new("Default", @"^Merge (branch|tag) '(?[^']*)'(?: into (?[^\s]*))*"), - new("SmartGit", @"^Finish (?[^\s]*)(?: into (?[^\s]*))*"), + new("SmartGit", @"^Finish (?[^\s]*)(?: into (?[^\s]*))*"), new("BitBucketPull", @"^Merge pull request #(?\d+) (from|in) (?.*) from (?[^\s]*) to (?[^\s]*)"), new("BitBucketPullv7", @"^Pull request #(?\d+).*\r?\n\r?\nMerge in (?.*) from (?[^\s]*) to (?[^\s]*)"), new("BitBucketCloudPull", @"^Merged in (?[^\s]*) \(pull request #(?\d+)\)"), new("GitHubPull", @"^Merge pull request #(?\d+) (from|in) (?:[^\s\/]+\/)?(?[^\s]*)(?: into (?[^\s]*))*"), new("RemoteTracking", @"^Merge remote-tracking branch '(?[^\s]*)'(?: into (?[^\s]*))*"), new("AzureDevOpsPull", @"^Merge pull request (?\d+) from (?[^\s]*) into (?[^\s]*)") - }; + ]; public MergeMessage(string mergeMessage, IGitVersionConfiguration configuration) { diff --git a/src/GitVersion.Core/Options/ConfigurationInfo.cs b/src/GitVersion.Core/Options/ConfigurationInfo.cs index 10e667f265..a7e19756de 100644 --- a/src/GitVersion.Core/Options/ConfigurationInfo.cs +++ b/src/GitVersion.Core/Options/ConfigurationInfo.cs @@ -1,6 +1,6 @@ namespace GitVersion; -public class ConfigurationInfo +public record ConfigurationInfo { public string? ConfigurationFile; public bool ShowConfiguration; diff --git a/src/GitVersion.Core/Options/FileWriteInfo.cs b/src/GitVersion.Core/Options/FileWriteInfo.cs index 0c2a9fbcbf..7a81b8b411 100644 --- a/src/GitVersion.Core/Options/FileWriteInfo.cs +++ b/src/GitVersion.Core/Options/FileWriteInfo.cs @@ -1,8 +1,3 @@ namespace GitVersion; -public sealed class FileWriteInfo(string workingDirectory, string fileName, string fileExtension) -{ - public string WorkingDirectory { get; } = workingDirectory; - public string FileName { get; } = fileName; - public string FileExtension { get; } = fileExtension; -} +public sealed record FileWriteInfo(string WorkingDirectory, string FileName, string FileExtension); diff --git a/src/GitVersion.Core/Options/GitVersionOptions.cs b/src/GitVersion.Core/Options/GitVersionOptions.cs index d3338a195c..1fc689dbd7 100644 --- a/src/GitVersion.Core/Options/GitVersionOptions.cs +++ b/src/GitVersion.Core/Options/GitVersionOptions.cs @@ -1,3 +1,4 @@ +using GitVersion.Git; using GitVersion.Logging; namespace GitVersion; diff --git a/src/GitVersion.Core/Options/RepositoryInfo.cs b/src/GitVersion.Core/Options/RepositoryInfo.cs index bc0991236e..4551ff8e11 100644 --- a/src/GitVersion.Core/Options/RepositoryInfo.cs +++ b/src/GitVersion.Core/Options/RepositoryInfo.cs @@ -1,6 +1,6 @@ namespace GitVersion; -public class RepositoryInfo +public record RepositoryInfo { public string? TargetUrl; public string? TargetBranch; diff --git a/src/GitVersion.Core/Options/Settings.cs b/src/GitVersion.Core/Options/Settings.cs index 22b198edc3..58ded50c19 100644 --- a/src/GitVersion.Core/Options/Settings.cs +++ b/src/GitVersion.Core/Options/Settings.cs @@ -1,6 +1,6 @@ namespace GitVersion; -public class Settings +public record Settings { public bool NoFetch; public bool NoCache; diff --git a/src/GitVersion.Core/Options/WixInfo.cs b/src/GitVersion.Core/Options/WixInfo.cs index 8680dca39a..8fa95b2851 100644 --- a/src/GitVersion.Core/Options/WixInfo.cs +++ b/src/GitVersion.Core/Options/WixInfo.cs @@ -1,6 +1,6 @@ namespace GitVersion; -public class WixInfo +public record WixInfo { public bool UpdateWixVersionFile; } diff --git a/src/GitVersion.Core/PublicAPI.Unshipped.txt b/src/GitVersion.Core/PublicAPI.Unshipped.txt index fac2dcec4a..4c3a508afc 100644 --- a/src/GitVersion.Core/PublicAPI.Unshipped.txt +++ b/src/GitVersion.Core/PublicAPI.Unshipped.txt @@ -1,8 +1,8 @@ #nullable enable -GitVersion.Agents.BuildAgentBase -GitVersion.Agents.BuildAgentBase.BuildAgentBase(GitVersion.IEnvironment! environment, GitVersion.Logging.ILog! log) -> void -GitVersion.Agents.BuildAgentBase.Environment.get -> GitVersion.IEnvironment! -GitVersion.Agents.BuildAgentBase.GenerateBuildLogOutput(GitVersion.OutputVariables.GitVersionVariables! variables) -> System.Collections.Generic.IEnumerable! +const GitVersion.Git.ReferenceName.LocalBranchPrefix = "refs/heads/" -> string! +const GitVersion.Git.ReferenceName.OriginPrefix = "origin/" -> string! +const GitVersion.Git.ReferenceName.RemoteTrackingBranchPrefix = "refs/remotes/" -> string! +const GitVersion.Git.ReferenceName.TagPrefix = "refs/tags/" -> string! GitVersion.Agents.IBuildAgent GitVersion.Agents.IBuildAgent.CanApplyToCurrentContext() -> bool GitVersion.Agents.IBuildAgent.GetCurrentBranch(bool usingDynamicRepos) -> string? @@ -11,108 +11,55 @@ GitVersion.Agents.IBuildAgent.PreventFetch() -> bool GitVersion.Agents.IBuildAgent.ShouldCleanUpRemotes() -> bool GitVersion.Agents.IBuildAgent.WriteIntegration(System.Action! writer, GitVersion.OutputVariables.GitVersionVariables! variables, bool updateBuildNumber = true) -> void GitVersion.Agents.ICurrentBuildAgent -GitVersion.Agents.LocalBuild -GitVersion.Agents.LocalBuild.LocalBuild(GitVersion.IEnvironment! environment, GitVersion.Logging.ILog! log) -> void GitVersion.AssemblySettingsInfo GitVersion.AssemblySettingsInfo.AssemblySettingsInfo() -> void GitVersion.AssemblySettingsInfo.EnsureAssemblyInfo -> bool GitVersion.AssemblySettingsInfo.Files -> System.Collections.Generic.ISet! GitVersion.AssemblySettingsInfo.UpdateAssemblyInfo -> bool GitVersion.AssemblySettingsInfo.UpdateProjectFiles -> bool -GitVersion.Attributes.Format -GitVersion.Attributes.Format.Date = 0 -> GitVersion.Attributes.Format -GitVersion.Attributes.Format.DateTime = 1 -> GitVersion.Attributes.Format -GitVersion.Attributes.Format.Duration = 2 -> GitVersion.Attributes.Format -GitVersion.Attributes.Format.Email = 3 -> GitVersion.Attributes.Format -GitVersion.Attributes.Format.Hostname = 4 -> GitVersion.Attributes.Format -GitVersion.Attributes.Format.IdnEmail = 5 -> GitVersion.Attributes.Format -GitVersion.Attributes.Format.IdnHostname = 6 -> GitVersion.Attributes.Format -GitVersion.Attributes.Format.Ipv4 = 7 -> GitVersion.Attributes.Format -GitVersion.Attributes.Format.Ipv6 = 8 -> GitVersion.Attributes.Format -GitVersion.Attributes.Format.Iri = 9 -> GitVersion.Attributes.Format -GitVersion.Attributes.Format.IriReference = 10 -> GitVersion.Attributes.Format -GitVersion.Attributes.Format.JsonPointer = 11 -> GitVersion.Attributes.Format -GitVersion.Attributes.Format.Regex = 12 -> GitVersion.Attributes.Format -GitVersion.Attributes.Format.RelativeJsonPointer = 13 -> GitVersion.Attributes.Format -GitVersion.Attributes.Format.Time = 14 -> GitVersion.Attributes.Format -GitVersion.Attributes.Format.Uri = 15 -> GitVersion.Attributes.Format -GitVersion.Attributes.Format.UriReference = 16 -> GitVersion.Attributes.Format -GitVersion.Attributes.Format.UriTemplate = 17 -> GitVersion.Attributes.Format -GitVersion.Attributes.Format.Uuid = 18 -> GitVersion.Attributes.Format -GitVersion.Attributes.JsonPropertyDefaultAttribute -GitVersion.Attributes.JsonPropertyDefaultAttribute.JsonPropertyDefaultAttribute(object? boxedValue) -> void -GitVersion.Attributes.JsonPropertyDefaultAttribute.Value.get -> string! -GitVersion.Attributes.JsonPropertyDefaultAttribute.JsonPropertyDefaultAttribute(bool value) -> void -GitVersion.Attributes.JsonPropertyDefaultAttribute.JsonPropertyDefaultAttribute(string? value) -> void -GitVersion.Attributes.JsonPropertyDefaultAttribute.JsonPropertyDefaultAttribute(GitVersion.Extensions.AssemblyFileVersioningScheme value) -> void -GitVersion.Attributes.JsonPropertyDefaultAttribute.JsonPropertyDefaultAttribute(GitVersion.Extensions.AssemblyVersioningScheme value) -> void -GitVersion.Attributes.JsonPropertyDefaultAttribute.JsonPropertyDefaultAttribute(GitVersion.SemanticVersionFormat value) -> void -GitVersion.Attributes.JsonPropertyDescriptionAttribute -GitVersion.Attributes.JsonPropertyDescriptionAttribute.Description.get -> string! -GitVersion.Attributes.JsonPropertyDescriptionAttribute.JsonPropertyDescriptionAttribute(string! description) -> void -GitVersion.Attributes.JsonPropertyFormatAttribute -GitVersion.Attributes.JsonPropertyFormatAttribute.Format.get -> GitVersion.Attributes.Format -GitVersion.Attributes.JsonPropertyFormatAttribute.JsonPropertyFormatAttribute(GitVersion.Attributes.Format format) -> void -GitVersion.AuthenticationInfo -GitVersion.AuthenticationInfo.Password.get -> string? -GitVersion.AuthenticationInfo.Password.set -> void -GitVersion.AuthenticationInfo.Token.get -> string? -GitVersion.AuthenticationInfo.Token.set -> void -GitVersion.AuthenticationInfo.Username.get -> string? -GitVersion.AuthenticationInfo.Username.set -> void -GitVersion.BranchCommit -GitVersion.BranchCommit.Branch.get -> GitVersion.IBranch! -GitVersion.BranchCommit.BranchCommit() -> void -GitVersion.BranchCommit.BranchCommit(GitVersion.ICommit! commit, GitVersion.IBranch! branch) -> void -GitVersion.BranchCommit.Commit.get -> GitVersion.ICommit! -GitVersion.BranchCommit.Equals(GitVersion.BranchCommit? other) -> bool GitVersion.BugException GitVersion.BugException.BugException() -> void GitVersion.BugException.BugException(string! message) -> void GitVersion.BugException.BugException(string? message, System.Exception? innerException) -> void -GitVersion.CommitExtensions -GitVersion.CommitFilter -GitVersion.CommitFilter.ExcludeReachableFrom.get -> object? -GitVersion.CommitFilter.ExcludeReachableFrom.set -> void -GitVersion.CommitFilter.FirstParentOnly.get -> bool -GitVersion.CommitFilter.FirstParentOnly.set -> void -GitVersion.CommitFilter.IncludeReachableFrom.get -> object? -GitVersion.CommitFilter.IncludeReachableFrom.set -> void -GitVersion.CommitFilter.SortBy.get -> GitVersion.CommitSortStrategies -GitVersion.CommitFilter.SortBy.set -> void -GitVersion.CommitSortStrategies -GitVersion.CommitSortStrategies.None = 0 -> GitVersion.CommitSortStrategies -GitVersion.CommitSortStrategies.Reverse = 4 -> GitVersion.CommitSortStrategies -GitVersion.CommitSortStrategies.Time = 2 -> GitVersion.CommitSortStrategies -GitVersion.CommitSortStrategies.Topological = 1 -> GitVersion.CommitSortStrategies GitVersion.Common.IRepositoryStore -GitVersion.Common.IRepositoryStore.ExcludingBranches(System.Collections.Generic.IEnumerable! branchesToExclude) -> System.Collections.Generic.IEnumerable! -GitVersion.Common.IRepositoryStore.FindBranch(GitVersion.ReferenceName! branchName) -> GitVersion.IBranch? -GitVersion.Common.IRepositoryStore.FindBranch(string! branchName) -> GitVersion.IBranch? -GitVersion.Common.IRepositoryStore.FindCommitBranchWasBranchedFrom(GitVersion.IBranch? branch, GitVersion.Configuration.IGitVersionConfiguration! configuration, params GitVersion.IBranch![]! excludedBranches) -> GitVersion.BranchCommit -GitVersion.Common.IRepositoryStore.FindCommitBranchesWasBranchedFrom(GitVersion.IBranch! branch, GitVersion.Configuration.IGitVersionConfiguration! configuration, System.Collections.Generic.IEnumerable! excludedBranches) -> System.Collections.Generic.IEnumerable! -GitVersion.Common.IRepositoryStore.FindCommitBranchesWasBranchedFrom(GitVersion.IBranch! branch, GitVersion.Configuration.IGitVersionConfiguration! configuration, params GitVersion.IBranch![]! excludedBranches) -> System.Collections.Generic.IEnumerable! -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, GitVersion.Configuration.IIgnoreConfiguration! ignore) -> System.Collections.Generic.IReadOnlyList! -GitVersion.Common.IRepositoryStore.GetCurrentCommit(GitVersion.IBranch! currentBranch, string? commitId, GitVersion.Configuration.IIgnoreConfiguration! ignore) -> GitVersion.ICommit? +GitVersion.Common.IRepositoryStore.ExcludingBranches(System.Collections.Generic.IEnumerable! branchesToExclude) -> System.Collections.Generic.IEnumerable! +GitVersion.Common.IRepositoryStore.FindBranch(GitVersion.Git.ReferenceName! branchName) -> GitVersion.Git.IBranch? +GitVersion.Common.IRepositoryStore.FindBranch(string! branchName) -> GitVersion.Git.IBranch? +GitVersion.Common.IRepositoryStore.FindCommitBranchesWasBranchedFrom(GitVersion.Git.IBranch! branch, GitVersion.Configuration.IGitVersionConfiguration! configuration, params GitVersion.Git.IBranch![]! excludedBranches) -> System.Collections.Generic.IEnumerable! +GitVersion.Common.IRepositoryStore.FindCommitBranchesWasBranchedFrom(GitVersion.Git.IBranch! branch, GitVersion.Configuration.IGitVersionConfiguration! configuration, System.Collections.Generic.IEnumerable! excludedBranches) -> System.Collections.Generic.IEnumerable! +GitVersion.Common.IRepositoryStore.FindCommitBranchWasBranchedFrom(GitVersion.Git.IBranch? branch, GitVersion.Configuration.IGitVersionConfiguration! configuration, params GitVersion.Git.IBranch![]! excludedBranches) -> GitVersion.Git.BranchCommit +GitVersion.Common.IRepositoryStore.FindMergeBase(GitVersion.Git.IBranch? branch, GitVersion.Git.IBranch? otherBranch) -> GitVersion.Git.ICommit? +GitVersion.Common.IRepositoryStore.FindMergeBase(GitVersion.Git.ICommit! commit, GitVersion.Git.ICommit! mainlineTip) -> GitVersion.Git.ICommit? +GitVersion.Common.IRepositoryStore.GetBranchesContainingCommit(GitVersion.Git.ICommit! commit, System.Collections.Generic.IEnumerable? branches = null, bool onlyTrackedBranches = false) -> System.Collections.Generic.IEnumerable! +GitVersion.Common.IRepositoryStore.GetCommitLog(GitVersion.Git.ICommit? baseVersionSource, GitVersion.Git.ICommit! currentCommit, GitVersion.Configuration.IIgnoreConfiguration! ignore) -> System.Collections.Generic.IReadOnlyList! +GitVersion.Common.IRepositoryStore.GetCurrentCommit(GitVersion.Git.IBranch! currentBranch, string? commitId, GitVersion.Configuration.IIgnoreConfiguration! ignore) -> GitVersion.Git.ICommit? GitVersion.Common.IRepositoryStore.GetNumberOfUncommittedChanges() -> int -GitVersion.Common.IRepositoryStore.GetSourceBranches(GitVersion.IBranch! branch, GitVersion.Configuration.IGitVersionConfiguration! configuration, System.Collections.Generic.IEnumerable! excludedBranches) -> System.Collections.Generic.IEnumerable! -GitVersion.Common.IRepositoryStore.GetSourceBranches(GitVersion.IBranch! branch, GitVersion.Configuration.IGitVersionConfiguration! configuration, params GitVersion.IBranch![]! excludedBranches) -> System.Collections.Generic.IEnumerable! -GitVersion.Common.IRepositoryStore.GetTargetBranch(string? targetBranchName) -> GitVersion.IBranch! -GitVersion.Common.IRepositoryStore.IsCommitOnBranch(GitVersion.ICommit? baseVersionSource, GitVersion.IBranch! branch, GitVersion.ICommit! firstMatchingCommit) -> bool -GitVersion.Configuration.ConfigurationExtensions +GitVersion.Common.IRepositoryStore.GetSourceBranches(GitVersion.Git.IBranch! branch, GitVersion.Configuration.IGitVersionConfiguration! configuration, params GitVersion.Git.IBranch![]! excludedBranches) -> System.Collections.Generic.IEnumerable! +GitVersion.Common.IRepositoryStore.GetSourceBranches(GitVersion.Git.IBranch! branch, GitVersion.Configuration.IGitVersionConfiguration! configuration, System.Collections.Generic.IEnumerable! excludedBranches) -> System.Collections.Generic.IEnumerable! +GitVersion.Common.IRepositoryStore.GetTargetBranch(string? targetBranchName) -> GitVersion.Git.IBranch! +GitVersion.Common.IRepositoryStore.IsCommitOnBranch(GitVersion.Git.ICommit? baseVersionSource, GitVersion.Git.IBranch! branch, GitVersion.Git.ICommit! firstMatchingCommit) -> bool +GitVersion.Configuration.AssemblyFileVersioningScheme +GitVersion.Configuration.AssemblyFileVersioningScheme.Major = 3 -> GitVersion.Configuration.AssemblyFileVersioningScheme +GitVersion.Configuration.AssemblyFileVersioningScheme.MajorMinor = 2 -> GitVersion.Configuration.AssemblyFileVersioningScheme +GitVersion.Configuration.AssemblyFileVersioningScheme.MajorMinorPatch = 1 -> GitVersion.Configuration.AssemblyFileVersioningScheme +GitVersion.Configuration.AssemblyFileVersioningScheme.MajorMinorPatchTag = 0 -> GitVersion.Configuration.AssemblyFileVersioningScheme +GitVersion.Configuration.AssemblyFileVersioningScheme.None = 4 -> GitVersion.Configuration.AssemblyFileVersioningScheme +GitVersion.Configuration.AssemblyVersioningScheme +GitVersion.Configuration.AssemblyVersioningScheme.Major = 3 -> GitVersion.Configuration.AssemblyVersioningScheme +GitVersion.Configuration.AssemblyVersioningScheme.MajorMinor = 2 -> GitVersion.Configuration.AssemblyVersioningScheme +GitVersion.Configuration.AssemblyVersioningScheme.MajorMinorPatch = 1 -> GitVersion.Configuration.AssemblyVersioningScheme +GitVersion.Configuration.AssemblyVersioningScheme.MajorMinorPatchTag = 0 -> GitVersion.Configuration.AssemblyVersioningScheme +GitVersion.Configuration.AssemblyVersioningScheme.None = 4 -> GitVersion.Configuration.AssemblyVersioningScheme GitVersion.Configuration.EffectiveBranchConfiguration -GitVersion.Configuration.EffectiveBranchConfiguration.Branch.get -> GitVersion.IBranch! -GitVersion.Configuration.EffectiveBranchConfiguration.EffectiveBranchConfiguration(GitVersion.Configuration.EffectiveConfiguration! Value, GitVersion.IBranch! Branch) -> void +GitVersion.Configuration.EffectiveBranchConfiguration.Branch.get -> GitVersion.Git.IBranch! +GitVersion.Configuration.EffectiveBranchConfiguration.EffectiveBranchConfiguration(GitVersion.Configuration.EffectiveConfiguration! Value, GitVersion.Git.IBranch! Branch) -> 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.AssemblyFileVersioningScheme.get -> GitVersion.Configuration.AssemblyFileVersioningScheme GitVersion.Configuration.EffectiveConfiguration.AssemblyInformationalFormat.get -> string? GitVersion.Configuration.EffectiveConfiguration.AssemblyVersioningFormat.get -> string? -GitVersion.Configuration.EffectiveConfiguration.AssemblyVersioningScheme.get -> GitVersion.Extensions.AssemblyVersioningScheme +GitVersion.Configuration.EffectiveConfiguration.AssemblyVersioningScheme.get -> GitVersion.Configuration.AssemblyVersioningScheme GitVersion.Configuration.EffectiveConfiguration.DeploymentMode.get -> GitVersion.VersionCalculation.DeploymentMode GitVersion.Configuration.EffectiveConfiguration.EffectiveConfiguration(GitVersion.Configuration.IGitVersionConfiguration! configuration, GitVersion.Configuration.IBranchConfiguration! branchConfiguration) -> void GitVersion.Configuration.EffectiveConfiguration.Ignore.get -> GitVersion.Configuration.IIgnoreConfiguration! @@ -170,10 +117,10 @@ GitVersion.Configuration.IConfigurationProvider GitVersion.Configuration.IConfigurationProvider.Provide(System.Collections.Generic.IReadOnlyDictionary? overrideConfiguration = null) -> GitVersion.Configuration.IGitVersionConfiguration! GitVersion.Configuration.IGitVersionConfiguration GitVersion.Configuration.IGitVersionConfiguration.AssemblyFileVersioningFormat.get -> string? -GitVersion.Configuration.IGitVersionConfiguration.AssemblyFileVersioningScheme.get -> GitVersion.Extensions.AssemblyFileVersioningScheme? +GitVersion.Configuration.IGitVersionConfiguration.AssemblyFileVersioningScheme.get -> GitVersion.Configuration.AssemblyFileVersioningScheme? GitVersion.Configuration.IGitVersionConfiguration.AssemblyInformationalFormat.get -> string? GitVersion.Configuration.IGitVersionConfiguration.AssemblyVersioningFormat.get -> string? -GitVersion.Configuration.IGitVersionConfiguration.AssemblyVersioningScheme.get -> GitVersion.Extensions.AssemblyVersioningScheme? +GitVersion.Configuration.IGitVersionConfiguration.AssemblyVersioningScheme.get -> GitVersion.Configuration.AssemblyVersioningScheme? GitVersion.Configuration.IGitVersionConfiguration.Branches.get -> System.Collections.Generic.IReadOnlyDictionary! GitVersion.Configuration.IGitVersionConfiguration.CommitDateFormat.get -> string? GitVersion.Configuration.IGitVersionConfiguration.GetEmptyBranchConfiguration() -> GitVersion.Configuration.IBranchConfiguration! @@ -187,13 +134,11 @@ GitVersion.Configuration.IGitVersionConfiguration.NextVersion.get -> string? GitVersion.Configuration.IGitVersionConfiguration.NoBumpMessage.get -> string? GitVersion.Configuration.IGitVersionConfiguration.PatchVersionBumpMessage.get -> string? GitVersion.Configuration.IGitVersionConfiguration.SemanticVersionFormat.get -> GitVersion.SemanticVersionFormat -GitVersion.Configuration.IGitVersionConfiguration.ToJsonString() -> string! GitVersion.Configuration.IGitVersionConfiguration.UpdateBuildNumber.get -> bool GitVersion.Configuration.IGitVersionConfiguration.VersionInBranchPattern.get -> string? GitVersion.Configuration.IGitVersionConfiguration.VersionInBranchRegex.get -> System.Text.RegularExpressions.Regex! GitVersion.Configuration.IGitVersionConfiguration.VersionStrategy.get -> GitVersion.VersionCalculation.VersionStrategies GitVersion.Configuration.IGitVersionConfiguration.Workflow.get -> string? -GitVersion.Configuration.IgnoreConfigurationExtensions GitVersion.Configuration.IIgnoreConfiguration GitVersion.Configuration.IIgnoreConfiguration.Before.get -> System.DateTimeOffset? GitVersion.Configuration.IIgnoreConfiguration.IsEmpty.get -> bool @@ -204,34 +149,148 @@ GitVersion.Configuration.IPreventIncrementConfiguration.WhenBranchMerged.get -> GitVersion.Configuration.IPreventIncrementConfiguration.WhenCurrentCommitTagged.get -> bool? GitVersion.ConfigurationInfo GitVersion.ConfigurationInfo.ConfigurationFile -> string? -GitVersion.ConfigurationInfo.ConfigurationInfo() -> void GitVersion.ConfigurationInfo.OverrideConfiguration -> System.Collections.Generic.IReadOnlyDictionary? GitVersion.ConfigurationInfo.ShowConfiguration -> bool -GitVersion.Extensions.AssemblyFileVersioningScheme -GitVersion.Extensions.AssemblyFileVersioningScheme.Major = 3 -> GitVersion.Extensions.AssemblyFileVersioningScheme -GitVersion.Extensions.AssemblyFileVersioningScheme.MajorMinor = 2 -> GitVersion.Extensions.AssemblyFileVersioningScheme -GitVersion.Extensions.AssemblyFileVersioningScheme.MajorMinorPatch = 1 -> GitVersion.Extensions.AssemblyFileVersioningScheme -GitVersion.Extensions.AssemblyFileVersioningScheme.MajorMinorPatchTag = 0 -> GitVersion.Extensions.AssemblyFileVersioningScheme -GitVersion.Extensions.AssemblyFileVersioningScheme.None = 4 -> GitVersion.Extensions.AssemblyFileVersioningScheme -GitVersion.Extensions.AssemblyVersioningScheme -GitVersion.Extensions.AssemblyVersioningScheme.Major = 3 -> GitVersion.Extensions.AssemblyVersioningScheme -GitVersion.Extensions.AssemblyVersioningScheme.MajorMinor = 2 -> GitVersion.Extensions.AssemblyVersioningScheme -GitVersion.Extensions.AssemblyVersioningScheme.MajorMinorPatch = 1 -> GitVersion.Extensions.AssemblyVersioningScheme -GitVersion.Extensions.AssemblyVersioningScheme.MajorMinorPatchTag = 0 -> GitVersion.Extensions.AssemblyVersioningScheme -GitVersion.Extensions.AssemblyVersioningScheme.None = 4 -> GitVersion.Extensions.AssemblyVersioningScheme GitVersion.Extensions.AssemblyVersionsGeneratorExtensions GitVersion.Extensions.CommonExtensions GitVersion.Extensions.DictionaryExtensions GitVersion.Extensions.EnumerableExtensions GitVersion.Extensions.GitExtensions +GitVersion.Extensions.IncrementStrategyExtensions GitVersion.Extensions.ReadEmbeddedResourceExtensions GitVersion.Extensions.ServiceCollectionExtensions GitVersion.Extensions.StringExtensions GitVersion.FileWriteInfo GitVersion.FileWriteInfo.FileExtension.get -> string! +GitVersion.FileWriteInfo.FileExtension.init -> void GitVersion.FileWriteInfo.FileName.get -> string! -GitVersion.FileWriteInfo.FileWriteInfo(string! workingDirectory, string! fileName, string! fileExtension) -> void +GitVersion.FileWriteInfo.FileName.init -> void +GitVersion.FileWriteInfo.FileWriteInfo(string! WorkingDirectory, string! FileName, string! FileExtension) -> void GitVersion.FileWriteInfo.WorkingDirectory.get -> string! +GitVersion.FileWriteInfo.WorkingDirectory.init -> void +GitVersion.Git.AuthenticationInfo +GitVersion.Git.AuthenticationInfo.Password.get -> string? +GitVersion.Git.AuthenticationInfo.Password.set -> void +GitVersion.Git.AuthenticationInfo.Token.get -> string? +GitVersion.Git.AuthenticationInfo.Token.set -> void +GitVersion.Git.AuthenticationInfo.Username.get -> string? +GitVersion.Git.AuthenticationInfo.Username.set -> void +GitVersion.Git.BranchCommit +GitVersion.Git.BranchCommit.Branch.get -> GitVersion.Git.IBranch! +GitVersion.Git.BranchCommit.BranchCommit() -> void +GitVersion.Git.BranchCommit.BranchCommit(GitVersion.Git.ICommit! commit, GitVersion.Git.IBranch! branch) -> void +GitVersion.Git.BranchCommit.Commit.get -> GitVersion.Git.ICommit! +GitVersion.Git.BranchCommit.Equals(GitVersion.Git.BranchCommit? other) -> bool +GitVersion.Git.CommitExtensions +GitVersion.Git.CommitFilter +GitVersion.Git.CommitFilter.ExcludeReachableFrom.get -> object? +GitVersion.Git.CommitFilter.ExcludeReachableFrom.set -> void +GitVersion.Git.CommitFilter.FirstParentOnly.get -> bool +GitVersion.Git.CommitFilter.FirstParentOnly.set -> void +GitVersion.Git.CommitFilter.IncludeReachableFrom.get -> object? +GitVersion.Git.CommitFilter.IncludeReachableFrom.set -> void +GitVersion.Git.CommitFilter.SortBy.get -> GitVersion.Git.CommitSortStrategies +GitVersion.Git.CommitFilter.SortBy.set -> void +GitVersion.Git.CommitSortStrategies +GitVersion.Git.CommitSortStrategies.None = 0 -> GitVersion.Git.CommitSortStrategies +GitVersion.Git.CommitSortStrategies.Reverse = 4 -> GitVersion.Git.CommitSortStrategies +GitVersion.Git.CommitSortStrategies.Time = 2 -> GitVersion.Git.CommitSortStrategies +GitVersion.Git.CommitSortStrategies.Topological = 1 -> GitVersion.Git.CommitSortStrategies +GitVersion.Git.IBranch +GitVersion.Git.IBranch.Commits.get -> GitVersion.Git.ICommitCollection! +GitVersion.Git.IBranch.IsDetachedHead.get -> bool +GitVersion.Git.IBranch.IsRemote.get -> bool +GitVersion.Git.IBranch.IsTracking.get -> bool +GitVersion.Git.IBranch.Tip.get -> GitVersion.Git.ICommit? +GitVersion.Git.IBranchCollection +GitVersion.Git.IBranchCollection.ExcludeBranches(System.Collections.Generic.IEnumerable! branchesToExclude) -> System.Collections.Generic.IEnumerable! +GitVersion.Git.IBranchCollection.this[string! name].get -> GitVersion.Git.IBranch? +GitVersion.Git.IBranchCollection.UpdateTrackedBranch(GitVersion.Git.IBranch! branch, string! remoteTrackingReferenceName) -> void +GitVersion.Git.ICommit +GitVersion.Git.ICommit.Message.get -> string! +GitVersion.Git.ICommit.Parents.get -> System.Collections.Generic.IReadOnlyList! +GitVersion.Git.ICommit.When.get -> System.DateTimeOffset +GitVersion.Git.ICommitCollection +GitVersion.Git.ICommitCollection.GetCommitsPriorTo(System.DateTimeOffset olderThan) -> System.Collections.Generic.IEnumerable! +GitVersion.Git.ICommitCollection.QueryBy(GitVersion.Git.CommitFilter! commitFilter) -> System.Collections.Generic.IEnumerable! +GitVersion.Git.IGitObject +GitVersion.Git.IGitObject.Id.get -> GitVersion.Git.IObjectId! +GitVersion.Git.IGitObject.Sha.get -> string! +GitVersion.Git.IGitRepository +GitVersion.Git.IGitRepository.Branches.get -> GitVersion.Git.IBranchCollection! +GitVersion.Git.IGitRepository.Commits.get -> GitVersion.Git.ICommitCollection! +GitVersion.Git.IGitRepository.DiscoverRepository(string? gitDirectory) -> void +GitVersion.Git.IGitRepository.FindMergeBase(GitVersion.Git.ICommit! commit, GitVersion.Git.ICommit! otherCommit) -> GitVersion.Git.ICommit? +GitVersion.Git.IGitRepository.GetNumberOfUncommittedChanges() -> int +GitVersion.Git.IGitRepository.Head.get -> GitVersion.Git.IBranch! +GitVersion.Git.IGitRepository.IsHeadDetached.get -> bool +GitVersion.Git.IGitRepository.IsShallow.get -> bool +GitVersion.Git.IGitRepository.Path.get -> string! +GitVersion.Git.IGitRepository.Refs.get -> GitVersion.Git.IReferenceCollection! +GitVersion.Git.IGitRepository.Remotes.get -> GitVersion.Git.IRemoteCollection! +GitVersion.Git.IGitRepository.Tags.get -> GitVersion.Git.ITagCollection! +GitVersion.Git.IGitRepository.WorkingDirectory.get -> string! +GitVersion.Git.IGitRepositoryInfo +GitVersion.Git.IGitRepositoryInfo.DotGitDirectory.get -> string? +GitVersion.Git.IGitRepositoryInfo.DynamicGitRepositoryPath.get -> string? +GitVersion.Git.IGitRepositoryInfo.GitRootPath.get -> string? +GitVersion.Git.IGitRepositoryInfo.ProjectRootDirectory.get -> string? +GitVersion.Git.IMutatingGitRepository +GitVersion.Git.IMutatingGitRepository.Checkout(string! commitOrBranchSpec) -> void +GitVersion.Git.IMutatingGitRepository.Clone(string? sourceUrl, string? workdirPath, GitVersion.Git.AuthenticationInfo! auth) -> void +GitVersion.Git.IMutatingGitRepository.CreateBranchForPullRequestBranch(GitVersion.Git.AuthenticationInfo! auth) -> void +GitVersion.Git.IMutatingGitRepository.Fetch(string! remote, System.Collections.Generic.IEnumerable! refSpecs, GitVersion.Git.AuthenticationInfo! auth, string? logMessage) -> void +GitVersion.Git.INamedReference +GitVersion.Git.INamedReference.Name.get -> GitVersion.Git.ReferenceName! +GitVersion.Git.IObjectId +GitVersion.Git.IObjectId.Sha.get -> string! +GitVersion.Git.IObjectId.ToString(int prefixLength) -> string! +GitVersion.Git.IReference +GitVersion.Git.IReference.ReferenceTargetId.get -> GitVersion.Git.IObjectId? +GitVersion.Git.IReference.TargetIdentifier.get -> string! +GitVersion.Git.IReferenceCollection +GitVersion.Git.IReferenceCollection.Add(string! name, string! canonicalRefNameOrObject, bool allowOverwrite = false) -> void +GitVersion.Git.IReferenceCollection.FromGlob(string! prefix) -> System.Collections.Generic.IEnumerable! +GitVersion.Git.IReferenceCollection.Head.get -> GitVersion.Git.IReference? +GitVersion.Git.IReferenceCollection.this[GitVersion.Git.ReferenceName! referenceName].get -> GitVersion.Git.IReference? +GitVersion.Git.IReferenceCollection.this[string! name].get -> GitVersion.Git.IReference? +GitVersion.Git.IReferenceCollection.UpdateTarget(GitVersion.Git.IReference! directRef, GitVersion.Git.IObjectId! targetId) -> void +GitVersion.Git.IRefSpec +GitVersion.Git.IRefSpec.Destination.get -> string! +GitVersion.Git.IRefSpec.Direction.get -> GitVersion.Git.RefSpecDirection +GitVersion.Git.IRefSpec.Source.get -> string! +GitVersion.Git.IRefSpec.Specification.get -> string! +GitVersion.Git.IRefSpecCollection +GitVersion.Git.IRemote +GitVersion.Git.IRemote.FetchRefSpecs.get -> System.Collections.Generic.IEnumerable! +GitVersion.Git.IRemote.Name.get -> string! +GitVersion.Git.IRemote.PushRefSpecs.get -> System.Collections.Generic.IEnumerable! +GitVersion.Git.IRemote.RefSpecs.get -> System.Collections.Generic.IEnumerable! +GitVersion.Git.IRemote.Url.get -> string! +GitVersion.Git.IRemoteCollection +GitVersion.Git.IRemoteCollection.Remove(string! remoteName) -> void +GitVersion.Git.IRemoteCollection.this[string! name].get -> GitVersion.Git.IRemote? +GitVersion.Git.IRemoteCollection.Update(string! remoteName, string! refSpec) -> void +GitVersion.Git.ITag +GitVersion.Git.ITag.Commit.get -> GitVersion.Git.ICommit! +GitVersion.Git.ITag.TargetSha.get -> string! +GitVersion.Git.ITagCollection +GitVersion.Git.ReferenceName +GitVersion.Git.ReferenceName.Canonical.get -> string! +GitVersion.Git.ReferenceName.CompareTo(GitVersion.Git.ReferenceName? other) -> int +GitVersion.Git.ReferenceName.Equals(GitVersion.Git.ReferenceName? other) -> bool +GitVersion.Git.ReferenceName.EquivalentTo(string? name) -> bool +GitVersion.Git.ReferenceName.Friendly.get -> string! +GitVersion.Git.ReferenceName.IsLocalBranch.get -> bool +GitVersion.Git.ReferenceName.IsPullRequest.get -> bool +GitVersion.Git.ReferenceName.IsRemoteBranch.get -> bool +GitVersion.Git.ReferenceName.IsTag.get -> bool +GitVersion.Git.ReferenceName.ReferenceName(string! canonical) -> void +GitVersion.Git.ReferenceName.TryGetSemanticVersion(out (GitVersion.SemanticVersion! Value, string? Name) result, System.Text.RegularExpressions.Regex! versionPatternRegex, string? tagPrefix, GitVersion.SemanticVersionFormat format) -> bool +GitVersion.Git.ReferenceName.WithoutOrigin.get -> string! +GitVersion.Git.RefSpecDirection +GitVersion.Git.RefSpecDirection.Fetch = 0 -> GitVersion.Git.RefSpecDirection +GitVersion.Git.RefSpecDirection.Push = 1 -> GitVersion.Git.RefSpecDirection GitVersion.GitToolsException GitVersion.GitToolsException.GitToolsException() -> void GitVersion.GitToolsException.GitToolsException(string! message, System.Exception! innerException) -> void @@ -242,10 +301,10 @@ GitVersion.GitVersionCommonModule.GitVersionCommonModule() -> void GitVersion.GitVersionCommonModule.RegisterTypes(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void GitVersion.GitVersionContext GitVersion.GitVersionContext.Configuration.get -> GitVersion.Configuration.IGitVersionConfiguration! -GitVersion.GitVersionContext.CurrentBranch.get -> GitVersion.IBranch! -GitVersion.GitVersionContext.CurrentBranchCommits.get -> System.Collections.Generic.IEnumerable! -GitVersion.GitVersionContext.CurrentCommit.get -> GitVersion.ICommit! -GitVersion.GitVersionContext.GitVersionContext(GitVersion.IBranch! currentBranch, GitVersion.ICommit! currentCommit, GitVersion.Configuration.IGitVersionConfiguration! configuration, bool isCurrentCommitTagged, int numberOfUncommittedChanges) -> void +GitVersion.GitVersionContext.CurrentBranch.get -> GitVersion.Git.IBranch! +GitVersion.GitVersionContext.CurrentBranchCommits.get -> System.Collections.Generic.IEnumerable! +GitVersion.GitVersionContext.CurrentCommit.get -> GitVersion.Git.ICommit! +GitVersion.GitVersionContext.GitVersionContext(GitVersion.Git.IBranch! currentBranch, GitVersion.Git.ICommit! currentCommit, GitVersion.Configuration.IGitVersionConfiguration! configuration, bool isCurrentCommitTagged, int numberOfUncommittedChanges) -> void GitVersion.GitVersionContext.IsCurrentCommitTagged.get -> bool GitVersion.GitVersionContext.NumberOfUncommittedChanges.get -> int GitVersion.GitVersionCoreModule @@ -258,7 +317,7 @@ GitVersion.GitVersionException.GitVersionException(string! message, System.Excep GitVersion.GitVersionException.GitVersionException(string! messageFormat, params object![]! args) -> void GitVersion.GitVersionOptions GitVersion.GitVersionOptions.AssemblySettingsInfo.get -> GitVersion.AssemblySettingsInfo! -GitVersion.GitVersionOptions.AuthenticationInfo.get -> GitVersion.AuthenticationInfo! +GitVersion.GitVersionOptions.AuthenticationInfo.get -> GitVersion.Git.AuthenticationInfo! GitVersion.GitVersionOptions.ConfigurationInfo.get -> GitVersion.ConfigurationInfo! GitVersion.GitVersionOptions.Diag -> bool GitVersion.GitVersionOptions.Format -> string? @@ -292,23 +351,6 @@ GitVersion.Helpers.RetryAction GitVersion.Helpers.RetryAction.Execute(System.Action! operation) -> void GitVersion.Helpers.RetryAction.RetryAction(int maxRetries = 5) -> void GitVersion.Helpers.ServiceMessageEscapeHelper -GitVersion.IBranch -GitVersion.IBranch.Commits.get -> GitVersion.ICommitCollection! -GitVersion.IBranch.IsDetachedHead.get -> bool -GitVersion.IBranch.IsRemote.get -> bool -GitVersion.IBranch.IsTracking.get -> bool -GitVersion.IBranch.Tip.get -> GitVersion.ICommit? -GitVersion.IBranchCollection -GitVersion.IBranchCollection.ExcludeBranches(System.Collections.Generic.IEnumerable! branchesToExclude) -> System.Collections.Generic.IEnumerable! -GitVersion.IBranchCollection.UpdateTrackedBranch(GitVersion.IBranch! branch, string! remoteTrackingReferenceName) -> void -GitVersion.IBranchCollection.this[string! name].get -> GitVersion.IBranch? -GitVersion.ICommit -GitVersion.ICommit.Message.get -> string! -GitVersion.ICommit.Parents.get -> System.Collections.Generic.IReadOnlyList! -GitVersion.ICommit.When.get -> System.DateTimeOffset -GitVersion.ICommitCollection -GitVersion.ICommitCollection.GetCommitsPriorTo(System.DateTimeOffset olderThan) -> System.Collections.Generic.IEnumerable! -GitVersion.ICommitCollection.QueryBy(GitVersion.CommitFilter! commitFilter) -> System.Collections.Generic.IEnumerable! GitVersion.IConverterContext GitVersion.IConverterContext.WorkingDirectory.get -> string! GitVersion.IEnvironment @@ -328,31 +370,9 @@ GitVersion.IFileSystem.OpenWrite(string! path) -> System.IO.Stream! GitVersion.IFileSystem.ReadAllText(string! path) -> string! GitVersion.IFileSystem.WriteAllText(string? file, string! fileContents) -> void GitVersion.IFileSystem.WriteAllText(string? file, string! fileContents, System.Text.Encoding! encoding) -> void -GitVersion.IGitObject -GitVersion.IGitObject.Id.get -> GitVersion.IObjectId! -GitVersion.IGitObject.Sha.get -> string! GitVersion.IGitPreparer -GitVersion.IGitPreparer.EnsureLocalBranchExistsForCurrentBranch(GitVersion.IRemote! remote, string! currentBranch) -> void +GitVersion.IGitPreparer.EnsureLocalBranchExistsForCurrentBranch(GitVersion.Git.IRemote! remote, string! currentBranch) -> void GitVersion.IGitPreparer.Prepare() -> void -GitVersion.IGitRepository -GitVersion.IGitRepository.Branches.get -> GitVersion.IBranchCollection! -GitVersion.IGitRepository.Commits.get -> GitVersion.ICommitCollection! -GitVersion.IGitRepository.DiscoverRepository(string? gitDirectory) -> void -GitVersion.IGitRepository.FindMergeBase(GitVersion.ICommit! commit, GitVersion.ICommit! otherCommit) -> GitVersion.ICommit? -GitVersion.IGitRepository.GetNumberOfUncommittedChanges() -> int -GitVersion.IGitRepository.Head.get -> GitVersion.IBranch! -GitVersion.IGitRepository.IsHeadDetached.get -> bool -GitVersion.IGitRepository.IsShallow.get -> bool -GitVersion.IGitRepository.Path.get -> string! -GitVersion.IGitRepository.Refs.get -> GitVersion.IReferenceCollection! -GitVersion.IGitRepository.Remotes.get -> GitVersion.IRemoteCollection! -GitVersion.IGitRepository.Tags.get -> GitVersion.ITagCollection! -GitVersion.IGitRepository.WorkingDirectory.get -> string! -GitVersion.IGitRepositoryInfo -GitVersion.IGitRepositoryInfo.DotGitDirectory.get -> string? -GitVersion.IGitRepositoryInfo.DynamicGitRepositoryPath.get -> string? -GitVersion.IGitRepositoryInfo.GitRootPath.get -> string? -GitVersion.IGitRepositoryInfo.ProjectRootDirectory.get -> string? GitVersion.IGitVersionCalculateTool GitVersion.IGitVersionCalculateTool.CalculateVersionVariables() -> GitVersion.OutputVariables.GitVersionVariables! GitVersion.IGitVersionContextFactory @@ -360,46 +380,6 @@ GitVersion.IGitVersionContextFactory.Create(GitVersion.GitVersionOptions! gitVer GitVersion.IGitVersionModule GitVersion.IGitVersionModule.FindAllDerivedTypes(System.Reflection.Assembly? assembly) -> System.Collections.Generic.IEnumerable! GitVersion.IGitVersionModule.RegisterTypes(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void -GitVersion.IMutatingGitRepository -GitVersion.IMutatingGitRepository.Checkout(string! commitOrBranchSpec) -> void -GitVersion.IMutatingGitRepository.Clone(string? sourceUrl, string? workdirPath, GitVersion.AuthenticationInfo! auth) -> void -GitVersion.IMutatingGitRepository.CreateBranchForPullRequestBranch(GitVersion.AuthenticationInfo! auth) -> void -GitVersion.IMutatingGitRepository.Fetch(string! remote, System.Collections.Generic.IEnumerable! refSpecs, GitVersion.AuthenticationInfo! auth, string? logMessage) -> void -GitVersion.INamedReference -GitVersion.INamedReference.Name.get -> GitVersion.ReferenceName! -GitVersion.IObjectId -GitVersion.IObjectId.Sha.get -> string! -GitVersion.IObjectId.ToString(int prefixLength) -> string! -GitVersion.IRefSpec -GitVersion.IRefSpec.Destination.get -> string! -GitVersion.IRefSpec.Direction.get -> GitVersion.RefSpecDirection -GitVersion.IRefSpec.Source.get -> string! -GitVersion.IRefSpec.Specification.get -> string! -GitVersion.IRefSpecCollection -GitVersion.IReference -GitVersion.IReference.ReferenceTargetId.get -> GitVersion.IObjectId? -GitVersion.IReference.TargetIdentifier.get -> string! -GitVersion.IReferenceCollection -GitVersion.IReferenceCollection.Add(string! name, string! canonicalRefNameOrObject, bool allowOverwrite = false) -> void -GitVersion.IReferenceCollection.FromGlob(string! prefix) -> System.Collections.Generic.IEnumerable! -GitVersion.IReferenceCollection.Head.get -> GitVersion.IReference? -GitVersion.IReferenceCollection.UpdateTarget(GitVersion.IReference! directRef, GitVersion.IObjectId! targetId) -> void -GitVersion.IReferenceCollection.this[GitVersion.ReferenceName! referenceName].get -> GitVersion.IReference? -GitVersion.IReferenceCollection.this[string! name].get -> GitVersion.IReference? -GitVersion.IRemote -GitVersion.IRemote.FetchRefSpecs.get -> System.Collections.Generic.IEnumerable! -GitVersion.IRemote.Name.get -> string! -GitVersion.IRemote.PushRefSpecs.get -> System.Collections.Generic.IEnumerable! -GitVersion.IRemote.RefSpecs.get -> System.Collections.Generic.IEnumerable! -GitVersion.IRemote.Url.get -> string! -GitVersion.IRemoteCollection -GitVersion.IRemoteCollection.Remove(string! remoteName) -> void -GitVersion.IRemoteCollection.Update(string! remoteName, string! refSpec) -> void -GitVersion.IRemoteCollection.this[string! name].get -> GitVersion.IRemote? -GitVersion.ITag -GitVersion.ITag.Commit.get -> GitVersion.ICommit! -GitVersion.ITag.TargetSha.get -> string! -GitVersion.ITagCollection GitVersion.IVersionConverter GitVersion.IVersionConverter.Execute(GitVersion.OutputVariables.GitVersionVariables! variables, T context) -> void GitVersion.IncrementStrategy @@ -408,7 +388,6 @@ GitVersion.IncrementStrategy.Major = 1 -> GitVersion.IncrementStrategy GitVersion.IncrementStrategy.Minor = 2 -> GitVersion.IncrementStrategy GitVersion.IncrementStrategy.None = 0 -> GitVersion.IncrementStrategy GitVersion.IncrementStrategy.Patch = 3 -> GitVersion.IncrementStrategy -GitVersion.IncrementStrategyExtensions GitVersion.LockedFileException GitVersion.LockedFileException.LockedFileException() -> void GitVersion.LockedFileException.LockedFileException(System.Exception! inner) -> void @@ -448,8 +427,8 @@ GitVersion.Logging.Verbosity.Verbose = 3 -> GitVersion.Logging.Verbosity GitVersion.MergeMessage GitVersion.MergeMessage.FormatName.get -> string? GitVersion.MergeMessage.IsMergedPullRequest.get -> bool +GitVersion.MergeMessage.MergedBranch.get -> GitVersion.Git.ReferenceName? GitVersion.MergeMessage.MergeMessage(string! mergeMessage, GitVersion.Configuration.IGitVersionConfiguration! configuration) -> void -GitVersion.MergeMessage.MergedBranch.get -> GitVersion.ReferenceName? GitVersion.MergeMessage.PullRequestNumber.get -> int? GitVersion.MergeMessage.TargetBranch.get -> string? GitVersion.MergeMessage.Version.get -> GitVersion.SemanticVersion? @@ -516,26 +495,9 @@ GitVersion.OutputVariables.IVersionVariableSerializer.FromFile(string! filePath) GitVersion.OutputVariables.IVersionVariableSerializer.FromJson(string! json) -> GitVersion.OutputVariables.GitVersionVariables! GitVersion.OutputVariables.IVersionVariableSerializer.ToFile(GitVersion.OutputVariables.GitVersionVariables! gitVersionVariables, string! filePath) -> void GitVersion.OutputVariables.IVersionVariableSerializer.ToJson(GitVersion.OutputVariables.GitVersionVariables! gitVersionVariables) -> string! -GitVersion.ReferenceName.TryGetSemanticVersion(out (GitVersion.SemanticVersion! Value, string? Name) result, System.Text.RegularExpressions.Regex! versionPatternRegex, string? tagPrefix, GitVersion.SemanticVersionFormat format) -> bool -GitVersion.RefSpecDirection -GitVersion.RefSpecDirection.Fetch = 0 -> GitVersion.RefSpecDirection -GitVersion.RefSpecDirection.Push = 1 -> GitVersion.RefSpecDirection -GitVersion.ReferenceName -GitVersion.ReferenceName.Canonical.get -> string! -GitVersion.ReferenceName.CompareTo(GitVersion.ReferenceName? other) -> int -GitVersion.ReferenceName.Equals(GitVersion.ReferenceName? other) -> bool -GitVersion.ReferenceName.EquivalentTo(string? name) -> bool -GitVersion.ReferenceName.Friendly.get -> string! -GitVersion.ReferenceName.IsLocalBranch.get -> bool -GitVersion.ReferenceName.IsPullRequest.get -> bool -GitVersion.ReferenceName.IsRemoteBranch.get -> bool -GitVersion.ReferenceName.IsTag.get -> bool -GitVersion.ReferenceName.ReferenceName(string! canonical) -> void -GitVersion.ReferenceName.WithoutOrigin.get -> string! GitVersion.RepositoryInfo GitVersion.RepositoryInfo.ClonePath -> string? GitVersion.RepositoryInfo.CommitId -> string? -GitVersion.RepositoryInfo.RepositoryInfo() -> void GitVersion.RepositoryInfo.TargetBranch -> string? GitVersion.RepositoryInfo.TargetUrl -> string? GitVersion.SemanticVersion @@ -644,8 +606,8 @@ GitVersion.SemanticVersionPreReleaseTag.ToString(string! format) -> string! GitVersion.SemanticVersionPreReleaseTag.ToString(string? format, System.IFormatProvider? formatProvider) -> string! GitVersion.SemanticVersionWithTag GitVersion.SemanticVersionWithTag.CompareTo(GitVersion.SemanticVersionWithTag? other) -> int -GitVersion.SemanticVersionWithTag.SemanticVersionWithTag(GitVersion.SemanticVersion! Value, GitVersion.ITag! Tag) -> void -GitVersion.SemanticVersionWithTag.Tag.get -> GitVersion.ITag! +GitVersion.SemanticVersionWithTag.SemanticVersionWithTag(GitVersion.SemanticVersion! Value, GitVersion.Git.ITag! Tag) -> void +GitVersion.SemanticVersionWithTag.Tag.get -> GitVersion.Git.ITag! GitVersion.SemanticVersionWithTag.Tag.init -> void GitVersion.SemanticVersionWithTag.Value.get -> GitVersion.SemanticVersion! GitVersion.SemanticVersionWithTag.Value.init -> void @@ -654,12 +616,11 @@ GitVersion.Settings.NoCache -> bool GitVersion.Settings.NoFetch -> bool GitVersion.Settings.NoNormalize -> bool GitVersion.Settings.OnlyTrackedBranches -> bool -GitVersion.Settings.Settings() -> void GitVersion.VersionCalculation.BaseVersion GitVersion.VersionCalculation.BaseVersion.BaseVersion() -> void -GitVersion.VersionCalculation.BaseVersion.BaseVersion(GitVersion.VersionCalculation.BaseVersionOperand! baseVersionOperand) -> void -GitVersion.VersionCalculation.BaseVersion.BaseVersion(string! source, GitVersion.SemanticVersion! semanticVersion, GitVersion.ICommit? baseVersionSource = null) -> void -GitVersion.VersionCalculation.BaseVersion.BaseVersionSource.get -> GitVersion.ICommit? +GitVersion.VersionCalculation.BaseVersion.BaseVersion(GitVersion.VersionCalculation.BaseVersionOperand! Operand) -> void +GitVersion.VersionCalculation.BaseVersion.BaseVersion(string! source, GitVersion.SemanticVersion! semanticVersion, GitVersion.Git.ICommit? baseVersionSource = null) -> void +GitVersion.VersionCalculation.BaseVersion.BaseVersionSource.get -> GitVersion.Git.ICommit? GitVersion.VersionCalculation.BaseVersion.GetIncrementedVersion() -> GitVersion.SemanticVersion! GitVersion.VersionCalculation.BaseVersion.Operand.get -> GitVersion.VersionCalculation.BaseVersionOperand! GitVersion.VersionCalculation.BaseVersion.Operand.init -> void @@ -670,8 +631,8 @@ GitVersion.VersionCalculation.BaseVersion.ShouldIncrement.get -> bool GitVersion.VersionCalculation.BaseVersion.Source.get -> string! GitVersion.VersionCalculation.BaseVersionOperand GitVersion.VersionCalculation.BaseVersionOperand.BaseVersionOperand() -> void -GitVersion.VersionCalculation.BaseVersionOperand.BaseVersionOperand(string! source, GitVersion.SemanticVersion! semanticVersion, GitVersion.ICommit? baseVersionSource = null) -> void -GitVersion.VersionCalculation.BaseVersionOperand.BaseVersionSource.get -> GitVersion.ICommit? +GitVersion.VersionCalculation.BaseVersionOperand.BaseVersionOperand(string! Source, GitVersion.SemanticVersion! SemanticVersion, GitVersion.Git.ICommit? BaseVersionSource = null) -> void +GitVersion.VersionCalculation.BaseVersionOperand.BaseVersionSource.get -> GitVersion.Git.ICommit? GitVersion.VersionCalculation.BaseVersionOperand.BaseVersionSource.init -> void GitVersion.VersionCalculation.BaseVersionOperand.SemanticVersion.get -> GitVersion.SemanticVersion! GitVersion.VersionCalculation.BaseVersionOperand.SemanticVersion.init -> void @@ -680,7 +641,7 @@ GitVersion.VersionCalculation.BaseVersionOperand.Source.init -> void GitVersion.VersionCalculation.BaseVersionOperator GitVersion.VersionCalculation.BaseVersionOperator.AlternativeSemanticVersion.get -> GitVersion.SemanticVersion? GitVersion.VersionCalculation.BaseVersionOperator.AlternativeSemanticVersion.init -> void -GitVersion.VersionCalculation.BaseVersionOperator.BaseVersionSource.get -> GitVersion.ICommit? +GitVersion.VersionCalculation.BaseVersionOperator.BaseVersionSource.get -> GitVersion.Git.ICommit? GitVersion.VersionCalculation.BaseVersionOperator.BaseVersionSource.init -> void GitVersion.VersionCalculation.BaseVersionOperator.ForceIncrement.get -> bool GitVersion.VersionCalculation.BaseVersionOperator.ForceIncrement.init -> void @@ -690,16 +651,13 @@ GitVersion.VersionCalculation.BaseVersionOperator.Label.get -> string? GitVersion.VersionCalculation.BaseVersionOperator.Label.init -> void GitVersion.VersionCalculation.BaseVersionOperator.Source.get -> string! GitVersion.VersionCalculation.BaseVersionOperator.Source.init -> void -GitVersion.VersionCalculation.Caching.GitVersionCache -GitVersion.VersionCalculation.Caching.GitVersionCache.GitVersionCache(GitVersion.IFileSystem! fileSystem, GitVersion.OutputVariables.IVersionVariableSerializer! serializer, GitVersion.Logging.ILog! log, GitVersion.IGitRepositoryInfo! repositoryInfo) -> void -GitVersion.VersionCalculation.Caching.GitVersionCache.LoadVersionVariablesFromDiskCache(GitVersion.VersionCalculation.Caching.GitVersionCacheKey! cacheKey) -> GitVersion.OutputVariables.GitVersionVariables? -GitVersion.VersionCalculation.Caching.GitVersionCache.WriteVariablesToDiskCache(GitVersion.VersionCalculation.Caching.GitVersionCacheKey! cacheKey, GitVersion.OutputVariables.GitVersionVariables! versionVariables) -> void GitVersion.VersionCalculation.Caching.GitVersionCacheKey -GitVersion.VersionCalculation.Caching.GitVersionCacheKey.GitVersionCacheKey(string! value) -> void +GitVersion.VersionCalculation.Caching.GitVersionCacheKey.GitVersionCacheKey(string! Value) -> void GitVersion.VersionCalculation.Caching.GitVersionCacheKey.Value.get -> string! -GitVersion.VersionCalculation.Caching.IGitVersionCache -GitVersion.VersionCalculation.Caching.IGitVersionCache.LoadVersionVariablesFromDiskCache(GitVersion.VersionCalculation.Caching.GitVersionCacheKey! cacheKey) -> GitVersion.OutputVariables.GitVersionVariables? -GitVersion.VersionCalculation.Caching.IGitVersionCache.WriteVariablesToDiskCache(GitVersion.VersionCalculation.Caching.GitVersionCacheKey! cacheKey, GitVersion.OutputVariables.GitVersionVariables! versionVariables) -> void +GitVersion.VersionCalculation.Caching.GitVersionCacheKey.Value.init -> void +GitVersion.VersionCalculation.Caching.IGitVersionCacheProvider +GitVersion.VersionCalculation.Caching.IGitVersionCacheProvider.LoadVersionVariablesFromDiskCache() -> GitVersion.OutputVariables.GitVersionVariables? +GitVersion.VersionCalculation.Caching.IGitVersionCacheProvider.WriteVariablesToDiskCache(GitVersion.OutputVariables.GitVersionVariables! versionVariables) -> void GitVersion.VersionCalculation.CommitMessageIncrementMode GitVersion.VersionCalculation.CommitMessageIncrementMode.Disabled = 1 -> GitVersion.VersionCalculation.CommitMessageIncrementMode GitVersion.VersionCalculation.CommitMessageIncrementMode.Enabled = 0 -> GitVersion.VersionCalculation.CommitMessageIncrementMode @@ -711,17 +669,17 @@ GitVersion.VersionCalculation.DeploymentMode.ManualDeployment = 0 -> GitVersion. GitVersion.VersionCalculation.IBaseVersion GitVersion.VersionCalculation.IBaseVersion.SemanticVersion.get -> GitVersion.SemanticVersion! GitVersion.VersionCalculation.IBaseVersionIncrement -GitVersion.VersionCalculation.IBaseVersionIncrement.BaseVersionSource.get -> GitVersion.ICommit? +GitVersion.VersionCalculation.IBaseVersionIncrement.BaseVersionSource.get -> GitVersion.Git.ICommit? GitVersion.VersionCalculation.IBaseVersionIncrement.Source.get -> string! GitVersion.VersionCalculation.IDeploymentModeCalculator -GitVersion.VersionCalculation.IDeploymentModeCalculator.Calculate(GitVersion.SemanticVersion! semanticVersion, GitVersion.ICommit? baseVersionSource) -> GitVersion.SemanticVersion! +GitVersion.VersionCalculation.IDeploymentModeCalculator.Calculate(GitVersion.SemanticVersion! semanticVersion, GitVersion.Git.ICommit? baseVersionSource) -> GitVersion.SemanticVersion! GitVersion.VersionCalculation.IEffectiveBranchConfigurationFinder -GitVersion.VersionCalculation.IEffectiveBranchConfigurationFinder.GetConfigurations(GitVersion.IBranch! branch, GitVersion.Configuration.IGitVersionConfiguration! configuration) -> System.Collections.Generic.IEnumerable! +GitVersion.VersionCalculation.IEffectiveBranchConfigurationFinder.GetConfigurations(GitVersion.Git.IBranch! branch, GitVersion.Configuration.IGitVersionConfiguration! configuration) -> System.Collections.Generic.IEnumerable! GitVersion.VersionCalculation.IIncrementStrategyFinder -GitVersion.VersionCalculation.IIncrementStrategyFinder.DetermineIncrementedField(GitVersion.ICommit! currentCommit, GitVersion.ICommit? baseVersionSource, bool shouldIncrement, GitVersion.Configuration.EffectiveConfiguration! configuration, string? label) -> GitVersion.VersionField -GitVersion.VersionCalculation.IIncrementStrategyFinder.GetIncrementForcedByCommit(GitVersion.ICommit! commit, GitVersion.Configuration.EffectiveConfiguration! configuration) -> GitVersion.VersionField -GitVersion.VersionCalculation.IIncrementStrategyFinder.GetIncrementForCommits(string? majorVersionBumpMessage, string? minorVersionBumpMessage, string? patchVersionBumpMessage, string? noBumpMessage, GitVersion.ICommit![]! commits) -> GitVersion.VersionField? -GitVersion.VersionCalculation.IIncrementStrategyFinder.GetMergedCommits(GitVersion.ICommit! mergeCommit, int index, GitVersion.Configuration.IIgnoreConfiguration! ignore) -> System.Collections.Generic.IEnumerable! +GitVersion.VersionCalculation.IIncrementStrategyFinder.DetermineIncrementedField(GitVersion.Git.ICommit! currentCommit, GitVersion.Git.ICommit? baseVersionSource, bool shouldIncrement, GitVersion.Configuration.EffectiveConfiguration! configuration, string? label) -> GitVersion.VersionField +GitVersion.VersionCalculation.IIncrementStrategyFinder.GetIncrementForcedByCommit(GitVersion.Git.ICommit! commit, GitVersion.Configuration.EffectiveConfiguration! configuration) -> GitVersion.VersionField +GitVersion.VersionCalculation.IIncrementStrategyFinder.GetIncrementForCommits(string? majorVersionBumpMessage, string? minorVersionBumpMessage, string? patchVersionBumpMessage, string? noBumpMessage, GitVersion.Git.ICommit![]! commits) -> GitVersion.VersionField? +GitVersion.VersionCalculation.IIncrementStrategyFinder.GetMergedCommits(GitVersion.Git.ICommit! mergeCommit, int index, GitVersion.Configuration.IIgnoreConfiguration! ignore) -> System.Collections.Generic.IEnumerable! GitVersion.VersionCalculation.INextVersionCalculator GitVersion.VersionCalculation.INextVersionCalculator.FindVersion() -> GitVersion.SemanticVersion! GitVersion.VersionCalculation.IVariableProvider @@ -764,25 +722,12 @@ GitVersion.WarningException.WarningException(string! message) -> void GitVersion.WarningException.WarningException(string? message, System.Exception? innerException) -> void GitVersion.WixInfo GitVersion.WixInfo.UpdateWixVersionFile -> bool -GitVersion.WixInfo.WixInfo() -> void -abstract GitVersion.Agents.BuildAgentBase.EnvironmentVariable.get -> string! -abstract GitVersion.Agents.BuildAgentBase.GenerateSetParameterMessage(string! name, string? value) -> string![]! -abstract GitVersion.Agents.BuildAgentBase.GenerateSetVersionMessage(GitVersion.OutputVariables.GitVersionVariables! variables) -> string? -const GitVersion.ReferenceName.LocalBranchPrefix = "refs/heads/" -> string! -const GitVersion.ReferenceName.OriginPrefix = "origin/" -> string! -const GitVersion.ReferenceName.RemoteTrackingBranchPrefix = "refs/remotes/" -> string! -const GitVersion.ReferenceName.TagPrefix = "refs/tags/" -> string! -override GitVersion.Agents.LocalBuild.CanApplyToCurrentContext() -> bool -override GitVersion.Agents.LocalBuild.EnvironmentVariable.get -> string! -override GitVersion.Agents.LocalBuild.GenerateSetParameterMessage(string! name, string? value) -> string![]! -override GitVersion.Agents.LocalBuild.GenerateSetVersionMessage(GitVersion.OutputVariables.GitVersionVariables! variables) -> string? -override GitVersion.Agents.LocalBuild.IsDefault.get -> bool -override GitVersion.BranchCommit.Equals(object? obj) -> bool -override GitVersion.BranchCommit.GetHashCode() -> int +override GitVersion.Git.BranchCommit.Equals(object? obj) -> bool +override GitVersion.Git.BranchCommit.GetHashCode() -> int +override GitVersion.Git.ReferenceName.Equals(object? obj) -> bool +override GitVersion.Git.ReferenceName.GetHashCode() -> int +override GitVersion.Git.ReferenceName.ToString() -> string! override GitVersion.Helpers.LambdaKeyComparer.Compare(TSource? x, TSource? y) -> int -override GitVersion.ReferenceName.Equals(object? obj) -> bool -override GitVersion.ReferenceName.GetHashCode() -> int -override GitVersion.ReferenceName.ToString() -> string! override GitVersion.SemanticVersion.Equals(object? obj) -> bool override GitVersion.SemanticVersion.GetHashCode() -> int override GitVersion.SemanticVersion.ToString() -> string! @@ -797,25 +742,8 @@ override GitVersion.VersionCalculation.BaseVersion.ToString() -> string! override GitVersion.VersionCalculation.NextVersion.Equals(object? other) -> bool override GitVersion.VersionCalculation.NextVersion.GetHashCode() -> int override GitVersion.VersionCalculation.NextVersion.ToString() -> string! -readonly GitVersion.Agents.BuildAgentBase.Log -> GitVersion.Logging.ILog! -static GitVersion.BranchCommit.operator !=(GitVersion.BranchCommit left, GitVersion.BranchCommit right) -> bool -static GitVersion.BranchCommit.operator ==(GitVersion.BranchCommit left, GitVersion.BranchCommit right) -> bool -static GitVersion.CommitExtensions.IsMergeCommit(this GitVersion.ICommit! source) -> bool -static GitVersion.Configuration.ConfigurationExtensions.FindGitDir(this string! path) -> (string! GitDirectory, string! WorkingTreeDirectory)? -static GitVersion.Configuration.ConfigurationExtensions.GetBranchConfiguration(this GitVersion.Configuration.IGitVersionConfiguration! configuration, GitVersion.IBranch! branch) -> GitVersion.Configuration.IBranchConfiguration! -static GitVersion.Configuration.ConfigurationExtensions.GetBranchConfiguration(this GitVersion.Configuration.IGitVersionConfiguration! configuration, GitVersion.ReferenceName! branchName) -> GitVersion.Configuration.IBranchConfiguration! -static GitVersion.Configuration.ConfigurationExtensions.GetBranchSpecificLabel(this GitVersion.Configuration.EffectiveConfiguration! configuration, GitVersion.ReferenceName! branchName, string? branchNameOverride) -> string? -static GitVersion.Configuration.ConfigurationExtensions.GetBranchSpecificLabel(this GitVersion.Configuration.EffectiveConfiguration! configuration, string? branchName, string? branchNameOverride) -> string? -static GitVersion.Configuration.ConfigurationExtensions.GetEffectiveBranchConfiguration(this GitVersion.Configuration.IGitVersionConfiguration! configuration, GitVersion.IBranch! branch) -> GitVersion.Configuration.EffectiveBranchConfiguration! -static GitVersion.Configuration.ConfigurationExtensions.GetEffectiveConfiguration(this GitVersion.Configuration.IGitVersionConfiguration! configuration, GitVersion.ReferenceName! branchName) -> GitVersion.Configuration.EffectiveConfiguration! -static GitVersion.Configuration.ConfigurationExtensions.GetFallbackBranchConfiguration(this GitVersion.Configuration.IGitVersionConfiguration! configuration) -> GitVersion.Configuration.IBranchConfiguration! -static GitVersion.Configuration.ConfigurationExtensions.IsReleaseBranch(this GitVersion.Configuration.IGitVersionConfiguration! configuration, GitVersion.IBranch! branch) -> bool -static GitVersion.Configuration.ConfigurationExtensions.IsReleaseBranch(this GitVersion.Configuration.IGitVersionConfiguration! configuration, GitVersion.ReferenceName! branchName) -> bool -static GitVersion.Configuration.ConfigurationExtensions.ToFilters(this GitVersion.Configuration.IIgnoreConfiguration! source) -> System.Collections.Generic.IEnumerable! -static GitVersion.Configuration.IgnoreConfigurationExtensions.Filter(this GitVersion.Configuration.IIgnoreConfiguration! ignore, System.Collections.Generic.IEnumerable! source) -> System.Collections.Generic.IEnumerable! -static GitVersion.Configuration.IgnoreConfigurationExtensions.Filter(this GitVersion.Configuration.IIgnoreConfiguration! ignore, System.Collections.Generic.IEnumerable! source) -> System.Collections.Generic.IEnumerable! -static GitVersion.Extensions.AssemblyVersionsGeneratorExtensions.GetAssemblyFileVersion(this GitVersion.SemanticVersion! sv, GitVersion.Extensions.AssemblyFileVersioningScheme scheme) -> string? -static GitVersion.Extensions.AssemblyVersionsGeneratorExtensions.GetAssemblyVersion(this GitVersion.SemanticVersion! sv, GitVersion.Extensions.AssemblyVersioningScheme scheme) -> string? +static GitVersion.Extensions.AssemblyVersionsGeneratorExtensions.GetAssemblyFileVersion(this GitVersion.SemanticVersion! sv, GitVersion.Configuration.AssemblyFileVersioningScheme scheme) -> string? +static GitVersion.Extensions.AssemblyVersionsGeneratorExtensions.GetAssemblyVersion(this GitVersion.SemanticVersion! sv, GitVersion.Configuration.AssemblyVersioningScheme scheme) -> string? static GitVersion.Extensions.CommonExtensions.NotNull(this T? value, string! name = "") -> T! static GitVersion.Extensions.CommonExtensions.NotNullOrEmpty(this string? value, string! name = "") -> string! static GitVersion.Extensions.CommonExtensions.NotNullOrWhitespace(this string? value, string! name = "") -> string! @@ -825,30 +753,29 @@ static GitVersion.Extensions.EnumerableExtensions.OnlyOrDefault(this System.C static GitVersion.Extensions.EnumerableExtensions.SingleOfType(this System.Collections.IEnumerable! source) -> T static GitVersion.Extensions.GitExtensions.CreateGitLogArgs(int? maxCommits) -> string! static GitVersion.Extensions.GitExtensions.DumpGraph(string! workingDirectory, System.Action? writer = null, int? maxCommits = null) -> void +static GitVersion.Extensions.IncrementStrategyExtensions.ToVersionField(this GitVersion.IncrementStrategy strategy) -> GitVersion.VersionField static GitVersion.Extensions.ReadEmbeddedResourceExtensions.ReadAsStringFromEmbeddedResource(this string! resourceName, System.Reflection.Assembly! assembly) -> string! static GitVersion.Extensions.ReadEmbeddedResourceExtensions.ReadAsStringFromEmbeddedResource(this string! resourceName) -> string! static GitVersion.Extensions.ServiceCollectionExtensions.AddModule(this Microsoft.Extensions.DependencyInjection.IServiceCollection! serviceCollection, GitVersion.IGitVersionModule! gitVersionModule) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! static GitVersion.Extensions.ServiceCollectionExtensions.GetServiceForType(this System.IServiceProvider! serviceProvider) -> TService static GitVersion.Extensions.StringExtensions.AppendLineFormat(this System.Text.StringBuilder! stringBuilder, string! format, params object![]! args) -> void -static GitVersion.Extensions.StringExtensions.ArgumentRequiresValue(this string! argument, int argumentIndex) -> bool static GitVersion.Extensions.StringExtensions.IsEmpty(this string? value) -> bool static GitVersion.Extensions.StringExtensions.IsEquivalentTo(this string! self, string? other) -> bool -static GitVersion.Extensions.StringExtensions.IsFalse(this string? value) -> bool -static GitVersion.Extensions.StringExtensions.IsHelp(this string! singleArgument) -> bool static GitVersion.Extensions.StringExtensions.IsNullOrEmpty(this string? value) -> bool static GitVersion.Extensions.StringExtensions.IsNullOrWhiteSpace(this string? value) -> bool -static GitVersion.Extensions.StringExtensions.IsSwitch(this string? value, string! switchName) -> bool -static GitVersion.Extensions.StringExtensions.IsSwitchArgument(this string? value) -> bool -static GitVersion.Extensions.StringExtensions.IsTrue(this string? value) -> bool -static GitVersion.Extensions.StringExtensions.IsValidPath(this string? path) -> bool static GitVersion.Extensions.StringExtensions.RegexReplace(this string! input, string! pattern, string! replace, System.Text.RegularExpressions.RegexOptions options = System.Text.RegularExpressions.RegexOptions.None) -> string! static GitVersion.Extensions.StringExtensions.WithPrefixIfNotNullOrEmpty(this string! value, string! prefix) -> string! +static GitVersion.Git.BranchCommit.operator !=(GitVersion.Git.BranchCommit left, GitVersion.Git.BranchCommit right) -> bool +static GitVersion.Git.BranchCommit.operator ==(GitVersion.Git.BranchCommit left, GitVersion.Git.BranchCommit right) -> bool +static GitVersion.Git.CommitExtensions.IsMergeCommit(this GitVersion.Git.ICommit! source) -> bool +static GitVersion.Git.ReferenceName.FromBranchName(string! branchName) -> GitVersion.Git.ReferenceName! +static GitVersion.Git.ReferenceName.Parse(string! canonicalName) -> GitVersion.Git.ReferenceName! +static GitVersion.Git.ReferenceName.TryParse(out GitVersion.Git.ReferenceName? value, string! canonicalName) -> bool static GitVersion.Helpers.Disposable.Create(System.Action! disposer) -> System.IDisposable! static GitVersion.Helpers.Disposable.Create(T value, System.Action! disposer) -> GitVersion.Helpers.IDisposable! static GitVersion.Helpers.EncodingHelper.DetectEncoding(System.Collections.Generic.IList! bytes) -> System.Text.Encoding? static GitVersion.Helpers.EncodingHelper.DetectEncoding(string? filename) -> System.Text.Encoding? static GitVersion.Helpers.ServiceMessageEscapeHelper.EscapeValue(string? value) -> string? -static GitVersion.IncrementStrategyExtensions.ToVersionField(this GitVersion.IncrementStrategy strategy) -> GitVersion.VersionField static GitVersion.Logging.LogExtensions.Debug(this GitVersion.Logging.ILog! log, GitVersion.Logging.LogAction! logAction) -> void static GitVersion.Logging.LogExtensions.Debug(this GitVersion.Logging.ILog! log, GitVersion.Logging.Verbosity verbosity, GitVersion.Logging.LogAction! logAction) -> void static GitVersion.Logging.LogExtensions.Debug(this GitVersion.Logging.ILog! log, GitVersion.Logging.Verbosity verbosity, string! format, params object![]! args) -> void @@ -876,10 +803,7 @@ static GitVersion.Logging.LogExtensions.Warning(this GitVersion.Logging.ILog! lo static GitVersion.Logging.LogExtensions.Warning(this GitVersion.Logging.ILog! log, GitVersion.Logging.Verbosity verbosity, string! format, params object![]! args) -> void static GitVersion.Logging.LogExtensions.Warning(this GitVersion.Logging.ILog! log, string! format, params object![]! args) -> void static GitVersion.Logging.LogExtensions.Write(this GitVersion.Logging.ILog! log, GitVersion.Logging.LogLevel level, string! format, params object![]! args) -> void -static GitVersion.MergeMessage.TryParse(GitVersion.ICommit! mergeCommit, GitVersion.Configuration.IGitVersionConfiguration! configuration, out GitVersion.MergeMessage? mergeMessage) -> bool -static GitVersion.ReferenceName.FromBranchName(string! branchName) -> GitVersion.ReferenceName! -static GitVersion.ReferenceName.Parse(string! canonicalName) -> GitVersion.ReferenceName! -static GitVersion.ReferenceName.TryParse(out GitVersion.ReferenceName? value, string! canonicalName) -> bool +static GitVersion.MergeMessage.TryParse(GitVersion.Git.ICommit! mergeCommit, GitVersion.Configuration.IGitVersionConfiguration! configuration, out GitVersion.MergeMessage? mergeMessage) -> bool static GitVersion.SemanticVersion.Parse(string! version, string? tagPrefixRegex, GitVersion.SemanticVersionFormat versionFormat = GitVersion.SemanticVersionFormat.Strict) -> GitVersion.SemanticVersion! static GitVersion.SemanticVersion.operator !=(GitVersion.SemanticVersion? v1, GitVersion.SemanticVersion? v2) -> bool static GitVersion.SemanticVersion.operator <(GitVersion.SemanticVersion! v1, GitVersion.SemanticVersion! v2) -> bool @@ -908,14 +832,8 @@ static GitVersion.VersionCalculation.NextVersion.operator <=(GitVersion.VersionC static GitVersion.VersionCalculation.NextVersion.operator ==(GitVersion.VersionCalculation.NextVersion! left, GitVersion.VersionCalculation.NextVersion? right) -> bool static GitVersion.VersionCalculation.NextVersion.operator >(GitVersion.VersionCalculation.NextVersion! left, GitVersion.VersionCalculation.NextVersion! right) -> bool static GitVersion.VersionCalculation.NextVersion.operator >=(GitVersion.VersionCalculation.NextVersion! left, GitVersion.VersionCalculation.NextVersion! right) -> bool -static readonly GitVersion.BranchCommit.Empty -> GitVersion.BranchCommit +static readonly GitVersion.Git.BranchCommit.Empty -> GitVersion.Git.BranchCommit static readonly GitVersion.Helpers.Disposable.Empty -> System.IDisposable! static readonly GitVersion.SemanticVersion.Empty -> GitVersion.SemanticVersion! static readonly GitVersion.SemanticVersionBuildMetaData.Empty -> GitVersion.SemanticVersionBuildMetaData! -static readonly GitVersion.SemanticVersionPreReleaseTag.Empty -> GitVersion.SemanticVersionPreReleaseTag! -virtual GitVersion.Agents.BuildAgentBase.CanApplyToCurrentContext() -> bool -virtual GitVersion.Agents.BuildAgentBase.GetCurrentBranch(bool usingDynamicRepos) -> string? -virtual GitVersion.Agents.BuildAgentBase.IsDefault.get -> bool -virtual GitVersion.Agents.BuildAgentBase.PreventFetch() -> bool -virtual GitVersion.Agents.BuildAgentBase.ShouldCleanUpRemotes() -> bool -virtual GitVersion.Agents.BuildAgentBase.WriteIntegration(System.Action! writer, GitVersion.OutputVariables.GitVersionVariables! variables, bool updateBuildNumber = true) -> void +static readonly GitVersion.SemanticVersionPreReleaseTag.Empty -> GitVersion.SemanticVersionPreReleaseTag! \ No newline at end of file diff --git a/src/GitVersion.Core/VersionCalculation/Abstractions/IDeploymentModeCalculator.cs b/src/GitVersion.Core/VersionCalculation/Abstractions/IDeploymentModeCalculator.cs index e4d16d3710..28c6cec386 100644 --- a/src/GitVersion.Core/VersionCalculation/Abstractions/IDeploymentModeCalculator.cs +++ b/src/GitVersion.Core/VersionCalculation/Abstractions/IDeploymentModeCalculator.cs @@ -1,3 +1,5 @@ +using GitVersion.Git; + namespace GitVersion.VersionCalculation; public interface IDeploymentModeCalculator diff --git a/src/GitVersion.Core/VersionCalculation/Abstractions/IEffectiveBranchConfigurationFinder.cs b/src/GitVersion.Core/VersionCalculation/Abstractions/IEffectiveBranchConfigurationFinder.cs index 3c010fb67c..9f43497dbb 100644 --- a/src/GitVersion.Core/VersionCalculation/Abstractions/IEffectiveBranchConfigurationFinder.cs +++ b/src/GitVersion.Core/VersionCalculation/Abstractions/IEffectiveBranchConfigurationFinder.cs @@ -1,4 +1,5 @@ using GitVersion.Configuration; +using GitVersion.Git; namespace GitVersion.VersionCalculation { diff --git a/src/GitVersion.Core/VersionCalculation/Abstractions/IIncrementStrategyFinder.cs b/src/GitVersion.Core/VersionCalculation/Abstractions/IIncrementStrategyFinder.cs index 3326e99c94..2c34ed344a 100644 --- a/src/GitVersion.Core/VersionCalculation/Abstractions/IIncrementStrategyFinder.cs +++ b/src/GitVersion.Core/VersionCalculation/Abstractions/IIncrementStrategyFinder.cs @@ -1,4 +1,5 @@ using GitVersion.Configuration; +using GitVersion.Git; namespace GitVersion.VersionCalculation; diff --git a/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheKey.cs b/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheKey.cs deleted file mode 100644 index b7bcd5a4e1..0000000000 --- a/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheKey.cs +++ /dev/null @@ -1,16 +0,0 @@ -using GitVersion.Extensions; - -namespace GitVersion.VersionCalculation.Caching; - -public class GitVersionCacheKey -{ - public GitVersionCacheKey(string value) - { - if (value.IsNullOrEmpty()) - throw new ArgumentNullException(nameof(value)); - - Value = value; - } - - public string Value { get; } -} diff --git a/src/GitVersion.Configuration/GitVersionCacheKeyFactory.cs b/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheKeyFactory.cs similarity index 94% rename from src/GitVersion.Configuration/GitVersionCacheKeyFactory.cs rename to src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheKeyFactory.cs index 4276f1acd3..e0fa826ae2 100644 --- a/src/GitVersion.Configuration/GitVersionCacheKeyFactory.cs +++ b/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheKeyFactory.cs @@ -1,6 +1,7 @@ using System.Security.Cryptography; using GitVersion.Configuration; using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.Helpers; using GitVersion.Logging; using Microsoft.Extensions.Options; @@ -12,6 +13,7 @@ internal class GitVersionCacheKeyFactory( ILog log, IOptions options, IConfigurationFileLocator configFileLocator, + IConfigurationSerializer configurationSerializer, IGitRepository gitRepository, IGitRepositoryInfo repositoryInfo) : IGitVersionCacheKeyFactory @@ -20,6 +22,7 @@ internal class GitVersionCacheKeyFactory( private readonly ILog log = log.NotNull(); private readonly IOptions options = options.NotNull(); private readonly IConfigurationFileLocator configFileLocator = configFileLocator.NotNull(); + private readonly IConfigurationSerializer configurationSerializer = configurationSerializer.NotNull(); private readonly IGitRepository gitRepository = gitRepository.NotNull(); private readonly IGitRepositoryInfo repositoryInfo = repositoryInfo.NotNull(); @@ -31,7 +34,7 @@ public GitVersionCacheKey Create(IReadOnlyDictionary? overrideC var overrideConfigHash = GetOverrideConfigHash(overrideConfiguration); var compositeHash = GetHash(gitSystemHash, configFileHash, repositorySnapshotHash, overrideConfigHash); - return new GitVersionCacheKey(compositeHash); + return new(compositeHash); } private string GetGitSystemHash() @@ -146,7 +149,7 @@ private string GetRepositorySnapshotHash() return GetHash(hash); } - private static string GetOverrideConfigHash(IReadOnlyDictionary? overrideConfiguration) + private string GetOverrideConfigHash(IReadOnlyDictionary? overrideConfiguration) { if (overrideConfiguration?.Any() != true) { @@ -155,7 +158,7 @@ private static string GetOverrideConfigHash(IReadOnlyDictionary // Doesn't depend on command line representation and // includes possible changes in default values of Config per se. - var configContent = ConfigurationSerializer.Serialize(overrideConfiguration); + var configContent = configurationSerializer.Serialize(overrideConfiguration); return GetHash(configContent); } diff --git a/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCache.cs b/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheProvider.cs similarity index 76% rename from src/GitVersion.Core/VersionCalculation/Caching/GitVersionCache.cs rename to src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheProvider.cs index 952b8007f1..63a67e6afb 100644 --- a/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCache.cs +++ b/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheProvider.cs @@ -1,20 +1,31 @@ using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.Helpers; using GitVersion.Logging; using GitVersion.OutputVariables; +using Microsoft.Extensions.Options; namespace GitVersion.VersionCalculation.Caching; -public class GitVersionCache(IFileSystem fileSystem, IVersionVariableSerializer serializer, ILog log, IGitRepositoryInfo repositoryInfo) - : IGitVersionCache +internal class GitVersionCacheProvider( + IFileSystem fileSystem, + ILog log, + IOptions options, + IVersionVariableSerializer serializer, + IGitVersionCacheKeyFactory cacheKeyFactory, + IGitRepositoryInfo repositoryInfo) + : IGitVersionCacheProvider { private readonly IFileSystem fileSystem = fileSystem.NotNull(); - private readonly IVersionVariableSerializer serializer = serializer.NotNull(); private readonly ILog log = log.NotNull(); + private readonly IOptions options = options.NotNull(); + private readonly IVersionVariableSerializer serializer = serializer.NotNull(); + private readonly IGitVersionCacheKeyFactory cacheKeyFactory = cacheKeyFactory.NotNull(); private readonly IGitRepositoryInfo repositoryInfo = repositoryInfo.NotNull(); - public void WriteVariablesToDiskCache(GitVersionCacheKey cacheKey, GitVersionVariables versionVariables) + public void WriteVariablesToDiskCache(GitVersionVariables versionVariables) { + var cacheKey = GetCacheKey(); var cacheFileName = GetCacheFileName(cacheKey); using (this.log.IndentLog($"Write version variables to cache file {cacheFileName}")) { @@ -29,8 +40,9 @@ public void WriteVariablesToDiskCache(GitVersionCacheKey cacheKey, GitVersionVar } } - public GitVersionVariables? LoadVersionVariablesFromDiskCache(GitVersionCacheKey cacheKey) + public GitVersionVariables? LoadVersionVariablesFromDiskCache() { + var cacheKey = GetCacheKey(); var cacheFileName = GetCacheFileName(cacheKey); using (this.log.IndentLog($"Loading version variables from disk cache file {cacheFileName}")) { @@ -39,6 +51,7 @@ public void WriteVariablesToDiskCache(GitVersionCacheKey cacheKey, GitVersionVar this.log.Info($"Cache file {cacheFileName} not found."); return null; } + try { var loadedVariables = serializer.FromFile(cacheFileName); @@ -84,5 +97,11 @@ private string PrepareCacheDirectory() return cacheDir; } + private GitVersionCacheKey GetCacheKey() + { + var cacheKey = this.cacheKeyFactory.Create(options.Value.ConfigurationInfo.OverrideConfiguration); + return cacheKey; + } + private static string GetCacheFileName(GitVersionCacheKey key, string cacheDir) => PathHelper.Combine(cacheDir, key.Value); } diff --git a/src/GitVersion.Core/VersionCalculation/Caching/IGitVersionCache.cs b/src/GitVersion.Core/VersionCalculation/Caching/IGitVersionCache.cs deleted file mode 100644 index c70aee78b0..0000000000 --- a/src/GitVersion.Core/VersionCalculation/Caching/IGitVersionCache.cs +++ /dev/null @@ -1,9 +0,0 @@ -using GitVersion.OutputVariables; - -namespace GitVersion.VersionCalculation.Caching; - -public interface IGitVersionCache -{ - void WriteVariablesToDiskCache(GitVersionCacheKey cacheKey, GitVersionVariables versionVariables); - GitVersionVariables? LoadVersionVariablesFromDiskCache(GitVersionCacheKey cacheKey); -} diff --git a/src/GitVersion.Core/VersionCalculation/Caching/IGitVersionCacheKeyFactory.cs b/src/GitVersion.Core/VersionCalculation/Caching/IGitVersionCacheKeyFactory.cs index 55edf3c8fe..29ae72d8b4 100644 --- a/src/GitVersion.Core/VersionCalculation/Caching/IGitVersionCacheKeyFactory.cs +++ b/src/GitVersion.Core/VersionCalculation/Caching/IGitVersionCacheKeyFactory.cs @@ -1,5 +1,6 @@ namespace GitVersion.VersionCalculation.Caching; +public record GitVersionCacheKey(string Value); internal interface IGitVersionCacheKeyFactory { GitVersionCacheKey Create(IReadOnlyDictionary? overrideConfiguration); diff --git a/src/GitVersion.Core/VersionCalculation/Caching/IGitVersionCacheProvider.cs b/src/GitVersion.Core/VersionCalculation/Caching/IGitVersionCacheProvider.cs new file mode 100644 index 0000000000..a25909892e --- /dev/null +++ b/src/GitVersion.Core/VersionCalculation/Caching/IGitVersionCacheProvider.cs @@ -0,0 +1,9 @@ +using GitVersion.OutputVariables; + +namespace GitVersion.VersionCalculation.Caching; + +public interface IGitVersionCacheProvider +{ + void WriteVariablesToDiskCache(GitVersionVariables versionVariables); + GitVersionVariables? LoadVersionVariablesFromDiskCache(); +} diff --git a/src/GitVersion.Core/VersionCalculation/EffectiveBranchConfigurationFinder.cs b/src/GitVersion.Core/VersionCalculation/EffectiveBranchConfigurationFinder.cs index 9e0fac9db3..561ddf7b80 100644 --- a/src/GitVersion.Core/VersionCalculation/EffectiveBranchConfigurationFinder.cs +++ b/src/GitVersion.Core/VersionCalculation/EffectiveBranchConfigurationFinder.cs @@ -1,6 +1,7 @@ using GitVersion.Common; using GitVersion.Configuration; using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.Logging; namespace GitVersion.VersionCalculation; @@ -15,7 +16,7 @@ public virtual IEnumerable GetConfigurations(IBran branch.NotNull(); configuration.NotNull(); - return GetEffectiveConfigurationsRecursive(branch, configuration, null, new()); + return GetEffectiveConfigurationsRecursive(branch, configuration, null, []); } private IEnumerable GetEffectiveConfigurationsRecursive( diff --git a/src/GitVersion.Core/VersionCalculation/IncrementStrategyFinder.cs b/src/GitVersion.Core/VersionCalculation/IncrementStrategyFinder.cs index 0cb2866c74..c22d218a5f 100644 --- a/src/GitVersion.Core/VersionCalculation/IncrementStrategyFinder.cs +++ b/src/GitVersion.Core/VersionCalculation/IncrementStrategyFinder.cs @@ -3,6 +3,7 @@ using GitVersion.Configuration; using GitVersion.Core; using GitVersion.Extensions; +using GitVersion.Git; namespace GitVersion.VersionCalculation; @@ -131,7 +132,7 @@ private IReadOnlyCollection GetCommitHistory(string? tagPrefix, Semanti var parentCommits = intermediateCommit.Parents.ToList(); while (parentCommits.Count != 0) { - List temporaryList = new(); + List temporaryList = []; foreach (var parentCommit in parentCommits) { if (commitLog.Remove(parentCommit.Sha)) diff --git a/src/GitVersion.Core/VersionCalculation/SemanticVersioning/SemanticVersionWithTag.cs b/src/GitVersion.Core/VersionCalculation/SemanticVersioning/SemanticVersionWithTag.cs index 84a888cae1..823c182244 100644 --- a/src/GitVersion.Core/VersionCalculation/SemanticVersioning/SemanticVersionWithTag.cs +++ b/src/GitVersion.Core/VersionCalculation/SemanticVersioning/SemanticVersionWithTag.cs @@ -1,3 +1,5 @@ +using GitVersion.Git; + namespace GitVersion; public sealed record SemanticVersionWithTag(SemanticVersion Value, ITag Tag) : IComparable diff --git a/src/GitVersion.Core/VersionCalculation/TrunkBased/NonTrunk/CommitOnNonTrunk.cs b/src/GitVersion.Core/VersionCalculation/TrunkBased/NonTrunk/CommitOnNonTrunk.cs index 3cef15ea2d..ea937bec17 100644 --- a/src/GitVersion.Core/VersionCalculation/TrunkBased/NonTrunk/CommitOnNonTrunk.cs +++ b/src/GitVersion.Core/VersionCalculation/TrunkBased/NonTrunk/CommitOnNonTrunk.cs @@ -11,7 +11,7 @@ internal sealed class CommitOnNonTrunk : ITrunkBasedIncrementer // A 58 minutes ago public bool MatchPrecondition(TrunkBasedIteration iteration, TrunkBasedCommit commit, TrunkBasedContext context) - => !commit.HasChildIteration && !commit.Configuration.IsMainBranch && context.SemanticVersion is null; + => commit is { HasChildIteration: false, Configuration.IsMainBranch: false } && context.SemanticVersion is null; public IEnumerable GetIncrements( TrunkBasedIteration iteration, TrunkBasedCommit commit, TrunkBasedContext context) diff --git a/src/GitVersion.Core/VersionCalculation/TrunkBased/NonTrunk/CommitOnNonTrunkWithPreReleaseTagBase.cs b/src/GitVersion.Core/VersionCalculation/TrunkBased/NonTrunk/CommitOnNonTrunkWithPreReleaseTagBase.cs index 221ab555eb..ed39b3c745 100644 --- a/src/GitVersion.Core/VersionCalculation/TrunkBased/NonTrunk/CommitOnNonTrunkWithPreReleaseTagBase.cs +++ b/src/GitVersion.Core/VersionCalculation/TrunkBased/NonTrunk/CommitOnNonTrunkWithPreReleaseTagBase.cs @@ -6,8 +6,8 @@ namespace GitVersion.VersionCalculation.TrunkBased.NonTrunk; internal abstract class CommitOnNonTrunkWithPreReleaseTagBase : ITrunkBasedIncrementer { public virtual bool MatchPrecondition(TrunkBasedIteration iteration, TrunkBasedCommit commit, TrunkBasedContext context) - => !commit.HasChildIteration && !commit.Configuration.IsMainBranch - && context.SemanticVersion?.IsPreRelease == true; + => commit is { HasChildIteration: false, Configuration.IsMainBranch: false } + && context.SemanticVersion?.IsPreRelease == true; public virtual IEnumerable GetIncrements( TrunkBasedIteration iteration, TrunkBasedCommit commit, TrunkBasedContext context) diff --git a/src/GitVersion.Core/VersionCalculation/TrunkBased/NonTrunk/MergeCommitOnNonTrunkBase.cs b/src/GitVersion.Core/VersionCalculation/TrunkBased/NonTrunk/MergeCommitOnNonTrunkBase.cs index d0458f98e3..e09a8308f0 100644 --- a/src/GitVersion.Core/VersionCalculation/TrunkBased/NonTrunk/MergeCommitOnNonTrunkBase.cs +++ b/src/GitVersion.Core/VersionCalculation/TrunkBased/NonTrunk/MergeCommitOnNonTrunkBase.cs @@ -5,7 +5,7 @@ namespace GitVersion.VersionCalculation.TrunkBased.NonTrunk; internal abstract class MergeCommitOnNonTrunkBase : ITrunkBasedIncrementer { public virtual bool MatchPrecondition(TrunkBasedIteration iteration, TrunkBasedCommit commit, TrunkBasedContext context) - => commit.HasChildIteration && !commit.Configuration.IsMainBranch && context.SemanticVersion is null; + => commit is { HasChildIteration: true, Configuration.IsMainBranch: false } && context.SemanticVersion is null; public virtual IEnumerable GetIncrements( TrunkBasedIteration iteration, TrunkBasedCommit commit, TrunkBasedContext context) diff --git a/src/GitVersion.Core/VersionCalculation/TrunkBased/Trunk/CommitOnTrunkBranchedBase.cs b/src/GitVersion.Core/VersionCalculation/TrunkBased/Trunk/CommitOnTrunkBranchedBase.cs index 9a74aa10ea..af8b2f8ff6 100644 --- a/src/GitVersion.Core/VersionCalculation/TrunkBased/Trunk/CommitOnTrunkBranchedBase.cs +++ b/src/GitVersion.Core/VersionCalculation/TrunkBased/Trunk/CommitOnTrunkBranchedBase.cs @@ -1,4 +1,5 @@ using GitVersion.Configuration; +using GitVersion.Extensions; namespace GitVersion.VersionCalculation.TrunkBased.Trunk; diff --git a/src/GitVersion.Core/VersionCalculation/TrunkBased/TrunkBasedCommit.cs b/src/GitVersion.Core/VersionCalculation/TrunkBased/TrunkBasedCommit.cs index d50df2858a..31d139af01 100644 --- a/src/GitVersion.Core/VersionCalculation/TrunkBased/TrunkBasedCommit.cs +++ b/src/GitVersion.Core/VersionCalculation/TrunkBased/TrunkBasedCommit.cs @@ -1,5 +1,6 @@ using GitVersion.Configuration; using GitVersion.Extensions; +using GitVersion.Git; namespace GitVersion.VersionCalculation.TrunkBased; @@ -8,7 +9,7 @@ namespace GitVersion.VersionCalculation.TrunkBased; "HasSuccessor = {" + nameof(HasSuccessor) + "}, HasPredecessor = {" + nameof(HasPredecessor) + "}, " + "HasChildIteration = {" + nameof(HasChildIteration) + "}, Message = {" + nameof(Message) + @"} \}" )] -internal record class TrunkBasedCommit(TrunkBasedIteration Iteration, ICommit Value, ReferenceName BranchName, EffectiveConfiguration Configuration, VersionField Increment) +internal record TrunkBasedCommit(TrunkBasedIteration Iteration, ICommit Value, ReferenceName BranchName, EffectiveConfiguration Configuration, VersionField Increment) { public bool IsPredecessorTheLastCommitOnTrunk => !Configuration.IsMainBranch && Predecessor?.Configuration.IsMainBranch == true; diff --git a/src/GitVersion.Core/VersionCalculation/TrunkBased/TrunkBasedContext.cs b/src/GitVersion.Core/VersionCalculation/TrunkBased/TrunkBasedContext.cs index fd11faa676..8386762d05 100644 --- a/src/GitVersion.Core/VersionCalculation/TrunkBased/TrunkBasedContext.cs +++ b/src/GitVersion.Core/VersionCalculation/TrunkBased/TrunkBasedContext.cs @@ -1,6 +1,8 @@ +using GitVersion.Git; + namespace GitVersion.VersionCalculation.TrunkBased; -internal record class TrunkBasedContext +internal record TrunkBasedContext { public string? TargetLabel { get; init; } diff --git a/src/GitVersion.Core/VersionCalculation/TrunkBased/TrunkBasedIteration.cs b/src/GitVersion.Core/VersionCalculation/TrunkBased/TrunkBasedIteration.cs index b10d3d688e..b8ec6f9673 100644 --- a/src/GitVersion.Core/VersionCalculation/TrunkBased/TrunkBasedIteration.cs +++ b/src/GitVersion.Core/VersionCalculation/TrunkBased/TrunkBasedIteration.cs @@ -1,12 +1,13 @@ using GitVersion.Configuration; using GitVersion.Extensions; +using GitVersion.Git; namespace GitVersion.VersionCalculation.TrunkBased; [DebuggerDisplay( @"\{ Id = {" + nameof(Id) + "}, BranchName = {" + nameof(BranchName) + "}, Depth = {" + nameof(Depth) + "}, NumberOfCommits = {" + nameof(NumberOfCommits) + "}" + @"} \}" )] -internal record class TrunkBasedIteration +internal record TrunkBasedIteration { public EffectiveConfiguration Configuration { get; } diff --git a/src/GitVersion.Core/VersionCalculation/VersionCalculators/ContinuousDeliveryVersionCalculator.cs b/src/GitVersion.Core/VersionCalculation/VersionCalculators/ContinuousDeliveryVersionCalculator.cs index 8cd7bd2044..91098dae31 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionCalculators/ContinuousDeliveryVersionCalculator.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionCalculators/ContinuousDeliveryVersionCalculator.cs @@ -1,4 +1,5 @@ using GitVersion.Common; +using GitVersion.Git; using GitVersion.Logging; namespace GitVersion.VersionCalculation; diff --git a/src/GitVersion.Core/VersionCalculation/VersionCalculators/ContinuousDeploymentVersionCalculator.cs b/src/GitVersion.Core/VersionCalculation/VersionCalculators/ContinuousDeploymentVersionCalculator.cs index 0808340627..eb8bcc3acc 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionCalculators/ContinuousDeploymentVersionCalculator.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionCalculators/ContinuousDeploymentVersionCalculator.cs @@ -1,4 +1,5 @@ using GitVersion.Common; +using GitVersion.Git; using GitVersion.Logging; namespace GitVersion.VersionCalculation; diff --git a/src/GitVersion.Core/VersionCalculation/VersionCalculators/ManualDeploymentVersionCalculator.cs b/src/GitVersion.Core/VersionCalculation/VersionCalculators/ManualDeploymentVersionCalculator.cs index 41364db63d..537ee7b360 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionCalculators/ManualDeploymentVersionCalculator.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionCalculators/ManualDeploymentVersionCalculator.cs @@ -1,4 +1,5 @@ using GitVersion.Common; +using GitVersion.Git; using GitVersion.Logging; namespace GitVersion.VersionCalculation; diff --git a/src/GitVersion.Core/VersionCalculation/VersionCalculators/NextVersionCalculator.cs b/src/GitVersion.Core/VersionCalculation/VersionCalculators/NextVersionCalculator.cs index 4780f6b757..692b4cbc4f 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionCalculators/NextVersionCalculator.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionCalculators/NextVersionCalculator.cs @@ -3,6 +3,7 @@ using GitVersion.Configuration; using GitVersion.Core; using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.Logging; namespace GitVersion.VersionCalculation; diff --git a/src/GitVersion.Core/VersionCalculation/VersionCalculators/VersionCalculatorBase.cs b/src/GitVersion.Core/VersionCalculation/VersionCalculators/VersionCalculatorBase.cs index 3c939332dc..a37ece76d8 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionCalculators/VersionCalculatorBase.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionCalculators/VersionCalculatorBase.cs @@ -1,5 +1,6 @@ using GitVersion.Common; using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.Logging; namespace GitVersion.VersionCalculation; diff --git a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/BaseVersion.cs b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/BaseVersion.cs index 03fa295d43..0d32d3dd48 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/BaseVersion.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/BaseVersion.cs @@ -1,9 +1,10 @@ using System.Diagnostics.CodeAnalysis; using GitVersion.Extensions; +using GitVersion.Git; namespace GitVersion.VersionCalculation; -public sealed record class BaseVersion : IBaseVersion +public sealed record BaseVersion(BaseVersionOperand Operand) : IBaseVersion { public BaseVersion() : this(new BaseVersionOperand()) { @@ -14,8 +15,6 @@ public BaseVersion(string source, SemanticVersion semanticVersion, ICommit? base { } - public BaseVersion(BaseVersionOperand baseVersionOperand) => Operand = baseVersionOperand.NotNull(); - public string Source => (Operator?.Source).IsNullOrEmpty() ? Operand.Source : Operator.Source; public SemanticVersion SemanticVersion => Operand.SemanticVersion; @@ -25,7 +24,7 @@ public BaseVersion(string source, SemanticVersion semanticVersion, ICommit? base [MemberNotNullWhen(true, nameof(Operator))] public bool ShouldIncrement => Operator is not null; - public BaseVersionOperand Operand { get; init; } + public BaseVersionOperand Operand { get; init; } = Operand.NotNull(); public BaseVersionOperator? Operator { get; init; } diff --git a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/BaseVersionOperand.cs b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/BaseVersionOperand.cs index 4e3b44477b..0a963bb947 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/BaseVersionOperand.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/BaseVersionOperand.cs @@ -1,23 +1,16 @@ using GitVersion.Extensions; +using GitVersion.Git; namespace GitVersion.VersionCalculation; -public sealed record class BaseVersionOperand : IBaseVersionIncrement +public sealed record BaseVersionOperand(string Source, SemanticVersion SemanticVersion, ICommit? BaseVersionSource = null) + : IBaseVersionIncrement { public BaseVersionOperand() : this(string.Empty, SemanticVersion.Empty) { } - public BaseVersionOperand(string source, SemanticVersion semanticVersion, ICommit? baseVersionSource = null) - { - Source = source.NotNull(); - SemanticVersion = semanticVersion.NotNull(); - BaseVersionSource = baseVersionSource; - } - - public string Source { get; init; } - - public SemanticVersion SemanticVersion { get; init; } + public string Source { get; init; } = Source.NotNull(); - public ICommit? BaseVersionSource { get; init; } + public SemanticVersion SemanticVersion { get; init; } = SemanticVersion.NotNull(); } diff --git a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/BaseVersionOperator.cs b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/BaseVersionOperator.cs index 11268c82b5..8f2708bc99 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/BaseVersionOperator.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/BaseVersionOperator.cs @@ -1,3 +1,5 @@ +using GitVersion.Git; + namespace GitVersion.VersionCalculation; public sealed record class BaseVersionOperator : IBaseVersionIncrement diff --git a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/IBaseVersionIncrement.cs b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/IBaseVersionIncrement.cs index e22cfbd9f8..02f53b7cd1 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/IBaseVersionIncrement.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/IBaseVersionIncrement.cs @@ -1,3 +1,5 @@ +using GitVersion.Git; + namespace GitVersion.VersionCalculation; public interface IBaseVersionIncrement diff --git a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/TrackReleaseBranchesVersionStrategy.cs b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/TrackReleaseBranchesVersionStrategy.cs index adbe014cad..6d8ddf164f 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/TrackReleaseBranchesVersionStrategy.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/TrackReleaseBranchesVersionStrategy.cs @@ -3,6 +3,7 @@ using GitVersion.Configuration; using GitVersion.Core; using GitVersion.Extensions; +using GitVersion.Git; namespace GitVersion.VersionCalculation; diff --git a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/TrunkBasedVersionStrategy.cs b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/TrunkBasedVersionStrategy.cs index ddeb03ee84..f5f4397775 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/TrunkBasedVersionStrategy.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/TrunkBasedVersionStrategy.cs @@ -3,6 +3,7 @@ using GitVersion.Configuration; using GitVersion.Core; using GitVersion.Extensions; +using GitVersion.Git; using GitVersion.VersionCalculation.TrunkBased; using GitVersion.VersionCalculation.TrunkBased.NonTrunk; using GitVersion.VersionCalculation.TrunkBased.Trunk; @@ -16,7 +17,11 @@ internal sealed class TrunkBasedVersionStrategy( IIncrementStrategyFinder incrementStrategyFinder) : IVersionStrategy { + private volatile int iterationCounter; private readonly Lazy contextLazy = contextLazy.NotNull(); + private readonly ITaggedSemanticVersionRepository taggedSemanticVersionRepository = taggedSemanticVersionRepository.NotNull(); + private readonly IRepositoryStore repositoryStore = repositoryStore.NotNull(); + private readonly IIncrementStrategyFinder incrementStrategyFinder = incrementStrategyFinder.NotNull(); private GitVersionContext Context => contextLazy.Value; @@ -62,12 +67,6 @@ internal sealed class TrunkBasedVersionStrategy( new CommitOnNonTrunkBranchedToNonTrunk() ]; - private volatile int iterationCounter; - - private readonly ITaggedSemanticVersionRepository taggedSemanticVersionRepository = taggedSemanticVersionRepository.NotNull(); - private readonly IRepositoryStore repositoryStore = repositoryStore.NotNull(); - private readonly IIncrementStrategyFinder incrementStrategyFinder = incrementStrategyFinder.NotNull(); - public IEnumerable GetBaseVersions(EffectiveBranchConfiguration configuration) { configuration.NotNull(); @@ -110,7 +109,7 @@ private bool IterateOverCommitsRecursive( IEnumerable commitsInReverseOrder, TrunkBasedIteration iteration, string? targetLabel, ILookup taggedSemanticVersions, HashSet? traversedCommits = null) { - traversedCommits ??= new(); + traversedCommits ??= []; Lazy> commitsWasBranchedFromLazy = new( () => GetCommitsWasBranchedFrom(branchName: iteration.BranchName) @@ -219,7 +218,7 @@ private VersionField GetIncrementForcedByCommit(ICommit commit, EffectiveConfigu private IReadOnlyDictionary GetCommitsWasBranchedFrom(ReferenceName branchName) { - Dictionary result = new(); + Dictionary result = []; var branch = repositoryStore.FindBranch(branchName); if (branch is null) return result; diff --git a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/VersionInBranchNameVersionStrategy.cs b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/VersionInBranchNameVersionStrategy.cs index 976bf25122..fb4c382343 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/VersionInBranchNameVersionStrategy.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/VersionInBranchNameVersionStrategy.cs @@ -2,6 +2,7 @@ using GitVersion.Common; using GitVersion.Configuration; using GitVersion.Extensions; +using GitVersion.Git; namespace GitVersion.VersionCalculation; diff --git a/src/GitVersion.LibGit2Sharp/Git/Branch.cs b/src/GitVersion.LibGit2Sharp/Git/Branch.cs index 5722d5cfa9..2cbda65c0e 100644 --- a/src/GitVersion.LibGit2Sharp/Git/Branch.cs +++ b/src/GitVersion.LibGit2Sharp/Git/Branch.cs @@ -1,7 +1,7 @@ using GitVersion.Extensions; using GitVersion.Helpers; -namespace GitVersion; +namespace GitVersion.Git; internal sealed class Branch : IBranch { diff --git a/src/GitVersion.LibGit2Sharp/Git/BranchCollection.cs b/src/GitVersion.LibGit2Sharp/Git/BranchCollection.cs index 89cb27fe04..b543161bd8 100644 --- a/src/GitVersion.LibGit2Sharp/Git/BranchCollection.cs +++ b/src/GitVersion.LibGit2Sharp/Git/BranchCollection.cs @@ -1,7 +1,7 @@ using GitVersion.Extensions; using LibGit2Sharp; -namespace GitVersion; +namespace GitVersion.Git; internal sealed class BranchCollection : IBranchCollection { diff --git a/src/GitVersion.LibGit2Sharp/Git/Commit.cs b/src/GitVersion.LibGit2Sharp/Git/Commit.cs index 2aa64d2f17..f9dd9cfc06 100644 --- a/src/GitVersion.LibGit2Sharp/Git/Commit.cs +++ b/src/GitVersion.LibGit2Sharp/Git/Commit.cs @@ -1,7 +1,7 @@ using GitVersion.Extensions; using GitVersion.Helpers; -namespace GitVersion; +namespace GitVersion.Git; internal sealed class Commit : GitObject, ICommit { @@ -14,13 +14,13 @@ internal sealed class Commit : GitObject, ICommit internal Commit(LibGit2Sharp.Commit innerCommit) : base(innerCommit) { this.innerCommit = innerCommit.NotNull(); - parentsLazy = new Lazy>(() => innerCommit.Parents.Select(parent => new Commit(parent)).ToList()); + this.parentsLazy = new(() => innerCommit.Parents.Select(parent => new Commit(parent)).ToList()); When = innerCommit.Committer.When; } public int CompareTo(ICommit? other) => comparerHelper.Compare(this, other); public bool Equals(ICommit? other) => equalityHelper.Equals(this, other); - public IReadOnlyList Parents => parentsLazy.Value; + public IReadOnlyList Parents => this.parentsLazy.Value; public DateTimeOffset When { get; } public string Message => this.innerCommit.Message; public override bool Equals(object? obj) => Equals(obj as ICommit); diff --git a/src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs b/src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs index 94e1d49d03..08ebb91393 100644 --- a/src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs +++ b/src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs @@ -1,7 +1,7 @@ using GitVersion.Extensions; using LibGit2Sharp; -namespace GitVersion; +namespace GitVersion.Git; internal sealed class CommitCollection : ICommitCollection { diff --git a/src/GitVersion.LibGit2Sharp/Git/GitObject.cs b/src/GitVersion.LibGit2Sharp/Git/GitObject.cs index 16fa8ebaa9..850168393c 100644 --- a/src/GitVersion.LibGit2Sharp/Git/GitObject.cs +++ b/src/GitVersion.LibGit2Sharp/Git/GitObject.cs @@ -1,7 +1,7 @@ using GitVersion.Extensions; using GitVersion.Helpers; -namespace GitVersion; +namespace GitVersion.Git; internal class GitObject : IGitObject { diff --git a/src/GitVersion.LibGit2Sharp/Git/GitRepository.cs b/src/GitVersion.LibGit2Sharp/Git/GitRepository.cs index 71d62e7959..6662992379 100644 --- a/src/GitVersion.LibGit2Sharp/Git/GitRepository.cs +++ b/src/GitVersion.LibGit2Sharp/Git/GitRepository.cs @@ -2,7 +2,7 @@ using GitVersion.Helpers; using LibGit2Sharp; -namespace GitVersion; +namespace GitVersion.Git; internal sealed partial class GitRepository { diff --git a/src/GitVersion.LibGit2Sharp/Git/GitRepository.extended.cs b/src/GitVersion.LibGit2Sharp/Git/GitRepository.extended.cs index e13641eb56..35abc4d410 100644 --- a/src/GitVersion.LibGit2Sharp/Git/GitRepository.extended.cs +++ b/src/GitVersion.LibGit2Sharp/Git/GitRepository.extended.cs @@ -4,7 +4,7 @@ using LibGit2Sharp; using LibGit2Sharp.Handlers; -namespace GitVersion; +namespace GitVersion.Git; internal partial class GitRepository(ILog log) : IMutatingGitRepository { diff --git a/src/GitVersion.LibGit2Sharp/Git/GitRepositoryInfo.cs b/src/GitVersion.LibGit2Sharp/Git/GitRepositoryInfo.cs index 65e8aaead9..a432d51a8e 100644 --- a/src/GitVersion.LibGit2Sharp/Git/GitRepositoryInfo.cs +++ b/src/GitVersion.LibGit2Sharp/Git/GitRepositoryInfo.cs @@ -3,7 +3,7 @@ using LibGit2Sharp; using Microsoft.Extensions.Options; -namespace GitVersion; +namespace GitVersion.Git; internal class GitRepositoryInfo : IGitRepositoryInfo { diff --git a/src/GitVersion.LibGit2Sharp/Git/ObjectId.cs b/src/GitVersion.LibGit2Sharp/Git/ObjectId.cs index 243133eb6b..0d924f59af 100644 --- a/src/GitVersion.LibGit2Sharp/Git/ObjectId.cs +++ b/src/GitVersion.LibGit2Sharp/Git/ObjectId.cs @@ -1,7 +1,7 @@ using GitVersion.Extensions; using GitVersion.Helpers; -namespace GitVersion; +namespace GitVersion.Git; internal sealed class ObjectId : IObjectId { diff --git a/src/GitVersion.LibGit2Sharp/Git/RefSpec.cs b/src/GitVersion.LibGit2Sharp/Git/RefSpec.cs index 16dcca3b95..b32e388e90 100644 --- a/src/GitVersion.LibGit2Sharp/Git/RefSpec.cs +++ b/src/GitVersion.LibGit2Sharp/Git/RefSpec.cs @@ -1,7 +1,7 @@ using GitVersion.Extensions; using GitVersion.Helpers; -namespace GitVersion; +namespace GitVersion.Git; internal class RefSpec : IRefSpec { diff --git a/src/GitVersion.LibGit2Sharp/Git/RefSpecCollection.cs b/src/GitVersion.LibGit2Sharp/Git/RefSpecCollection.cs index e7ca999747..a465fcbd5d 100644 --- a/src/GitVersion.LibGit2Sharp/Git/RefSpecCollection.cs +++ b/src/GitVersion.LibGit2Sharp/Git/RefSpecCollection.cs @@ -1,6 +1,6 @@ using GitVersion.Extensions; -namespace GitVersion; +namespace GitVersion.Git; internal sealed class RefSpecCollection : IRefSpecCollection { diff --git a/src/GitVersion.LibGit2Sharp/Git/Reference.cs b/src/GitVersion.LibGit2Sharp/Git/Reference.cs index cc29b520d5..7afe5a3919 100644 --- a/src/GitVersion.LibGit2Sharp/Git/Reference.cs +++ b/src/GitVersion.LibGit2Sharp/Git/Reference.cs @@ -2,7 +2,7 @@ using GitVersion.Helpers; using LibGit2Sharp; -namespace GitVersion +namespace GitVersion.Git { internal sealed class Reference : IReference { diff --git a/src/GitVersion.LibGit2Sharp/Git/ReferenceCollection.cs b/src/GitVersion.LibGit2Sharp/Git/ReferenceCollection.cs index 2383c33980..1159dfe87a 100644 --- a/src/GitVersion.LibGit2Sharp/Git/ReferenceCollection.cs +++ b/src/GitVersion.LibGit2Sharp/Git/ReferenceCollection.cs @@ -1,6 +1,6 @@ using GitVersion.Extensions; -namespace GitVersion; +namespace GitVersion.Git; internal sealed class ReferenceCollection : IReferenceCollection { diff --git a/src/GitVersion.LibGit2Sharp/Git/Remote.cs b/src/GitVersion.LibGit2Sharp/Git/Remote.cs index 95afdf16a9..a41d7d5e80 100644 --- a/src/GitVersion.LibGit2Sharp/Git/Remote.cs +++ b/src/GitVersion.LibGit2Sharp/Git/Remote.cs @@ -1,7 +1,7 @@ using GitVersion.Extensions; using GitVersion.Helpers; -namespace GitVersion; +namespace GitVersion.Git; internal sealed class Remote : IRemote { diff --git a/src/GitVersion.LibGit2Sharp/Git/RemoteCollection.cs b/src/GitVersion.LibGit2Sharp/Git/RemoteCollection.cs index aad80d1f22..5fc8433621 100644 --- a/src/GitVersion.LibGit2Sharp/Git/RemoteCollection.cs +++ b/src/GitVersion.LibGit2Sharp/Git/RemoteCollection.cs @@ -1,6 +1,6 @@ using GitVersion.Extensions; -namespace GitVersion; +namespace GitVersion.Git; internal sealed class RemoteCollection : IRemoteCollection { diff --git a/src/GitVersion.LibGit2Sharp/Git/RepositoryExtensions.cs b/src/GitVersion.LibGit2Sharp/Git/RepositoryExtensions.cs index 2325ee1e8f..fc32d6e072 100644 --- a/src/GitVersion.LibGit2Sharp/Git/RepositoryExtensions.cs +++ b/src/GitVersion.LibGit2Sharp/Git/RepositoryExtensions.cs @@ -1,4 +1,4 @@ -namespace GitVersion; +namespace GitVersion.Git; internal static class RepositoryExtensions { diff --git a/src/GitVersion.LibGit2Sharp/Git/Tag.cs b/src/GitVersion.LibGit2Sharp/Git/Tag.cs index 477b5ad0d3..71d41570dc 100644 --- a/src/GitVersion.LibGit2Sharp/Git/Tag.cs +++ b/src/GitVersion.LibGit2Sharp/Git/Tag.cs @@ -2,27 +2,27 @@ using GitVersion.Helpers; using LibGit2Sharp; -namespace GitVersion; +namespace GitVersion.Git; internal sealed class Tag : ITag { private static readonly LambdaEqualityHelper equalityHelper = new(x => x.Name.Canonical); private static readonly LambdaKeyComparer comparerHelper = new(x => x.Name.Canonical); private readonly LibGit2Sharp.Tag innerTag; - private readonly Lazy _commitLazy; + private readonly Lazy commitLazy; internal Tag(LibGit2Sharp.Tag tag) { this.innerTag = tag.NotNull(); + this.commitLazy = new(PeeledTargetCommit); Name = new(this.innerTag.CanonicalName); - _commitLazy = new(PeeledTargetCommit); } public ReferenceName Name { get; } public int CompareTo(ITag? other) => comparerHelper.Compare(this, other); public bool Equals(ITag? other) => equalityHelper.Equals(this, other); public string TargetSha => this.innerTag.Target.Sha; - public ICommit Commit => _commitLazy.Value.NotNull(); + public ICommit Commit => this.commitLazy.Value.NotNull(); private ICommit? PeeledTargetCommit() { diff --git a/src/GitVersion.LibGit2Sharp/Git/TagCollection.cs b/src/GitVersion.LibGit2Sharp/Git/TagCollection.cs index ca81e4077f..65f5637cda 100644 --- a/src/GitVersion.LibGit2Sharp/Git/TagCollection.cs +++ b/src/GitVersion.LibGit2Sharp/Git/TagCollection.cs @@ -1,6 +1,6 @@ using GitVersion.Extensions; -namespace GitVersion; +namespace GitVersion.Git; internal sealed class TagCollection : ITagCollection { diff --git a/src/GitVersion.LibGit2Sharp/GitVersionLibGit2SharpModule.cs b/src/GitVersion.LibGit2Sharp/GitVersionLibGit2SharpModule.cs index cdb00d381f..942d60e719 100644 --- a/src/GitVersion.LibGit2Sharp/GitVersionLibGit2SharpModule.cs +++ b/src/GitVersion.LibGit2Sharp/GitVersionLibGit2SharpModule.cs @@ -1,3 +1,4 @@ +using GitVersion.Git; using GitVersion.Logging; using Microsoft.Extensions.DependencyInjection; diff --git a/src/GitVersion.Output.Tests/Output/AssemblyFileVersionTests.cs b/src/GitVersion.Output.Tests/Output/AssemblyFileVersionTests.cs index 377477e6b8..d6f50b26ee 100644 --- a/src/GitVersion.Output.Tests/Output/AssemblyFileVersionTests.cs +++ b/src/GitVersion.Output.Tests/Output/AssemblyFileVersionTests.cs @@ -1,3 +1,4 @@ +using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Extensions; diff --git a/src/GitVersion.Output.Tests/Output/AssemblyInfoFileUpdaterTests.cs b/src/GitVersion.Output.Tests/Output/AssemblyInfoFileUpdaterTests.cs index 1d576d0dd8..7082e33020 100644 --- a/src/GitVersion.Output.Tests/Output/AssemblyInfoFileUpdaterTests.cs +++ b/src/GitVersion.Output.Tests/Output/AssemblyInfoFileUpdaterTests.cs @@ -1,6 +1,5 @@ using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; -using GitVersion.Extensions; using GitVersion.Helpers; using GitVersion.Logging; using GitVersion.Output.AssemblyInfo; diff --git a/src/GitVersion.Output.Tests/Output/ProjectFileUpdaterTests.cs b/src/GitVersion.Output.Tests/Output/ProjectFileUpdaterTests.cs index 9a3d6b5790..90f92f91c4 100644 --- a/src/GitVersion.Output.Tests/Output/ProjectFileUpdaterTests.cs +++ b/src/GitVersion.Output.Tests/Output/ProjectFileUpdaterTests.cs @@ -1,7 +1,6 @@ using System.Xml.Linq; using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; -using GitVersion.Extensions; using GitVersion.Helpers; using GitVersion.Logging; using GitVersion.Output.AssemblyInfo; diff --git a/src/GitVersion.Output/AssemblyInfo/AssemblyInfoContext.cs b/src/GitVersion.Output/AssemblyInfo/AssemblyInfoContext.cs index 44dfeb79c0..c8e51572dd 100644 --- a/src/GitVersion.Output/AssemblyInfo/AssemblyInfoContext.cs +++ b/src/GitVersion.Output/AssemblyInfo/AssemblyInfoContext.cs @@ -1,9 +1,4 @@ namespace GitVersion.Output.AssemblyInfo; -internal readonly struct AssemblyInfoContext(string workingDirectory, bool ensureAssemblyInfo, params string[] assemblyInfoFiles) - : IConverterContext -{ - public string WorkingDirectory { get; } = workingDirectory; - public bool EnsureAssemblyInfo { get; } = ensureAssemblyInfo; - public string[] AssemblyInfoFiles { get; } = assemblyInfoFiles; -} +internal readonly record struct AssemblyInfoContext(string WorkingDirectory, bool EnsureAssemblyInfo, params string[] AssemblyInfoFiles) + : IConverterContext; diff --git a/src/GitVersion.Output/GitVersion.Output.csproj b/src/GitVersion.Output/GitVersion.Output.csproj index da36e3d835..8b771aa5b5 100644 --- a/src/GitVersion.Output/GitVersion.Output.csproj +++ b/src/GitVersion.Output/GitVersion.Output.csproj @@ -1,16 +1,32 @@ + + + GITVERSION_OUTPUT + + + + + + + + + Attributes\JsonPropertyDescriptionAttribute.cs + + + + diff --git a/src/GitVersion.Output/GitVersionInfo/GitVersionInfoContext.cs b/src/GitVersion.Output/GitVersionInfo/GitVersionInfoContext.cs index 13f2840da7..27217adf90 100644 --- a/src/GitVersion.Output/GitVersionInfo/GitVersionInfoContext.cs +++ b/src/GitVersion.Output/GitVersionInfo/GitVersionInfoContext.cs @@ -1,14 +1,14 @@ namespace GitVersion.Output.GitVersionInfo; -internal readonly struct GitVersionInfoContext(string workingDirectory, string fileName, string fileExtension, string? targetNamespace = null) +internal readonly record struct GitVersionInfoContext( + string WorkingDirectory, + string FileName, + string FileExtension, + string? TargetNamespace = null) : IConverterContext { - public GitVersionInfoContext(string workingDirectory, string fileName, string fileExtension) : this(workingDirectory, fileName, fileExtension, null) + public GitVersionInfoContext(string workingDirectory, string fileName, string fileExtension) + : this(workingDirectory, fileName, fileExtension, null) { } - - public string WorkingDirectory { get; } = workingDirectory; - public string FileName { get; } = fileName; - public string FileExtension { get; } = fileExtension; - public string? TargetNamespace { get; } = targetNamespace; } diff --git a/src/GitVersion.Output/OutputGenerator/OutputContext.cs b/src/GitVersion.Output/OutputGenerator/OutputContext.cs index e001ba8cc3..98ad1474ff 100644 --- a/src/GitVersion.Output/OutputGenerator/OutputContext.cs +++ b/src/GitVersion.Output/OutputGenerator/OutputContext.cs @@ -1,9 +1,3 @@ namespace GitVersion.Output.OutputGenerator; -internal readonly struct OutputContext(string workingDirectory, string? outputFile, bool? updateBuildNumber) - : IConverterContext -{ - public string WorkingDirectory { get; } = workingDirectory; - public string? OutputFile { get; } = outputFile; - public bool? UpdateBuildNumber { get; } = updateBuildNumber; -} +internal readonly record struct OutputContext(string WorkingDirectory, string? OutputFile, bool? UpdateBuildNumber) : IConverterContext; diff --git a/src/GitVersion.Output/PublicAPI.Unshipped.txt b/src/GitVersion.Output/PublicAPI.Unshipped.txt index 946f93a466..a3558a8293 100644 --- a/src/GitVersion.Output/PublicAPI.Unshipped.txt +++ b/src/GitVersion.Output/PublicAPI.Unshipped.txt @@ -4,70 +4,9 @@ GitVersion.IGitVersionOutputTool.GenerateGitVersionInformation(GitVersion.Output GitVersion.IGitVersionOutputTool.OutputVariables(GitVersion.OutputVariables.GitVersionVariables! variables, bool updateBuildNumber) -> void GitVersion.IGitVersionOutputTool.UpdateAssemblyInfo(GitVersion.OutputVariables.GitVersionVariables! variables) -> void GitVersion.IGitVersionOutputTool.UpdateWixVersionFile(GitVersion.OutputVariables.GitVersionVariables! variables) -> void +GitVersion.Output.Attributes.JsonPropertyDescriptionAttribute +GitVersion.Output.Attributes.JsonPropertyDescriptionAttribute.Description.get -> string! +GitVersion.Output.Attributes.JsonPropertyDescriptionAttribute.JsonPropertyDescriptionAttribute(string! description) -> void GitVersion.Output.GitVersionOutputModule GitVersion.Output.GitVersionOutputModule.GitVersionOutputModule() -> void -GitVersion.Output.GitVersionOutputModule.RegisterTypes(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void -GitVersion.OutputVariables.VersionVariableSerializer -GitVersion.OutputVariables.VersionVariableSerializer.FromFile(string! filePath) -> GitVersion.OutputVariables.GitVersionVariables! -GitVersion.OutputVariables.VersionVariableSerializer.FromJson(string! json) -> GitVersion.OutputVariables.GitVersionVariables! -GitVersion.OutputVariables.VersionVariableSerializer.ToFile(GitVersion.OutputVariables.GitVersionVariables! gitVersionVariables, string! filePath) -> void -GitVersion.OutputVariables.VersionVariableSerializer.ToJson(GitVersion.OutputVariables.GitVersionVariables! gitVersionVariables) -> string! -GitVersion.OutputVariables.VersionVariableSerializer.VersionVariableSerializer(GitVersion.IFileSystem! fileSystem) -> void -GitVersion.OutputVariables.VersionVariablesJsonModel -GitVersion.OutputVariables.VersionVariablesJsonModel.AssemblySemFileVer.get -> string? -GitVersion.OutputVariables.VersionVariablesJsonModel.AssemblySemFileVer.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.AssemblySemVer.get -> string? -GitVersion.OutputVariables.VersionVariablesJsonModel.AssemblySemVer.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.BranchName.get -> string? -GitVersion.OutputVariables.VersionVariablesJsonModel.BranchName.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.BuildMetaData.get -> int? -GitVersion.OutputVariables.VersionVariablesJsonModel.BuildMetaData.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.CommitDate.get -> string? -GitVersion.OutputVariables.VersionVariablesJsonModel.CommitDate.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.CommitsSinceVersionSource.get -> int? -GitVersion.OutputVariables.VersionVariablesJsonModel.CommitsSinceVersionSource.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.EscapedBranchName.get -> string? -GitVersion.OutputVariables.VersionVariablesJsonModel.EscapedBranchName.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.FullBuildMetaData.get -> string? -GitVersion.OutputVariables.VersionVariablesJsonModel.FullBuildMetaData.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.FullSemVer.get -> string? -GitVersion.OutputVariables.VersionVariablesJsonModel.FullSemVer.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.InformationalVersion.get -> string? -GitVersion.OutputVariables.VersionVariablesJsonModel.InformationalVersion.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.Major.get -> int? -GitVersion.OutputVariables.VersionVariablesJsonModel.Major.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.MajorMinorPatch.get -> string? -GitVersion.OutputVariables.VersionVariablesJsonModel.MajorMinorPatch.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.Minor.get -> int? -GitVersion.OutputVariables.VersionVariablesJsonModel.Minor.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.Patch.get -> int? -GitVersion.OutputVariables.VersionVariablesJsonModel.Patch.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.PreReleaseLabel.get -> string? -GitVersion.OutputVariables.VersionVariablesJsonModel.PreReleaseLabel.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.PreReleaseLabelWithDash.get -> string? -GitVersion.OutputVariables.VersionVariablesJsonModel.PreReleaseLabelWithDash.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.PreReleaseNumber.get -> int? -GitVersion.OutputVariables.VersionVariablesJsonModel.PreReleaseNumber.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.PreReleaseTag.get -> string? -GitVersion.OutputVariables.VersionVariablesJsonModel.PreReleaseTag.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.PreReleaseTagWithDash.get -> string? -GitVersion.OutputVariables.VersionVariablesJsonModel.PreReleaseTagWithDash.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.SemVer.get -> string? -GitVersion.OutputVariables.VersionVariablesJsonModel.SemVer.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.Sha.get -> string? -GitVersion.OutputVariables.VersionVariablesJsonModel.Sha.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.ShortSha.get -> string? -GitVersion.OutputVariables.VersionVariablesJsonModel.ShortSha.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.UncommittedChanges.get -> int? -GitVersion.OutputVariables.VersionVariablesJsonModel.UncommittedChanges.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.VersionSourceSha.get -> string? -GitVersion.OutputVariables.VersionVariablesJsonModel.VersionSourceSha.set -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.VersionVariablesJsonModel() -> void -GitVersion.OutputVariables.VersionVariablesJsonModel.WeightedPreReleaseNumber.get -> int? -GitVersion.OutputVariables.VersionVariablesJsonModel.WeightedPreReleaseNumber.set -> void -GitVersion.OutputVariables.VersionVariablesJsonStringConverter -GitVersion.OutputVariables.VersionVariablesJsonStringConverter.VersionVariablesJsonStringConverter() -> void -override GitVersion.OutputVariables.VersionVariablesJsonStringConverter.CanConvert(System.Type! typeToConvert) -> bool -override GitVersion.OutputVariables.VersionVariablesJsonStringConverter.HandleNull.get -> bool -override GitVersion.OutputVariables.VersionVariablesJsonStringConverter.Read(ref System.Text.Json.Utf8JsonReader reader, System.Type! typeToConvert, System.Text.Json.JsonSerializerOptions! options) -> string! -override GitVersion.OutputVariables.VersionVariablesJsonStringConverter.Write(System.Text.Json.Utf8JsonWriter! writer, string? value, System.Text.Json.JsonSerializerOptions! options) -> void +GitVersion.Output.GitVersionOutputModule.RegisterTypes(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void \ No newline at end of file diff --git a/src/GitVersion.Output/Serializer/VersionVariableSerializer.cs b/src/GitVersion.Output/Serializer/VersionVariableSerializer.cs index 1ffac9e567..b6243ea2aa 100644 --- a/src/GitVersion.Output/Serializer/VersionVariableSerializer.cs +++ b/src/GitVersion.Output/Serializer/VersionVariableSerializer.cs @@ -4,7 +4,7 @@ namespace GitVersion.OutputVariables; -public class VersionVariableSerializer(IFileSystem fileSystem) : IVersionVariableSerializer +internal class VersionVariableSerializer(IFileSystem fileSystem) : IVersionVariableSerializer { public GitVersionVariables FromJson(string json) { diff --git a/src/GitVersion.Output/Serializer/VersionVariablesJsonModel.cs b/src/GitVersion.Output/Serializer/VersionVariablesJsonModel.cs index b545391ffc..89d32b254b 100644 --- a/src/GitVersion.Output/Serializer/VersionVariablesJsonModel.cs +++ b/src/GitVersion.Output/Serializer/VersionVariablesJsonModel.cs @@ -1,8 +1,8 @@ -using GitVersion.Attributes; +using GitVersion.Output.Attributes; namespace GitVersion.OutputVariables; -public class VersionVariablesJsonModel +internal class VersionVariablesJsonModel { [JsonPropertyDescription("Suitable for .NET AssemblyFileVersion. Defaults to Major.Minor.Patch.0.")] public string? AssemblySemFileVer { get; set; } diff --git a/src/GitVersion.Output/Serializer/VersionVariablesJsonStringConverter.cs b/src/GitVersion.Output/Serializer/VersionVariablesJsonStringConverter.cs index a5d7c2844a..236853f11d 100644 --- a/src/GitVersion.Output/Serializer/VersionVariablesJsonStringConverter.cs +++ b/src/GitVersion.Output/Serializer/VersionVariablesJsonStringConverter.cs @@ -3,7 +3,7 @@ namespace GitVersion.OutputVariables; -public class VersionVariablesJsonStringConverter : JsonConverter +internal class VersionVariablesJsonStringConverter : JsonConverter { public override bool CanConvert(Type typeToConvert) => typeToConvert == typeof(string); diff --git a/src/GitVersion.Output/WixUpdater/WixVersionContext.cs b/src/GitVersion.Output/WixUpdater/WixVersionContext.cs index f802f4e6ef..391beaf11d 100644 --- a/src/GitVersion.Output/WixUpdater/WixVersionContext.cs +++ b/src/GitVersion.Output/WixUpdater/WixVersionContext.cs @@ -1,6 +1,3 @@ namespace GitVersion.Output.WixUpdater; -internal readonly struct WixVersionContext(string workingDirectory) : IConverterContext -{ - public string WorkingDirectory { get; } = workingDirectory; -} +internal readonly record struct WixVersionContext(string WorkingDirectory) : IConverterContext; diff --git a/src/GitVersion.Schema/DefaultAttributeHandler.cs b/src/GitVersion.Schema/DefaultAttributeHandler.cs index 8ffa5c5b5a..3d80690d21 100644 --- a/src/GitVersion.Schema/DefaultAttributeHandler.cs +++ b/src/GitVersion.Schema/DefaultAttributeHandler.cs @@ -1,4 +1,4 @@ -using GitVersion.Attributes; +using GitVersion.Configuration.Attributes; using Json.Schema.Generation; using Json.Schema.Generation.Intents; diff --git a/src/GitVersion.Schema/DescriptionAttributeHandler.cs b/src/GitVersion.Schema/DescriptionAttributeHandler.cs index f87bd157a5..2ebfd69302 100644 --- a/src/GitVersion.Schema/DescriptionAttributeHandler.cs +++ b/src/GitVersion.Schema/DescriptionAttributeHandler.cs @@ -1,14 +1,27 @@ -using GitVersion.Attributes; using Json.Schema.Generation; using Json.Schema.Generation.Intents; +using ConfigurationDescriptionAttribute = GitVersion.Configuration.Attributes.JsonPropertyDescriptionAttribute; +using OutputDescriptionAttribute = GitVersion.Output.Attributes.JsonPropertyDescriptionAttribute; + namespace GitVersion.Schema; -internal class DescriptionAttributeHandler : IAttributeHandler +internal class DescriptionAttributeHandler1 : IAttributeHandler +{ + void IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute) + { + if (attribute is ConfigurationDescriptionAttribute descriptionAttribute) + { + context.Intents.Insert(0, new DescriptionIntent(descriptionAttribute.Description)); + } + } +} + +internal class DescriptionAttributeHandler2 : IAttributeHandler { void IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute) { - if (attribute is JsonPropertyDescriptionAttribute descriptionAttribute) + if (attribute is OutputDescriptionAttribute descriptionAttribute) { context.Intents.Insert(0, new DescriptionIntent(descriptionAttribute.Description)); } diff --git a/src/GitVersion.Schema/FormatAttributeHandler.cs b/src/GitVersion.Schema/FormatAttributeHandler.cs index bd49aa4bba..1c3bd5a8d1 100644 --- a/src/GitVersion.Schema/FormatAttributeHandler.cs +++ b/src/GitVersion.Schema/FormatAttributeHandler.cs @@ -1,15 +1,15 @@ -using GitVersion.Attributes; using Json.Schema; using Json.Schema.Generation; using Json.Schema.Generation.Intents; -using Format = GitVersion.Attributes.Format; +using Format = GitVersion.Configuration.Attributes.Format; +using FormatAttribute = GitVersion.Configuration.Attributes.JsonPropertyFormatAttribute; namespace GitVersion.Schema; -internal class FormatAttributeHandler : IAttributeHandler +internal class FormatAttributeHandler : IAttributeHandler { void IAttributeHandler.AddConstraints(SchemaGenerationContextBase context, Attribute attribute) { - if (attribute is JsonPropertyFormatAttribute formatAttribute) + if (attribute is FormatAttribute formatAttribute) { Json.Schema.Format? format = formatAttribute.Format switch { diff --git a/src/GitVersion.Schema/Program.cs b/src/GitVersion.Schema/Program.cs index 25e30bbfac..3bed198c98 100644 --- a/src/GitVersion.Schema/Program.cs +++ b/src/GitVersion.Schema/Program.cs @@ -17,7 +17,8 @@ }; AttributeHandler.AddHandler(); -AttributeHandler.AddHandler(); +AttributeHandler.AddHandler(); +AttributeHandler.AddHandler(); AttributeHandler.AddHandler(); var builder = new JsonSchemaBuilder(); @@ -33,7 +34,7 @@ configuration.PropertyNameResolver = PropertyNameResolvers.AsDeclared; -builder = new JsonSchemaBuilder(); +builder = new(); builder.Schema("http://json-schema.org/draft-07/schema#"); builder.Id($"https://gitversion.net/schemas/{schemaVersion}/GitVersion.json"); builder.Title("GitVersion version variables output");