From c63c1a30d0e77be2d7d9fde7aa6c0e6b91275c24 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Mon, 9 Dec 2024 22:15:27 +0100 Subject: [PATCH 001/107] update actions/attest-build-provenance to v2.0.1 --- .github/actions/artifacts-attest/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/artifacts-attest/action.yml b/.github/actions/artifacts-attest/action.yml index a1d424e510..7722489c36 100644 --- a/.github/actions/artifacts-attest/action.yml +++ b/.github/actions/artifacts-attest/action.yml @@ -6,7 +6,7 @@ runs: steps: - name: 'Attestation' - uses: actions/attest-build-provenance@v1 + uses: actions/attest-build-provenance@v2.0.1 with: subject-path: | ${{ github.workspace }}/artifacts/packages/native From 7b50d63835ba690dd45ba09350f1cc2d07f9896c Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Fri, 20 Dec 2024 13:37:16 +0100 Subject: [PATCH 002/107] remove ignore in dependabot --- .github/dependabot.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f74944833f..60831b08ed 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -32,8 +32,6 @@ updates: - "/new-cli" - "/src" - "/" - ignore: - - dependency-name: "LibGit2Sharp" schedule: interval: daily open-pull-requests-limit: 10 From 2d1166e2f03478bb1a54a59b6dece8a25d669f76 Mon Sep 17 00:00:00 2001 From: HHobeck Date: Tue, 7 Jan 2025 09:03:12 +0100 Subject: [PATCH 003/107] Topological commit sort causes issues when master is merged into a feature branch --- .../reference/modes/continuous-delivery.md | 2 +- .../reference/modes/continuous-deployment.md | 2 +- .../docs/reference/modes/manual-deployment.md | 2 +- .../Extensions/GitToolsTestingExtensions.cs | 2 +- .../IntegrationTests/OtherScenarios.cs | 23 +++++++++++-------- .../IntegrationTests/PerformanceScenarios.cs | 13 +++++++---- .../IncrementStrategyFinder.cs | 7 ++++-- .../TaggedCommitVersionStrategy.cs | 22 ++++++++++++++++-- 8 files changed, 50 insertions(+), 23 deletions(-) diff --git a/docs/input/docs/reference/modes/continuous-delivery.md b/docs/input/docs/reference/modes/continuous-delivery.md index 3b6aa456ae..ee5c1df4cf 100644 --- a/docs/input/docs/reference/modes/continuous-delivery.md +++ b/docs/input/docs/reference/modes/continuous-delivery.md @@ -24,7 +24,7 @@ Continuous delivery is good when you deploy continuously to an testing system. * 1.1.0-3 * 1.1.0-2 (tag: 1.1.0-2) <-- This is the version which has been deployed on testing * 1.1.0-1 -* 1.1.1-0 +* 1.1.0-0 Tags are not required but optional in this mode to communicate when the release is done as it's an automated process. diff --git a/docs/input/docs/reference/modes/continuous-deployment.md b/docs/input/docs/reference/modes/continuous-deployment.md index 88d7f7887e..b700c3732b 100644 --- a/docs/input/docs/reference/modes/continuous-deployment.md +++ b/docs/input/docs/reference/modes/continuous-deployment.md @@ -21,7 +21,7 @@ to deploy on production. This means that GitVersion will build * 1.2.0 * 1.1.0 (tag: 1.1.0) <-- This is the version which has been deployed on production * 1.1.0 -* 1.1.1 +* 1.1.0 Tags are required in this mode to communicate when the deployment happens on production. diff --git a/docs/input/docs/reference/modes/manual-deployment.md b/docs/input/docs/reference/modes/manual-deployment.md index e76e3e08d0..75e0fb9d74 100644 --- a/docs/input/docs/reference/modes/manual-deployment.md +++ b/docs/input/docs/reference/modes/manual-deployment.md @@ -21,7 +21,7 @@ deployed. For instance: * 1.1.0-2+1 * 1.1.0-1+2 (tag: 1.1.0-1) <-- This is the version which has been deployed on testing * 1.1.0-1+1 -* 1.1.1-1+0 +* 1.1.0-1+0 Tags are required in this mode to communicate when the release is done as it's an external manual process. diff --git a/src/GitVersion.Core.Tests/Extensions/GitToolsTestingExtensions.cs b/src/GitVersion.Core.Tests/Extensions/GitToolsTestingExtensions.cs index cfd5c713d5..7e20ec2aaf 100644 --- a/src/GitVersion.Core.Tests/Extensions/GitToolsTestingExtensions.cs +++ b/src/GitVersion.Core.Tests/Extensions/GitToolsTestingExtensions.cs @@ -138,7 +138,7 @@ public static void AssertFullSemver(this RepositoryFixtureBase fixture, string f /// /// Simulates running on build server /// - public static void InitializeRepo(this RemoteRepositoryFixture fixture) + public static void InitializeRepository(this RemoteRepositoryFixture fixture) { var gitVersionOptions = new GitVersionOptions { diff --git a/src/GitVersion.Core.Tests/IntegrationTests/OtherScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/OtherScenarios.cs index dce46a0eb6..de62c1008f 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/OtherScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/OtherScenarios.cs @@ -26,7 +26,7 @@ public void DoNotBlowUpWhenMainAndDevelopPointAtSameCommit() Commands.Fetch(fixture.LocalRepositoryFixture.Repository, fixture.LocalRepositoryFixture.Repository.Network.Remotes.First().Name, [], new(), null); Commands.Checkout(fixture.LocalRepositoryFixture.Repository, fixture.Repository.Head.Tip); fixture.LocalRepositoryFixture.Repository.Branches.Remove(MainBranch); - fixture.InitializeRepo(); + fixture.InitializeRepository(); fixture.AssertFullSemver("1.0.1-1"); } @@ -92,7 +92,7 @@ public void DoNotBlowUpWhenDevelopAndFeatureBranchPointAtSameCommit() Commands.Fetch(fixture.LocalRepositoryFixture.Repository, fixture.LocalRepositoryFixture.Repository.Network.Remotes.First().Name, [], new(), null); Commands.Checkout(fixture.LocalRepositoryFixture.Repository, fixture.Repository.Head.Tip); fixture.LocalRepositoryFixture.Repository.Branches.Remove(MainBranch); - fixture.InitializeRepo(); + fixture.InitializeRepository(); fixture.AssertFullSemver("1.1.0-alpha.1"); } @@ -100,7 +100,7 @@ public void DoNotBlowUpWhenDevelopAndFeatureBranchPointAtSameCommit() [TestCase(false, 1)] [TestCase(true, 5)] [TestCase(false, 5)] - public void HasDirtyFlagWhenUncommittedChangesAreInRepo(bool stageFile, int numberOfFiles) + public void HasDirtyFlagWhenUncommittedChangesAreInRepository(bool stageFile, int numberOfFiles) { using var fixture = new EmptyRepositoryFixture(); fixture.MakeACommit(); @@ -133,7 +133,7 @@ public void NoDirtyFlagInCleanRepository() [TestCase(false, "1.1.0-alpha.2")] [TestCase(true, "1.2.0-alpha.1")] - public void EnsureTrackMergeTargetStrategyWhichWillLookForTaggedMergecommits(bool trackMergeTarget, string expectedVersion) + public void EnsureTrackMergeTargetStrategyWhichWillLookForTaggedMergeCommits(bool trackMergeTarget, string expectedVersion) { // * 9daa6ea 53 minutes ago (HEAD -> develop) // | * 85536f2 55 minutes ago (tag: 1.1.0, main) @@ -1283,7 +1283,7 @@ public void EnsureVersionAfterMainIsMergedBackToDevelopIsCorrectForMainline(bool } [TestCase(false, "2.0.0-alpha.3")] - [TestCase(true, "2.0.0-alpha.3")] + [TestCase(true, "3.0.0-alpha.2")] public void EnsureVersionAfterMainIsMergedBackToDevelopIsCorrectForGitFlow(bool applyTag, string semanticVersion) { var configuration = GitFlowConfigurationBuilder.New.Build(); @@ -1300,7 +1300,7 @@ public void EnsureVersionAfterMainIsMergedBackToDevelopIsCorrectForGitFlow(bool fixture.Checkout("main"); fixture.MakeACommit("C"); - if (applyTag) fixture.ApplyTag("1.0.1"); + if (applyTag) fixture.ApplyTag("2.0.0"); fixture.Checkout("develop"); fixture.MergeNoFF("main"); @@ -1380,7 +1380,8 @@ public void AlternativeSemanticVersionsShouldBeConsidered() } [TestCase(null, "6.0.0-beta.6")] - [TestCase("beta", "6.0.0-beta.21")] + [TestCase("beta", "6.0.0-beta.6")] + [TestCase("gamma", "6.0.0-gamma.21")] public void AlternativeSemanticVersionsShouldBeConsidered(string? labelOnMain, string version) { var configuration = GitFlowConfigurationBuilder.New @@ -1391,14 +1392,16 @@ public void AlternativeSemanticVersionsShouldBeConsidered(string? labelOnMain, s using var fixture = new EmptyRepositoryFixture(); fixture.MakeATaggedCommit("1.0.0"); - fixture.MakeATaggedCommit("4.0.0-beta.14"); fixture.MakeACommit("A"); + fixture.ApplyTag("4.0.0-beta.14"); + fixture.ApplyTag("4.0.0-gamma.14"); + fixture.MakeACommit("B"); fixture.MakeATaggedCommit("6.0.0-alpha.1"); fixture.MakeATaggedCommit("6.0.0-alpha.2"); fixture.MakeATaggedCommit("6.0.0-alpha.3"); - fixture.MakeACommit("B"); - fixture.MakeATaggedCommit("6.0.0-beta.5"); fixture.MakeACommit("C"); + fixture.MakeATaggedCommit("6.0.0-beta.5"); + fixture.MakeACommit("D"); fixture.AssertFullSemver(version, configuration); } diff --git a/src/GitVersion.Core.Tests/IntegrationTests/PerformanceScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/PerformanceScenarios.cs index b79e2644d9..aad4244caf 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/PerformanceScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/PerformanceScenarios.cs @@ -12,10 +12,13 @@ public void RepositoryWithALotOfTags() using var fixture = new EmptyRepositoryFixture(); - const int maxCommits = 500; - for (int i = 0; i < maxCommits; i++) + Random random = new(4711); + SemanticVersion semanticVersion = SemanticVersion.Empty; + for (int i = 0; i < 500; i++) { - fixture.MakeATaggedCommit($"1.0.{i}"); + VersionField versionField = (VersionField)random.Next(1, 4); + semanticVersion = semanticVersion.Increment(versionField, string.Empty, forceIncrement: true); + fixture.MakeATaggedCommit(semanticVersion.ToString("j")); } fixture.BranchTo("feature"); @@ -23,9 +26,9 @@ public void RepositoryWithALotOfTags() var sw = Stopwatch.StartNew(); - fixture.AssertFullSemver($"1.0.{maxCommits}-feature.1+1", configuration); + fixture.AssertFullSemver("170.3.3-feature.1+1", configuration); sw.Stop(); - sw.ElapsedMilliseconds.ShouldBeLessThan(5000); + sw.ElapsedMilliseconds.ShouldBeLessThan(2500); } } diff --git a/src/GitVersion.Core/VersionCalculation/IncrementStrategyFinder.cs b/src/GitVersion.Core/VersionCalculation/IncrementStrategyFinder.cs index 41f75a8b34..909e746915 100644 --- a/src/GitVersion.Core/VersionCalculation/IncrementStrategyFinder.cs +++ b/src/GitVersion.Core/VersionCalculation/IncrementStrategyFinder.cs @@ -106,7 +106,11 @@ private IReadOnlyCollection GetCommitHistory(string? tagPrefix, Semanti .ToHashSet() ); - var intermediateCommits = GetIntermediateCommits(baseVersionSource, currentCommit, ignore).ToArray(); + var intermediateCommits = this.repositoryStore.GetCommitLog( + baseVersionSource: baseVersionSource, + currentCommit: currentCommit, + ignore: ignore + ); var commitLog = intermediateCommits.ToDictionary(element => element.Id.Sha); foreach (var intermediateCommit in intermediateCommits.Reverse()) @@ -197,7 +201,6 @@ public IEnumerable GetMergedCommits(ICommit mergeCommit, int index, IIg ICommit findMergeBase = this.repositoryStore.FindMergeBase(baseCommit, mergedCommit) ?? throw new InvalidOperationException("Cannot find the base commit of merged branch."); - return GetIntermediateCommits(findMergeBase, mergedCommit, ignore); } diff --git a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/TaggedCommitVersionStrategy.cs b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/TaggedCommitVersionStrategy.cs index 73aa3104f2..dfd9a7fba7 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/TaggedCommitVersionStrategy.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/TaggedCommitVersionStrategy.cs @@ -1,6 +1,8 @@ using GitVersion.Configuration; using GitVersion.Core; using GitVersion.Extensions; +using GitVersion.Logging; +using static GitVersion.Core.RegexPatterns; namespace GitVersion.VersionCalculation; @@ -10,7 +12,7 @@ namespace GitVersion.VersionCalculation; /// Increments if the tag is not the current commit. /// internal sealed class TaggedCommitVersionStrategy( - Lazy contextLazy, + Lazy contextLazy, ILog log, ITaggedSemanticVersionService taggedSemanticVersionService, IIncrementStrategyFinder incrementStrategyFinder) : IVersionStrategy @@ -18,6 +20,7 @@ internal sealed class TaggedCommitVersionStrategy( private readonly ITaggedSemanticVersionService taggedSemanticVersionService = taggedSemanticVersionService.NotNull(); private readonly Lazy contextLazy = contextLazy.NotNull(); private readonly IIncrementStrategyFinder incrementStrategyFinder = incrementStrategyFinder.NotNull(); + private readonly ILog log = log.NotNull(); private GitVersionContext Context => contextLazy.Value; @@ -41,6 +44,7 @@ private IEnumerable GetBaseVersionsInternal(EffectiveBranchConfigur var label = configuration.Value.GetBranchSpecificLabel(Context.CurrentBranch.Name, null); + SemanticVersion semanticVersionTreshold = new(0, 0, 0); List alternativeSemanticVersionsWithTag = []; foreach (var semanticVersionWithTag in taggedSemanticVersions) { @@ -50,6 +54,19 @@ private IEnumerable GetBaseVersionsInternal(EffectiveBranchConfigur continue; } + var alternativeSemanticVersionMax = alternativeSemanticVersionsWithTag.Max()?.Value; + var highestPossibleSemanticVersion = semanticVersionWithTag.Value.Increment( + VersionField.Major, null, forceIncrement: true, alternativeSemanticVersionMax + ); + if (highestPossibleSemanticVersion.IsLessThan(semanticVersionTreshold, includePreRelease: false)) + { + this.log.Info( + $"The tag '{semanticVersionWithTag.Value}' is skipped because it will never be higher than other tags." + ); + alternativeSemanticVersionsWithTag.Clear(); + continue; + } + var baseVersionSource = semanticVersionWithTag.Tag.Commit; var increment = incrementStrategyFinder.DetermineIncrementedField( currentCommit: Context.CurrentCommit, @@ -58,6 +75,7 @@ private IEnumerable GetBaseVersionsInternal(EffectiveBranchConfigur configuration: configuration.Value, label: label ); + semanticVersionTreshold = semanticVersionWithTag.Value.Increment(increment, null, forceIncrement: true); yield return new BaseVersion( $"Git tag '{semanticVersionWithTag.Tag.Name.Friendly}'", semanticVersionWithTag.Value, baseVersionSource) @@ -67,7 +85,7 @@ private IEnumerable GetBaseVersionsInternal(EffectiveBranchConfigur Increment = increment, ForceIncrement = false, Label = label, - AlternativeSemanticVersion = alternativeSemanticVersionsWithTag.Max()?.Value + AlternativeSemanticVersion = alternativeSemanticVersionMax } }; alternativeSemanticVersionsWithTag.Clear(); From a484a484f933a5853343834858ccf0832704eb46 Mon Sep 17 00:00:00 2001 From: HHobeck Date: Tue, 7 Jan 2025 11:08:54 +0100 Subject: [PATCH 004/107] Integrate code review remarks. --- .../IncrementStrategyFinder.cs | 6 +---- .../TaggedCommitVersionStrategy.cs | 24 +++++++++---------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/GitVersion.Core/VersionCalculation/IncrementStrategyFinder.cs b/src/GitVersion.Core/VersionCalculation/IncrementStrategyFinder.cs index 909e746915..d0f69f4bbb 100644 --- a/src/GitVersion.Core/VersionCalculation/IncrementStrategyFinder.cs +++ b/src/GitVersion.Core/VersionCalculation/IncrementStrategyFinder.cs @@ -106,11 +106,7 @@ private IReadOnlyCollection GetCommitHistory(string? tagPrefix, Semanti .ToHashSet() ); - var intermediateCommits = this.repositoryStore.GetCommitLog( - baseVersionSource: baseVersionSource, - currentCommit: currentCommit, - ignore: ignore - ); + var intermediateCommits = this.repositoryStore.GetCommitLog(baseVersionSource, currentCommit, ignore); var commitLog = intermediateCommits.ToDictionary(element => element.Id.Sha); foreach (var intermediateCommit in intermediateCommits.Reverse()) diff --git a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/TaggedCommitVersionStrategy.cs b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/TaggedCommitVersionStrategy.cs index dfd9a7fba7..4e08eef9c8 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/TaggedCommitVersionStrategy.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/TaggedCommitVersionStrategy.cs @@ -2,7 +2,6 @@ using GitVersion.Core; using GitVersion.Extensions; using GitVersion.Logging; -using static GitVersion.Core.RegexPatterns; namespace GitVersion.VersionCalculation; @@ -12,15 +11,16 @@ namespace GitVersion.VersionCalculation; /// Increments if the tag is not the current commit. /// internal sealed class TaggedCommitVersionStrategy( - Lazy contextLazy, ILog log, + ILog log, + Lazy contextLazy, ITaggedSemanticVersionService taggedSemanticVersionService, IIncrementStrategyFinder incrementStrategyFinder) : IVersionStrategy { + private readonly ILog log = log.NotNull(); private readonly ITaggedSemanticVersionService taggedSemanticVersionService = taggedSemanticVersionService.NotNull(); private readonly Lazy contextLazy = contextLazy.NotNull(); private readonly IIncrementStrategyFinder incrementStrategyFinder = incrementStrategyFinder.NotNull(); - private readonly ILog log = log.NotNull(); private GitVersionContext Context => contextLazy.Value; @@ -44,30 +44,30 @@ private IEnumerable GetBaseVersionsInternal(EffectiveBranchConfigur var label = configuration.Value.GetBranchSpecificLabel(Context.CurrentBranch.Name, null); - SemanticVersion semanticVersionTreshold = new(0, 0, 0); + var semanticVersionTreshold = SemanticVersion.Empty; List alternativeSemanticVersionsWithTag = []; - foreach (var semanticVersionWithTag in taggedSemanticVersions) + foreach (var semanticVersion in taggedSemanticVersions) { - if (!semanticVersionWithTag.Value.IsMatchForBranchSpecificLabel(label)) + if (!semanticVersion.Value.IsMatchForBranchSpecificLabel(label)) { - alternativeSemanticVersionsWithTag.Add(semanticVersionWithTag); + alternativeSemanticVersionsWithTag.Add(semanticVersion); continue; } var alternativeSemanticVersionMax = alternativeSemanticVersionsWithTag.Max()?.Value; - var highestPossibleSemanticVersion = semanticVersionWithTag.Value.Increment( + var highestPossibleSemanticVersion = semanticVersion.Value.Increment( VersionField.Major, null, forceIncrement: true, alternativeSemanticVersionMax ); if (highestPossibleSemanticVersion.IsLessThan(semanticVersionTreshold, includePreRelease: false)) { this.log.Info( - $"The tag '{semanticVersionWithTag.Value}' is skipped because it will never be higher than other tags." + $"The tag '{semanticVersion.Value}' is skipped because it provides a lower base version than other tags." ); alternativeSemanticVersionsWithTag.Clear(); continue; } - var baseVersionSource = semanticVersionWithTag.Tag.Commit; + var baseVersionSource = semanticVersion.Tag.Commit; var increment = incrementStrategyFinder.DetermineIncrementedField( currentCommit: Context.CurrentCommit, baseVersionSource: baseVersionSource, @@ -75,10 +75,10 @@ private IEnumerable GetBaseVersionsInternal(EffectiveBranchConfigur configuration: configuration.Value, label: label ); - semanticVersionTreshold = semanticVersionWithTag.Value.Increment(increment, null, forceIncrement: true); + semanticVersionTreshold = semanticVersion.Value.Increment(increment, null, forceIncrement: true); yield return new BaseVersion( - $"Git tag '{semanticVersionWithTag.Tag.Name.Friendly}'", semanticVersionWithTag.Value, baseVersionSource) + $"Git tag '{semanticVersion.Tag.Name.Friendly}'", semanticVersion.Value, baseVersionSource) { Operator = new BaseVersionOperator { From cc001191b7c5e3e7c21da0a2ed84cb344d415771 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Wed, 8 Jan 2025 11:36:04 +0100 Subject: [PATCH 005/107] fix dependabot configuration --- .github/dependabot.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 60831b08ed..7a4c13a974 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -31,7 +31,6 @@ updates: - "/build" - "/new-cli" - "/src" - - "/" schedule: interval: daily open-pull-requests-limit: 10 From d275b2882c0d56eb1e55b3dbef75ad8301d6f512 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 10:42:23 +0000 Subject: [PATCH 006/107] (deps): Bump the microsoft group across 2 directories with 4 updates Bumps the microsoft group with 2 updates in the /new-cli directory: [Microsoft.CodeAnalysis.CSharp](https://github.com/dotnet/roslyn) and [Microsoft.CodeAnalysis.Analyzers](https://github.com/dotnet/roslyn-analyzers). Bumps the microsoft group with 3 updates in the /src directory: [Microsoft.CodeAnalysis.Common](https://github.com/dotnet/roslyn), [Microsoft.CodeAnalysis.CSharp](https://github.com/dotnet/roslyn) and [Microsoft.CodeAnalysis.VisualBasic](https://github.com/dotnet/roslyn). Updates `Microsoft.CodeAnalysis.CSharp` from 4.11.0 to 4.12.0 - [Release notes](https://github.com/dotnet/roslyn/releases) - [Changelog](https://github.com/dotnet/roslyn/blob/main/docs/Breaking%20API%20Changes.md) - [Commits](https://github.com/dotnet/roslyn/commits) Updates `Microsoft.CodeAnalysis.Analyzers` from 3.11.0 to 3.3.4 - [Release notes](https://github.com/dotnet/roslyn-analyzers/releases) - [Changelog](https://github.com/dotnet/roslyn-analyzers/blob/main/PostReleaseActivities.md) - [Commits](https://github.com/dotnet/roslyn-analyzers/commits/v3.3.4) Updates `Microsoft.CodeAnalysis.Common` from 4.11.0 to 4.12.0 - [Release notes](https://github.com/dotnet/roslyn/releases) - [Changelog](https://github.com/dotnet/roslyn/blob/main/docs/Breaking%20API%20Changes.md) - [Commits](https://github.com/dotnet/roslyn/commits) Updates `Microsoft.CodeAnalysis.CSharp` from 4.11.0 to 4.12.0 - [Release notes](https://github.com/dotnet/roslyn/releases) - [Changelog](https://github.com/dotnet/roslyn/blob/main/docs/Breaking%20API%20Changes.md) - [Commits](https://github.com/dotnet/roslyn/commits) Updates `Microsoft.CodeAnalysis.Common` from 4.11.0 to 4.12.0 - [Release notes](https://github.com/dotnet/roslyn/releases) - [Changelog](https://github.com/dotnet/roslyn/blob/main/docs/Breaking%20API%20Changes.md) - [Commits](https://github.com/dotnet/roslyn/commits) Updates `Microsoft.CodeAnalysis.VisualBasic` from 4.11.0 to 4.12.0 - [Release notes](https://github.com/dotnet/roslyn/releases) - [Changelog](https://github.com/dotnet/roslyn/blob/main/docs/Breaking%20API%20Changes.md) - [Commits](https://github.com/dotnet/roslyn/commits) --- updated-dependencies: - dependency-name: Microsoft.CodeAnalysis.CSharp dependency-type: direct:production update-type: version-update:semver-minor dependency-group: microsoft - dependency-name: Microsoft.CodeAnalysis.Analyzers dependency-type: direct:production update-type: version-update:semver-minor dependency-group: microsoft - dependency-name: Microsoft.CodeAnalysis.Common dependency-type: direct:production update-type: version-update:semver-minor dependency-group: microsoft - dependency-name: Microsoft.CodeAnalysis.CSharp dependency-type: direct:production update-type: version-update:semver-minor dependency-group: microsoft - dependency-name: Microsoft.CodeAnalysis.Common dependency-type: direct:production update-type: version-update:semver-minor dependency-group: microsoft - dependency-name: Microsoft.CodeAnalysis.VisualBasic dependency-type: direct:production update-type: version-update:semver-minor dependency-group: microsoft ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 2 +- src/Directory.Packages.props | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index 954cffd0ea..103cd24f38 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -6,7 +6,7 @@ - + diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 7b94376646..4ba21fb81c 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -6,9 +6,9 @@ - - - + + + From d04c75c022823bc5c33939b0fa6b1a6e9c0e53f7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 10:57:54 +0000 Subject: [PATCH 007/107] (deps): Bump coverlet.msbuild from 6.0.2 to 6.0.3 in /src Bumps [coverlet.msbuild](https://github.com/coverlet-coverage/coverlet) from 6.0.2 to 6.0.3. - [Release notes](https://github.com/coverlet-coverage/coverlet/releases) - [Commits](https://github.com/coverlet-coverage/coverlet/compare/v6.0.2...v6.0.3) --- updated-dependencies: - dependency-name: coverlet.msbuild dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 7b94376646..7e0f377798 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -40,6 +40,6 @@ - + \ No newline at end of file From 921c4b9b8613b6daf9d40d5a2e846100149cd9e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 11:04:32 +0000 Subject: [PATCH 008/107] (deps): Bump JunitXml.TestLogger from 4.1.0 to 5.0.0 in /src Bumps [JunitXml.TestLogger](https://github.com/spekt/testlogger) from 4.1.0 to 5.0.0. - [Release notes](https://github.com/spekt/testlogger/releases) - [Changelog](https://github.com/spekt/testlogger/blob/master/CHANGELOG.md) - [Commits](https://github.com/spekt/testlogger/compare/v4.1.0...v5.0.0) --- updated-dependencies: - dependency-name: JunitXml.TestLogger dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 7b94376646..be95ab4d84 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -20,7 +20,7 @@ - + From b0d89f82213880b01d9729e1170a51f81b85de0b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:07:35 +0000 Subject: [PATCH 009/107] (deps): Bump the analyzers group across 2 directories with 3 updates Bumps the analyzers group with 2 updates in the /new-cli directory: [Roslynator.Analyzers](https://github.com/dotnet/roslynator) and [Roslynator.Formatting.Analyzers](https://github.com/dotnet/roslynator). Bumps the analyzers group with 3 updates in the /src directory: [Roslynator.Analyzers](https://github.com/dotnet/roslynator), [Roslynator.Formatting.Analyzers](https://github.com/dotnet/roslynator) and [NUnit.Analyzers](https://github.com/nunit/nunit.analyzers). Updates `Roslynator.Analyzers` from 4.12.9 to 4.12.10 - [Release notes](https://github.com/dotnet/roslynator/releases) - [Changelog](https://github.com/dotnet/roslynator/blob/main/ChangeLog.md) - [Commits](https://github.com/dotnet/roslynator/compare/v4.12.9...v4.12.10) Updates `Roslynator.Formatting.Analyzers` from 4.12.9 to 4.12.10 - [Release notes](https://github.com/dotnet/roslynator/releases) - [Changelog](https://github.com/dotnet/roslynator/blob/main/ChangeLog.md) - [Commits](https://github.com/dotnet/roslynator/compare/v4.12.9...v4.12.10) Updates `Roslynator.Analyzers` from 4.12.9 to 4.12.10 - [Release notes](https://github.com/dotnet/roslynator/releases) - [Changelog](https://github.com/dotnet/roslynator/blob/main/ChangeLog.md) - [Commits](https://github.com/dotnet/roslynator/compare/v4.12.9...v4.12.10) Updates `Roslynator.Formatting.Analyzers` from 4.12.9 to 4.12.10 - [Release notes](https://github.com/dotnet/roslynator/releases) - [Changelog](https://github.com/dotnet/roslynator/blob/main/ChangeLog.md) - [Commits](https://github.com/dotnet/roslynator/compare/v4.12.9...v4.12.10) Updates `NUnit.Analyzers` from 4.4.0 to 4.5.0 - [Release notes](https://github.com/nunit/nunit.analyzers/releases) - [Changelog](https://github.com/nunit/nunit.analyzers/blob/master/CHANGES.md) - [Commits](https://github.com/nunit/nunit.analyzers/compare/4.4.0...4.5.0) --- updated-dependencies: - dependency-name: Roslynator.Analyzers dependency-type: direct:production update-type: version-update:semver-patch dependency-group: analyzers - dependency-name: Roslynator.Formatting.Analyzers dependency-type: direct:production update-type: version-update:semver-patch dependency-group: analyzers - dependency-name: Roslynator.Analyzers dependency-type: direct:production update-type: version-update:semver-patch dependency-group: analyzers - dependency-name: Roslynator.Formatting.Analyzers dependency-type: direct:production update-type: version-update:semver-patch dependency-group: analyzers - dependency-name: NUnit.Analyzers dependency-type: direct:production update-type: version-update:semver-minor dependency-group: analyzers ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 4 ++-- src/Directory.Packages.props | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index 103cd24f38..01c8fe021a 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -12,8 +12,8 @@ - - + + diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 4ba21fb81c..e8befa0805 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -15,8 +15,8 @@ - - + + @@ -33,7 +33,7 @@ - + From 5dba8920d533ca55724419edaf6577b113947601 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 10:54:17 +0000 Subject: [PATCH 010/107] (deps): Bump Cake.Frosting.Git from 4.0.0 to 5.0.1 in /build Bumps [Cake.Frosting.Git](https://github.com/cake-contrib/Cake_Git) from 4.0.0 to 5.0.1. - [Release notes](https://github.com/cake-contrib/Cake_Git/releases) - [Changelog](https://github.com/cake-contrib/Cake_Git/blob/develop/ReleaseNotes.md) - [Commits](https://github.com/cake-contrib/Cake_Git/compare/v4.0.0...v5.0.1) --- updated-dependencies: - dependency-name: Cake.Frosting.Git dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- build/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Directory.Packages.props b/build/Directory.Packages.props index 2e0ac0583c..b8ef3cbd86 100644 --- a/build/Directory.Packages.props +++ b/build/Directory.Packages.props @@ -7,7 +7,7 @@ - + From b95e423a66b36e1d91bd07bdb5446e2df11133d9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 10:53:51 +0000 Subject: [PATCH 011/107] (deps): Bump the serilog group across 1 directory with 2 updates Bumps the serilog group with 2 updates in the /new-cli directory: [Microsoft.Extensions.DependencyInjection.Abstractions](https://github.com/dotnet/runtime) and [Serilog.Extensions.Logging](https://github.com/serilog/serilog-extensions-logging). Updates `Microsoft.Extensions.DependencyInjection.Abstractions` from 9.0.0 to 9.0.0 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.0...v9.0.0) Updates `Serilog.Extensions.Logging` from 8.0.0 to 9.0.0 - [Release notes](https://github.com/serilog/serilog-extensions-logging/releases) - [Commits](https://github.com/serilog/serilog-extensions-logging/compare/v8.0.0...v9.0.0) --- updated-dependencies: - dependency-name: Microsoft.Extensions.DependencyInjection.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: serilog - dependency-name: Serilog.Extensions.Logging dependency-type: direct:production update-type: version-update:semver-major dependency-group: serilog ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index 103cd24f38..8818f52a1b 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -16,7 +16,7 @@ - + From 210508767a55ed8cd8df716caee48c3b313b78f1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 13:36:48 +0000 Subject: [PATCH 012/107] (deps): Bump YamlDotNet from 16.2.1 to 16.3.0 in /src Bumps [YamlDotNet](https://github.com/aaubry/YamlDotNet) from 16.2.1 to 16.3.0. - [Release notes](https://github.com/aaubry/YamlDotNet/releases) - [Commits](https://github.com/aaubry/YamlDotNet/compare/v16.2.1...v16.3.0) --- updated-dependencies: - dependency-name: YamlDotNet dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 343b091a2c..588554fae2 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -39,7 +39,7 @@ - + \ No newline at end of file From a707758fdc03ab82d20beb36d671354700ba403f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 13:41:34 +0000 Subject: [PATCH 013/107] (deps): Bump NUnit from 4.2.2 to 4.3.2 in /src Bumps [NUnit](https://github.com/nunit/nunit) from 4.2.2 to 4.3.2. - [Release notes](https://github.com/nunit/nunit/releases) - [Changelog](https://github.com/nunit/nunit/blob/main/CHANGES.md) - [Commits](https://github.com/nunit/nunit/compare/4.2.2...4.3.2) --- updated-dependencies: - dependency-name: NUnit dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index dcf7b95a2d..e88abe658f 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -32,7 +32,7 @@ - + From 79b4771c03ef35d78c9b8c57944a16003e0ee2c1 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Wed, 8 Jan 2025 15:52:22 +0100 Subject: [PATCH 014/107] add LibGit2Sharp dependabot section --- .github/dependabot.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 7a4c13a974..debc5ad413 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -27,6 +27,9 @@ updates: nunit: patterns: - "NUnit.*" + LibGit2Sharp: + patterns: + - "LibGit2Sharp.*" directories: - "/build" - "/new-cli" From ecbba657125aa9ecf7c5901f4a6fa1bf7a6281df Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 15:31:56 +0000 Subject: [PATCH 015/107] (deps): Bump JsonSchema.Net.Generation from 4.6.0 to 5.0.0 in /src Bumps [JsonSchema.Net.Generation](https://github.com/json-everything/json-everything) from 4.6.0 to 5.0.0. - [Commits](https://github.com/json-everything/json-everything/compare/schema-gen-v4.6.0...logic-v5.0.0) --- updated-dependencies: - dependency-name: JsonSchema.Net.Generation dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- schemas/6.1/GitVersion.configuration.json | 440 ++++++++++++---------- schemas/6.1/GitVersion.json | 85 ++++- src/Directory.Packages.props | 2 +- src/GitVersion.Schema/Program.cs | 1 - 4 files changed, 314 insertions(+), 214 deletions(-) diff --git a/schemas/6.1/GitVersion.configuration.json b/schemas/6.1/GitVersion.configuration.json index affb98d33e..c23d8a4686 100644 --- a/schemas/6.1/GitVersion.configuration.json +++ b/schemas/6.1/GitVersion.configuration.json @@ -7,7 +7,10 @@ "properties": { "assembly-file-versioning-format": { "description": "Specifies the format of AssemblyFileVersion and overwrites the value of assembly-file-versioning-scheme.", - "type": "string" + "type": [ + "string", + "null" + ] }, "assembly-file-versioning-scheme": { "description": "The scheme to use when setting AssemblyFileVersion attribute. Can be 'MajorMinorPatchTag', 'MajorMinorPatch', 'MajorMinor', 'Major', 'None'. Defaults to 'MajorMinorPatch'.", @@ -17,17 +20,24 @@ "MajorMinorPatch", "MajorMinor", "Major", - "None" + "None", + null ] }, "assembly-informational-format": { "description": "Specifies the format of AssemblyInformationalVersion. Defaults to '{InformationalVersion}'.", "default": "'{InformationalVersion}'", - "type": "string" + "type": [ + "string", + "null" + ] }, "assembly-versioning-format": { "description": "Specifies the format of AssemblyVersion and overwrites the value of assembly-versioning-scheme.", - "type": "string" + "type": [ + "string", + "null" + ] }, "assembly-versioning-scheme": { "description": "The scheme to use when setting AssemblyVersion attribute. Can be 'MajorMinorPatchTag', 'MajorMinorPatch', 'MajorMinor', 'Major', 'None'. Defaults to 'MajorMinorPatch'.", @@ -37,62 +47,209 @@ "MajorMinorPatch", "MajorMinor", "Major", - "None" + "None", + null ] }, "branches": { "description": "The header for all the individual branch configuration.", "type": "object", "additionalProperties": { - "$ref": "#/$defs/branchConfiguration" + "type": "object", + "properties": { + "commit-message-incrementing": { + "description": "Sets whether it should be possible to increment the version with special syntax in the commit message. Can be 'Disabled', 'Enabled' or 'MergeMessageOnly'.", + "enum": [ + "Enabled", + "Disabled", + "MergeMessageOnly", + null + ] + }, + "mode": { + "description": "The deployment mode for this branch. Can be 'ManualDeployment', 'ContinuousDelivery', 'ContinuousDeployment'.", + "enum": [ + "ManualDeployment", + "ContinuousDelivery", + "ContinuousDeployment", + null + ] + }, + "increment": { + "description": "The increment strategy for this branch. Can be 'Inherit', 'Patch', 'Minor', 'Major', 'None'.", + "$ref": "#/$defs/incrementStrategy" + }, + "is-main-branch": { + "description": "When using Mainline mode, this indicates that this branch is a mainline. By default main and support/* are mainlines.", + "type": [ + "boolean", + "null" + ] + }, + "is-release-branch": { + "description": "Indicates this branch configuration represents a release branch in GitFlow.", + "type": [ + "boolean", + "null" + ] + }, + "is-source-branch-for": { + "description": "The branches that this branch is a source branch.", + "$ref": "#/$defs/hashSetOfString" + }, + "label": { + "description": "The label to use for this branch. Use the value {BranchName} or similar as a placeholder to insert a named capture group from RegularExpression (fx. the branch name).", + "type": [ + "string", + "null" + ] + }, + "label-number-pattern": { + "format": "regex", + "description": "The regular expression pattern to use to extract the number from the branch name. Defaults to '[/-](?\\d+)'.", + "default": "[/-](?\\d+)", + "type": [ + "string", + "null" + ] + }, + "pre-release-weight": { + "description": "Provides a way to translate the PreReleaseLabel to a number.", + "type": [ + "integer", + "null" + ] + }, + "prevent-increment": { + "description": "The prevent increment configuration section.", + "$ref": "#/$defs/preventIncrementConfiguration" + }, + "regex": { + "format": "regex", + "description": "The regular expression pattern to use to match this branch.", + "type": [ + "string", + "null" + ] + }, + "source-branches": { + "description": "The source branches for this branch.", + "$ref": "#/$defs/hashSetOfString" + }, + "track-merge-message": { + "description": "This property is a branch related property and gives the user the possibility to control the behavior of whether the merge commit message will be interpreted as a next version or not.", + "type": [ + "boolean", + "null" + ] + }, + "track-merge-target": { + "description": "Strategy which will look for tagged merge commits directly off the current branch.", + "type": [ + "boolean", + "null" + ] + }, + "tracks-release-branches": { + "description": "Indicates this branch configuration represents develop in GitFlow.", + "type": [ + "boolean", + "null" + ] + } + } } }, "commit-date-format": { "description": "The format to use when calculating the commit date. Defaults to 'yyyy-MM-dd'. See [Standard Date and Time Format Strings](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) and [Custom Date and Time Format Strings](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings).", "default": "yyyy-MM-dd", - "type": "string" + "type": [ + "string", + "null" + ] }, "commit-message-incrementing": { - "$ref": "#/$defs/nullableOfCommitMessageIncrementMode" + "description": "Sets whether it should be possible to increment the version with special syntax in the commit message. Can be 'Disabled', 'Enabled' or 'MergeMessageOnly'.", + "enum": [ + "Enabled", + "Disabled", + "MergeMessageOnly", + null + ] }, "mode": { - "$ref": "#/$defs/nullableOfDeploymentMode" + "description": "The deployment mode for this branch. Can be 'ManualDeployment', 'ContinuousDelivery', 'ContinuousDeployment'.", + "enum": [ + "ManualDeployment", + "ContinuousDelivery", + "ContinuousDeployment", + null + ] }, "ignore": { "description": "The header property for the ignore configuration.", "type": "object", "properties": { "commits-before": { - "$ref": "#/$defs/string3" + "format": "date-time", + "description": "Commits before this date will be ignored. Format: yyyy-MM-ddTHH:mm:ss.", + "type": [ + "string", + "null" + ] }, "sha": { - "$ref": "#/$defs/hashSetOfString2" + "description": "A sequence of SHAs to be excluded from the version calculations.", + "$ref": "#/$defs/hashSetOfString" } } }, "increment": { + "description": "The increment strategy for this branch. Can be 'Inherit', 'Patch', 'Minor', 'Major', 'None'.", "$ref": "#/$defs/incrementStrategy" }, "is-main-branch": { - "$ref": "#/$defs/nullableOfBoolean" + "description": "When using Mainline mode, this indicates that this branch is a mainline. By default main and support/* are mainlines.", + "type": [ + "boolean", + "null" + ] }, "is-release-branch": { - "$ref": "#/$defs/nullableOfBoolean1" + "description": "Indicates this branch configuration represents a release branch in GitFlow.", + "type": [ + "boolean", + "null" + ] }, "is-source-branch-for": { + "description": "The branches that this branch is a source branch.", "$ref": "#/$defs/hashSetOfString" }, "label": { - "$ref": "#/$defs/string" + "description": "The label to use for this branch. Use the value {BranchName} or similar as a placeholder to insert a named capture group from RegularExpression (fx. the branch name).", + "type": [ + "string", + "null" + ] }, "label-number-pattern": { - "$ref": "#/$defs/string1" + "format": "regex", + "description": "The regular expression pattern to use to extract the number from the branch name. Defaults to '[/-](?\\d+)'.", + "default": "[/-](?\\d+)", + "type": [ + "string", + "null" + ] }, "major-version-bump-message": { "format": "regex", "description": "The regular expression to match commit messages with to perform a major version increment. Defaults to '\\+semver:\\s?(breaking|major)'", "default": "\\+semver:\\s?(breaking|major)", - "type": "string" + "type": [ + "string", + "null" + ] }, "merge-message-formats": { "description": "Custom merge message formats to enable identification of merge messages that do not follow the built-in conventions.", @@ -105,32 +262,54 @@ "format": "regex", "description": "The regular expression to match commit messages with to perform a minor version increment. Defaults to '\\+semver:\\s?(feature|minor)'", "default": "\\+semver:\\s?(feature|minor)", - "type": "string" + "type": [ + "string", + "null" + ] }, "next-version": { "description": "Allows you to bump the next version explicitly. Useful for bumping main or a feature branch with breaking changes", - "type": "string" + "type": [ + "string", + "null" + ] }, "no-bump-message": { "format": "regex", "description": "Used to tell GitVersion not to increment when in Mainline development mode. Defaults to '\\+semver:\\s?(none|skip)'", "default": "\\+semver:\\s?(none|skip)", - "type": "string" + "type": [ + "string", + "null" + ] }, "patch-version-bump-message": { "format": "regex", "description": "The regular expression to match commit messages with to perform a patch version increment. Defaults to '\\+semver:\\s?(fix|patch)'", "default": "\\+semver:\\s?(fix|patch)", - "type": "string" + "type": [ + "string", + "null" + ] }, "pre-release-weight": { - "$ref": "#/$defs/nullableOfInt32" + "description": "Provides a way to translate the PreReleaseLabel to a number.", + "type": [ + "integer", + "null" + ] }, "prevent-increment": { + "description": "The prevent increment configuration section.", "$ref": "#/$defs/preventIncrementConfiguration" }, "regex": { - "$ref": "#/$defs/string2" + "format": "regex", + "description": "The regular expression pattern to use to match this branch.", + "type": [ + "string", + "null" + ] }, "semantic-version-format": { "description": "Specifies the semantic version format that is used when parsing the string. Can be 'Strict' or 'Loose'. Defaults to 'Strict'.", @@ -141,13 +320,17 @@ ] }, "source-branches": { - "$ref": "#/$defs/hashSetOfString1" + "description": "The source branches for this branch.", + "$ref": "#/$defs/hashSetOfString" }, "tag-prefix": { "format": "regex", "description": "A regular expression which is used to trim Git tags before processing. Defaults to '[vV]?'", "default": "[vV]?", - "type": "string" + "type": [ + "string", + "null" + ] }, "tag-pre-release-weight": { "description": "The pre-release weight in case of tagged commits. Defaults to 60000.", @@ -157,13 +340,25 @@ ] }, "track-merge-message": { - "$ref": "#/$defs/nullableOfBoolean4" + "description": "This property is a branch related property and gives the user the possibility to control the behavior of whether the merge commit message will be interpreted as a next version or not.", + "type": [ + "boolean", + "null" + ] }, "track-merge-target": { - "$ref": "#/$defs/nullableOfBoolean5" + "description": "Strategy which will look for tagged merge commits directly off the current branch.", + "type": [ + "boolean", + "null" + ] }, "tracks-release-branches": { - "$ref": "#/$defs/nullableOfBoolean6" + "description": "Indicates this branch configuration represents develop in GitFlow.", + "type": [ + "boolean", + "null" + ] }, "update-build-number": { "description": "Whether to update the build number in the project file. Defaults to true.", @@ -174,13 +369,15 @@ "format": "regex", "description": "A regular expression which is used to determine the version number in the branch name or commit message (e.g., v1.0.0-LTS). Defaults to '(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*'.", "default": "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*", - "type": "string" + "type": [ + "string", + "null" + ] }, "strategies": { "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 'Mainline'.", "type": "array", "items": { - "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 'Mainline'.", "enum": [ "None", "Fallback", @@ -195,78 +392,14 @@ }, "workflow": { "description": "The base template of the configuration to use. Possible values are: 'GitFlow/v1' or 'GitHubFlow/v1'", - "type": "string" + "type": [ + "string", + "null" + ] } }, "$defs": { - "branchConfiguration": { - "type": "object", - "properties": { - "commit-message-incrementing": { - "$ref": "#/$defs/nullableOfCommitMessageIncrementMode" - }, - "mode": { - "$ref": "#/$defs/nullableOfDeploymentMode" - }, - "increment": { - "$ref": "#/$defs/incrementStrategy" - }, - "is-main-branch": { - "$ref": "#/$defs/nullableOfBoolean" - }, - "is-release-branch": { - "$ref": "#/$defs/nullableOfBoolean1" - }, - "is-source-branch-for": { - "$ref": "#/$defs/hashSetOfString" - }, - "label": { - "$ref": "#/$defs/string" - }, - "label-number-pattern": { - "$ref": "#/$defs/string1" - }, - "pre-release-weight": { - "$ref": "#/$defs/nullableOfInt32" - }, - "prevent-increment": { - "$ref": "#/$defs/preventIncrementConfiguration" - }, - "regex": { - "$ref": "#/$defs/string2" - }, - "source-branches": { - "$ref": "#/$defs/hashSetOfString1" - }, - "track-merge-message": { - "$ref": "#/$defs/nullableOfBoolean4" - }, - "track-merge-target": { - "$ref": "#/$defs/nullableOfBoolean5" - }, - "tracks-release-branches": { - "$ref": "#/$defs/nullableOfBoolean6" - } - } - }, - "nullableOfCommitMessageIncrementMode": { - "description": "Sets whether it should be possible to increment the version with special syntax in the commit message. Can be 'Disabled', 'Enabled' or 'MergeMessageOnly'.", - "enum": [ - "Enabled", - "Disabled", - "MergeMessageOnly" - ] - }, - "nullableOfDeploymentMode": { - "description": "The deployment mode for this branch. Can be 'ManualDeployment', 'ContinuousDelivery', 'ContinuousDeployment'.", - "enum": [ - "ManualDeployment", - "ContinuousDelivery", - "ContinuousDeployment" - ] - }, "incrementStrategy": { - "description": "The increment strategy for this branch. Can be 'Inherit', 'Patch', 'Minor', 'Major', 'None'.", "enum": [ "None", "Major", @@ -275,120 +408,37 @@ "Inherit" ] }, - "nullableOfBoolean": { - "description": "When using Mainline mode, this indicates that this branch is a mainline. By default main and support/* are mainlines.", - "type": [ - "boolean", - "null" - ] - }, - "nullableOfBoolean1": { - "description": "Indicates this branch configuration represents a release branch in GitFlow.", - "type": [ - "boolean", - "null" - ] - }, "hashSetOfString": { - "description": "The branches that this branch is a source branch.", "type": "array", "items": { - "description": "The branches that this branch is a source branch.", "type": "string" } }, - "string": { - "description": "The label to use for this branch. Use the value {BranchName} or similar as a placeholder to insert a named capture group from RegularExpression (fx. the branch name).", - "type": "string" - }, - "string1": { - "format": "regex", - "description": "The regular expression pattern to use to extract the number from the branch name. Defaults to '[/-](?\\d+)'.", - "default": "[/-](?\\d+)", - "type": "string" - }, - "nullableOfInt32": { - "description": "Provides a way to translate the PreReleaseLabel to a number.", - "type": [ - "integer", - "null" - ] - }, "preventIncrementConfiguration": { - "description": "The prevent increment configuration section.", "type": "object", "properties": { "of-merged-branch": { - "$ref": "#/$defs/nullableOfBoolean2" + "description": "Prevent increment when branch merged.", + "type": [ + "boolean", + "null" + ] }, "when-branch-merged": { - "$ref": "#/$defs/nullableOfBoolean2" + "description": "Prevent increment when branch merged.", + "type": [ + "boolean", + "null" + ] }, "when-current-commit-tagged": { - "$ref": "#/$defs/nullableOfBoolean3" + "description": "This branch related property controls the behavior whether to use the tagged (value set to true) or the incremented (value set to false) semantic version. Defaults to true.", + "type": [ + "boolean", + "null" + ] } } - }, - "nullableOfBoolean2": { - "description": "Prevent increment when branch merged.", - "type": [ - "boolean", - "null" - ] - }, - "nullableOfBoolean3": { - "description": "This branch related property controls the behavior whether to use the tagged (value set to true) or the incremented (value set to false) semantic version. Defaults to true.", - "type": [ - "boolean", - "null" - ] - }, - "string2": { - "format": "regex", - "description": "The regular expression pattern to use to match this branch.", - "type": "string" - }, - "hashSetOfString1": { - "description": "The source branches for this branch.", - "type": "array", - "items": { - "description": "The source branches for this branch.", - "type": "string" - } - }, - "nullableOfBoolean4": { - "description": "This property is a branch related property and gives the user the possibility to control the behavior of whether the merge commit message will be interpreted as a next version or not.", - "type": [ - "boolean", - "null" - ] - }, - "nullableOfBoolean5": { - "description": "Strategy which will look for tagged merge commits directly off the current branch.", - "type": [ - "boolean", - "null" - ] - }, - "nullableOfBoolean6": { - "description": "Indicates this branch configuration represents develop in GitFlow.", - "type": [ - "boolean", - "null" - ] - }, - "string3": { - "format": "date-time", - "description": "Commits before this date will be ignored. Format: yyyy-MM-ddTHH:mm:ss.", - "type": "string" - }, - "hashSetOfString2": { - "description": "A sequence of SHAs to be excluded from the version calculations.", - "type": "array", - "items": { - "description": "A sequence of SHAs to be excluded from the version calculations.", - "type": "string" - } } } } \ No newline at end of file diff --git a/schemas/6.1/GitVersion.json b/schemas/6.1/GitVersion.json index 037e6acbf4..9c4e5945ab 100644 --- a/schemas/6.1/GitVersion.json +++ b/schemas/6.1/GitVersion.json @@ -7,15 +7,24 @@ "properties": { "AssemblySemFileVer": { "description": "Suitable for .NET AssemblyFileVersion. Defaults to Major.Minor.Patch.0.", - "type": "string" + "type": [ + "string", + "null" + ] }, "AssemblySemVer": { "description": "Suitable for .NET AssemblyVersion. Defaults to Major.Minor.0.0", - "type": "string" + "type": [ + "string", + "null" + ] }, "BranchName": { "description": "The name of the checked out Git branch.", - "type": "string" + "type": [ + "string", + "null" + ] }, "BuildMetaData": { "description": "The build metadata, usually representing number of commits since the VersionSourceSha.", @@ -26,7 +35,10 @@ }, "CommitDate": { "description": "The ISO-8601 formatted date of the commit identified by Sha.", - "type": "string" + "type": [ + "string", + "null" + ] }, "CommitsSinceVersionSource": { "description": "The number of commits since the version source.", @@ -37,19 +49,31 @@ }, "EscapedBranchName": { "description": "Equal to BranchName, but with / replaced with -.", - "type": "string" + "type": [ + "string", + "null" + ] }, "FullBuildMetaData": { "description": "The BuildMetaData suffixed with BranchName and Sha.", - "type": "string" + "type": [ + "string", + "null" + ] }, "FullSemVer": { "description": "The full, SemVer 2.0 compliant version number.", - "type": "string" + "type": [ + "string", + "null" + ] }, "InformationalVersion": { "description": "Suitable for .NET AssemblyInformationalVersion. Defaults to FullSemVer suffixed by FullBuildMetaData.", - "type": "string" + "type": [ + "string", + "null" + ] }, "Major": { "description": "The major version. Should be incremented on breaking changes.", @@ -60,7 +84,10 @@ }, "MajorMinorPatch": { "description": "Major, Minor and Patch joined together, separated by '.'.", - "type": "string" + "type": [ + "string", + "null" + ] }, "Minor": { "description": "The minor version. Should be incremented on new features.", @@ -78,11 +105,17 @@ }, "PreReleaseLabel": { "description": "The pre-release label is the name of the pre-release.", - "type": "string" + "type": [ + "string", + "null" + ] }, "PreReleaseLabelWithDash": { "description": "The pre-release label prefixed with a dash.", - "type": "string" + "type": [ + "string", + "null" + ] }, "PreReleaseNumber": { "description": "The pre-release number is the number of commits since the last version bump.", @@ -93,23 +126,38 @@ }, "PreReleaseTag": { "description": "The pre-release tag is the pre-release label suffixed by the PreReleaseNumber.", - "type": "string" + "type": [ + "string", + "null" + ] }, "PreReleaseTagWithDash": { "description": "The pre-release tag prefixed with a dash.", - "type": "string" + "type": [ + "string", + "null" + ] }, "SemVer": { "description": "The semantic version number, including PreReleaseTagWithDash for pre-release version numbers.", - "type": "string" + "type": [ + "string", + "null" + ] }, "Sha": { "description": "The SHA of the Git commit.", - "type": "string" + "type": [ + "string", + "null" + ] }, "ShortSha": { "description": "The Sha limited to 7 characters.", - "type": "string" + "type": [ + "string", + "null" + ] }, "UncommittedChanges": { "description": "The number of uncommitted changes present in the repository.", @@ -120,7 +168,10 @@ }, "VersionSourceSha": { "description": "The SHA of the commit used as version source.", - "type": "string" + "type": [ + "string", + "null" + ] }, "WeightedPreReleaseNumber": { "description": "A summation of branch specific pre-release-weight and the PreReleaseNumber. Can be used to obtain a monotonically increasing version number across the branches.", diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index e88abe658f..18afaff8c2 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -19,7 +19,7 @@ - + diff --git a/src/GitVersion.Schema/Program.cs b/src/GitVersion.Schema/Program.cs index ba84aed254..60451c13b2 100644 --- a/src/GitVersion.Schema/Program.cs +++ b/src/GitVersion.Schema/Program.cs @@ -12,7 +12,6 @@ var configuration = new SchemaGeneratorConfiguration { PropertyNameResolver = PropertyNameResolvers.KebabCase, - Nullability = Nullability.AllowForNullableValueTypes, PropertyOrder = PropertyOrder.ByName, }; From a6f0c9013ac1cf1f19b666fc0a00965c926e85e7 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Wed, 8 Jan 2025 19:53:51 +0100 Subject: [PATCH 016/107] use ubuntu-24.04 --- .github/workflows/_build.yml | 2 +- .github/workflows/_docker_manifests.yml | 2 +- .github/workflows/_prepare.yml | 4 ++-- .github/workflows/_unit_tests.yml | 2 +- .github/workflows/ci.yml | 8 ++++---- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/docs.yml | 6 +++--- .github/workflows/format.yml | 2 +- .github/workflows/mkdocs.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/stale.yml | 2 +- .github/workflows/winget.yml | 2 +- 12 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/_build.yml b/.github/workflows/_build.yml index 75ed54e3c2..ae96c6357d 100644 --- a/.github/workflows/_build.yml +++ b/.github/workflows/_build.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest, ubuntu-latest, macos-15] + os: [windows-latest, ubuntu-24.04, macos-15] runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/_docker_manifests.yml b/.github/workflows/_docker_manifests.yml index 2e72c53e51..9a1fdeb2b1 100644 --- a/.github/workflows/_docker_manifests.yml +++ b/.github/workflows/_docker_manifests.yml @@ -14,7 +14,7 @@ env: jobs: manifest: name: ${{ matrix.dockerDistro }} - net${{ matrix.dotnetVersion }} - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 strategy: fail-fast: false matrix: diff --git a/.github/workflows/_prepare.yml b/.github/workflows/_prepare.yml index 5c5d485933..ff23316ac6 100644 --- a/.github/workflows/_prepare.yml +++ b/.github/workflows/_prepare.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest, ubuntu-latest, macos-15] + os: [windows-latest, ubuntu-24.04, macos-15] runs-on: ${{ matrix.os }} steps: @@ -49,7 +49,7 @@ jobs: set_matrix: needs: [ prepare ] name: Set Matrix - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 outputs: dockerDistros: ${{ steps.set_matrix.outputs.dockerDistros }} dotnetVersions: ${{ steps.set_matrix.outputs.dotnetVersions }} diff --git a/.github/workflows/_unit_tests.yml b/.github/workflows/_unit_tests.yml index f4925b5f59..97bf554592 100644 --- a/.github/workflows/_unit_tests.yml +++ b/.github/workflows/_unit_tests.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest, ubuntu-latest, macos-15] + os: [windows-latest, ubuntu-24.04, macos-15] dotnetVersion: ${{ fromJson(inputs.dotnetVersions) }} runs-on: ${{ matrix.os }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 504a339b9f..19f78cdd91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,9 +70,9 @@ jobs: matrix: include: - arch: amd64 - runner: ubuntu-latest + runner: ubuntu-24.04 - arch: arm64 - runner: ubuntu-latest + runner: ubuntu-24.04 uses: ./.github/workflows/_artifacts_linux.yml with: runner: ${{ matrix.runner }} @@ -88,9 +88,9 @@ jobs: matrix: include: - arch: amd64 - runner: ubuntu-latest + runner: ubuntu-24.04 - arch: arm64 - runner: ubuntu-latest + runner: ubuntu-24.04 uses: ./.github/workflows/_docker.yml with: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b05b693cd2..752b375de9 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -39,7 +39,7 @@ jobs: contents: read # for actions/checkout to fetch code security-events: write # for github/codeql-action/analyze to upload SARIF results name: Analyze - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 strategy: fail-fast: false diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 271abaebcc..f49b4d9436 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -33,7 +33,7 @@ env: jobs: prepare: name: Prepare Build - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - @@ -87,7 +87,7 @@ jobs: validate: name: Validates Html needs: [ prepare ] - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout @@ -123,7 +123,7 @@ jobs: publish: name: Publish docs needs: [ validate ] - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 env: GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} GITHUB_USERNAME: ${{ github.actor }} diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 2e61a314b0..f3cc9ffc04 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -34,7 +34,7 @@ env: jobs: format: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 name: DotNet Format steps: - diff --git a/.github/workflows/mkdocs.yml b/.github/workflows/mkdocs.yml index 9182452b60..e3918452ad 100644 --- a/.github/workflows/mkdocs.yml +++ b/.github/workflows/mkdocs.yml @@ -15,7 +15,7 @@ defaults: jobs: docs: name: Update Markdown (embedded snippets) - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 033d0c2dbd..ae9230ea55 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ on: jobs: release: name: Trigger ci flow - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index b6b44be7cf..4db0930525 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -11,7 +11,7 @@ permissions: jobs: stale: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/stale@v9 with: diff --git a/.github/workflows/winget.yml b/.github/workflows/winget.yml index 1f9e75b3ce..f6ad004ed9 100644 --- a/.github/workflows/winget.yml +++ b/.github/workflows/winget.yml @@ -17,7 +17,7 @@ jobs: permissions: contents: none name: Bump winget manifest - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Get version id: get-version From d1396a6b2b385978250295742e857668971db9f1 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Wed, 8 Jan 2025 20:02:08 +0100 Subject: [PATCH 017/107] use windows-2025 --- .github/workflows/_artifacts_windows.yml | 2 +- .github/workflows/_build.yml | 8 ++++---- .github/workflows/_prepare.yml | 2 +- .github/workflows/_publish.yml | 2 +- .github/workflows/_unit_tests.yml | 2 +- .github/workflows/ci.yml | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/_artifacts_windows.yml b/.github/workflows/_artifacts_windows.yml index 6c1832961e..c93e7092bd 100644 --- a/.github/workflows/_artifacts_windows.yml +++ b/.github/workflows/_artifacts_windows.yml @@ -8,7 +8,7 @@ env: jobs: artifacts: name: ${{ matrix.package }} - runs-on: windows-latest + runs-on: windows-2025 strategy: fail-fast: false matrix: diff --git a/.github/workflows/_build.yml b/.github/workflows/_build.yml index ae96c6357d..b3ce787c63 100644 --- a/.github/workflows/_build.yml +++ b/.github/workflows/_build.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest, ubuntu-24.04, macos-15] + os: [windows-2025, ubuntu-24.04, macos-15] runs-on: ${{ matrix.os }} steps: @@ -30,21 +30,21 @@ jobs: - name: 'Upload nuget packages' uses: actions/upload-artifact@v4 - if: matrix.os == 'windows-latest' + if: matrix.os == 'windows-2025' with: name: nuget path: ${{ github.workspace }}/artifacts/packages/nuget - name: 'Upload native packages' uses: actions/upload-artifact@v4 - if: matrix.os == 'windows-latest' + if: matrix.os == 'windows-2025' with: name: native-${{ runner.os }} path: ${{ github.workspace }}/artifacts/packages/native/*.zip - name: 'Upload native packages' uses: actions/upload-artifact@v4 - if: matrix.os != 'windows-latest' + if: matrix.os != 'windows-2025' with: name: native-${{ runner.os }} path: ${{ github.workspace }}/artifacts/packages/native/*.tar.gz diff --git a/.github/workflows/_prepare.yml b/.github/workflows/_prepare.yml index ff23316ac6..1ab92c7163 100644 --- a/.github/workflows/_prepare.yml +++ b/.github/workflows/_prepare.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest, ubuntu-24.04, macos-15] + os: [windows-2025, ubuntu-24.04, macos-15] runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/_publish.yml b/.github/workflows/_publish.yml index d9aec579e7..142042a8da 100644 --- a/.github/workflows/_publish.yml +++ b/.github/workflows/_publish.yml @@ -8,7 +8,7 @@ env: jobs: publish: name: ${{ matrix.taskName }} - runs-on: windows-latest + runs-on: windows-2025 strategy: fail-fast: false matrix: diff --git a/.github/workflows/_unit_tests.yml b/.github/workflows/_unit_tests.yml index 97bf554592..f06c55a71d 100644 --- a/.github/workflows/_unit_tests.yml +++ b/.github/workflows/_unit_tests.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest, ubuntu-24.04, macos-15] + os: [windows-2025, ubuntu-24.04, macos-15] dotnetVersion: ${{ fromJson(inputs.dotnetVersions) }} runs-on: ${{ matrix.os }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19f78cdd91..805050efda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,7 +118,7 @@ jobs: release: name: Release needs: [ publish, docker_linux_manifests ] - runs-on: windows-latest + runs-on: windows-2025 env: GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} steps: From 1faa5a1176931104da49badaf4b3fda555abef05 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 19:17:47 +0000 Subject: [PATCH 018/107] (deps): Bump xunit.assert from 2.9.2 to 2.9.3 in /build Bumps [xunit.assert](https://github.com/xunit/xunit) from 2.9.2 to 2.9.3. - [Commits](https://github.com/xunit/xunit/compare/v2-2.9.2...v2-2.9.3) --- updated-dependencies: - dependency-name: xunit.assert dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Directory.Packages.props b/build/Directory.Packages.props index b8ef3cbd86..849085972c 100644 --- a/build/Directory.Packages.props +++ b/build/Directory.Packages.props @@ -15,6 +15,6 @@ - + \ No newline at end of file From 403dbd371157f1071d01741a69ab34367844542a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 16:12:25 +0000 Subject: [PATCH 019/107] (deps): Bump NUnit.Analyzers Bumps the analyzers group with 1 update in the /src directory: [NUnit.Analyzers](https://github.com/nunit/nunit.analyzers). Updates `NUnit.Analyzers` from 4.5.0 to 4.6.0 - [Release notes](https://github.com/nunit/nunit.analyzers/releases) - [Changelog](https://github.com/nunit/nunit.analyzers/blob/master/CHANGES.md) - [Commits](https://github.com/nunit/nunit.analyzers/compare/4.5.0...4.6.0) --- updated-dependencies: - dependency-name: NUnit.Analyzers dependency-type: direct:production update-type: version-update:semver-minor dependency-group: analyzers ... Signed-off-by: dependabot[bot] --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 18afaff8c2..9cb1f547dc 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -33,7 +33,7 @@ - + From f3e1fd4b31f67c0b39cfe182c88376428c084c66 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Jan 2025 15:45:44 +0000 Subject: [PATCH 020/107] (deps): Bump Polly from 8.5.0 to 8.5.1 in /src Bumps [Polly](https://github.com/App-vNext/Polly) from 8.5.0 to 8.5.1. - [Release notes](https://github.com/App-vNext/Polly/releases) - [Changelog](https://github.com/App-vNext/Polly/blob/main/CHANGELOG.md) - [Commits](https://github.com/App-vNext/Polly/compare/8.5.0...8.5.1) --- updated-dependencies: - dependency-name: Polly dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 9cb1f547dc..df9b7c1a4e 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -14,7 +14,7 @@ - + From cdedabd0259e143e602121b7346fbbeb9f04d945 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Jan 2025 15:45:20 +0000 Subject: [PATCH 021/107] (deps): Bump Polly from 8.5.0 to 8.5.1 in /new-cli Bumps [Polly](https://github.com/App-vNext/Polly) from 8.5.0 to 8.5.1. - [Release notes](https://github.com/App-vNext/Polly/releases) - [Changelog](https://github.com/App-vNext/Polly/blob/main/CHANGELOG.md) - [Commits](https://github.com/App-vNext/Polly/compare/8.5.0...8.5.1) --- updated-dependencies: - dependency-name: Polly dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index abd90ead7a..0471094bf3 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -11,7 +11,7 @@ - + From 4330f7e31b8e5bff62b8b63f4c055251e0545238 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Jan 2025 07:45:23 +0000 Subject: [PATCH 022/107] (deps): Bump dotnet-sdk from 9.0.101 to 9.0.102 Bumps [dotnet-sdk](https://github.com/dotnet/sdk) from 9.0.101 to 9.0.102. - [Release notes](https://github.com/dotnet/sdk/releases) - [Commits](https://github.com/dotnet/sdk/commits/v9.0.102) --- updated-dependencies: - dependency-name: dotnet-sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 7b200833ee..63f9762c77 100644 --- a/global.json +++ b/global.json @@ -5,6 +5,6 @@ "src" ], "sdk": { - "version": "9.0.101" + "version": "9.0.102" } } From fb43928da0ccd86a9b69ab9b9d12146c1331aeaa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Jan 2025 07:59:36 +0000 Subject: [PATCH 023/107] (deps): Bump the microsoft group across 2 directories with 9 updates Bumps the microsoft group with 2 updates in the /new-cli directory: [System.Text.Json](https://github.com/dotnet/runtime) and [Microsoft.Extensions.DependencyInjection.Abstractions](https://github.com/dotnet/runtime). Bumps the microsoft group with 9 updates in the /src directory: | Package | From | To | | --- | --- | --- | | [System.Text.Json](https://github.com/dotnet/runtime) | `9.0.0` | `9.0.1` | | [Microsoft.Extensions.DependencyInjection.Abstractions](https://github.com/dotnet/runtime) | `9.0.0` | `9.0.1` | | [Microsoft.Extensions.Configuration.CommandLine](https://github.com/dotnet/runtime) | `9.0.0` | `9.0.1` | | [Microsoft.Extensions.DependencyInjection](https://github.com/dotnet/runtime) | `9.0.0` | `9.0.1` | | [Microsoft.Extensions.FileSystemGlobbing](https://github.com/dotnet/runtime) | `9.0.0` | `9.0.1` | | [Microsoft.Extensions.FileSystemGlobbing](https://github.com/dotnet/runtime) | `9.0.0` | `9.0.1` | | [Microsoft.Extensions.Hosting](https://github.com/dotnet/runtime) | `9.0.0` | `9.0.1` | | [Microsoft.Bcl.AsyncInterfaces](https://github.com/dotnet/runtime) | `9.0.0` | `9.0.1` | | [System.Drawing.Common](https://github.com/dotnet/winforms) | `9.0.0` | `9.0.1` | | [System.Security.Cryptography.Xml](https://github.com/dotnet/runtime) | `9.0.0` | `9.0.1` | Updates `System.Text.Json` from 9.0.0 to 9.0.1 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.0...v9.0.1) Updates `Microsoft.Extensions.DependencyInjection.Abstractions` from 9.0.0 to 9.0.1 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.0...v9.0.1) Updates `System.Text.Json` from 9.0.0 to 9.0.1 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.0...v9.0.1) Updates `Microsoft.Extensions.DependencyInjection.Abstractions` from 9.0.0 to 9.0.1 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.0...v9.0.1) Updates `Microsoft.Extensions.Configuration.CommandLine` from 9.0.0 to 9.0.1 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.0...v9.0.1) Updates `Microsoft.Extensions.DependencyInjection` from 9.0.0 to 9.0.1 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.0...v9.0.1) Updates `Microsoft.Extensions.FileSystemGlobbing` from 9.0.0 to 9.0.1 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.0...v9.0.1) Updates `Microsoft.Extensions.FileSystemGlobbing` from 9.0.0 to 9.0.1 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.0...v9.0.1) Updates `Microsoft.Extensions.Hosting` from 9.0.0 to 9.0.1 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.0...v9.0.1) Updates `Microsoft.Bcl.AsyncInterfaces` from 9.0.0 to 9.0.1 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.0...v9.0.1) Updates `System.Drawing.Common` from 9.0.0 to 9.0.1 - [Release notes](https://github.com/dotnet/winforms/releases) - [Changelog](https://github.com/dotnet/winforms/blob/main/docs/release-activity.md) - [Commits](https://github.com/dotnet/winforms/commits/v9.0.1) Updates `System.Security.Cryptography.Xml` from 9.0.0 to 9.0.1 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.0...v9.0.1) --- updated-dependencies: - dependency-name: System.Text.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: Microsoft.Extensions.DependencyInjection.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: System.Text.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: Microsoft.Extensions.DependencyInjection.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: Microsoft.Extensions.Configuration.CommandLine dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: Microsoft.Extensions.DependencyInjection dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: Microsoft.Extensions.FileSystemGlobbing dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: Microsoft.Extensions.FileSystemGlobbing dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: Microsoft.Extensions.Hosting dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: Microsoft.Bcl.AsyncInterfaces dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: System.Drawing.Common dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: System.Security.Cryptography.Xml dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 4 ++-- src/Directory.Packages.props | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index 0471094bf3..33569b2740 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -10,7 +10,7 @@ - + @@ -21,6 +21,6 @@ - + \ No newline at end of file diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index df9b7c1a4e..efd7e7b66f 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -11,8 +11,8 @@ - - + + @@ -22,13 +22,13 @@ - + - - - - + + + + @@ -36,9 +36,9 @@ - - - + + + From 7b31a5c1665f62a28fc53475af6058e373b13eda Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 15:34:35 +0000 Subject: [PATCH 024/107] (deps): Bump coverlet.msbuild from 6.0.3 to 6.0.4 in /src Bumps [coverlet.msbuild](https://github.com/coverlet-coverage/coverlet) from 6.0.3 to 6.0.4. - [Release notes](https://github.com/coverlet-coverage/coverlet/releases) - [Commits](https://github.com/coverlet-coverage/coverlet/compare/v6.0.3...v6.0.4) --- updated-dependencies: - dependency-name: coverlet.msbuild dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index efd7e7b66f..28eb2abce4 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -40,6 +40,6 @@ - + \ No newline at end of file From f0b195fc1d8e78d8293965d29b20f59d88bc34e4 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Tue, 21 Jan 2025 07:18:15 +0100 Subject: [PATCH 025/107] formatting cleanup --- .github/actions/docker-manifests/action.yml | 10 ++++++++-- .github/actions/docker-publish/action.yml | 10 ++++++++-- .github/actions/docker-test/action.yml | 10 ++++++++-- .github/workflows/_artifacts_linux.yml | 5 ++++- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/.github/actions/docker-manifests/action.yml b/.github/actions/docker-manifests/action.yml index 7bf0945382..c1df90f6b8 100644 --- a/.github/actions/docker-manifests/action.yml +++ b/.github/actions/docker-manifests/action.yml @@ -32,7 +32,10 @@ runs: - name: '[Docker Publish Manifests] DockerHub' shell: pwsh - run: dotnet run/docker.dll --target=DockerManifest --arch=amd64 --arch=arm64 --dotnet_version=${{ inputs.dotnetVersion }} --docker_distro=${{ inputs.dockerDistro }} --docker_registry dockerhub + run: | + dotnet run/docker.dll ` + --target=DockerManifest --arch=amd64 --arch=arm64 --dotnet_version=${{ inputs.dotnetVersion }} ` + --docker_distro=${{ inputs.dockerDistro }} --docker_registry dockerhub - name: Login to GitHub uses: docker/login-action@v3 @@ -43,4 +46,7 @@ runs: - name: '[Docker Publish Manifests] GitHub' shell: pwsh - run: dotnet run/docker.dll --target=DockerManifest --arch=amd64 --arch=arm64 --dotnet_version=${{ inputs.dotnetVersion }} --docker_distro=${{ inputs.dockerDistro }} --docker_registry github + run: | + dotnet run/docker.dll ` + --target=DockerManifest --arch=amd64 --arch=arm64 --dotnet_version=${{ inputs.dotnetVersion }} ` + --docker_distro=${{ inputs.dockerDistro }} --docker_registry github diff --git a/.github/actions/docker-publish/action.yml b/.github/actions/docker-publish/action.yml index d65fbe5aee..cd14fc1df4 100644 --- a/.github/actions/docker-publish/action.yml +++ b/.github/actions/docker-publish/action.yml @@ -35,7 +35,10 @@ runs: - name: '[Docker Publish] DockerHub' shell: pwsh - run: dotnet run/docker.dll --target=DockerPublish --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnetVersion }} --docker_distro=${{ inputs.dockerDistro }} --docker_registry dockerhub --verbosity=diagnostic + run: | + dotnet run/docker.dll ` + --target=DockerPublish --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnetVersion }} ` + --docker_distro=${{ inputs.dockerDistro }} --docker_registry dockerhub --verbosity=diagnostic - name: Login to GitHub uses: docker/login-action@v3 @@ -46,4 +49,7 @@ runs: - name: '[Docker Publish] GitHub' shell: pwsh - run: dotnet run/docker.dll --target=DockerPublish --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnetVersion }} --docker_distro=${{ inputs.dockerDistro }} --docker_registry github --verbosity=diagnostic + run: | + dotnet run/docker.dll ` + --target=DockerPublish --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnetVersion }} ` + --docker_distro=${{ inputs.dockerDistro }} --docker_registry github --verbosity=diagnostic diff --git a/.github/actions/docker-test/action.yml b/.github/actions/docker-test/action.yml index 7e450d2d8e..9ee3fc9ec7 100644 --- a/.github/actions/docker-test/action.yml +++ b/.github/actions/docker-test/action.yml @@ -17,8 +17,14 @@ runs: - name: '[Docker Build & Test] DockerHub' shell: pwsh - run: dotnet run/docker.dll --target=DockerTest --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnetVersion }} --docker_distro=${{ inputs.dockerDistro }} --docker_registry dockerhub --verbosity=diagnostic + run: | + dotnet run/docker.dll --target=DockerTest ` + --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnetVersion }} ` + --docker_distro=${{ inputs.dockerDistro }} --docker_registry dockerhub --verbosity=diagnostic - name: '[Docker Build & Test] GitHub' shell: pwsh - run: dotnet run/docker.dll --target=DockerTest --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnetVersion }} --docker_distro=${{ inputs.dockerDistro }} --docker_registry github --verbosity=diagnostic + run: | + dotnet run/docker.dll --target=DockerTest ` + --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnetVersion }} ` + --docker_distro=${{ inputs.dockerDistro }} --docker_registry github --verbosity=diagnostic diff --git a/.github/workflows/_artifacts_linux.yml b/.github/workflows/_artifacts_linux.yml index ceb3e7c969..a407dedc3d 100644 --- a/.github/workflows/_artifacts_linux.yml +++ b/.github/workflows/_artifacts_linux.yml @@ -50,4 +50,7 @@ jobs: - name: '[Test Artifacts]' shell: pwsh - run: dotnet run/artifacts.dll --target=ArtifactsTest --arch=${{ inputs.arch }} --dotnet_version=${{ matrix.dotnetVersion }} --docker_distro=${{ matrix.dockerDistro }} \ No newline at end of file + run: | + dotnet run/artifacts.dll ` + --target=ArtifactsTest --arch=${{ inputs.arch }} --dotnet_version=${{ matrix.dotnetVersion }} ` + --docker_distro=${{ matrix.dockerDistro }} \ No newline at end of file From c2fe008e408638ec0d77570d61ba528bb456b160 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Fri, 29 Dec 2023 05:51:51 +0100 Subject: [PATCH 026/107] update the workflows to test the artifacts and docker images on arm64 runners --- .github/workflows/_docker.yml | 3 --- .github/workflows/_docker_manifests.yml | 3 --- .github/workflows/ci.yml | 4 ++-- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/_docker.yml b/.github/workflows/_docker.yml index 8514377ad6..b0b432b735 100644 --- a/.github/workflows/_docker.yml +++ b/.github/workflows/_docker.yml @@ -46,9 +46,6 @@ jobs: uses: docker/setup-docker-action@v4 with: daemon-config: '{ "features": { "containerd-snapshotter": true } }' - - - name: Setup QEMU - uses: docker/setup-qemu-action@v3 - name: Setup Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/.github/workflows/_docker_manifests.yml b/.github/workflows/_docker_manifests.yml index 9a1fdeb2b1..39a4045e9c 100644 --- a/.github/workflows/_docker_manifests.yml +++ b/.github/workflows/_docker_manifests.yml @@ -34,9 +34,6 @@ jobs: uses: docker/setup-docker-action@v4 with: daemon-config: '{ "features": { "containerd-snapshotter": true } }' - - - name: Setup QEMU - uses: docker/setup-qemu-action@v3 - name: Setup Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 805050efda..bfa6c9732e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,7 @@ jobs: - arch: amd64 runner: ubuntu-24.04 - arch: arm64 - runner: ubuntu-24.04 + runner: ubuntu-24.04-arm uses: ./.github/workflows/_artifacts_linux.yml with: runner: ${{ matrix.runner }} @@ -90,7 +90,7 @@ jobs: - arch: amd64 runner: ubuntu-24.04 - arch: arm64 - runner: ubuntu-24.04 + runner: ubuntu-24.04-arm uses: ./.github/workflows/_docker.yml with: From 9f656bea3ce9c4f8a7c3d55196b6d1f5ac728d7b Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Tue, 21 Jan 2025 07:50:56 +0100 Subject: [PATCH 027/107] add docker-setup action --- .github/actions/docker-setup/action.yml | 16 ++++++++++++++++ .github/workflows/_artifacts_linux.yml | 3 +++ .github/workflows/_docker.yml | 11 +---------- .github/workflows/_docker_manifests.yml | 11 +---------- 4 files changed, 21 insertions(+), 20 deletions(-) create mode 100644 .github/actions/docker-setup/action.yml diff --git a/.github/actions/docker-setup/action.yml b/.github/actions/docker-setup/action.yml new file mode 100644 index 0000000000..7b75cebdfd --- /dev/null +++ b/.github/actions/docker-setup/action.yml @@ -0,0 +1,16 @@ +name: 'Docker Setup' +description: 'Setups the docker engine' + +runs: + using: 'composite' + steps: + - name: Set up Docker + uses: docker/setup-docker-action@v4 + with: + daemon-config: '{ "features": { "containerd-snapshotter": true } }' + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + version: 'latest' + driver-opts: 'image=moby/buildkit:buildx-stable-1' + install: true diff --git a/.github/workflows/_artifacts_linux.yml b/.github/workflows/_artifacts_linux.yml index a407dedc3d..d7ad93db09 100644 --- a/.github/workflows/_artifacts_linux.yml +++ b/.github/workflows/_artifacts_linux.yml @@ -47,6 +47,9 @@ jobs: with: name: native-Linux path: ${{ github.workspace }}/artifacts/packages/native + - + name: Set up Docker + uses: ./.github/actions/docker-setup - name: '[Test Artifacts]' shell: pwsh diff --git a/.github/workflows/_docker.yml b/.github/workflows/_docker.yml index b0b432b735..7986ca8f58 100644 --- a/.github/workflows/_docker.yml +++ b/.github/workflows/_docker.yml @@ -43,16 +43,7 @@ jobs: path: ${{ github.workspace }}/artifacts/packages/nuget - name: Set up Docker - uses: docker/setup-docker-action@v4 - with: - daemon-config: '{ "features": { "containerd-snapshotter": true } }' - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - version: 'latest' - driver-opts: 'image=moby/buildkit:buildx-stable-1' - install: true + uses: ./.github/actions/docker-setup - name: Docker Test if: success() && github.event_name == 'pull_request' || github.repository_owner != 'GitTools' diff --git a/.github/workflows/_docker_manifests.yml b/.github/workflows/_docker_manifests.yml index 39a4045e9c..e88ae64e63 100644 --- a/.github/workflows/_docker_manifests.yml +++ b/.github/workflows/_docker_manifests.yml @@ -31,16 +31,7 @@ jobs: uses: ./.github/actions/cache-restore - name: Set up Docker - uses: docker/setup-docker-action@v4 - with: - daemon-config: '{ "features": { "containerd-snapshotter": true } }' - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - version: 'latest' - driver-opts: 'image=moby/buildkit:buildx-stable-1' - install: true + uses: ./.github/actions/docker-setup - name: Docker Manifests if: success() && github.event_name != 'pull_request' && github.repository_owner == 'GitTools' && github.ref_name == 'main' From 8b7bbdc8e01fe56d0e73daf2dae912bd0801cd9c Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Tue, 21 Jan 2025 19:59:22 +0100 Subject: [PATCH 028/107] use snake_case for output variables --- .github/actions/docker-manifests/action.yml | 12 ++++++------ .github/actions/docker-publish/action.yml | 12 ++++++------ .github/actions/docker-test/action.yml | 12 ++++++------ .github/workflows/_artifacts_linux.yml | 16 ++++++++-------- .github/workflows/_docker.yml | 18 +++++++++--------- .github/workflows/_docker_manifests.yml | 14 +++++++------- .github/workflows/_prepare.yml | 12 ++++++------ .github/workflows/_unit_tests.yml | 10 +++++----- .github/workflows/ci.yml | 14 +++++++------- build/config/Tasks/SetMatrix.cs | 4 ++-- 10 files changed, 62 insertions(+), 62 deletions(-) diff --git a/.github/actions/docker-manifests/action.yml b/.github/actions/docker-manifests/action.yml index c1df90f6b8..23de24c989 100644 --- a/.github/actions/docker-manifests/action.yml +++ b/.github/actions/docker-manifests/action.yml @@ -1,10 +1,10 @@ name: 'Docker Manifests' description: 'Docker Publish Manifests' inputs: - dockerDistro: + docker_distro: description: 'Linux Distro' required: true - dotnetVersion: + dotnet_version: description: '.net version' required: true docker_registry_username: @@ -34,8 +34,8 @@ runs: shell: pwsh run: | dotnet run/docker.dll ` - --target=DockerManifest --arch=amd64 --arch=arm64 --dotnet_version=${{ inputs.dotnetVersion }} ` - --docker_distro=${{ inputs.dockerDistro }} --docker_registry dockerhub + --target=DockerManifest --arch=amd64 --arch=arm64 --dotnet_version=${{ inputs.dotnet_version }} ` + --docker_distro=${{ inputs.docker_distro }} --docker_registry dockerhub - name: Login to GitHub uses: docker/login-action@v3 @@ -48,5 +48,5 @@ runs: shell: pwsh run: | dotnet run/docker.dll ` - --target=DockerManifest --arch=amd64 --arch=arm64 --dotnet_version=${{ inputs.dotnetVersion }} ` - --docker_distro=${{ inputs.dockerDistro }} --docker_registry github + --target=DockerManifest --arch=amd64 --arch=arm64 --dotnet_version=${{ inputs.dotnet_version }} ` + --docker_distro=${{ inputs.docker_distro }} --docker_registry github diff --git a/.github/actions/docker-publish/action.yml b/.github/actions/docker-publish/action.yml index cd14fc1df4..e5f2e05757 100644 --- a/.github/actions/docker-publish/action.yml +++ b/.github/actions/docker-publish/action.yml @@ -4,10 +4,10 @@ inputs: arch: description: 'Docker architecture' required: true - dockerDistro: + docker_distro: description: 'Linux Distro' required: true - dotnetVersion: + dotnet_version: description: '.net version' required: true docker_registry_username: @@ -37,8 +37,8 @@ runs: shell: pwsh run: | dotnet run/docker.dll ` - --target=DockerPublish --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnetVersion }} ` - --docker_distro=${{ inputs.dockerDistro }} --docker_registry dockerhub --verbosity=diagnostic + --target=DockerPublish --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnet_version }} ` + --docker_distro=${{ inputs.docker_distro }} --docker_registry dockerhub --verbosity=diagnostic - name: Login to GitHub uses: docker/login-action@v3 @@ -51,5 +51,5 @@ runs: shell: pwsh run: | dotnet run/docker.dll ` - --target=DockerPublish --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnetVersion }} ` - --docker_distro=${{ inputs.dockerDistro }} --docker_registry github --verbosity=diagnostic + --target=DockerPublish --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnet_version }} ` + --docker_distro=${{ inputs.docker_distro }} --docker_registry github --verbosity=diagnostic diff --git a/.github/actions/docker-test/action.yml b/.github/actions/docker-test/action.yml index 9ee3fc9ec7..c7a747121f 100644 --- a/.github/actions/docker-test/action.yml +++ b/.github/actions/docker-test/action.yml @@ -4,10 +4,10 @@ inputs: arch: description: 'Docker architecture' default: 'amd64' - dockerDistro: + docker_distro: description: 'Linux Distro' default: 'debian.12' - dotnetVersion: + dotnet_version: description: '.net version' default: '8.0' @@ -19,12 +19,12 @@ runs: shell: pwsh run: | dotnet run/docker.dll --target=DockerTest ` - --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnetVersion }} ` - --docker_distro=${{ inputs.dockerDistro }} --docker_registry dockerhub --verbosity=diagnostic + --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnet_version }} ` + --docker_distro=${{ inputs.docker_distro }} --docker_registry dockerhub --verbosity=diagnostic - name: '[Docker Build & Test] GitHub' shell: pwsh run: | dotnet run/docker.dll --target=DockerTest ` - --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnetVersion }} ` - --docker_distro=${{ inputs.dockerDistro }} --docker_registry github --verbosity=diagnostic + --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnet_version }} ` + --docker_distro=${{ inputs.docker_distro }} --docker_registry github --verbosity=diagnostic diff --git a/.github/workflows/_artifacts_linux.yml b/.github/workflows/_artifacts_linux.yml index d7ad93db09..813732178b 100644 --- a/.github/workflows/_artifacts_linux.yml +++ b/.github/workflows/_artifacts_linux.yml @@ -7,10 +7,10 @@ on: arch: required: true type: string - dockerDistros: + docker_distros: required: true type: string - dotnetVersions: + dotnet_versions: required: true type: string env: @@ -19,13 +19,13 @@ env: jobs: artifacts: - name: ${{ matrix.dockerDistro }} - net${{ matrix.dotnetVersion }} + name: ${{ matrix.docker_distro }} - net${{ matrix.dotnet_version }} runs-on: ${{ inputs.runner }} strategy: fail-fast: false - matrix: - dockerDistro: ${{ fromJson(inputs.dockerDistros) }} - dotnetVersion: ${{ fromJson(inputs.dotnetVersions) }} + matrix: + docker_distro: ${{ fromJson(inputs.docker_distros) }} + dotnet_version: ${{ fromJson(inputs.dotnet_versions) }} steps: - name: Checkout @@ -55,5 +55,5 @@ jobs: shell: pwsh run: | dotnet run/artifacts.dll ` - --target=ArtifactsTest --arch=${{ inputs.arch }} --dotnet_version=${{ matrix.dotnetVersion }} ` - --docker_distro=${{ matrix.dockerDistro }} \ No newline at end of file + --target=ArtifactsTest --arch=${{ inputs.arch }} --dotnet_version=${{ matrix.dotnet_version }} ` + --docker_distro=${{ matrix.docker_distro }} \ No newline at end of file diff --git a/.github/workflows/_docker.yml b/.github/workflows/_docker.yml index 7986ca8f58..5ca990810d 100644 --- a/.github/workflows/_docker.yml +++ b/.github/workflows/_docker.yml @@ -7,10 +7,10 @@ on: arch: required: true type: string - dockerDistros: + docker_distros: required: true type: string - dotnetVersions: + dotnet_versions: required: true type: string env: @@ -19,13 +19,13 @@ env: jobs: docker: - name: ${{ matrix.dockerDistro }} - net${{ matrix.dotnetVersion }} + name: ${{ matrix.docker_distro }} - net${{ matrix.dotnet_version }} runs-on: ${{ inputs.runner }} strategy: fail-fast: false matrix: - dockerDistro: ${{ fromJson(inputs.dockerDistros) }} - dotnetVersion: ${{ fromJson(inputs.dotnetVersions) }} + docker_distro: ${{ fromJson(inputs.docker_distros) }} + dotnet_version: ${{ fromJson(inputs.dotnet_versions) }} steps: - name: Checkout @@ -50,16 +50,16 @@ jobs: uses: ./.github/actions/docker-test with: arch: ${{ inputs.arch }} - dockerDistro: ${{ matrix.dockerDistro }} - dotnetVersion: ${{ matrix.dotnetVersion }} + docker_distro: ${{ matrix.docker_distro }} + dotnet_version: ${{ matrix.dotnet_version }} - name: Docker Publish if: success() && github.event_name != 'pull_request' && github.repository_owner == 'GitTools' && github.ref_name == 'main' uses: ./.github/actions/docker-publish with: arch: ${{ inputs.arch }} - dockerDistro: ${{ matrix.dockerDistro }} - dotnetVersion: ${{ matrix.dotnetVersion }} + docker_distro: ${{ matrix.docker_distro }} + dotnet_version: ${{ matrix.dotnet_version }} docker_registry_username: ${{ secrets.DOCKER_USERNAME }} docker_registry_password: ${{ secrets.DOCKER_PASSWORD }} github_registry_username: ${{ github.repository_owner }} diff --git a/.github/workflows/_docker_manifests.yml b/.github/workflows/_docker_manifests.yml index e88ae64e63..1212d8b4a7 100644 --- a/.github/workflows/_docker_manifests.yml +++ b/.github/workflows/_docker_manifests.yml @@ -1,10 +1,10 @@ on: workflow_call: inputs: - dockerDistros: + docker_distros: required: true type: string - dotnetVersions: + dotnet_versions: required: true type: string env: @@ -13,13 +13,13 @@ env: jobs: manifest: - name: ${{ matrix.dockerDistro }} - net${{ matrix.dotnetVersion }} + name: ${{ matrix.docker_distro }} - net${{ matrix.dotnet_version }} runs-on: ubuntu-24.04 strategy: fail-fast: false matrix: - dockerDistro: ${{ fromJson(inputs.dockerDistros) }} - dotnetVersion: ${{ fromJson(inputs.dotnetVersions) }} + docker_distro: ${{ fromJson(inputs.docker_distros) }} + dotnet_version: ${{ fromJson(inputs.dotnet_versions) }} steps: - name: Checkout @@ -37,8 +37,8 @@ jobs: if: success() && github.event_name != 'pull_request' && github.repository_owner == 'GitTools' && github.ref_name == 'main' uses: ./.github/actions/docker-manifests with: - dockerDistro: ${{ matrix.dockerDistro }} - dotnetVersion: ${{ matrix.dotnetVersion }} + docker_distro: ${{ matrix.docker_distro }} + dotnet_version: ${{ matrix.dotnet_version }} docker_registry_username: ${{ secrets.DOCKER_USERNAME }} docker_registry_password: ${{ secrets.DOCKER_PASSWORD }} github_registry_username: ${{ github.repository_owner }} diff --git a/.github/workflows/_prepare.yml b/.github/workflows/_prepare.yml index 1ab92c7163..58c8e6b9b1 100644 --- a/.github/workflows/_prepare.yml +++ b/.github/workflows/_prepare.yml @@ -1,12 +1,12 @@ on: workflow_call: outputs: - dockerDistros: + docker_distros: description: 'List of Docker distros' - value: ${{ jobs.set_matrix.outputs.dockerDistros }} - dotnetVersions: + value: ${{ jobs.set_matrix.outputs.docker_distros }} + dotnet_versions: description: 'List of .NET versions' - value: ${{ jobs.set_matrix.outputs.dotnetVersions }} + value: ${{ jobs.set_matrix.outputs.dotnet_versions }} jobs: prepare: name: ${{ matrix.os }} @@ -51,8 +51,8 @@ jobs: name: Set Matrix runs-on: ubuntu-24.04 outputs: - dockerDistros: ${{ steps.set_matrix.outputs.dockerDistros }} - dotnetVersions: ${{ steps.set_matrix.outputs.dotnetVersions }} + docker_distros: ${{ steps.set_matrix.outputs.docker_distros }} + dotnet_versions: ${{ steps.set_matrix.outputs.dotnet_versions }} steps: - name: Checkout diff --git a/.github/workflows/_unit_tests.yml b/.github/workflows/_unit_tests.yml index f06c55a71d..7557db2398 100644 --- a/.github/workflows/_unit_tests.yml +++ b/.github/workflows/_unit_tests.yml @@ -1,7 +1,7 @@ on: workflow_call: inputs: - dotnetVersions: + dotnet_versions: required: true type: string env: @@ -10,14 +10,14 @@ env: jobs: unit_test: - name: ${{ matrix.os }} - net${{ matrix.dotnetVersion }} + name: ${{ matrix.os }} - net${{ matrix.dotnet_version }} env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} strategy: fail-fast: false matrix: os: [windows-2025, ubuntu-24.04, macos-15] - dotnetVersion: ${{ fromJson(inputs.dotnetVersions) }} + dotnet_version: ${{ fromJson(inputs.dotnet_versions) }} runs-on: ${{ matrix.os }} steps: @@ -32,11 +32,11 @@ jobs: - name: '[Unit Test]' shell: pwsh - run: dotnet run/build.dll --target=Test --dotnet_version=${{ matrix.dotnetVersion }} + run: dotnet run/build.dll --target=Test --dotnet_version=${{ matrix.dotnet_version }} - name: Test Summary uses: test-summary/action@v2.4 - if: matrix.dotnetVersion == '9.0' + if: matrix.dotnet_version == '9.0' with: paths: artifacts/test-results/*.results.xml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bfa6c9732e..4e26468265 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: needs: [ prepare ] uses: ./.github/workflows/_unit_tests.yml with: - dotnetVersions: ${{ needs.prepare.outputs.dotnetVersions }} + dotnet_versions: ${{ needs.prepare.outputs.dotnet_versions }} secrets: inherit artifacts_windows_test: @@ -77,8 +77,8 @@ jobs: with: runner: ${{ matrix.runner }} arch: ${{ matrix.arch }} - dockerDistros: ${{ needs.prepare.outputs.dockerDistros }} - dotnetVersions: ${{ needs.prepare.outputs.dotnetVersions }} + docker_distros: ${{ needs.prepare.outputs.docker_distros }} + dotnet_versions: ${{ needs.prepare.outputs.dotnet_versions }} docker_linux_images: needs: [ prepare, build ] @@ -96,8 +96,8 @@ jobs: with: runner: ${{ matrix.runner }} arch: ${{ matrix.arch }} - dockerDistros: ${{ needs.prepare.outputs.dockerDistros }} - dotnetVersions: ${{ needs.prepare.outputs.dotnetVersions }} + docker_distros: ${{ needs.prepare.outputs.docker_distros }} + dotnet_versions: ${{ needs.prepare.outputs.dotnet_versions }} secrets: inherit docker_linux_manifests: @@ -105,8 +105,8 @@ jobs: name: Docker Manifests uses: ./.github/workflows/_docker_manifests.yml with: - dockerDistros: ${{ needs.prepare.outputs.dockerDistros }} - dotnetVersions: ${{ needs.prepare.outputs.dotnetVersions }} + docker_distros: ${{ needs.prepare.outputs.docker_distros }} + dotnet_versions: ${{ needs.prepare.outputs.dotnet_versions }} secrets: inherit publish: diff --git a/build/config/Tasks/SetMatrix.cs b/build/config/Tasks/SetMatrix.cs index 44bd8a6c3d..666757cfa5 100644 --- a/build/config/Tasks/SetMatrix.cs +++ b/build/config/Tasks/SetMatrix.cs @@ -8,8 +8,8 @@ public override void Run(BuildContext context) { if (context.BuildSystem().IsRunningOnGitHubActions) { - context.GitHubActions().Commands.SetOutputParameter("dockerDistros", context.SerializeJson(Constants.DockerDistros)); - context.GitHubActions().Commands.SetOutputParameter("dotnetVersions", context.SerializeJson(Constants.DotnetVersions)); + context.GitHubActions().Commands.SetOutputParameter("docker_distros", context.SerializeJson(Constants.DockerDistros)); + context.GitHubActions().Commands.SetOutputParameter("dotnet_versions", context.SerializeJson(Constants.DotnetVersions)); } else { From 7b415469f218aa5b230cc731f4231394b00f6464 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2025 22:12:10 +0000 Subject: [PATCH 029/107] (docs deps): Bump undici from 6.19.8 to 6.21.1 in the npm_and_yarn group Bumps the npm_and_yarn group with 1 update: [undici](https://github.com/nodejs/undici). Updates `undici` from 6.19.8 to 6.21.1 - [Release notes](https://github.com/nodejs/undici/releases) - [Commits](https://github.com/nodejs/undici/compare/v6.19.8...v6.21.1) --- updated-dependencies: - dependency-name: undici dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] --- package-lock.json | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7fe4034898..686831da48 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15574,10 +15574,11 @@ } }, "node_modules/undici": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.19.8.tgz", - "integrity": "sha512-U8uCCl2x9TK3WANvmBavymRzxbfFYG+tAu+fgx3zxQy3qdagQqBLwJVrdyO1TBfUXvfKveMKJZhpvUYoOjM+4g==", + "version": "6.21.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.21.1.tgz", + "integrity": "sha512-q/1rj5D0/zayJB2FraXdaWxbhWiNKDvu8naDT2dl1yTlvJp4BLtOcp2a5BvgGNQpYYJzau7tf1WgKv3b+7mqpQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=18.17" } @@ -28440,9 +28441,9 @@ } }, "undici": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.19.8.tgz", - "integrity": "sha512-U8uCCl2x9TK3WANvmBavymRzxbfFYG+tAu+fgx3zxQy3qdagQqBLwJVrdyO1TBfUXvfKveMKJZhpvUYoOjM+4g==", + "version": "6.21.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.21.1.tgz", + "integrity": "sha512-q/1rj5D0/zayJB2FraXdaWxbhWiNKDvu8naDT2dl1yTlvJp4BLtOcp2a5BvgGNQpYYJzau7tf1WgKv3b+7mqpQ==", "dev": true }, "unified-args": { From 2fdcb370f647a10990b31bbeac47f7be85c18d69 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Jan 2025 16:00:57 +0000 Subject: [PATCH 030/107] (deps): Bump System.CommandLine Bumps the microsoft group with 1 update in the /new-cli directory: [System.CommandLine](https://github.com/dotnet/command-line-api). Updates `System.CommandLine` from 2.0.0-beta4.24528.1 to 2.0.0-beta4.25071.2 - [Release notes](https://github.com/dotnet/command-line-api/releases) - [Changelog](https://github.com/dotnet/command-line-api/blob/main/docs/History.md) - [Commits](https://github.com/dotnet/command-line-api/commits) --- updated-dependencies: - dependency-name: System.CommandLine dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index 33569b2740..aef8122b03 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -20,7 +20,7 @@ - + \ No newline at end of file From 152f84c8218d345f58219674b97316f53b8801eb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 15:50:02 +0000 Subject: [PATCH 031/107] (deps): Bump Shouldly from 4.2.1 to 4.3.0 in /src Bumps [Shouldly](https://github.com/shouldly/shouldly) from 4.2.1 to 4.3.0. - [Release notes](https://github.com/shouldly/shouldly/releases) - [Changelog](https://github.com/shouldly/shouldly/blob/master/BREAKING%20CHANGES.txt) - [Commits](https://github.com/shouldly/shouldly/compare/4.2.1...4.3.0) --- updated-dependencies: - dependency-name: Shouldly dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 28eb2abce4..2f928a5e6b 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -35,7 +35,7 @@ - + From d3db023055e7ba77a7494019080f230bb2ba51ef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Jan 2025 09:04:07 +0000 Subject: [PATCH 032/107] (deps): Bump System.CommandLine (#4392) Bumps the microsoft group with 1 update in the /new-cli directory: [System.CommandLine](https://github.com/dotnet/command-line-api). Updates `System.CommandLine` from 2.0.0-beta4.25071.2 to 2.0.0-beta4.25072.1 - [Release notes](https://github.com/dotnet/command-line-api/releases) - [Changelog](https://github.com/dotnet/command-line-api/blob/main/docs/History.md) - [Commits](https://github.com/dotnet/command-line-api/commits) --- updated-dependencies: - dependency-name: System.CommandLine dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- new-cli/Directory.Packages.props | 2 +- new-cli/GitVersion.Cli.Generator/Content.cs | 14 +++++++------- new-cli/GitVersion.Cli/GitVersionApp.cs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index aef8122b03..f6442ac986 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -20,7 +20,7 @@ - + \ No newline at end of file diff --git a/new-cli/GitVersion.Cli.Generator/Content.cs b/new-cli/GitVersion.Cli.Generator/Content.cs index f3a2484a68..edde296b9f 100644 --- a/new-cli/GitVersion.Cli.Generator/Content.cs +++ b/new-cli/GitVersion.Cli.Generator/Content.cs @@ -27,7 +27,7 @@ public static class Content namespace {{Namespace}}; -public class {{Model.CommandTypeName}}Impl : CliCommand, ICommandImpl +public class {{Model.CommandTypeName}}Impl : Command, ICommandImpl { public string CommandName => nameof({{Model.CommandTypeName}}Impl); {{- if (Model.ParentCommand | string.empty) }} @@ -38,14 +38,14 @@ public class {{Model.CommandTypeName}}Impl : CliCommand, ICommandImpl {{- $settingsProperties = Model.SettingsProperties | array.sort "Name" }} // Options list {{~ for $prop in $settingsProperties ~}} - protected readonly CliOption<{{$prop.TypeName}}> {{$prop.Name}}Option; + protected readonly Option<{{$prop.TypeName}}> {{$prop.Name}}Option; {{~ end ~}} public {{Model.CommandTypeName}}Impl({{Model.CommandTypeName}} command) : base("{{Model.CommandName}}", "{{Model.CommandDescription}}") { {{~ for $prop in $settingsProperties ~}} - {{$prop.Name}}Option = new CliOption<{{$prop.TypeName}}>("{{$prop.OptionName}}", [{{$prop.Aliases}}]) + {{$prop.Name}}Option = new Option<{{$prop.TypeName}}>("{{$prop.OptionName}}", [{{$prop.Aliases}}]) { Required = {{$prop.Required}}, Description = "{{$prop.Description}}", @@ -80,7 +80,7 @@ Task Run(ParseResult parseResult, CancellationToken cancellationToken) using {{InfraNamespaceName}}; namespace {{Namespace}}; -public class RootCommandImpl : CliRootCommand +public class RootCommandImpl : RootCommand { public RootCommandImpl(IEnumerable commands) { @@ -94,12 +94,12 @@ private void AddCommand(ICommandImpl command, IDictionary { if (!string.IsNullOrWhiteSpace(command.ParentCommandName)) { - var parent = map[command.ParentCommandName] as CliCommand; - parent?.Add((CliCommand)command); + var parent = map[command.ParentCommandName] as Command; + parent?.Add((Command)command); } else { - Add((CliCommand)command); + Add((Command)command); } } } diff --git a/new-cli/GitVersion.Cli/GitVersionApp.cs b/new-cli/GitVersion.Cli/GitVersionApp.cs index d873b38bcd..7c9d1854d1 100644 --- a/new-cli/GitVersion.Cli/GitVersionApp.cs +++ b/new-cli/GitVersion.Cli/GitVersionApp.cs @@ -13,7 +13,7 @@ internal class GitVersionApp(RootCommandImpl rootCommand) public Task RunAsync(string[] args, CancellationToken cancellationToken) { - var cliConfiguration = new CliConfiguration(rootCommand); + var cliConfiguration = new CommandLineConfiguration(rootCommand); var parseResult = cliConfiguration.Parse(args); var logFile = parseResult.GetValue(GitVersionSettings.LogFileOption); From ca38e922a7f5ee8684bf9560a0818709530e5555 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 16:17:53 +0000 Subject: [PATCH 033/107] (deps): Bump the analyzers group across 2 directories with 2 updates Bumps the analyzers group with 2 updates in the /new-cli directory: [Roslynator.Analyzers](https://github.com/dotnet/roslynator) and [Roslynator.Formatting.Analyzers](https://github.com/dotnet/roslynator). Bumps the analyzers group with 2 updates in the /src directory: [Roslynator.Analyzers](https://github.com/dotnet/roslynator) and [Roslynator.Formatting.Analyzers](https://github.com/dotnet/roslynator). Updates `Roslynator.Analyzers` from 4.12.10 to 4.12.11 - [Release notes](https://github.com/dotnet/roslynator/releases) - [Changelog](https://github.com/dotnet/roslynator/blob/main/ChangeLog.md) - [Commits](https://github.com/dotnet/roslynator/compare/v4.12.10...v4.12.11) Updates `Roslynator.Formatting.Analyzers` from 4.12.10 to 4.12.11 - [Release notes](https://github.com/dotnet/roslynator/releases) - [Changelog](https://github.com/dotnet/roslynator/blob/main/ChangeLog.md) - [Commits](https://github.com/dotnet/roslynator/compare/v4.12.10...v4.12.11) Updates `Roslynator.Analyzers` from 4.12.10 to 4.12.11 - [Release notes](https://github.com/dotnet/roslynator/releases) - [Changelog](https://github.com/dotnet/roslynator/blob/main/ChangeLog.md) - [Commits](https://github.com/dotnet/roslynator/compare/v4.12.10...v4.12.11) Updates `Roslynator.Formatting.Analyzers` from 4.12.10 to 4.12.11 - [Release notes](https://github.com/dotnet/roslynator/releases) - [Changelog](https://github.com/dotnet/roslynator/blob/main/ChangeLog.md) - [Commits](https://github.com/dotnet/roslynator/compare/v4.12.10...v4.12.11) --- updated-dependencies: - dependency-name: Roslynator.Analyzers dependency-type: direct:production update-type: version-update:semver-patch dependency-group: analyzers - dependency-name: Roslynator.Formatting.Analyzers dependency-type: direct:production update-type: version-update:semver-patch dependency-group: analyzers - dependency-name: Roslynator.Analyzers dependency-type: direct:production update-type: version-update:semver-patch dependency-group: analyzers - dependency-name: Roslynator.Formatting.Analyzers dependency-type: direct:production update-type: version-update:semver-patch dependency-group: analyzers ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 4 ++-- src/Directory.Packages.props | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index f6442ac986..0498da41e5 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -12,8 +12,8 @@ - - + + diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 2f928a5e6b..69f15bafea 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -15,8 +15,8 @@ - - + + From 095d06160ef4d17cdddb7222686af6f8cc47ecec Mon Sep 17 00:00:00 2001 From: Bi0T1N Date: Fri, 31 Jan 2025 21:49:12 +0100 Subject: [PATCH 034/107] Avoid building git from source for devcontainer use git version from OS to avoid compiling newest version from source -> saves quite some time --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d2569415e2..c8de2ac6d0 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -15,7 +15,7 @@ "upgradePackages": "true" }, "ghcr.io/devcontainers/features/git:1": { - "version": "latest", + "version": "os-provided", "ppa": "false" }, "ghcr.io/devcontainers/features/powershell:1": { From 81f282db4ef69d47a7d41ac15da26e7699417c2e Mon Sep 17 00:00:00 2001 From: Bi0T1N Date: Fri, 31 Jan 2025 21:52:49 +0100 Subject: [PATCH 035/107] Fix building project in devcontainer the SDK version is defined as v9.0 in global.json and hence it shows that NET 9.0 is missing in the dotnet v8.0 container compiling and running the tests works now: dotnet test --framework net9.0 src/ --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index d71522864b..df058170ac 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/devcontainers/dotnet:dev-8.0 +FROM mcr.microsoft.com/devcontainers/dotnet:dev-9.0 # [Optional] Uncomment this section to install additional OS packages. # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ From 5145ee5533bd74bb2c23077578ef278177fe7e16 Mon Sep 17 00:00:00 2001 From: AlphaYankee <54741936+AlphaYankee@users.noreply.github.com> Date: Thu, 29 Aug 2024 23:53:18 +0200 Subject: [PATCH 036/107] Do not return the tag as branch name for GitLab CI In case of a tag pipeline, return null as branch name instead of the tag --- src/GitVersion.BuildAgents/Agents/GitLabCi.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/GitVersion.BuildAgents/Agents/GitLabCi.cs b/src/GitVersion.BuildAgents/Agents/GitLabCi.cs index 0956084ab7..23c0e912a1 100644 --- a/src/GitVersion.BuildAgents/Agents/GitLabCi.cs +++ b/src/GitVersion.BuildAgents/Agents/GitLabCi.cs @@ -21,7 +21,18 @@ public override string[] GenerateSetParameterMessage(string name, string? value) $"GitVersion_{name}={value}" ]; - public override string? GetCurrentBranch(bool usingDynamicRepos) => Environment.GetEnvironmentVariable("CI_COMMIT_REF_NAME"); + public override string? GetCurrentBranch(bool usingDynamicRepos) + { + // CI_COMMIT_REF_NAME can contain either the branch or the tag + // See https://docs.gitlab.com/ee/ci/variables/predefined_variables.html + + // CI_COMMIT_TAG is only available in tag pipelines, + // so we can exit if CI_COMMIT_REF_NAME would return the tag + if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("CI_COMMIT_TAG"))) + return null; + + return Environment.GetEnvironmentVariable("CI_COMMIT_REF_NAME"); + } public override bool PreventFetch() => true; From 805058438d6848ce7ced779768498d99e91d23d3 Mon Sep 17 00:00:00 2001 From: Bi0T1N Date: Fri, 31 Jan 2025 21:25:51 +0100 Subject: [PATCH 037/107] Add tests for GitLab CI to ignore branch name for tags --- .../Agents/GitLabCiTests.cs | 57 ++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/src/GitVersion.BuildAgents.Tests/Agents/GitLabCiTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/GitLabCiTests.cs index aa1e2ec6b0..2e5eba6ea1 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/GitLabCiTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/GitLabCiTests.cs @@ -9,16 +9,22 @@ namespace GitVersion.Agents.Tests; [TestFixture] public class GitLabCiTests : TestBase { - private GitLabCi buildServer; private IServiceProvider sp; + private GitLabCi buildServer; + private IEnvironment environment; [SetUp] public void SetUp() { this.sp = ConfigureServices(services => services.AddSingleton()); this.buildServer = this.sp.GetRequiredService(); + this.environment = this.sp.GetRequiredService(); + this.environment.SetEnvironmentVariable(GitLabCi.EnvironmentVariableName, "true"); } + [TearDown] + public void TearDown() => this.environment.SetEnvironmentVariable(GitLabCi.EnvironmentVariableName, null); + [Test] public void GenerateSetVersionMessageReturnsVersionAsIsAlthoughThisIsNotUsedByJenkins() { @@ -34,6 +40,55 @@ public void GenerateMessageTest() generatedParameterMessages[0].ShouldBe("GitVersion_name=value"); } + [TestCase("main", "main")] + [TestCase("dev", "dev")] + [TestCase("development", "development")] + [TestCase("my_cool_feature", "my_cool_feature")] + [TestCase("#3-change_projectname", "#3-change_projectname")] + public void GetCurrentBranchShouldHandleBranches(string branchName, string expectedResult) + { + this.environment.SetEnvironmentVariable("CI_COMMIT_REF_NAME", branchName); + + var result = this.buildServer.GetCurrentBranch(false); + + result.ShouldBe(expectedResult); + } + + [TestCase("main", "", "main")] + [TestCase("v1.0.0", "v1.0.0", null)] + [TestCase("development", "", "development")] + [TestCase("v1.2.1", "v1.2.1", null)] + public void GetCurrentBranchShouldHandleTags(string branchName, string commitTag, string? expectedResult) + { + this.environment.SetEnvironmentVariable("CI_COMMIT_REF_NAME", branchName); + this.environment.SetEnvironmentVariable("CI_COMMIT_TAG", commitTag); // only set in pipelines for tags + + var result = this.buildServer.GetCurrentBranch(false); + + if (!string.IsNullOrEmpty(expectedResult)) + { + result.ShouldBe(expectedResult); + } + else + { + result.ShouldBeNull(); + } + } + + [TestCase("main", "main")] + [TestCase("dev", "dev")] + [TestCase("development", "development")] + [TestCase("my_cool_feature", "my_cool_feature")] + [TestCase("#3-change_projectname", "#3-change_projectname")] + public void GetCurrentBranchShouldHandlePullRequests(string branchName, string expectedResult) + { + this.environment.SetEnvironmentVariable("CI_COMMIT_REF_NAME", branchName); + + var result = this.buildServer.GetCurrentBranch(false); + + result.ShouldBe(expectedResult); + } + [Test] public void WriteAllVariablesToTheTextWriter() { From f7919ad0b4727eefef4188fea704fcc2c4fb409f Mon Sep 17 00:00:00 2001 From: HHobeck Date: Sat, 18 Jan 2025 12:16:15 +0100 Subject: [PATCH 038/107] branch regex is matched against {EscapedBranchName} not {BranchName} +semver minor --- BREAKING_CHANGES.md | 6 +- docs/input/docs/reference/configuration.md | 70 ++++++------------- docs/input/docs/workflows/GitFlow/v1.yml | 15 ++-- docs/input/docs/workflows/GitHubFlow/v1.yml | 11 ++- .../docs/workflows/TrunkBased/preview1.yml | 11 ++- .../ConfigurationExtensionsTests.cs | 4 +- ...riteOutEffectiveConfiguration.approved.txt | 13 ++-- .../ConfigurationProviderTests.cs | 8 +-- .../Workflows/approved/GitFlow/v1.yml | 15 ++-- .../Workflows/approved/GitHubFlow/v1.yml | 11 ++- .../approved/TrunkBased/preview1.yml | 11 ++- .../BranchConfiguration.cs | 9 --- .../Builders/BranchConfigurationBuilder.cs | 9 --- .../Builders/ConfigurationBuilderBase.cs | 9 --- .../Builders/GitFlowConfigurationBuilder.cs | 3 +- .../GitHubFlowConfigurationBuilder.cs | 3 +- .../TrunkBasedConfigurationBuilder.cs | 3 +- .../IntegrationTests/DevelopScenarios.cs | 2 +- .../FeatureBranchScenarios.cs | 11 +-- .../MainlineDevelopmentScenarios.cs | 2 +- ...EffectiveBranchConfigurationFinderTests.cs | 2 +- .../NextVersionCalculatorTests.cs | 4 +- .../Configuration/ConfigurationConstants.cs | 1 + .../Configuration/EffectiveConfiguration.cs | 3 - .../Configuration/IBranchConfiguration.cs | 2 - src/GitVersion.Core/Core/RegexPatterns.cs | 15 ++-- .../Extensions/ConfigurationExtensions.cs | 31 ++++---- src/GitVersion.Core/PublicAPI.Shipped.txt | 2 - 28 files changed, 105 insertions(+), 181 deletions(-) diff --git a/BREAKING_CHANGES.md b/BREAKING_CHANGES.md index 93e2285091..39f064160d 100644 --- a/BREAKING_CHANGES.md +++ b/BREAKING_CHANGES.md @@ -1,3 +1,7 @@ +## v6.1.0 + +* The configuration property `label-number-pattern` was removed. The functionality can be still used by changing the label and the branch name regular expression for pull-request branches. + ## v6.0.0 ### Platforms @@ -60,7 +64,7 @@ * The `useBranchName` magic string has been removed. Instead use `{BranchName}` for `label`. * The `BranchPrefixToTrim` configuration property has been removed. `RegularExpression` is now used to capture named groups instead. - * Default `RegularExpression` for feature branches is changed from `^features?[/-]` to `^features?[/-](?.+)` to support using `{BranchName}` out-of-the-box + * Default `RegularExpression` for feature branches is changed from `^features?[\/-]` to `^features?[\/-](?.+)` to support using `{BranchName}` out-of-the-box * Default `RegularExpression` for unknown branches is changed from `.*` to `(?.+)` to support using `{BranchName}` out-of-the-box * The `Mainline` mode and the related implementation has been removed completely. The new `Mainline` version strategy should be used instead. diff --git a/docs/input/docs/reference/configuration.md b/docs/input/docs/reference/configuration.md index 9f7354f2ce..9dda482e2e 100644 --- a/docs/input/docs/reference/configuration.md +++ b/docs/input/docs/reference/configuration.md @@ -100,7 +100,7 @@ branches: of-merged-branch: true when-current-commit-tagged: false track-merge-target: false - regex: ^releases?[/-](?.+) + regex: ^releases?[\/-](?.+) source-branches: - main - support @@ -116,7 +116,7 @@ branches: prevent-increment: when-current-commit-tagged: false track-merge-message: true - regex: ^features?[/-](?.+) + regex: ^features?[\/-](?.+) source-branches: - develop - main @@ -128,14 +128,13 @@ branches: pre-release-weight: 30000 pull-request: mode: ContinuousDelivery - label: PullRequest + label: PullRequest{Number} increment: Inherit prevent-increment: of-merged-branch: true when-current-commit-tagged: false - label-number-pattern: '[/-](?\d+)' track-merge-message: true - regex: ^(pull|pull\-requests|pr)[/-] + regex: ^(pull-requests|pull|pr)[\/-](?\d*) source-branches: - develop - main @@ -151,7 +150,7 @@ branches: increment: Inherit prevent-increment: when-current-commit-tagged: false - regex: ^hotfix(es)?[/-](?.+) + regex: ^hotfix(es)?[\/-](?.+) source-branches: - main - support @@ -165,7 +164,7 @@ branches: prevent-increment: of-merged-branch: true track-merge-target: false - regex: ^support[/-](?.+) + regex: ^support[\/-](?.+) source-branches: - main is-source-branch-for: [] @@ -262,7 +261,7 @@ branches: when-current-commit-tagged: false track-merge-target: false track-merge-message: true - regex: ^releases?[/-](?.+) + regex: ^releases?[\/-](?.+) source-branches: - main is-source-branch-for: [] @@ -277,7 +276,7 @@ branches: prevent-increment: when-current-commit-tagged: false track-merge-message: true - regex: ^features?[/-](?.+) + regex: ^features?[\/-](?.+) source-branches: - main - release @@ -286,14 +285,13 @@ branches: pre-release-weight: 30000 pull-request: mode: ContinuousDelivery - label: PullRequest + label: PullRequest{Number} increment: Inherit prevent-increment: of-merged-branch: true when-current-commit-tagged: false - label-number-pattern: '[/-](?\d+)' track-merge-message: true - regex: ^(pull|pull\-requests|pr)[/-] + regex: ^(pull-requests|pull|pr)[\/-](?\d*) source-branches: - main - release @@ -381,7 +379,7 @@ branches: prevent-increment: when-current-commit-tagged: false track-merge-message: true - regex: ^features?[/-](?.+) + regex: ^features?[\/-](?.+) source-branches: - main is-source-branch-for: [] @@ -393,7 +391,7 @@ branches: increment: Patch prevent-increment: when-current-commit-tagged: false - regex: ^hotfix(es)?[/-](?.+) + regex: ^hotfix(es)?[\/-](?.+) source-branches: - main is-source-branch-for: [] @@ -402,14 +400,13 @@ branches: pre-release-weight: 30000 pull-request: mode: ContinuousDelivery - label: PullRequest + label: PullRequest{Number} increment: Inherit prevent-increment: of-merged-branch: true when-current-commit-tagged: false - label-number-pattern: '[/-](?\d+)' track-merge-message: true - regex: ^(pull|pull\-requests|pr)[/-] + regex: ^(pull-requests|pull|pr)[\/-](?\d*) source-branches: - main - feature @@ -690,7 +687,7 @@ branches: is-main-branch: false pre-release-weight: 0 release: - regex: ^releases?[/-] + regex: ^releases?[\/-] mode: ContinuousDelivery label: beta increment: None @@ -702,29 +699,28 @@ branches: is-main-branch: false pre-release-weight: 30000 feature: - regex: ^features?[/-] + regex: ^features?[\/-] mode: ContinuousDelivery label: '{BranchName}' increment: Inherit source-branches: [ 'develop', 'main', 'release', 'feature', 'support', 'hotfix' ] pre-release-weight: 30000 pull-request: - regex: ^(pull|pull\-requests|pr)[/-] + regex: ^(pull-requests|pull|pr)[\/-] mode: ContinuousDelivery label: PullRequest increment: Inherit - label-number-pattern: '[/-](?\d+)[-/]' source-branches: [ 'develop', 'main', 'release', 'feature', 'support', 'hotfix' ] pre-release-weight: 30000 hotfix: - regex: ^hotfix(es)?[/-] + regex: ^hotfix(es)?[\/-] mode: ContinuousDelivery label: beta increment: Inherit source-branches: [ 'release', 'main', 'support', 'hotfix' ] pre-release-weight: 30000 support: - regex: ^support[/-] + regex: ^support[\/-] mode: ContinuousDelivery label: '' increment: Patch @@ -840,9 +836,9 @@ The pre-release label to use for this branch. Use the value `{BranchName}` as a insert the value of the named group `BranchName` from the [regular expression](#regex). For example: branch `feature/foo` would become a pre-release label -of `alpha.foo` with `label: 'alpha.{BranchName}'` and `regex: '^features?[/-](?.+)'`. +of `alpha.foo` with `label: 'alpha.{BranchName}'` and `regex: '^features?[\/-](?.+)'`. -Another example: branch `features/sc-12345/some-description` would become a pre-release label of `sc-12345` with `label: '{StoryNo}'` and `regex: '^features?[/-](?sc-\d+)[-/].+'`. +Another example: branch `features/sc-12345/some-description` would become a pre-release label of `sc-12345` with `label: '{StoryNo}'` and `regex: '^features?[\/-](?sc-\d+)[-/].+'`. **Note:** To clear a default use an empty string: `label: ''` @@ -871,30 +867,6 @@ The increment of the merged branch will be ignored when this branch related prop This branch related property controls the behvior whether to use the tagged (value set to true) or the incremented (value set to false) semantic version. Defaults to true. -### label-number-pattern - -Pull requests require us to extract the pre-release number out of the branch -name so `refs/pulls/534/merge` builds as `PullRequest.534`. This is a regex with -a named capture group called `number`. - -If the branch `mode` is set to `ContinuousDeployment`, then the extracted -`number` is appended to the name of the pre-release label and the number portion -is the number of commits since the last label. This enables consecutive commits to -the pull request branch to generate unique full semantic version numbers when -the branch is configured to use ContinuousDeployment mode. - -**Example usage:** - -```yaml -branches: - pull-request: - mode: ContinuousDeployment - label: PullRequest - increment: Inherit - track-merge-target: true - label-number-pattern: '[/-](?\d+)[-/]' -``` - ### track-merge-target Strategy which will look for tagged merge commits directly off the current diff --git a/docs/input/docs/workflows/GitFlow/v1.yml b/docs/input/docs/workflows/GitFlow/v1.yml index 3eaec755f8..114ecf8e4f 100644 --- a/docs/input/docs/workflows/GitFlow/v1.yml +++ b/docs/input/docs/workflows/GitFlow/v1.yml @@ -1,4 +1,4 @@ -assembly-versioning-scheme: MajorMinorPatch +assembly-versioning-scheme: MajorMinorPatch assembly-file-versioning-scheme: MajorMinorPatch tag-prefix: '[vV]?' version-in-branch-pattern: (?[vV]?\d+(\.\d+)?(\.\d+)?).* @@ -57,7 +57,7 @@ branches: of-merged-branch: true when-current-commit-tagged: false track-merge-target: false - regex: ^releases?[/-](?.+) + regex: ^releases?[\/-](?.+) source-branches: - main - support @@ -73,7 +73,7 @@ branches: prevent-increment: when-current-commit-tagged: false track-merge-message: true - regex: ^features?[/-](?.+) + regex: ^features?[\/-](?.+) source-branches: - develop - main @@ -85,14 +85,13 @@ branches: pre-release-weight: 30000 pull-request: mode: ContinuousDelivery - label: PullRequest + label: PullRequest{Number} increment: Inherit prevent-increment: of-merged-branch: true when-current-commit-tagged: false - label-number-pattern: '[/-](?\d+)' track-merge-message: true - regex: ^(pull|pull\-requests|pr)[/-] + regex: ^(pull-requests|pull|pr)[\/-](?\d*) source-branches: - develop - main @@ -108,7 +107,7 @@ branches: increment: Inherit prevent-increment: when-current-commit-tagged: false - regex: ^hotfix(es)?[/-](?.+) + regex: ^hotfix(es)?[\/-](?.+) source-branches: - main - support @@ -122,7 +121,7 @@ branches: prevent-increment: of-merged-branch: true track-merge-target: false - regex: ^support[/-](?.+) + regex: ^support[\/-](?.+) source-branches: - main is-source-branch-for: [] diff --git a/docs/input/docs/workflows/GitHubFlow/v1.yml b/docs/input/docs/workflows/GitHubFlow/v1.yml index 0943cd01fa..bc0452231a 100644 --- a/docs/input/docs/workflows/GitHubFlow/v1.yml +++ b/docs/input/docs/workflows/GitHubFlow/v1.yml @@ -1,4 +1,4 @@ -assembly-versioning-scheme: MajorMinorPatch +assembly-versioning-scheme: MajorMinorPatch assembly-file-versioning-scheme: MajorMinorPatch tag-prefix: '[vV]?' version-in-branch-pattern: (?[vV]?\d+(\.\d+)?(\.\d+)?).* @@ -43,7 +43,7 @@ branches: when-current-commit-tagged: false track-merge-target: false track-merge-message: true - regex: ^releases?[/-](?.+) + regex: ^releases?[\/-](?.+) source-branches: - main is-source-branch-for: [] @@ -58,7 +58,7 @@ branches: prevent-increment: when-current-commit-tagged: false track-merge-message: true - regex: ^features?[/-](?.+) + regex: ^features?[\/-](?.+) source-branches: - main - release @@ -67,14 +67,13 @@ branches: pre-release-weight: 30000 pull-request: mode: ContinuousDelivery - label: PullRequest + label: PullRequest{Number} increment: Inherit prevent-increment: of-merged-branch: true when-current-commit-tagged: false - label-number-pattern: '[/-](?\d+)' track-merge-message: true - regex: ^(pull|pull\-requests|pr)[/-] + regex: ^(pull-requests|pull|pr)[\/-](?\d*) source-branches: - main - release diff --git a/docs/input/docs/workflows/TrunkBased/preview1.yml b/docs/input/docs/workflows/TrunkBased/preview1.yml index 9bfb28dae6..83d231527f 100644 --- a/docs/input/docs/workflows/TrunkBased/preview1.yml +++ b/docs/input/docs/workflows/TrunkBased/preview1.yml @@ -1,4 +1,4 @@ -assembly-versioning-scheme: MajorMinorPatch +assembly-versioning-scheme: MajorMinorPatch assembly-file-versioning-scheme: MajorMinorPatch tag-prefix: '[vV]?' version-in-branch-pattern: (?[vV]?\d+(\.\d+)?(\.\d+)?).* @@ -37,7 +37,7 @@ branches: prevent-increment: when-current-commit-tagged: false track-merge-message: true - regex: ^features?[/-](?.+) + regex: ^features?[\/-](?.+) source-branches: - main is-source-branch-for: [] @@ -49,7 +49,7 @@ branches: increment: Patch prevent-increment: when-current-commit-tagged: false - regex: ^hotfix(es)?[/-](?.+) + regex: ^hotfix(es)?[\/-](?.+) source-branches: - main is-source-branch-for: [] @@ -58,14 +58,13 @@ branches: pre-release-weight: 30000 pull-request: mode: ContinuousDelivery - label: PullRequest + label: PullRequest{Number} increment: Inherit prevent-increment: of-merged-branch: true when-current-commit-tagged: false - label-number-pattern: '[/-](?\d+)' track-merge-message: true - regex: ^(pull|pull\-requests|pr)[/-] + regex: ^(pull-requests|pull|pr)[\/-](?\d*) source-branches: - main - feature diff --git a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationExtensionsTests.cs b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationExtensionsTests.cs index 4edbae0b4e..97e225f752 100644 --- a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationExtensionsTests.cs +++ b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationExtensionsTests.cs @@ -40,8 +40,8 @@ public void EnsureIsReleaseBranchWithReferenceNameWorksAsExpected(string branchN isReleaseBranch.ShouldBe(expectedIsReleaseBranch); } - [TestCase("feature/sc-1000/Description", "^features?[/-](?.+)", "{BranchName}", "sc-1000-Description")] - [TestCase("feature/sc-1000/Description", "^features?[/-](?sc-\\d+)[-/].+", "{StoryNo}", "sc-1000")] + [TestCase("feature/sc-1000/Description", @"^features?[\/-](?.+)", "{BranchName}", "sc-1000-Description")] + [TestCase("feature/sc-1000/Description", @"^features?[\/-](?sc-\d+)[-\/].+", "{StoryNo}", "sc-1000")] public void EnsureGetBranchSpecificLabelWorksAsExpected(string branchName, string regularExpression, string label, string expectedLabel) { var configuration = GitFlowConfigurationBuilder.New diff --git a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt index e3bd60b3bf..114ecf8e4f 100644 --- a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt +++ b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt @@ -57,7 +57,7 @@ branches: of-merged-branch: true when-current-commit-tagged: false track-merge-target: false - regex: ^releases?[/-](?.+) + regex: ^releases?[\/-](?.+) source-branches: - main - support @@ -73,7 +73,7 @@ branches: prevent-increment: when-current-commit-tagged: false track-merge-message: true - regex: ^features?[/-](?.+) + regex: ^features?[\/-](?.+) source-branches: - develop - main @@ -85,14 +85,13 @@ branches: pre-release-weight: 30000 pull-request: mode: ContinuousDelivery - label: PullRequest + label: PullRequest{Number} increment: Inherit prevent-increment: of-merged-branch: true when-current-commit-tagged: false - label-number-pattern: '[/-](?\d+)' track-merge-message: true - regex: ^(pull|pull\-requests|pr)[/-] + regex: ^(pull-requests|pull|pr)[\/-](?\d*) source-branches: - develop - main @@ -108,7 +107,7 @@ branches: increment: Inherit prevent-increment: when-current-commit-tagged: false - regex: ^hotfix(es)?[/-](?.+) + regex: ^hotfix(es)?[\/-](?.+) source-branches: - main - support @@ -122,7 +121,7 @@ branches: prevent-increment: of-merged-branch: true track-merge-target: false - regex: ^support[/-](?.+) + regex: ^support[\/-](?.+) source-branches: - main is-source-branch-for: [] diff --git a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs index f693649640..ca721c3a18 100644 --- a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs +++ b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs @@ -103,7 +103,7 @@ public void SourceBranchesValidationShouldFailWhenMatchingBranchConfigurationIsM const string text = @" branches: bug: - regex: 'bug[/-]' + regex: 'bug[\/-]' label: bugfix source-branches: [notconfigured]"; using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, text: text); @@ -120,7 +120,7 @@ public void SourceBranchesValidationShouldSucceedForWellKnownBranches(string wel var text = $@" branches: bug: - regex: 'bug[/-]' + regex: 'bug[\/-]' label: bugfix source-branches: [{wellKnownBranchKey}]"; using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, text: text); @@ -136,13 +136,13 @@ public void CanProvideConfigForNewBranch() next-version: 2.0.0 branches: bug: - regex: 'bug[/-]' + regex: 'bug[\/-]' label: bugfix source-branches: []"; using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, text: text); var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath); - configuration.Branches["bug"].RegularExpression.ShouldBe("bug[/-]"); + configuration.Branches["bug"].RegularExpression.ShouldBe(@"bug[\/-]"); configuration.Branches["bug"].Label.ShouldBe("bugfix"); } diff --git a/src/GitVersion.Configuration.Tests/Workflows/approved/GitFlow/v1.yml b/src/GitVersion.Configuration.Tests/Workflows/approved/GitFlow/v1.yml index 3eaec755f8..114ecf8e4f 100644 --- a/src/GitVersion.Configuration.Tests/Workflows/approved/GitFlow/v1.yml +++ b/src/GitVersion.Configuration.Tests/Workflows/approved/GitFlow/v1.yml @@ -1,4 +1,4 @@ -assembly-versioning-scheme: MajorMinorPatch +assembly-versioning-scheme: MajorMinorPatch assembly-file-versioning-scheme: MajorMinorPatch tag-prefix: '[vV]?' version-in-branch-pattern: (?[vV]?\d+(\.\d+)?(\.\d+)?).* @@ -57,7 +57,7 @@ branches: of-merged-branch: true when-current-commit-tagged: false track-merge-target: false - regex: ^releases?[/-](?.+) + regex: ^releases?[\/-](?.+) source-branches: - main - support @@ -73,7 +73,7 @@ branches: prevent-increment: when-current-commit-tagged: false track-merge-message: true - regex: ^features?[/-](?.+) + regex: ^features?[\/-](?.+) source-branches: - develop - main @@ -85,14 +85,13 @@ branches: pre-release-weight: 30000 pull-request: mode: ContinuousDelivery - label: PullRequest + label: PullRequest{Number} increment: Inherit prevent-increment: of-merged-branch: true when-current-commit-tagged: false - label-number-pattern: '[/-](?\d+)' track-merge-message: true - regex: ^(pull|pull\-requests|pr)[/-] + regex: ^(pull-requests|pull|pr)[\/-](?\d*) source-branches: - develop - main @@ -108,7 +107,7 @@ branches: increment: Inherit prevent-increment: when-current-commit-tagged: false - regex: ^hotfix(es)?[/-](?.+) + regex: ^hotfix(es)?[\/-](?.+) source-branches: - main - support @@ -122,7 +121,7 @@ branches: prevent-increment: of-merged-branch: true track-merge-target: false - regex: ^support[/-](?.+) + regex: ^support[\/-](?.+) source-branches: - main is-source-branch-for: [] diff --git a/src/GitVersion.Configuration.Tests/Workflows/approved/GitHubFlow/v1.yml b/src/GitVersion.Configuration.Tests/Workflows/approved/GitHubFlow/v1.yml index 0943cd01fa..bc0452231a 100644 --- a/src/GitVersion.Configuration.Tests/Workflows/approved/GitHubFlow/v1.yml +++ b/src/GitVersion.Configuration.Tests/Workflows/approved/GitHubFlow/v1.yml @@ -1,4 +1,4 @@ -assembly-versioning-scheme: MajorMinorPatch +assembly-versioning-scheme: MajorMinorPatch assembly-file-versioning-scheme: MajorMinorPatch tag-prefix: '[vV]?' version-in-branch-pattern: (?[vV]?\d+(\.\d+)?(\.\d+)?).* @@ -43,7 +43,7 @@ branches: when-current-commit-tagged: false track-merge-target: false track-merge-message: true - regex: ^releases?[/-](?.+) + regex: ^releases?[\/-](?.+) source-branches: - main is-source-branch-for: [] @@ -58,7 +58,7 @@ branches: prevent-increment: when-current-commit-tagged: false track-merge-message: true - regex: ^features?[/-](?.+) + regex: ^features?[\/-](?.+) source-branches: - main - release @@ -67,14 +67,13 @@ branches: pre-release-weight: 30000 pull-request: mode: ContinuousDelivery - label: PullRequest + label: PullRequest{Number} increment: Inherit prevent-increment: of-merged-branch: true when-current-commit-tagged: false - label-number-pattern: '[/-](?\d+)' track-merge-message: true - regex: ^(pull|pull\-requests|pr)[/-] + regex: ^(pull-requests|pull|pr)[\/-](?\d*) source-branches: - main - release diff --git a/src/GitVersion.Configuration.Tests/Workflows/approved/TrunkBased/preview1.yml b/src/GitVersion.Configuration.Tests/Workflows/approved/TrunkBased/preview1.yml index 9bfb28dae6..83d231527f 100644 --- a/src/GitVersion.Configuration.Tests/Workflows/approved/TrunkBased/preview1.yml +++ b/src/GitVersion.Configuration.Tests/Workflows/approved/TrunkBased/preview1.yml @@ -1,4 +1,4 @@ -assembly-versioning-scheme: MajorMinorPatch +assembly-versioning-scheme: MajorMinorPatch assembly-file-versioning-scheme: MajorMinorPatch tag-prefix: '[vV]?' version-in-branch-pattern: (?[vV]?\d+(\.\d+)?(\.\d+)?).* @@ -37,7 +37,7 @@ branches: prevent-increment: when-current-commit-tagged: false track-merge-message: true - regex: ^features?[/-](?.+) + regex: ^features?[\/-](?.+) source-branches: - main is-source-branch-for: [] @@ -49,7 +49,7 @@ branches: increment: Patch prevent-increment: when-current-commit-tagged: false - regex: ^hotfix(es)?[/-](?.+) + regex: ^hotfix(es)?[\/-](?.+) source-branches: - main is-source-branch-for: [] @@ -58,14 +58,13 @@ branches: pre-release-weight: 30000 pull-request: mode: ContinuousDelivery - label: PullRequest + label: PullRequest{Number} increment: Inherit prevent-increment: of-merged-branch: true when-current-commit-tagged: false - label-number-pattern: '[/-](?\d+)' track-merge-message: true - regex: ^(pull|pull\-requests|pr)[/-] + regex: ^(pull-requests|pull|pr)[\/-](?\d*) source-branches: - main - feature diff --git a/src/GitVersion.Configuration/BranchConfiguration.cs b/src/GitVersion.Configuration/BranchConfiguration.cs index 5f8cbd07bf..06317c999a 100644 --- a/src/GitVersion.Configuration/BranchConfiguration.cs +++ b/src/GitVersion.Configuration/BranchConfiguration.cs @@ -1,5 +1,4 @@ using GitVersion.Configuration.Attributes; -using GitVersion.Core; using GitVersion.Extensions; using GitVersion.VersionCalculation; @@ -26,12 +25,6 @@ internal record BranchConfiguration : IBranchConfiguration [JsonPropertyDescription("The prevent increment configuration section.")] public PreventIncrementConfiguration PreventIncrement { get; internal set; } = new(); - [JsonPropertyName("label-number-pattern")] - [JsonPropertyDescription($"The regular expression pattern to use to extract the number from the branch name. Defaults to '{RegexPatterns.Configuration.DefaultLabelNumberPattern}'.")] - [JsonPropertyDefault(RegexPatterns.Configuration.DefaultLabelNumberPattern)] - [JsonPropertyFormat(Format.Regex)] - public string? LabelNumberPattern { get; internal set; } - [JsonPropertyName("track-merge-target")] [JsonPropertyDescription("Strategy which will look for tagged merge commits directly off the current branch.")] public bool? TrackMergeTarget { get; internal set; } @@ -97,7 +90,6 @@ public virtual IBranchConfiguration Inherit(IBranchConfiguration configuration) WhenBranchMerged = PreventIncrement.WhenBranchMerged ?? configuration.PreventIncrement.WhenBranchMerged, WhenCurrentCommitTagged = PreventIncrement.WhenCurrentCommitTagged ?? configuration.PreventIncrement.WhenCurrentCommitTagged }, - LabelNumberPattern = LabelNumberPattern ?? configuration.LabelNumberPattern, TrackMergeTarget = TrackMergeTarget ?? configuration.TrackMergeTarget, TrackMergeMessage = TrackMergeMessage ?? configuration.TrackMergeMessage, CommitMessageIncrementing = CommitMessageIncrementing ?? configuration.CommitMessageIncrementing, @@ -124,7 +116,6 @@ public virtual IBranchConfiguration Inherit(EffectiveConfiguration configuration WhenBranchMerged = PreventIncrement.WhenBranchMerged ?? configuration.PreventIncrementWhenBranchMerged, WhenCurrentCommitTagged = PreventIncrement.WhenCurrentCommitTagged ?? configuration.PreventIncrementWhenCurrentCommitTagged }, - LabelNumberPattern = LabelNumberPattern ?? configuration.LabelNumberPattern, TrackMergeTarget = TrackMergeTarget ?? configuration.TrackMergeTarget, TrackMergeMessage = TrackMergeMessage ?? configuration.TrackMergeMessage, CommitMessageIncrementing = CommitMessageIncrementing ?? configuration.CommitMessageIncrementing, diff --git a/src/GitVersion.Configuration/Builders/BranchConfigurationBuilder.cs b/src/GitVersion.Configuration/Builders/BranchConfigurationBuilder.cs index db36d2b006..18c40f8b81 100644 --- a/src/GitVersion.Configuration/Builders/BranchConfigurationBuilder.cs +++ b/src/GitVersion.Configuration/Builders/BranchConfigurationBuilder.cs @@ -12,7 +12,6 @@ internal class BranchConfigurationBuilder private bool? preventIncrementOfMergedBranch; private bool? preventIncrementWhenBranchMerged; private bool? preventIncrementWhenCurrentCommitTagged; - private string? labelNumberPattern; private bool? trackMergeTarget; private bool? trackMergeMessage; private CommitMessageIncrementMode? commitMessageIncrementing; @@ -64,12 +63,6 @@ public virtual BranchConfigurationBuilder WithPreventIncrementWhenCurrentCommitT return this; } - public virtual BranchConfigurationBuilder WithLabelNumberPattern(string? value) - { - this.labelNumberPattern = value; - return this; - } - public virtual BranchConfigurationBuilder WithTrackMergeTarget(bool? value) { this.trackMergeTarget = value; @@ -150,7 +143,6 @@ public virtual BranchConfigurationBuilder WithConfiguration(IBranchConfiguration WithPreventIncrementOfMergedBranch(value.PreventIncrement.OfMergedBranch); WithPreventIncrementWhenBranchMerged(value.PreventIncrement.WhenBranchMerged); WithPreventIncrementWhenCurrentCommitTagged(value.PreventIncrement.WhenCurrentCommitTagged); - WithLabelNumberPattern(value.LabelNumberPattern); WithTrackMergeTarget(value.TrackMergeTarget); WithTrackMergeMessage(value.TrackMergeMessage); WithCommitMessageIncrementing(value.CommitMessageIncrementing); @@ -176,7 +168,6 @@ public virtual BranchConfigurationBuilder WithConfiguration(IBranchConfiguration CommitMessageIncrementing = commitMessageIncrementing, IsMainBranch = isMainBranch, IsReleaseBranch = isReleaseBranch, - LabelNumberPattern = labelNumberPattern, PreventIncrement = new PreventIncrementConfiguration { OfMergedBranch = preventIncrementOfMergedBranch, diff --git a/src/GitVersion.Configuration/Builders/ConfigurationBuilderBase.cs b/src/GitVersion.Configuration/Builders/ConfigurationBuilderBase.cs index 80d6437579..3a7bfa3b3c 100644 --- a/src/GitVersion.Configuration/Builders/ConfigurationBuilderBase.cs +++ b/src/GitVersion.Configuration/Builders/ConfigurationBuilderBase.cs @@ -35,7 +35,6 @@ internal abstract class ConfigurationBuilderBase : IConfi private bool? preventIncrementOfMergedBranch; private bool? preventIncrementWhenBranchMerged; private bool? preventIncrementWhenCurrentCommitTagged; - private string? labelNumberPattern; private bool? trackMergeTarget; private bool? trackMergeMessage; private CommitMessageIncrementMode? commitMessageIncrementing; @@ -278,12 +277,6 @@ public virtual TConfigurationBuilder WithPreventIncrementWhenCurrentCommitTagged return (TConfigurationBuilder)this; } - public virtual TConfigurationBuilder WithLabelNumberPattern(string? value) - { - this.labelNumberPattern = value; - return (TConfigurationBuilder)this; - } - public virtual TConfigurationBuilder WithTrackMergeTarget(bool? value) { this.trackMergeTarget = value; @@ -363,7 +356,6 @@ public virtual TConfigurationBuilder WithConfiguration(IGitVersionConfiguration WithPreventIncrementOfMergedBranch(value.PreventIncrement.OfMergedBranch); WithPreventIncrementWhenBranchMerged(value.PreventIncrement.WhenBranchMerged); WithPreventIncrementWhenCurrentCommitTagged(value.PreventIncrement.WhenCurrentCommitTagged); - WithLabelNumberPattern(value.LabelNumberPattern); WithTrackMergeTarget(value.TrackMergeTarget); WithTrackMergeMessage(value.TrackMergeMessage); WithCommitMessageIncrementing(value.CommitMessageIncrementing); @@ -423,7 +415,6 @@ public virtual IGitVersionConfiguration Build() CommitMessageIncrementing = this.commitMessageIncrementing, IsMainBranch = this.isMainBranch, IsReleaseBranch = this.isReleaseBranch, - LabelNumberPattern = this.labelNumberPattern, PreventIncrement = new PreventIncrementConfiguration { OfMergedBranch = this.preventIncrementOfMergedBranch, diff --git a/src/GitVersion.Configuration/Builders/GitFlowConfigurationBuilder.cs b/src/GitVersion.Configuration/Builders/GitFlowConfigurationBuilder.cs index 0122d54b8d..09fe1afb72 100644 --- a/src/GitVersion.Configuration/Builders/GitFlowConfigurationBuilder.cs +++ b/src/GitVersion.Configuration/Builders/GitFlowConfigurationBuilder.cs @@ -139,13 +139,12 @@ private GitFlowConfigurationBuilder() this.SupportBranch.Name, this.HotfixBranch.Name ], - Label = "PullRequest", + Label = $"PullRequest{ConfigurationConstants.PullRequestNumberPlaceholder}", PreventIncrement = new PreventIncrementConfiguration { OfMergedBranch = true, WhenCurrentCommitTagged = false }, - LabelNumberPattern = RegexPatterns.Configuration.DefaultLabelNumberPattern, TrackMergeMessage = true, PreReleaseWeight = 30000 }); diff --git a/src/GitVersion.Configuration/Builders/GitHubFlowConfigurationBuilder.cs b/src/GitVersion.Configuration/Builders/GitHubFlowConfigurationBuilder.cs index b31db0c152..b470db4174 100644 --- a/src/GitVersion.Configuration/Builders/GitHubFlowConfigurationBuilder.cs +++ b/src/GitVersion.Configuration/Builders/GitHubFlowConfigurationBuilder.cs @@ -107,14 +107,13 @@ private GitHubFlowConfigurationBuilder() WithBranch(PullRequestBranch.Name).WithConfiguration(new BranchConfiguration { DeploymentMode = DeploymentMode.ContinuousDelivery, - Label = "PullRequest", + Label = $"PullRequest{ConfigurationConstants.PullRequestNumberPlaceholder}", Increment = IncrementStrategy.Inherit, PreventIncrement = new PreventIncrementConfiguration { OfMergedBranch = true, WhenCurrentCommitTagged = false }, - LabelNumberPattern = RegexPatterns.Configuration.DefaultLabelNumberPattern, RegularExpression = PullRequestBranch.RegexPattern, SourceBranches = [ diff --git a/src/GitVersion.Configuration/Builders/TrunkBasedConfigurationBuilder.cs b/src/GitVersion.Configuration/Builders/TrunkBasedConfigurationBuilder.cs index 74ccd921e6..b672ae3824 100644 --- a/src/GitVersion.Configuration/Builders/TrunkBasedConfigurationBuilder.cs +++ b/src/GitVersion.Configuration/Builders/TrunkBasedConfigurationBuilder.cs @@ -105,14 +105,13 @@ private TrunkBasedConfigurationBuilder() WithBranch(PullRequestBranch.Name).WithConfiguration(new BranchConfiguration { DeploymentMode = DeploymentMode.ContinuousDelivery, - Label = "PullRequest", + Label = $"PullRequest{ConfigurationConstants.PullRequestNumberPlaceholder}", Increment = IncrementStrategy.Inherit, PreventIncrement = new PreventIncrementConfiguration { OfMergedBranch = true, WhenCurrentCommitTagged = false }, - LabelNumberPattern = RegexPatterns.Configuration.DefaultLabelNumberPattern, RegularExpression = PullRequestBranch.RegexPattern, SourceBranches = [ diff --git a/src/GitVersion.Core.Tests/IntegrationTests/DevelopScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/DevelopScenarios.cs index 6d06396eb4..7b3908a2dc 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/DevelopScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/DevelopScenarios.cs @@ -395,7 +395,7 @@ public void WhenPreventIncrementOfMergedBranchVersionIsSetToFalseForDevelopCommi ) .WithBranch("hotfix", builder => builder .WithPreventIncrementOfMergedBranch(true) - .WithRegularExpression("^(origin/)?hotfix[/-]") + .WithRegularExpression(@"^(origin/)?hotfix[\/-]") ) .Build(); diff --git a/src/GitVersion.Core.Tests/IntegrationTests/FeatureBranchScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/FeatureBranchScenarios.cs index c0da0e2918..05cd9a46cb 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/FeatureBranchScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/FeatureBranchScenarios.cs @@ -182,10 +182,13 @@ public void CanUseBranchNameOffAReleaseBranch() fixture.AssertFullSemver("0.3.0-PROJ-1.1+4", configuration); } - [TestCase("alpha", "JIRA-123", "^features?[/-](?.+)", "alpha")] - [TestCase($"alpha.{ConfigurationConstants.BranchNamePlaceholder}", "JIRA-123", "^features?[/-](?.+)", "alpha.JIRA-123")] - [TestCase("{BranchName}-of-task-number-{TaskNumber}", "4711_this-is-a-feature", "^features?[/-](?\\d+)_(?.+)", "this-is-a-feature-of-task-number-4711")] - [TestCase("{BranchName}", "4711_this-is-a-feature", "^features?[/-](?.+)", "4711-this-is-a-feature")] + [TestCase("alpha", "JIRA-123", @"^features?[\/-](?.+)", "alpha")] + [TestCase($"alpha.{ConfigurationConstants.BranchNamePlaceholder}", "JIRA-123", @"^features?[\/-](?.+)", "alpha.JIRA-123")] + [TestCase("{BranchName}-of-task-number-{TaskNumber}", "4711_this-is-a-feature", @"^features?[\/-](?\d+)_(?.+)", "this-is-a-feature-of-task-number-4711")] + [TestCase("{BranchName}", "4711_this-is-a-feature", @"^features?[\/-](?.+)", "4711-this-is-a-feature")] + [TestCase("{BranchName}.xyz", "x_y.7.z", @"^features?[\/-](?.+)", "x-y-7-z.xyz")] + [TestCase("{BranchName}", "yourname/dash-separated-words", @".*\/(?[^\/]+)$", "dash-separated-words")] + [TestCase("{X}.{Z}-{Y}.{X}-{Z}.{X}", "xxxyyz", @"^features?[\/-](?x+)(?y+)(?z+)$", "xxx.z-yy.xxx-z.xxx")] public void ShouldUseConfiguredLabel(string label, string featureName, string regularExpression, string preReleaseLabelName) { var configuration = GitFlowConfigurationBuilder.New diff --git a/src/GitVersion.Core.Tests/IntegrationTests/MainlineDevelopmentScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/MainlineDevelopmentScenarios.cs index 8ba8ab429f..dfd3574819 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/MainlineDevelopmentScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/MainlineDevelopmentScenarios.cs @@ -26,7 +26,7 @@ private static GitFlowConfigurationBuilder GetConfigurationBuilder() => GitFlowC .WithBranch("hotfix", builder => builder .WithIsMainBranch(false).WithIncrement(IncrementStrategy.Patch) .WithDeploymentMode(DeploymentMode.ContinuousDelivery) - .WithRegularExpression("^hotfix[/-](?.+)").WithLabel("{BranchName}") + .WithRegularExpression(@"^hotfix[\/-](?.+)").WithLabel("{BranchName}") .WithSourceBranches("main") ) .WithBranch("pull-request", builder => builder diff --git a/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs index 0b90e579f5..4a4b295da0 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs @@ -165,7 +165,7 @@ public void UsesFirstBranchConfigWhenMultipleMatch(string branchName, IncrementS .WithBranch("release", builder => builder .WithIncrement(IncrementStrategy.Patch) .WithLabel("not-latest") - .WithRegularExpression("releases?[/-]") + .WithRegularExpression(@"releases?[\/-]") ) .Build(); diff --git a/src/GitVersion.Core.Tests/VersionCalculation/NextVersionCalculatorTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/NextVersionCalculatorTests.cs index af8dd75d35..eb6340389b 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/NextVersionCalculatorTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/NextVersionCalculatorTests.cs @@ -68,7 +68,7 @@ public void PreReleaseLabelCanUseBranchName() var configuration = GitFlowConfigurationBuilder.New .WithNextVersion("1.0.0") .WithBranch("custom", builder => builder - .WithRegularExpression("^custom?[/-](?.+)") + .WithRegularExpression(@"^custom?[\/-](?.+)") .WithLabel(ConfigurationConstants.BranchNamePlaceholder) .WithSourceBranches() ) @@ -216,7 +216,7 @@ public void PreReleaseLabelCanUseBranchNameVariable() var configuration = GitFlowConfigurationBuilder.New .WithNextVersion("1.0.0") .WithBranch("custom", builder => builder - .WithRegularExpression("^custom?[/-](?.+)") + .WithRegularExpression(@"^custom?[\/-](?.+)") .WithLabel($"alpha.{ConfigurationConstants.BranchNamePlaceholder}") .WithDeploymentMode(DeploymentMode.ManualDeployment) .WithSourceBranches() diff --git a/src/GitVersion.Core/Configuration/ConfigurationConstants.cs b/src/GitVersion.Core/Configuration/ConfigurationConstants.cs index f8774c93ba..017990354d 100644 --- a/src/GitVersion.Core/Configuration/ConfigurationConstants.cs +++ b/src/GitVersion.Core/Configuration/ConfigurationConstants.cs @@ -24,6 +24,7 @@ internal static class ConfigurationConstants public const string DefaultAssemblyInformationalFormat = "{InformationalVersion}"; public const string DefaultCommitDateFormat = "yyyy-MM-dd"; public const string BranchNamePlaceholder = "{BranchName}"; + public const string PullRequestNumberPlaceholder = "{Number}"; public const bool DefaultUpdateBuildNumber = true; public const int DefaultTagPreReleaseWeight = 60000; diff --git a/src/GitVersion.Core/Configuration/EffectiveConfiguration.cs b/src/GitVersion.Core/Configuration/EffectiveConfiguration.cs index c7514c34cc..bd16f1f2ba 100644 --- a/src/GitVersion.Core/Configuration/EffectiveConfiguration.cs +++ b/src/GitVersion.Core/Configuration/EffectiveConfiguration.cs @@ -60,7 +60,6 @@ public EffectiveConfiguration( PreventIncrementOfMergedBranch = branchConfiguration.PreventIncrement.OfMergedBranch ?? false; PreventIncrementWhenBranchMerged = branchConfiguration.PreventIncrement.WhenBranchMerged ?? false; PreventIncrementWhenCurrentCommitTagged = branchConfiguration.PreventIncrement.WhenCurrentCommitTagged ?? true; - LabelNumberPattern = branchConfiguration.LabelNumberPattern; TrackMergeTarget = branchConfiguration.TrackMergeTarget ?? false; TrackMergeMessage = branchConfiguration.TrackMergeMessage ?? true; MajorVersionBumpMessage = configuration.MajorVersionBumpMessage; @@ -109,8 +108,6 @@ public EffectiveConfiguration( public bool PreventIncrementWhenCurrentCommitTagged { get; } - public string? LabelNumberPattern { get; } - public bool TrackMergeTarget { get; } public bool TrackMergeMessage { get; } diff --git a/src/GitVersion.Core/Configuration/IBranchConfiguration.cs b/src/GitVersion.Core/Configuration/IBranchConfiguration.cs index cf81ef3dcc..209168bb9d 100644 --- a/src/GitVersion.Core/Configuration/IBranchConfiguration.cs +++ b/src/GitVersion.Core/Configuration/IBranchConfiguration.cs @@ -14,8 +14,6 @@ public interface IBranchConfiguration IPreventIncrementConfiguration PreventIncrement { get; } - string? LabelNumberPattern { get; } - bool? TrackMergeTarget { get; } bool? TrackMergeMessage { get; } diff --git a/src/GitVersion.Core/Core/RegexPatterns.cs b/src/GitVersion.Core/Core/RegexPatterns.cs index 23f7b82d0a..4e13455b95 100644 --- a/src/GitVersion.Core/Core/RegexPatterns.cs +++ b/src/GitVersion.Core/Core/RegexPatterns.cs @@ -18,7 +18,6 @@ static RegexPatterns() Cache.TryAdd(Configuration.DefaultTagPrefixRegex.ToString(), Configuration.DefaultTagPrefixRegex); Cache.TryAdd(Configuration.DefaultVersionInBranchRegex.ToString(), Configuration.DefaultVersionInBranchRegex); - Cache.TryAdd(Configuration.DefaultLabelNumberRegex.ToString(), Configuration.DefaultLabelNumberRegex); Cache.TryAdd(Configuration.MainBranchRegex.ToString(), Configuration.MainBranchRegex); Cache.TryAdd(Configuration.DevelopBranchRegex.ToString(), Configuration.DevelopBranchRegex); Cache.TryAdd(Configuration.ReleaseBranchRegex.ToString(), Configuration.ReleaseBranchRegex); @@ -83,9 +82,6 @@ internal static class Configuration [StringSyntax(StringSyntaxAttribute.Regex)] public const string DefaultVersionInBranchPattern = @"(?[vV]?\d+(\.\d+)?(\.\d+)?).*"; - [StringSyntax(StringSyntaxAttribute.Regex)] - public const string DefaultLabelNumberPattern = @"[/-](?\d+)"; - [StringSyntax(StringSyntaxAttribute.Regex)] public const string MainBranchRegexPattern = "^master$|^main$"; @@ -93,26 +89,25 @@ internal static class Configuration public const string DevelopBranchRegexPattern = "^dev(elop)?(ment)?$"; [StringSyntax(StringSyntaxAttribute.Regex)] - public const string ReleaseBranchRegexPattern = "^releases?[/-](?.+)"; + public const string ReleaseBranchRegexPattern = @"^releases?[\/-](?.+)"; [StringSyntax(StringSyntaxAttribute.Regex)] - public const string FeatureBranchRegexPattern = "^features?[/-](?.+)"; + public const string FeatureBranchRegexPattern = @"^features?[\/-](?.+)"; [StringSyntax(StringSyntaxAttribute.Regex)] - public const string PullRequestBranchRegexPattern = @"^(pull|pull\-requests|pr)[/-]"; + public const string PullRequestBranchRegexPattern = @"^(pull-requests|pull|pr)[\/-](?\d*)"; [StringSyntax(StringSyntaxAttribute.Regex)] - public const string HotfixBranchRegexPattern = "^hotfix(es)?[/-](?.+)"; + public const string HotfixBranchRegexPattern = @"^hotfix(es)?[\/-](?.+)"; [StringSyntax(StringSyntaxAttribute.Regex)] - public const string SupportBranchRegexPattern = "^support[/-](?.+)"; + public const string SupportBranchRegexPattern = @"^support[\/-](?.+)"; [StringSyntax(StringSyntaxAttribute.Regex)] public const string UnknownBranchRegexPattern = "(?.+)"; public static Regex DefaultTagPrefixRegex { get; } = new(DefaultTagPrefixPattern, Options); public static Regex DefaultVersionInBranchRegex { get; } = new(DefaultVersionInBranchPattern, Options); - public static Regex DefaultLabelNumberRegex { get; } = new(DefaultLabelNumberPattern, Options); public static Regex MainBranchRegex { get; } = new(MainBranchRegexPattern, Options); public static Regex DevelopBranchRegex { get; } = new(DevelopBranchRegexPattern, Options); public static Regex ReleaseBranchRegex { get; } = new(ReleaseBranchRegexPattern, Options); diff --git a/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs b/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs index b10b2b9ae8..a1e0b4bf7a 100644 --- a/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs +++ b/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs @@ -90,39 +90,32 @@ public static bool IsReleaseBranch(this IGitVersionConfiguration configuration, } var effectiveBranchName = branchNameOverride ?? branchName; - if (!configuration.RegularExpression.IsNullOrWhiteSpace() && !effectiveBranchName.IsNullOrEmpty()) { - effectiveBranchName = effectiveBranchName.RegexReplace("[^a-zA-Z0-9-_]", "-"); var regex = RegexPatterns.Cache.GetOrAdd(configuration.RegularExpression); var match = regex.Match(effectiveBranchName); if (match.Success) { - // ReSharper disable once LoopCanBeConvertedToQuery foreach (var groupName in regex.GetGroupNames()) { - label = label.Replace("{" + groupName + "}", match.Groups[groupName].Value); + var groupValue = match.Groups[groupName].Value; + Lazy escapedGroupValueLazy = new(() => EscapeInvalidCharaters(groupValue)); + var placeholder = $"{{{groupName}}}"; + int index, startIndex = 0; + while ((index = label.IndexOf(placeholder, startIndex, StringComparison.InvariantCulture)) >= 0) + { + var escapedGroupValue = escapedGroupValueLazy.Value; + label = label.Remove(index, placeholder.Length).Insert(index, escapedGroupValue); + startIndex = index + escapedGroupValue.Length; + } } - - label = label.Replace('_', '-'); - } - } - - // Evaluate tag number pattern and append to prerelease tag, preserving build metadata - if (!configuration.LabelNumberPattern.IsNullOrEmpty() && !effectiveBranchName.IsNullOrEmpty()) - { - var regex = RegexPatterns.Cache.GetOrAdd(configuration.LabelNumberPattern); - var match = regex.Match(effectiveBranchName); - var numberGroup = match.Groups["number"]; - if (numberGroup.Success) - { - label += numberGroup.Value; } } - return label; } + private static string EscapeInvalidCharaters(string groupValue) => groupValue.RegexReplace(@"[^a-zA-Z0-9-]", "-"); + public static (string GitDirectory, string WorkingTreeDirectory)? FindGitDir(this IFileSystem fileSystem, string path) { string? startingDir = path; diff --git a/src/GitVersion.Core/PublicAPI.Shipped.txt b/src/GitVersion.Core/PublicAPI.Shipped.txt index d3f010c444..e8e7ed46a5 100644 --- a/src/GitVersion.Core/PublicAPI.Shipped.txt +++ b/src/GitVersion.Core/PublicAPI.Shipped.txt @@ -71,7 +71,6 @@ GitVersion.Configuration.EffectiveConfiguration.Increment.get -> GitVersion.Incr GitVersion.Configuration.EffectiveConfiguration.IsMainBranch.get -> bool GitVersion.Configuration.EffectiveConfiguration.IsReleaseBranch.get -> bool GitVersion.Configuration.EffectiveConfiguration.Label.get -> string? -GitVersion.Configuration.EffectiveConfiguration.LabelNumberPattern.get -> string? GitVersion.Configuration.EffectiveConfiguration.MajorVersionBumpMessage.get -> string? GitVersion.Configuration.EffectiveConfiguration.MinorVersionBumpMessage.get -> string? GitVersion.Configuration.EffectiveConfiguration.NextVersion.get -> string? @@ -103,7 +102,6 @@ GitVersion.Configuration.IBranchConfiguration.IsMatch(string! branchName) -> boo GitVersion.Configuration.IBranchConfiguration.IsReleaseBranch.get -> bool? GitVersion.Configuration.IBranchConfiguration.IsSourceBranchFor.get -> System.Collections.Generic.IReadOnlyCollection! GitVersion.Configuration.IBranchConfiguration.Label.get -> string? -GitVersion.Configuration.IBranchConfiguration.LabelNumberPattern.get -> string? GitVersion.Configuration.IBranchConfiguration.PreReleaseWeight.get -> int? GitVersion.Configuration.IBranchConfiguration.PreventIncrement.get -> GitVersion.Configuration.IPreventIncrementConfiguration! GitVersion.Configuration.IBranchConfiguration.RegularExpression.get -> string? From dbed90b64d3a3f3f8d5f545ff756c31b0a7950bc Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Sat, 18 Jan 2025 11:16:45 +0000 Subject: [PATCH 039/107] Docs changes --- docs/input/docs/reference/configuration.md | 45 +++++++++++++++++----- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/docs/input/docs/reference/configuration.md b/docs/input/docs/reference/configuration.md index 9dda482e2e..78166094e2 100644 --- a/docs/input/docs/reference/configuration.md +++ b/docs/input/docs/reference/configuration.md @@ -208,7 +208,7 @@ tracks-release-branches: false is-release-branch: false is-main-branch: false ``` -snippet source | anchor +snippet source | anchor The supported built-in configuration for the `GitHubFlow` workflow (`workflow: GitHubFlow/v1`) looks like: @@ -332,7 +332,7 @@ tracks-release-branches: false is-release-branch: false is-main-branch: false ``` -snippet source | anchor +snippet source | anchor The preview built-in configuration (experimental usage only) for the `TrunkBased` workflow (`workflow: TrunkBased/preview1`) looks like: @@ -441,7 +441,7 @@ tracks-release-branches: false is-release-branch: false is-main-branch: false ``` -snippet source | anchor +snippet source | anchor The details of the available options are as follows: @@ -687,7 +687,7 @@ branches: is-main-branch: false pre-release-weight: 0 release: - regex: ^releases?[\/-] + regex: ^releases?[/-] mode: ContinuousDelivery label: beta increment: None @@ -699,28 +699,29 @@ branches: is-main-branch: false pre-release-weight: 30000 feature: - regex: ^features?[\/-] + regex: ^features?[/-] mode: ContinuousDelivery label: '{BranchName}' increment: Inherit source-branches: [ 'develop', 'main', 'release', 'feature', 'support', 'hotfix' ] pre-release-weight: 30000 pull-request: - regex: ^(pull-requests|pull|pr)[\/-] + regex: ^(pull|pull\-requests|pr)[/-] mode: ContinuousDelivery label: PullRequest increment: Inherit + label-number-pattern: '[/-](?\d+)[-/]' source-branches: [ 'develop', 'main', 'release', 'feature', 'support', 'hotfix' ] pre-release-weight: 30000 hotfix: - regex: ^hotfix(es)?[\/-] + regex: ^hotfix(es)?[/-] mode: ContinuousDelivery label: beta increment: Inherit source-branches: [ 'release', 'main', 'support', 'hotfix' ] pre-release-weight: 30000 support: - regex: ^support[\/-] + regex: ^support[/-] mode: ContinuousDelivery label: '' increment: Patch @@ -836,9 +837,9 @@ The pre-release label to use for this branch. Use the value `{BranchName}` as a insert the value of the named group `BranchName` from the [regular expression](#regex). For example: branch `feature/foo` would become a pre-release label -of `alpha.foo` with `label: 'alpha.{BranchName}'` and `regex: '^features?[\/-](?.+)'`. +of `alpha.foo` with `label: 'alpha.{BranchName}'` and `regex: '^features?[/-](?.+)'`. -Another example: branch `features/sc-12345/some-description` would become a pre-release label of `sc-12345` with `label: '{StoryNo}'` and `regex: '^features?[\/-](?sc-\d+)[-/].+'`. +Another example: branch `features/sc-12345/some-description` would become a pre-release label of `sc-12345` with `label: '{StoryNo}'` and `regex: '^features?[/-](?sc-\d+)[-/].+'`. **Note:** To clear a default use an empty string: `label: ''` @@ -867,6 +868,30 @@ The increment of the merged branch will be ignored when this branch related prop This branch related property controls the behvior whether to use the tagged (value set to true) or the incremented (value set to false) semantic version. Defaults to true. +### label-number-pattern + +Pull requests require us to extract the pre-release number out of the branch +name so `refs/pulls/534/merge` builds as `PullRequest.534`. This is a regex with +a named capture group called `number`. + +If the branch `mode` is set to `ContinuousDeployment`, then the extracted +`number` is appended to the name of the pre-release label and the number portion +is the number of commits since the last label. This enables consecutive commits to +the pull request branch to generate unique full semantic version numbers when +the branch is configured to use ContinuousDeployment mode. + +**Example usage:** + +```yaml +branches: + pull-request: + mode: ContinuousDeployment + label: PullRequest + increment: Inherit + track-merge-target: true + label-number-pattern: '[/-](?\d+)[-/]' +``` + ### track-merge-target Strategy which will look for tagged merge commits directly off the current From eded73b765f2d2284f939682a19c8a1bb1717c07 Mon Sep 17 00:00:00 2001 From: Hardy Hobeck Date: Tue, 28 Jan 2025 10:22:33 +0100 Subject: [PATCH 040/107] Update documentation --- docs/input/docs/reference/configuration.md | 136 ++++++++++-------- .../mdsource/configuration.source.md | 130 +++++++++-------- 2 files changed, 143 insertions(+), 123 deletions(-) diff --git a/docs/input/docs/reference/configuration.md b/docs/input/docs/reference/configuration.md index 78166094e2..4cf1792336 100644 --- a/docs/input/docs/reference/configuration.md +++ b/docs/input/docs/reference/configuration.md @@ -208,7 +208,7 @@ tracks-release-branches: false is-release-branch: false is-main-branch: false ``` -snippet source | anchor +snippet source | anchor The supported built-in configuration for the `GitHubFlow` workflow (`workflow: GitHubFlow/v1`) looks like: @@ -332,7 +332,7 @@ tracks-release-branches: false is-release-branch: false is-main-branch: false ``` -snippet source | anchor +snippet source | anchor The preview built-in configuration (experimental usage only) for the `TrunkBased` workflow (`workflow: TrunkBased/preview1`) looks like: @@ -441,7 +441,7 @@ tracks-release-branches: false is-release-branch: false is-main-branch: false ``` -snippet source | anchor +snippet source | anchor The details of the available options are as follows: @@ -661,77 +661,84 @@ If you have branch specific configuration upgrading to v4 will force you to upgrade. ```yaml +workflow: 'GitHubFlow/v1' branches: main: - regex: ^master$|^main$ - mode: ContinuousDelivery label: '' increment: Patch - prevent-increment-of-merged-branch-version: true + prevent-increment: + of-merged-branch: true track-merge-target: false - source-branches: [ 'develop', 'release' ] + track-merge-message: true + regex: ^master$|^main$ + source-branches: [] + is-source-branch-for: [] tracks-release-branches: false is-release-branch: false is-main-branch: true pre-release-weight: 55000 - develop: - regex: ^dev(elop)?(ment)?$ - mode: ContinuousDeployment - label: alpha - increment: Minor - prevent-increment-of-merged-branch-version: false - track-merge-target: true - source-branches: [] - tracks-release-branches: true - is-release-branch: false - is-main-branch: false - pre-release-weight: 0 release: - regex: ^releases?[/-] - mode: ContinuousDelivery + mode: ManualDeployment label: beta - increment: None - prevent-increment-of-merged-branch-version: true + increment: Patch + prevent-increment: + of-merged-branch: true + when-branch-merged: false + when-current-commit-tagged: false track-merge-target: false - source-branches: [ 'develop', 'main', 'support', 'release' ] + track-merge-message: true + regex: ^releases?[\/-](?.+) + source-branches: + - main + is-source-branch-for: [] tracks-release-branches: false is-release-branch: true is-main-branch: false pre-release-weight: 30000 feature: - regex: ^features?[/-] - mode: ContinuousDelivery + mode: ManualDeployment label: '{BranchName}' increment: Inherit - source-branches: [ 'develop', 'main', 'release', 'feature', 'support', 'hotfix' ] + prevent-increment: + when-current-commit-tagged: false + track-merge-message: true + regex: ^features?[\/-](?.+) + source-branches: + - main + - release + is-source-branch-for: [] + is-main-branch: false pre-release-weight: 30000 pull-request: - regex: ^(pull|pull\-requests|pr)[/-] mode: ContinuousDelivery - label: PullRequest + label: PullRequest{Number} increment: Inherit - label-number-pattern: '[/-](?\d+)[-/]' - source-branches: [ 'develop', 'main', 'release', 'feature', 'support', 'hotfix' ] + prevent-increment: + of-merged-branch: true + when-current-commit-tagged: false + track-merge-message: true + regex: ^(pull-requests|pull|pr)[\/-](?\d*) + source-branches: + - main + - release + - feature + is-source-branch-for: [] pre-release-weight: 30000 - hotfix: - regex: ^hotfix(es)?[/-] - mode: ContinuousDelivery - label: beta + unknown: + mode: ManualDeployment + label: '{BranchName}' increment: Inherit - source-branches: [ 'release', 'main', 'support', 'hotfix' ] - pre-release-weight: 30000 - support: - regex: ^support[/-] - mode: ContinuousDelivery - label: '' - increment: Patch - prevent-increment-of-merged-branch-version: true - track-merge-target: false - source-branches: [ 'main' ] - tracks-release-branches: false - is-release-branch: false - is-main-branch: true - pre-release-weight: 55000 + prevent-increment: + when-current-commit-tagged: false + track-merge-message: false + regex: (?.+) + source-branches: + - main + - release + - feature + - pull-request + is-source-branch-for: [] + is-main-branch: false ``` If you don't specify the regex, the built-in for that branch config will be @@ -837,9 +844,9 @@ The pre-release label to use for this branch. Use the value `{BranchName}` as a insert the value of the named group `BranchName` from the [regular expression](#regex). For example: branch `feature/foo` would become a pre-release label -of `alpha.foo` with `label: 'alpha.{BranchName}'` and `regex: '^features?[/-](?.+)'`. +of `alpha.foo` with `label: 'alpha.{BranchName}'` and `regex: '^features?[\/-](?.+)'`. -Another example: branch `features/sc-12345/some-description` would become a pre-release label of `sc-12345` with `label: '{StoryNo}'` and `regex: '^features?[/-](?sc-\d+)[-/].+'`. +Another example: branch `features/sc-12345/some-description` would become a pre-release label of `sc-12345` with `label: '{StoryNo}'` and `regex: '^features?[\/-](?sc-\d+)[-/].+'`. **Note:** To clear a default use an empty string: `label: ''` @@ -871,25 +878,28 @@ This branch related property controls the behvior whether to use the tagged (val ### label-number-pattern Pull requests require us to extract the pre-release number out of the branch -name so `refs/pulls/534/merge` builds as `PullRequest.534`. This is a regex with -a named capture group called `number`. - -If the branch `mode` is set to `ContinuousDeployment`, then the extracted -`number` is appended to the name of the pre-release label and the number portion -is the number of commits since the last label. This enables consecutive commits to -the pull request branch to generate unique full semantic version numbers when -the branch is configured to use ContinuousDeployment mode. +name so `refs/pull/534/merge` builds as `PullRequest534`. This is a regex with +a named capture group called `Number`. **Example usage:** ```yaml branches: pull-request: - mode: ContinuousDeployment - label: PullRequest + mode: ContinuousDelivery + label: PullRequest{Number} increment: Inherit - track-merge-target: true - label-number-pattern: '[/-](?\d+)[-/]' + prevent-increment: + of-merged-branch: true + when-current-commit-tagged: false + track-merge-message: true + regex: ^(pull-requests|pull|pr)[\/-](?\d*) + source-branches: + - main + - release + - feature + is-source-branch-for: [] + pre-release-weight: 30000 ``` ### track-merge-target diff --git a/docs/input/docs/reference/mdsource/configuration.source.md b/docs/input/docs/reference/mdsource/configuration.source.md index be3500ee72..5ba2cabcad 100644 --- a/docs/input/docs/reference/mdsource/configuration.source.md +++ b/docs/input/docs/reference/mdsource/configuration.source.md @@ -265,77 +265,84 @@ If you have branch specific configuration upgrading to v4 will force you to upgrade. ```yaml +workflow: 'GitHubFlow/v1' branches: main: - regex: ^master$|^main$ - mode: ContinuousDelivery label: '' increment: Patch - prevent-increment-of-merged-branch-version: true + prevent-increment: + of-merged-branch: true track-merge-target: false - source-branches: [ 'develop', 'release' ] + track-merge-message: true + regex: ^master$|^main$ + source-branches: [] + is-source-branch-for: [] tracks-release-branches: false is-release-branch: false is-main-branch: true pre-release-weight: 55000 - develop: - regex: ^dev(elop)?(ment)?$ - mode: ContinuousDeployment - label: alpha - increment: Minor - prevent-increment-of-merged-branch-version: false - track-merge-target: true - source-branches: [] - tracks-release-branches: true - is-release-branch: false - is-main-branch: false - pre-release-weight: 0 release: - regex: ^releases?[/-] - mode: ContinuousDelivery + mode: ManualDeployment label: beta - increment: None - prevent-increment-of-merged-branch-version: true + increment: Patch + prevent-increment: + of-merged-branch: true + when-branch-merged: false + when-current-commit-tagged: false track-merge-target: false - source-branches: [ 'develop', 'main', 'support', 'release' ] + track-merge-message: true + regex: ^releases?[\/-](?.+) + source-branches: + - main + is-source-branch-for: [] tracks-release-branches: false is-release-branch: true is-main-branch: false pre-release-weight: 30000 feature: - regex: ^features?[/-] - mode: ContinuousDelivery + mode: ManualDeployment label: '{BranchName}' increment: Inherit - source-branches: [ 'develop', 'main', 'release', 'feature', 'support', 'hotfix' ] + prevent-increment: + when-current-commit-tagged: false + track-merge-message: true + regex: ^features?[\/-](?.+) + source-branches: + - main + - release + is-source-branch-for: [] + is-main-branch: false pre-release-weight: 30000 pull-request: - regex: ^(pull|pull\-requests|pr)[/-] mode: ContinuousDelivery - label: PullRequest + label: PullRequest{Number} increment: Inherit - label-number-pattern: '[/-](?\d+)[-/]' - source-branches: [ 'develop', 'main', 'release', 'feature', 'support', 'hotfix' ] + prevent-increment: + of-merged-branch: true + when-current-commit-tagged: false + track-merge-message: true + regex: ^(pull-requests|pull|pr)[\/-](?\d*) + source-branches: + - main + - release + - feature + is-source-branch-for: [] pre-release-weight: 30000 - hotfix: - regex: ^hotfix(es)?[/-] - mode: ContinuousDelivery - label: beta + unknown: + mode: ManualDeployment + label: '{BranchName}' increment: Inherit - source-branches: [ 'release', 'main', 'support', 'hotfix' ] - pre-release-weight: 30000 - support: - regex: ^support[/-] - mode: ContinuousDelivery - label: '' - increment: Patch - prevent-increment-of-merged-branch-version: true - track-merge-target: false - source-branches: [ 'main' ] - tracks-release-branches: false - is-release-branch: false - is-main-branch: true - pre-release-weight: 55000 + prevent-increment: + when-current-commit-tagged: false + track-merge-message: false + regex: (?.+) + source-branches: + - main + - release + - feature + - pull-request + is-source-branch-for: [] + is-main-branch: false ``` If you don't specify the regex, the built-in for that branch config will be @@ -441,9 +448,9 @@ The pre-release label to use for this branch. Use the value `{BranchName}` as a insert the value of the named group `BranchName` from the [regular expression](#regex). For example: branch `feature/foo` would become a pre-release label -of `alpha.foo` with `label: 'alpha.{BranchName}'` and `regex: '^features?[/-](?.+)'`. +of `alpha.foo` with `label: 'alpha.{BranchName}'` and `regex: '^features?[\/-](?.+)'`. -Another example: branch `features/sc-12345/some-description` would become a pre-release label of `sc-12345` with `label: '{StoryNo}'` and `regex: '^features?[/-](?sc-\d+)[-/].+'`. +Another example: branch `features/sc-12345/some-description` would become a pre-release label of `sc-12345` with `label: '{StoryNo}'` and `regex: '^features?[\/-](?sc-\d+)[-/].+'`. **Note:** To clear a default use an empty string: `label: ''` @@ -475,25 +482,28 @@ This branch related property controls the behvior whether to use the tagged (val ### label-number-pattern Pull requests require us to extract the pre-release number out of the branch -name so `refs/pulls/534/merge` builds as `PullRequest.534`. This is a regex with -a named capture group called `number`. - -If the branch `mode` is set to `ContinuousDeployment`, then the extracted -`number` is appended to the name of the pre-release label and the number portion -is the number of commits since the last label. This enables consecutive commits to -the pull request branch to generate unique full semantic version numbers when -the branch is configured to use ContinuousDeployment mode. +name so `refs/pull/534/merge` builds as `PullRequest534`. This is a regex with +a named capture group called `Number`. **Example usage:** ```yaml branches: pull-request: - mode: ContinuousDeployment - label: PullRequest + mode: ContinuousDelivery + label: PullRequest{Number} increment: Inherit - track-merge-target: true - label-number-pattern: '[/-](?\d+)[-/]' + prevent-increment: + of-merged-branch: true + when-current-commit-tagged: false + track-merge-message: true + regex: ^(pull-requests|pull|pr)[\/-](?\d*) + source-branches: + - main + - release + - feature + is-source-branch-for: [] + pre-release-weight: 30000 ``` ### track-merge-target From 17c0cf899d9540709d214c24bcba9dbd7d80e16d Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Tue, 28 Jan 2025 09:26:37 +0000 Subject: [PATCH 041/107] Docs changes --- docs/input/docs/reference/configuration.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/input/docs/reference/configuration.md b/docs/input/docs/reference/configuration.md index 4cf1792336..f6ac35c566 100644 --- a/docs/input/docs/reference/configuration.md +++ b/docs/input/docs/reference/configuration.md @@ -208,7 +208,7 @@ tracks-release-branches: false is-release-branch: false is-main-branch: false ``` -snippet source | anchor +snippet source | anchor The supported built-in configuration for the `GitHubFlow` workflow (`workflow: GitHubFlow/v1`) looks like: @@ -332,7 +332,7 @@ tracks-release-branches: false is-release-branch: false is-main-branch: false ``` -snippet source | anchor +snippet source | anchor The preview built-in configuration (experimental usage only) for the `TrunkBased` workflow (`workflow: TrunkBased/preview1`) looks like: @@ -441,7 +441,7 @@ tracks-release-branches: false is-release-branch: false is-main-branch: false ``` -snippet source | anchor +snippet source | anchor The details of the available options are as follows: From 0e73ee4470a688170bb7fe81e376b8f4300d20d0 Mon Sep 17 00:00:00 2001 From: Hardy Hobeck Date: Sat, 1 Feb 2025 12:48:15 +0100 Subject: [PATCH 042/107] Integrate code review remarks --- BREAKING_CHANGES.md | 2 +- schemas/6.1/GitVersion.configuration.json | 18 ------------------ 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/BREAKING_CHANGES.md b/BREAKING_CHANGES.md index 39f064160d..e1ab2c4975 100644 --- a/BREAKING_CHANGES.md +++ b/BREAKING_CHANGES.md @@ -1,4 +1,4 @@ -## v6.1.0 +## v6.2.0 * The configuration property `label-number-pattern` was removed. The functionality can be still used by changing the label and the branch name regular expression for pull-request branches. diff --git a/schemas/6.1/GitVersion.configuration.json b/schemas/6.1/GitVersion.configuration.json index c23d8a4686..a186b94b48 100644 --- a/schemas/6.1/GitVersion.configuration.json +++ b/schemas/6.1/GitVersion.configuration.json @@ -104,15 +104,6 @@ "null" ] }, - "label-number-pattern": { - "format": "regex", - "description": "The regular expression pattern to use to extract the number from the branch name. Defaults to '[/-](?\\d+)'.", - "default": "[/-](?\\d+)", - "type": [ - "string", - "null" - ] - }, "pre-release-weight": { "description": "Provides a way to translate the PreReleaseLabel to a number.", "type": [ @@ -233,15 +224,6 @@ "null" ] }, - "label-number-pattern": { - "format": "regex", - "description": "The regular expression pattern to use to extract the number from the branch name. Defaults to '[/-](?\\d+)'.", - "default": "[/-](?\\d+)", - "type": [ - "string", - "null" - ] - }, "major-version-bump-message": { "format": "regex", "description": "The regular expression to match commit messages with to perform a major version increment. Defaults to '\\+semver:\\s?(breaking|major)'", From ce00518676e7c7a6fddc7669bb95250b76856213 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Feb 2025 15:30:24 +0000 Subject: [PATCH 043/107] (docs deps): Bump the remark group with 53 updates Bumps the remark group with 53 updates: | Package | From | To | | --- | --- | --- | | [remark-lint](https://github.com/remarkjs/remark-lint) | `10.0.0` | `10.0.1` | | [remark-lint-blockquote-indentation](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-checkbox-character-style](https://github.com/remarkjs/remark-lint) | `5.0.0` | `5.0.1` | | [remark-lint-checkbox-content-indent](https://github.com/remarkjs/remark-lint) | `5.0.0` | `5.0.1` | | [remark-lint-code-block-style](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-definition-case](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-definition-spacing](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-fenced-code-flag](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.1.1` | | [remark-lint-fenced-code-marker](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-file-extension](https://github.com/remarkjs/remark-lint) | `3.0.0` | `3.0.1` | | [remark-lint-final-definition](https://github.com/remarkjs/remark-lint) | `4.0.1` | `4.0.2` | | [remark-lint-final-newline](https://github.com/remarkjs/remark-lint) | `3.0.0` | `3.0.1` | | [remark-lint-hard-break-spaces](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.1.1` | | [remark-lint-heading-increment](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-heading-style](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-link-title-style](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-list-item-bullet-indent](https://github.com/remarkjs/remark-lint) | `5.0.0` | `5.0.1` | | [remark-lint-list-item-content-indent](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-list-item-indent](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-maximum-heading-length](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.1.1` | | [remark-lint-no-blockquote-without-marker](https://github.com/remarkjs/remark-lint) | `6.0.0` | `6.0.1` | | [remark-lint-no-consecutive-blank-lines](https://github.com/remarkjs/remark-lint) | `5.0.0` | `5.0.1` | | [remark-lint-no-duplicate-definitions](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-no-duplicate-headings](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-no-emphasis-as-heading](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-no-empty-url](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-no-file-name-articles](https://github.com/remarkjs/remark-lint) | `3.0.0` | `3.0.1` | | [remark-lint-no-file-name-consecutive-dashes](https://github.com/remarkjs/remark-lint) | `3.0.0` | `3.0.1` | | [remark-lint-no-file-name-irregular-characters](https://github.com/remarkjs/remark-lint) | `3.0.0` | `3.0.1` | | [remark-lint-no-file-name-mixed-case](https://github.com/remarkjs/remark-lint) | `3.0.0` | `3.0.1` | | [remark-lint-no-file-name-outer-dashes](https://github.com/remarkjs/remark-lint) | `3.0.0` | `3.0.1` | | [remark-lint-no-heading-content-indent](https://github.com/remarkjs/remark-lint) | `5.0.0` | `5.0.1` | | [remark-lint-no-heading-indent](https://github.com/remarkjs/remark-lint) | `5.0.0` | `5.0.1` | | [remark-lint-no-heading-like-paragraph](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-no-literal-urls](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-no-multiple-toplevel-headings](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-no-reference-like-url](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-no-shell-dollars](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-no-shortcut-reference-image](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-no-table-indentation](https://github.com/remarkjs/remark-lint) | `5.0.0` | `5.0.1` | | [remark-lint-no-tabs](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-no-unused-definitions](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-ordered-list-marker-style](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-ordered-list-marker-value](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-rule-style](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-strong-marker](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-lint-table-cell-padding](https://github.com/remarkjs/remark-lint) | `5.0.0` | `5.1.1` | | [remark-lint-table-pipe-alignment](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.1.1` | | [remark-lint-table-pipes](https://github.com/remarkjs/remark-lint) | `5.0.0` | `5.0.1` | | [remark-lint-unordered-list-marker-style](https://github.com/remarkjs/remark-lint) | `4.0.0` | `4.0.1` | | [remark-preset-lint-consistent](https://github.com/remarkjs/remark-lint) | `6.0.0` | `6.0.1` | | [remark-preset-lint-markdown-style-guide](https://github.com/remarkjs/remark-lint) | `6.0.0` | `6.0.1` | | [remark-preset-lint-recommended](https://github.com/remarkjs/remark-lint) | `7.0.0` | `7.0.1` | Updates `remark-lint` from 10.0.0 to 10.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/main/changelog.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/10.0.0...10.0.1) Updates `remark-lint-blockquote-indentation` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-checkbox-character-style` from 5.0.0 to 5.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/5.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/5.0.0...5.0.1) Updates `remark-lint-checkbox-content-indent` from 5.0.0 to 5.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/5.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/5.0.0...5.0.1) Updates `remark-lint-code-block-style` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-definition-case` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-definition-spacing` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-fenced-code-flag` from 4.0.0 to 4.1.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/main/changelog.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...remark-lint-table-cell-padding@4.1.1) Updates `remark-lint-fenced-code-marker` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-file-extension` from 3.0.0 to 3.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/main/changelog.md) - [Commits](https://github.com/remarkjs/remark-lint/commits) Updates `remark-lint-final-definition` from 4.0.1 to 4.0.2 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.2/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/remark-lint-final-definition@4.0.1...4.0.2) Updates `remark-lint-final-newline` from 3.0.0 to 3.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/main/changelog.md) - [Commits](https://github.com/remarkjs/remark-lint/commits) Updates `remark-lint-hard-break-spaces` from 4.0.0 to 4.1.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/main/changelog.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...remark-lint-table-cell-padding@4.1.1) Updates `remark-lint-heading-increment` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-heading-style` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-link-title-style` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-list-item-bullet-indent` from 5.0.0 to 5.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/5.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/5.0.0...5.0.1) Updates `remark-lint-list-item-content-indent` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-list-item-indent` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-maximum-heading-length` from 4.0.0 to 4.1.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/main/changelog.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...remark-lint-table-cell-padding@4.1.1) Updates `remark-lint-no-blockquote-without-marker` from 6.0.0 to 6.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/main/changelog.md) - [Commits](https://github.com/remarkjs/remark-lint/commits) Updates `remark-lint-no-consecutive-blank-lines` from 5.0.0 to 5.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/5.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/5.0.0...5.0.1) Updates `remark-lint-no-duplicate-definitions` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-no-duplicate-headings` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-no-emphasis-as-heading` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-no-empty-url` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-no-file-name-articles` from 3.0.0 to 3.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/main/changelog.md) - [Commits](https://github.com/remarkjs/remark-lint/commits) Updates `remark-lint-no-file-name-consecutive-dashes` from 3.0.0 to 3.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/main/changelog.md) - [Commits](https://github.com/remarkjs/remark-lint/commits) Updates `remark-lint-no-file-name-irregular-characters` from 3.0.0 to 3.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/main/changelog.md) - [Commits](https://github.com/remarkjs/remark-lint/commits) Updates `remark-lint-no-file-name-mixed-case` from 3.0.0 to 3.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/main/changelog.md) - [Commits](https://github.com/remarkjs/remark-lint/commits) Updates `remark-lint-no-file-name-outer-dashes` from 3.0.0 to 3.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/main/changelog.md) - [Commits](https://github.com/remarkjs/remark-lint/commits) Updates `remark-lint-no-heading-content-indent` from 5.0.0 to 5.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/5.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/5.0.0...5.0.1) Updates `remark-lint-no-heading-indent` from 5.0.0 to 5.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/5.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/5.0.0...5.0.1) Updates `remark-lint-no-heading-like-paragraph` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-no-literal-urls` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-no-multiple-toplevel-headings` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-no-reference-like-url` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-no-shell-dollars` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-no-shortcut-reference-image` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-no-table-indentation` from 5.0.0 to 5.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/5.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/5.0.0...5.0.1) Updates `remark-lint-no-tabs` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-no-unused-definitions` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-ordered-list-marker-style` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-ordered-list-marker-value` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-rule-style` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-strong-marker` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-lint-table-cell-padding` from 5.0.0 to 5.1.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/main/changelog.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/5.0.0...remark-preset-lint-markdown-style-guide@5.1.1) Updates `remark-lint-table-pipe-alignment` from 4.0.0 to 4.1.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/main/changelog.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...remark-lint-table-cell-padding@4.1.1) Updates `remark-lint-table-pipes` from 5.0.0 to 5.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/5.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/5.0.0...5.0.1) Updates `remark-lint-unordered-list-marker-style` from 4.0.0 to 4.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/4.0.1/history.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/4.0.0...4.0.1) Updates `remark-preset-lint-consistent` from 6.0.0 to 6.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/main/changelog.md) - [Commits](https://github.com/remarkjs/remark-lint/commits) Updates `remark-preset-lint-markdown-style-guide` from 6.0.0 to 6.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/main/changelog.md) - [Commits](https://github.com/remarkjs/remark-lint/commits) Updates `remark-preset-lint-recommended` from 7.0.0 to 7.0.1 - [Release notes](https://github.com/remarkjs/remark-lint/releases) - [Changelog](https://github.com/remarkjs/remark-lint/blob/main/changelog.md) - [Commits](https://github.com/remarkjs/remark-lint/compare/7.0.0...7.0.1) --- updated-dependencies: - dependency-name: remark-lint dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-blockquote-indentation dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-checkbox-character-style dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-checkbox-content-indent dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-code-block-style dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-definition-case dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-definition-spacing dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-fenced-code-flag dependency-type: direct:development update-type: version-update:semver-minor dependency-group: remark - dependency-name: remark-lint-fenced-code-marker dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-file-extension dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-final-definition dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-final-newline dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-hard-break-spaces dependency-type: direct:development update-type: version-update:semver-minor dependency-group: remark - dependency-name: remark-lint-heading-increment dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-heading-style dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-link-title-style dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-list-item-bullet-indent dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-list-item-content-indent dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-list-item-indent dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-maximum-heading-length dependency-type: direct:development update-type: version-update:semver-minor dependency-group: remark - dependency-name: remark-lint-no-blockquote-without-marker dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-consecutive-blank-lines dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-duplicate-definitions dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-duplicate-headings dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-emphasis-as-heading dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-empty-url dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-file-name-articles dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-file-name-consecutive-dashes dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-file-name-irregular-characters dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-file-name-mixed-case dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-file-name-outer-dashes dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-heading-content-indent dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-heading-indent dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-heading-like-paragraph dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-literal-urls dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-multiple-toplevel-headings dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-reference-like-url dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-shell-dollars dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-shortcut-reference-image dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-table-indentation dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-tabs dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-no-unused-definitions dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-ordered-list-marker-style dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-ordered-list-marker-value dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-rule-style dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-strong-marker dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-table-cell-padding dependency-type: direct:development update-type: version-update:semver-minor dependency-group: remark - dependency-name: remark-lint-table-pipe-alignment dependency-type: direct:development update-type: version-update:semver-minor dependency-group: remark - dependency-name: remark-lint-table-pipes dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-lint-unordered-list-marker-style dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-preset-lint-consistent dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-preset-lint-markdown-style-guide dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark - dependency-name: remark-preset-lint-recommended dependency-type: direct:development update-type: version-update:semver-patch dependency-group: remark ... Signed-off-by: dependabot[bot] --- package-lock.json | 795 ++++++++++++++++++++++++---------------------- package.json | 106 +++---- 2 files changed, 477 insertions(+), 424 deletions(-) diff --git a/package-lock.json b/package-lock.json index 686831da48..2951e77495 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,65 +11,65 @@ "remark-cli": "^12.0.1", "remark-frontmatter": "^5.0.0", "remark-heading-gap": "^6.0.0", - "remark-lint": "^10.0.0", - "remark-lint-blockquote-indentation": "^4.0.0", - "remark-lint-checkbox-character-style": "^5.0.0", - "remark-lint-checkbox-content-indent": "^5.0.0", + "remark-lint": "^10.0.1", + "remark-lint-blockquote-indentation": "^4.0.1", + "remark-lint-checkbox-character-style": "^5.0.1", + "remark-lint-checkbox-content-indent": "^5.0.1", "remark-lint-code": "^2.0.0", - "remark-lint-code-block-style": "^4.0.0", - "remark-lint-definition-case": "^4.0.0", - "remark-lint-definition-spacing": "^4.0.0", - "remark-lint-fenced-code-flag": "^4.0.0", - "remark-lint-fenced-code-marker": "^4.0.0", - "remark-lint-file-extension": "^3.0.0", - "remark-lint-final-definition": "^4.0.1", - "remark-lint-final-newline": "^3.0.0", - "remark-lint-hard-break-spaces": "^4.0.0", - "remark-lint-heading-increment": "^4.0.0", - "remark-lint-heading-style": "^4.0.0", + "remark-lint-code-block-style": "^4.0.1", + "remark-lint-definition-case": "^4.0.1", + "remark-lint-definition-spacing": "^4.0.1", + "remark-lint-fenced-code-flag": "^4.1.1", + "remark-lint-fenced-code-marker": "^4.0.1", + "remark-lint-file-extension": "^3.0.1", + "remark-lint-final-definition": "^4.0.2", + "remark-lint-final-newline": "^3.0.1", + "remark-lint-hard-break-spaces": "^4.1.1", + "remark-lint-heading-increment": "^4.0.1", + "remark-lint-heading-style": "^4.0.1", "remark-lint-heading-whitespace": "^1.0.0", - "remark-lint-link-title-style": "^4.0.0", - "remark-lint-list-item-bullet-indent": "^5.0.0", - "remark-lint-list-item-content-indent": "^4.0.0", - "remark-lint-list-item-indent": "^4.0.0", - "remark-lint-maximum-heading-length": "^4.0.0", - "remark-lint-no-blockquote-without-marker": "^6.0.0", - "remark-lint-no-consecutive-blank-lines": "^5.0.0", + "remark-lint-link-title-style": "^4.0.1", + "remark-lint-list-item-bullet-indent": "^5.0.1", + "remark-lint-list-item-content-indent": "^4.0.1", + "remark-lint-list-item-indent": "^4.0.1", + "remark-lint-maximum-heading-length": "^4.1.1", + "remark-lint-no-blockquote-without-marker": "^6.0.1", + "remark-lint-no-consecutive-blank-lines": "^5.0.1", "remark-lint-no-dead-urls": "^2.0.1", - "remark-lint-no-duplicate-definitions": "^4.0.0", - "remark-lint-no-duplicate-headings": "^4.0.0", - "remark-lint-no-emphasis-as-heading": "^4.0.0", + "remark-lint-no-duplicate-definitions": "^4.0.1", + "remark-lint-no-duplicate-headings": "^4.0.1", + "remark-lint-no-emphasis-as-heading": "^4.0.1", "remark-lint-no-empty-sections": "^4.0.0", - "remark-lint-no-empty-url": "^4.0.0", - "remark-lint-no-file-name-articles": "^3.0.0", - "remark-lint-no-file-name-consecutive-dashes": "^3.0.0", - "remark-lint-no-file-name-irregular-characters": "^3.0.0", - "remark-lint-no-file-name-mixed-case": "^3.0.0", - "remark-lint-no-file-name-outer-dashes": "^3.0.0", - "remark-lint-no-heading-content-indent": "^5.0.0", - "remark-lint-no-heading-indent": "^5.0.0", - "remark-lint-no-heading-like-paragraph": "^4.0.0", - "remark-lint-no-literal-urls": "^4.0.0", - "remark-lint-no-multiple-toplevel-headings": "^4.0.0", - "remark-lint-no-reference-like-url": "^4.0.0", + "remark-lint-no-empty-url": "^4.0.1", + "remark-lint-no-file-name-articles": "^3.0.1", + "remark-lint-no-file-name-consecutive-dashes": "^3.0.1", + "remark-lint-no-file-name-irregular-characters": "^3.0.1", + "remark-lint-no-file-name-mixed-case": "^3.0.1", + "remark-lint-no-file-name-outer-dashes": "^3.0.1", + "remark-lint-no-heading-content-indent": "^5.0.1", + "remark-lint-no-heading-indent": "^5.0.1", + "remark-lint-no-heading-like-paragraph": "^4.0.1", + "remark-lint-no-literal-urls": "^4.0.1", + "remark-lint-no-multiple-toplevel-headings": "^4.0.1", + "remark-lint-no-reference-like-url": "^4.0.1", "remark-lint-no-repeat-punctuation": "^0.1.4", - "remark-lint-no-shell-dollars": "^4.0.0", - "remark-lint-no-shortcut-reference-image": "^4.0.0", - "remark-lint-no-table-indentation": "^5.0.0", - "remark-lint-no-tabs": "^4.0.0", - "remark-lint-no-unused-definitions": "^4.0.0", - "remark-lint-ordered-list-marker-style": "^4.0.0", - "remark-lint-ordered-list-marker-value": "^4.0.0", - "remark-lint-rule-style": "^4.0.0", - "remark-lint-strong-marker": "^4.0.0", - "remark-lint-table-cell-padding": "^5.0.0", - "remark-lint-table-pipe-alignment": "^4.0.0", - "remark-lint-table-pipes": "^5.0.0", - "remark-lint-unordered-list-marker-style": "^4.0.0", + "remark-lint-no-shell-dollars": "^4.0.1", + "remark-lint-no-shortcut-reference-image": "^4.0.1", + "remark-lint-no-table-indentation": "^5.0.1", + "remark-lint-no-tabs": "^4.0.1", + "remark-lint-no-unused-definitions": "^4.0.1", + "remark-lint-ordered-list-marker-style": "^4.0.1", + "remark-lint-ordered-list-marker-value": "^4.0.1", + "remark-lint-rule-style": "^4.0.1", + "remark-lint-strong-marker": "^4.0.1", + "remark-lint-table-cell-padding": "^5.1.1", + "remark-lint-table-pipe-alignment": "^4.1.1", + "remark-lint-table-pipes": "^5.0.1", + "remark-lint-unordered-list-marker-style": "^4.0.1", "remark-lint-write-good": "^1.2.0", - "remark-preset-lint-consistent": "^6.0.0", - "remark-preset-lint-markdown-style-guide": "^6.0.0", - "remark-preset-lint-recommended": "^7.0.0", + "remark-preset-lint-consistent": "^6.0.1", + "remark-preset-lint-markdown-style-guide": "^6.0.1", + "remark-preset-lint-recommended": "^7.0.1", "remark-retext": "^6.0.0", "remark-textr": "^6.1.0", "remark-validate-links": "^13.0.2" @@ -5805,10 +5805,11 @@ } }, "node_modules/remark-lint": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-10.0.0.tgz", - "integrity": "sha512-E8yHHDOJ8b+qI0G49BRu24pe8t0fNNBWv8ENQJpCGNrVeTeyBIGEbaUe1yuF7OG8faA6PVpcN/pqWjzW9fcBWQ==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-10.0.1.tgz", + "integrity": "sha512-1+PYGFziOg4pH7DDf1uMd4AR3YuO2EMnds/SdIWMPGT7CAfDRSnAmpxPsJD0Ds3IKpn97h3d5KPGf1WFOg6hXQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "remark-message-control": "^8.0.0", @@ -5820,10 +5821,11 @@ } }, "node_modules/remark-lint-blockquote-indentation": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-blockquote-indentation/-/remark-lint-blockquote-indentation-4.0.0.tgz", - "integrity": "sha512-hdUvn+KsJbBKpY9jLY01PmfpJ/WGhLu9GJMXQGU8ADXJc+F5DWSgKAr6GQ1IUKqvGYdEML/KZ61WomWFUuecVA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-blockquote-indentation/-/remark-lint-blockquote-indentation-4.0.1.tgz", + "integrity": "sha512-7BhOsImFgTD7IIliu2tt+yJbx5gbMbXCOspc3VdYf/87iLJdWKqJoMy2V6DZG7kBjBlBsIZi38fDDngJttXt4w==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -5970,10 +5972,11 @@ } }, "node_modules/remark-lint-checkbox-character-style": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-checkbox-character-style/-/remark-lint-checkbox-character-style-5.0.0.tgz", - "integrity": "sha512-K0G/Nok59fb2q5KUxcemBVt+ymnhTkDVLJAatZ4PAh9At8y0DGctHdU27jWsuvO0Fs7Zy62Usk7IJE2VO89p1w==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-checkbox-character-style/-/remark-lint-checkbox-character-style-5.0.1.tgz", + "integrity": "sha512-6qilm7XQXOcTvjFEqqNY57Ki7md9rkSdpMIfIzVXdEnI4Npl2BnUff6ANrGRM7qTgJTrloaf8H0eQ91urcU6Og==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -6120,10 +6123,11 @@ } }, "node_modules/remark-lint-checkbox-content-indent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-checkbox-content-indent/-/remark-lint-checkbox-content-indent-5.0.0.tgz", - "integrity": "sha512-7L25a7TEfdogFSh4HDOnB+GTTTEiXJDMlceUPft9bzIjElI8Hm2+a2D8jUQn4ahj+j/3LmdZW4GjAeyfdPuqTA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-checkbox-content-indent/-/remark-lint-checkbox-content-indent-5.0.1.tgz", + "integrity": "sha512-R1gV4vGkgJQZQFIGve1paj4mVDUWlgX0KAHhjNpSyzuwuSIDoxWpEuSJSxcnczESgcjM4yVrZqEGMYi/fqZK0w==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -6280,10 +6284,11 @@ } }, "node_modules/remark-lint-code-block-style": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-code-block-style/-/remark-lint-code-block-style-4.0.0.tgz", - "integrity": "sha512-LKBKMVruEO0tzDnnnqi1TfUcnwY6Mo7cVtZM4E4pKt3KMhtvgU2wD68/MxDOEJd0pmnLrEgIadv74bY0gWhZpg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-code-block-style/-/remark-lint-code-block-style-4.0.1.tgz", + "integrity": "sha512-d4mHsEpv1yqXWl2dd+28tGRX0Lzk5qw7cfxAQVkOXPUONhsMFwXJEBeeqZokeG4lOKtkKdIJR7ezScDfWR0X4w==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -6467,10 +6472,11 @@ } }, "node_modules/remark-lint-definition-case": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-definition-case/-/remark-lint-definition-case-4.0.0.tgz", - "integrity": "sha512-XBmMmj8ii0KZUuJf7ZaVXDGp2+DWE02re9qn/6mV23rBpsDmpz7U1lQWRlwFQIE5q5bxIxP5pX7hDeTH0Egy9Q==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-definition-case/-/remark-lint-definition-case-4.0.1.tgz", + "integrity": "sha512-BItJMeXyEBKW/beM7gFLMt3flnyNoRDd8yNFq+7pIeFjO7KWGRxBWUaNgk/tFEPyQcGeCqrNS3nS0ic7qi7I2w==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -6602,10 +6608,11 @@ } }, "node_modules/remark-lint-definition-spacing": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-definition-spacing/-/remark-lint-definition-spacing-4.0.0.tgz", - "integrity": "sha512-t6nP8unz6z/DLBTWeOmDFHPFbX3E2PbNgt2fTazRbVnMC6z3o25hBzg5hI6DL0MPt2ZTRX++rJsGRjb+vgh/tQ==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-definition-spacing/-/remark-lint-definition-spacing-4.0.1.tgz", + "integrity": "sha512-ZjShKaBUGeHrZyIZWwOZOxX3guj/P7gRR5wbDADQctL4oK+ZLQfOvJFmAsF1nD4gNr0Ficjd0AuiWxQcc1qTMA==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "longest-streak": "^3.0.0", @@ -6888,10 +6895,11 @@ } }, "node_modules/remark-lint-fenced-code-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-fenced-code-flag/-/remark-lint-fenced-code-flag-4.0.0.tgz", - "integrity": "sha512-Zs0wJd4nRvBo/9NWQVfWg5Ykapbo0Zzw/SyZc3f0h73S1gTZZcfeU+bA5oDivlBdcUgLBsyHRE0QaoaVvN3/Wg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/remark-lint-fenced-code-flag/-/remark-lint-fenced-code-flag-4.1.1.tgz", + "integrity": "sha512-hKPqowc79jrJL47AfnqDThvE8Q249nHCleR5nxuf9ybriMqcAHYxragKzU5c4W1fNy20bTfFdZz/iAAQAk9kwg==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -7038,10 +7046,11 @@ } }, "node_modules/remark-lint-fenced-code-marker": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-fenced-code-marker/-/remark-lint-fenced-code-marker-4.0.0.tgz", - "integrity": "sha512-WFN88Rx78m4/HSbW3Kx2XAYbVfzYns4bJd9qpwDD90DA3nc59zciYd01xi6Bk3n9vSs5gIlmG7xkwxVHHJ8KCA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-fenced-code-marker/-/remark-lint-fenced-code-marker-4.0.1.tgz", + "integrity": "sha512-uI91OcVPKjNxV+vpjDW9T64hkE0a/CRn3JhwdMxUAJYpVsKnA7PFPSFJOx/abNsVZHNSe7ZFGgGdaH/lqgSizA==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -7188,10 +7197,11 @@ } }, "node_modules/remark-lint-file-extension": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-file-extension/-/remark-lint-file-extension-3.0.0.tgz", - "integrity": "sha512-wrOKiGvcl/ftB7FkeX2/l13ALvhKXV77HGR8AXo86cVY2pD+K0WdOC52DV3ldgpUXpWzE9kcgF8bbkxwzKpFFg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-file-extension/-/remark-lint-file-extension-3.0.1.tgz", + "integrity": "sha512-1Ca5Dgu9J/j1fb7nvzNXh2xy4ija03igiP5i4le64LfrlloGax4VWcG/M7uL+CpRTFVqEJMWw0iKDEZxYSgImg==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "quotation": "^2.0.0", @@ -7295,10 +7305,11 @@ } }, "node_modules/remark-lint-final-definition": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/remark-lint-final-definition/-/remark-lint-final-definition-4.0.1.tgz", - "integrity": "sha512-51T9oSdA7wuhjSdgGo0snO1BY39Igt9cJQi7XpgtgFsbfQk8zSSAUAc/rLabY6+YCTpcPs6qmwvLXZ4mPX6Qlg==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-final-definition/-/remark-lint-final-definition-4.0.2.tgz", + "integrity": "sha512-fz3UAcFQef77Zb8rz4za2R6y7pdyJot22iGtFoNIKdtbcNa8IKKEVoY3NIfrsLfhrjwzcha1Sp3fFA9NF6lc4w==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -7447,10 +7458,11 @@ } }, "node_modules/remark-lint-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-final-newline/-/remark-lint-final-newline-3.0.0.tgz", - "integrity": "sha512-NaPyn6FiOn3IV/6gIcwWfJmgraPT2IaVLjhakfPglZkKVfn/FrOfETyY8Bp+HLoSRI9967OH0yRDnK7/pPIWeQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-final-newline/-/remark-lint-final-newline-3.0.1.tgz", + "integrity": "sha512-q5diKHD6BMbzqWqgvYPOB8AJgLrMzEMBAprNXjcpKoZ/uCRqly+gxjco+qVUMtMWSd+P+KXZZEqoa7Y6QiOudw==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -7555,10 +7567,11 @@ } }, "node_modules/remark-lint-hard-break-spaces": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-hard-break-spaces/-/remark-lint-hard-break-spaces-4.0.0.tgz", - "integrity": "sha512-zCTq7/xfM0ZL3bMopXse9DH2nk38wE1LrxmYwnTrqASBLnEAJWE2U2//tRGVMEBfSAnNvmIo96twz6zkLWjbGA==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/remark-lint-hard-break-spaces/-/remark-lint-hard-break-spaces-4.1.1.tgz", + "integrity": "sha512-AKDPDt39fvmr3yk38OKZEWJxxCOOUBE+96AsBfs+ExS5LW6oLa9041X5ahFDQHvHGzdoremEIaaElursaPEkNg==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unified-lint-rule": "^3.0.0", @@ -7718,10 +7731,11 @@ } }, "node_modules/remark-lint-heading-increment": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-heading-increment/-/remark-lint-heading-increment-4.0.0.tgz", - "integrity": "sha512-TARnsjXWzY/yLwxh/y4+KnDSXO3Koue8Crp55T8G9pjj3vw+XgTAG35zSpIIY9HmGiQ2a3R0SOj2pAxATpnckg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-heading-increment/-/remark-lint-heading-increment-4.0.1.tgz", + "integrity": "sha512-uat7RTQn0hGlMv62p7yjLlg3tO3RljFbH6C+0M+5BNEF+s3NrA8jJgqW0UwLLNdCd3EABCKaWloHumT57ND7PQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -7855,10 +7869,11 @@ } }, "node_modules/remark-lint-heading-style": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-heading-style/-/remark-lint-heading-style-4.0.0.tgz", - "integrity": "sha512-dQ6Jul5K0+aNUvrq4W7H0+osSoC9hsmwHZqBFq000+eMP/hWJqI8tuudw1rap8HHYuOsKLRbB5q+Fr7G+3Vw+Q==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-heading-style/-/remark-lint-heading-style-4.0.1.tgz", + "integrity": "sha512-+rUpJ/N2CGC5xPgZ18XgsCsUBtadgEhdTi0BJPrsFmHPzL22BUHajeg9im8Y7zphUcbi1qFiKuxZd2nzDgZSXQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-heading-style": "^3.0.0", @@ -8077,10 +8092,11 @@ } }, "node_modules/remark-lint-link-title-style": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-link-title-style/-/remark-lint-link-title-style-4.0.0.tgz", - "integrity": "sha512-cihTO5dkhjMj/evYIDAvRdQHD82OQeF4fNAq8FLb81HmFKo77VlSF6CK55H1bvlZogfJG58uN/5d1tSsOdcEbg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-link-title-style/-/remark-lint-link-title-style-4.0.1.tgz", + "integrity": "sha512-MtmnYrhjhRXR0zeiyYf/7GBlUF5KAPypJb345KjyDluOhI4Wj4VAXvVQuov/MFc3y8p/1yVwv3QDYv6yue8/wQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unified-lint-rule": "^3.0.0", @@ -8226,10 +8242,11 @@ } }, "node_modules/remark-lint-list-item-bullet-indent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-list-item-bullet-indent/-/remark-lint-list-item-bullet-indent-5.0.0.tgz", - "integrity": "sha512-qq22QaxsDjfsL7aWGIPmP3P0N99CJBQQW1+iSrhYAMCDzqVlw6I3wPNAeR6s8mcoeHT8YlT6eQH3V8xJ0SlW6w==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-list-item-bullet-indent/-/remark-lint-list-item-bullet-indent-5.0.1.tgz", + "integrity": "sha512-LKuTxkw5aYChzZoF3BkfaBheSCHs0T8n8dPHLQEuOLo6iC5wy98iyryz0KZ61GD8stlZgQO2KdWSdnP6vr40Iw==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "pluralize": "^8.0.0", @@ -8347,10 +8364,11 @@ } }, "node_modules/remark-lint-list-item-content-indent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-list-item-content-indent/-/remark-lint-list-item-content-indent-4.0.0.tgz", - "integrity": "sha512-L4GZgWQQ54qWKbnDle3dbEOtnq+qdmZJ70lpM3yMFEMHs4xejqPKsIoiYeUtIV0rYHHCWS7IlLzcgYUK9vENQw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-list-item-content-indent/-/remark-lint-list-item-content-indent-4.0.1.tgz", + "integrity": "sha512-KSopxxp64O6dLuTQ2sWaTqgjKWr1+AoB1QCTektMJ3mfHfn0QyZzC2CZbBU22KGzBhiYXv9cIxlJlxUtq2NqHg==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -8498,10 +8516,11 @@ } }, "node_modules/remark-lint-list-item-indent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-list-item-indent/-/remark-lint-list-item-indent-4.0.0.tgz", - "integrity": "sha512-Yd6/g8CH9e4vlPAPNgl7F575uKhP+pTo/qwGkE61GOcgEVNJ/529hjumUhyQ4sOAX0YAPAjxvq6fJvb4AhVOOA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-list-item-indent/-/remark-lint-list-item-indent-4.0.1.tgz", + "integrity": "sha512-gJd1Q+jOAeTgmGRsdMpnRh01DUrAm0O5PCQxE8ttv1QZOV015p/qJH+B4N6QSmcUuPokHLAh9USuq05C73qpiA==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -8799,10 +8818,11 @@ } }, "node_modules/remark-lint-maximum-heading-length": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-maximum-heading-length/-/remark-lint-maximum-heading-length-4.0.0.tgz", - "integrity": "sha512-UCQxUd0zZyi6RUbpoK5KsxC50ppVqVk0hSgrSPot4wB6PHRgYMALU2fDkEcAjLDc/Y2TayG3IaZEKdqe+84Cwg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/remark-lint-maximum-heading-length/-/remark-lint-maximum-heading-length-4.1.1.tgz", + "integrity": "sha512-99yonukJ+e0uhx0zGH4uq6H9mhO7FA1ufmuToODH1N+X3ja61Grvlvvlq9UbP9+gbfbWgN97QGKPaTlE29FpaQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-mdx": "^3.0.0", @@ -9127,10 +9147,11 @@ } }, "node_modules/remark-lint-no-blockquote-without-marker": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-blockquote-without-marker/-/remark-lint-no-blockquote-without-marker-6.0.0.tgz", - "integrity": "sha512-fBhoTpkWcl5tG4FdwPdJIyb8XLrdr6MdLk1+K2BQ6Rom3rRsIYvuox4ohxOunNrXuth8xyw8kC6wDmODR44oFw==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-blockquote-without-marker/-/remark-lint-no-blockquote-without-marker-6.0.1.tgz", + "integrity": "sha512-b4IOkNcG7C16HYAdKUeAhO7qPt45m+v7SeYbVrqvbSFtlD3EUBL8fgHRgLK1mdujFXDP1VguOEMx+Txv8JOT4w==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -9280,10 +9301,11 @@ } }, "node_modules/remark-lint-no-consecutive-blank-lines": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-consecutive-blank-lines/-/remark-lint-no-consecutive-blank-lines-5.0.0.tgz", - "integrity": "sha512-HsDZbFlelBVO3mEJDXd9v4z0HLB8pqxWnsV+I4ILYFp5lKYf6NxJaLBWFtP1gAg1+95WxityGLkGtYqmicDjpg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-consecutive-blank-lines/-/remark-lint-no-consecutive-blank-lines-5.0.1.tgz", + "integrity": "sha512-yLtYCrEBtGDao4ozmZruRzjMYAcBVFK69PoYjPfNwFO8pQ/LPt8KCq6oyg1ronNyRbDYEGqVdLIHcT/zL3LjPA==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-directive": "^3.0.0", @@ -9587,10 +9609,11 @@ } }, "node_modules/remark-lint-no-duplicate-definitions": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-duplicate-definitions/-/remark-lint-no-duplicate-definitions-4.0.0.tgz", - "integrity": "sha512-21fcOACkCyhNsHkedKlpvqIywYx+5zGR507bW8e59gzdGhTbnBwQ9du4ACmN9jxPTfIBhUVMz0bWezkGrHE7Bg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-duplicate-definitions/-/remark-lint-no-duplicate-definitions-4.0.1.tgz", + "integrity": "sha512-Ek+A/xDkv5Nn+BXCFmf+uOrFSajCHj6CjhsHjtROgVUeEPj726yYekDBoDRA0Y3+z+U30AsJoHgf/9Jj1IFSug==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -9724,10 +9747,11 @@ } }, "node_modules/remark-lint-no-duplicate-headings": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-duplicate-headings/-/remark-lint-no-duplicate-headings-4.0.0.tgz", - "integrity": "sha512-FgBU/JCdR5MitHM+hnOcgBGO5ZCNV8epzuHIglFlJeb8ow23YhhNgmGvyk7RGrZrYuU5R9uQq23N4dF0g9atCA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-duplicate-headings/-/remark-lint-no-duplicate-headings-4.0.1.tgz", + "integrity": "sha512-6lggqnpIe5FepikjYF2me3ovKV4oD/rAz8WmwVbLR2cLkce1iH+PB7jyxk/A2gQQqrDcIlRMA5Ct2Yj56cEwhQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -9875,10 +9899,11 @@ } }, "node_modules/remark-lint-no-emphasis-as-heading": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-emphasis-as-heading/-/remark-lint-no-emphasis-as-heading-4.0.0.tgz", - "integrity": "sha512-JViGYbuO/xzZThK+qVTNjtLM0v1xMTWFTWt2OJzAkDaGS6T9ZB5ZtRVSBFEMG0SF3dvpJwxe+3ABTsuPBdlYsA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-emphasis-as-heading/-/remark-lint-no-emphasis-as-heading-4.0.1.tgz", + "integrity": "sha512-zzI/C330qdKO9FB3h6IUtOG36FSrS5nfJ7qxp0atXGYtHyg+Ag7dPC/0FzchOVsxofQm0QTstVoIARt/9TiN5g==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -10068,10 +10093,11 @@ } }, "node_modules/remark-lint-no-empty-url": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-empty-url/-/remark-lint-no-empty-url-4.0.0.tgz", - "integrity": "sha512-2zJxrSnL42wGe+CSZepBzoj8d/FeL/QU8GM6TEO/5qGfXwvJD7s2v6q074UJU0CAaWlWRqSxElescwk3yGQddA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-empty-url/-/remark-lint-no-empty-url-4.0.1.tgz", + "integrity": "sha512-FSQIO+Q63kNNSUfbvvWPz6ES4q1gJIc4aMjohch9bfKwcv6wWZc6UkjlMMi823I124p6onrY/F8KKECv06H5YQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unified-lint-rule": "^3.0.0", @@ -10202,10 +10228,11 @@ } }, "node_modules/remark-lint-no-file-name-articles": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-articles/-/remark-lint-no-file-name-articles-3.0.0.tgz", - "integrity": "sha512-il4IseupahbV2TVfFjfDVL/EQw7jBWVlMVsv4K2cgl5uPIjiCjFGQypqKnWl6pZDN0oNOs/DE8gBdyuDjldJaA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-articles/-/remark-lint-no-file-name-articles-3.0.1.tgz", + "integrity": "sha512-h31ZDDJV2T6g9WLBrXg1CJ1m8M170O/tlDPAEPGCa/rxwKvMcfum4yicaot0ZKbUZ1uEPjVSUPDeo3sU0zciCQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unified-lint-rule": "^3.0.0" @@ -10308,10 +10335,11 @@ } }, "node_modules/remark-lint-no-file-name-consecutive-dashes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-consecutive-dashes/-/remark-lint-no-file-name-consecutive-dashes-3.0.0.tgz", - "integrity": "sha512-3vSI1LOQlu8NSCpWLsKELa8dS9HU+YVZE0U43/DNkdEcnZmlJLpTHQjBTMZUHQipRgoOO+TOSyXFyN/H+2lbuQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-consecutive-dashes/-/remark-lint-no-file-name-consecutive-dashes-3.0.1.tgz", + "integrity": "sha512-qGJRZ81sowEjv1dBodbHZ29pDZbrFpxiQQ6gBvkkHkkoYPekdnr8iUxmV38HcqH8+JNW1O4ELr+m71AA9/34Mw==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unified-lint-rule": "^3.0.0" @@ -10414,10 +10442,11 @@ } }, "node_modules/remark-lint-no-file-name-irregular-characters": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-irregular-characters/-/remark-lint-no-file-name-irregular-characters-3.0.0.tgz", - "integrity": "sha512-DhGreliHNU7lLTARQujsaLAn8fUPY0V+H0LSmOUuowBZPtIRWeNdQhunSp96RvsuYdqAdERXe0WuH58i3pRqrg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-irregular-characters/-/remark-lint-no-file-name-irregular-characters-3.0.1.tgz", + "integrity": "sha512-kNm16eDnPqbN05W0RLIedHi40YzHf1esPHbNKv12AljKWptdCTS72uGjAbqUSZ48dRoKtJzL0HJ0OAqXIWUyxA==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unified-lint-rule": "^3.0.0" @@ -10520,10 +10549,11 @@ } }, "node_modules/remark-lint-no-file-name-mixed-case": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-mixed-case/-/remark-lint-no-file-name-mixed-case-3.0.0.tgz", - "integrity": "sha512-MXXNHdGB6P46itkf8gRP0kxQL85KfAj9YOOBqNtGsgI/8J5rsyM/rz1Ac20Xe+5C5oGi71+7EO/TExKu/+7dfw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-mixed-case/-/remark-lint-no-file-name-mixed-case-3.0.1.tgz", + "integrity": "sha512-cXVY0gM6DIHHK+mUhQVZ/WLh4cNfzEDpM54LNJBnflR9n9r6eNLR3JlWFRviTL4xRrQ5FXisBSlBa87BquiFVA==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unified-lint-rule": "^3.0.0" @@ -10626,10 +10656,11 @@ } }, "node_modules/remark-lint-no-file-name-outer-dashes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-outer-dashes/-/remark-lint-no-file-name-outer-dashes-3.0.0.tgz", - "integrity": "sha512-3kgamCp39mdlCtqF/+JLwwS4VpSj5wvVwRythUfrpW7993I9kF67dBsaU545aEzWSK+UJZqjb40i0m2VfnBRfQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-outer-dashes/-/remark-lint-no-file-name-outer-dashes-3.0.1.tgz", + "integrity": "sha512-QIMrBPZKZ6BwQRPM65HhEHcJv6+wZnZ4z2ikvx2ht40cSmIN7ZTL7wKKJlnpF+4Ioi9XUj+cRHWqEhwJ9LCQIw==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unified-lint-rule": "^3.0.0" @@ -10732,10 +10763,11 @@ } }, "node_modules/remark-lint-no-heading-content-indent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-heading-content-indent/-/remark-lint-no-heading-content-indent-5.0.0.tgz", - "integrity": "sha512-psYSlD2BjcVkgpeXOLwPcYFBrbtJWp8E8JX1J4vSfoHPeY6aIxgYxXkf57cjGTApfRL8xawBmMDiF1FgQvpZYg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-heading-content-indent/-/remark-lint-no-heading-content-indent-5.0.1.tgz", + "integrity": "sha512-YIWktnZo7M9aw7PGnHdshvetSH3Y0qW+Fm143R66zsk5lLzn1XA5NEd/MtDzP8tSxxV+gcv+bDd5St1QUI4oSQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -10882,10 +10914,11 @@ } }, "node_modules/remark-lint-no-heading-indent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-heading-indent/-/remark-lint-no-heading-indent-5.0.0.tgz", - "integrity": "sha512-JWGIWhaEzH00HywI0DHex92tJ5Mw7l11shQ6/MGhRjYsHMRWcwWcVeOuktVMe/BiQbg0hRoE4+g0z2VgUD6Cqw==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-heading-indent/-/remark-lint-no-heading-indent-5.0.1.tgz", + "integrity": "sha512-R/KkR9Qfh0AM3asadSnQQXMHu6BNZxPbxLI9h9JBPIZM+EtzycDlhaAHbOlQUdaHA5UEANhYENZBLrueH50Cdg==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -11032,10 +11065,11 @@ } }, "node_modules/remark-lint-no-heading-like-paragraph": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-heading-like-paragraph/-/remark-lint-no-heading-like-paragraph-4.0.0.tgz", - "integrity": "sha512-6P22xHF+2omrQUA9ujQ5yBUlZr3goaAxoa1t3wNSIydzqkbgwLS+RlpGsVvilW1Q8h4JgWpB42Zpflat6xr90g==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-heading-like-paragraph/-/remark-lint-no-heading-like-paragraph-4.0.1.tgz", + "integrity": "sha512-1sscTjv/F/mK5cNThz6fu57xcLgLdB0rl9vJ3BEwh7U4V5cIKp1tdFQhaguweSBnKCjCVaiU7HsEdle01Ai07Q==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -11331,10 +11365,11 @@ } }, "node_modules/remark-lint-no-literal-urls": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-literal-urls/-/remark-lint-no-literal-urls-4.0.0.tgz", - "integrity": "sha512-rl/3Ai4Ax9IH/fRpOJZuXk1HgYX6oFTauhmBOilpqbq/YT2kN3FuXaneXdRfKv1bgMdHaLKxHWxGj/mDyA2n8w==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-literal-urls/-/remark-lint-no-literal-urls-4.0.1.tgz", + "integrity": "sha512-RhTANFkFFXE6bM+WxWcPo2TTPEfkWG3lJZU50ycW7tJJmxUzDNzRed/z80EVJIdGwFa0NntVooLUJp3xrogalQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-to-string": "^4.0.0", @@ -11494,10 +11529,11 @@ } }, "node_modules/remark-lint-no-multiple-toplevel-headings": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-multiple-toplevel-headings/-/remark-lint-no-multiple-toplevel-headings-4.0.0.tgz", - "integrity": "sha512-JW11iYxza7asDdhQuKfr8SH1u4NBOCQ4U7Ru0HrKCPcT4y/AB1C1il5uMQzbcervgYPBq69xzyQ24+AJeL0t3A==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-multiple-toplevel-headings/-/remark-lint-no-multiple-toplevel-headings-4.0.1.tgz", + "integrity": "sha512-8sepobIOu3PlDOuMH7jtri+LH4tFNVQU+aqKSkrlNRdp831fYz9S+jA2crTVqWqxVbTwiF96uJWePv8/9qmHnA==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -11631,10 +11667,11 @@ } }, "node_modules/remark-lint-no-reference-like-url": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-reference-like-url/-/remark-lint-no-reference-like-url-4.0.0.tgz", - "integrity": "sha512-YkP8qWdrWDr9s8JLbJoC/U5Z0fU7hpa59Nin0i8zEOtD9coiYoI/YtXRKqSXuAKDmweb+JckhqtKuGJS5u77+w==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-reference-like-url/-/remark-lint-no-reference-like-url-4.0.1.tgz", + "integrity": "sha512-GXS73779bPnJSqvCfOK2XzGzCWL5ggyk53KE049oOYTS55vmc26PjeW+ykbGfXIazRazZ1DLGaAqNoU9jCnZ4w==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -11805,10 +11842,11 @@ } }, "node_modules/remark-lint-no-shell-dollars": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-shell-dollars/-/remark-lint-no-shell-dollars-4.0.0.tgz", - "integrity": "sha512-ye2h8FzjsgqqQV0HHN2g9N4FqI3eD9Gpgu7tU5ADIJyQ3mUJdwBoFn7IlGnpmumR1fb/l6u/AhRavIZxXYqG+Q==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-shell-dollars/-/remark-lint-no-shell-dollars-4.0.1.tgz", + "integrity": "sha512-UPE1DNCIkLtnS3YFD065Gkq5lQqfndBDpX8Ct/Zjn7M0/hzCyf9B6tpwCU0I20m9jzhS/CSY6mxYnAiEg+KkFA==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "collapse-white-space": "^2.0.0", @@ -11941,10 +11979,11 @@ } }, "node_modules/remark-lint-no-shortcut-reference-image": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-shortcut-reference-image/-/remark-lint-no-shortcut-reference-image-4.0.0.tgz", - "integrity": "sha512-YEiCpW5F/8/LZyxlOuVK2L/n0NJ1AB0AJK7oP39OVyEk3Xl7w+JQi6nZ3KiH6REh+PWGqKn6M0KEPL9cT/iAOw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-shortcut-reference-image/-/remark-lint-no-shortcut-reference-image-4.0.1.tgz", + "integrity": "sha512-hQhJ3Dr8ZWRdj7qm6+9vcPpqtGchhENA2UHOmcTraLf6dN1cFATCgY/HbTbRIN6NkG/EEClTgRC1QCokWR2Mmw==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unified-lint-rule": "^3.0.0", @@ -12209,10 +12248,11 @@ } }, "node_modules/remark-lint-no-table-indentation": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-table-indentation/-/remark-lint-no-table-indentation-5.0.0.tgz", - "integrity": "sha512-MaLmnzgirpnRiRjWwrsyOX0RmP2eG4YAv169MtsxTVa6O3CpUDwTuTzivudE9L0kVvTlyF9DXEmdyjm85LDyVA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-table-indentation/-/remark-lint-no-table-indentation-5.0.1.tgz", + "integrity": "sha512-LHw9MGsuilM+3HkbRFZmdSE4T+sziaQzULH5ImYkLH2MLF8GKnAm2mgtveLZcW01wqFV2oEbpF1Y/s/QloXT7w==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -12361,10 +12401,11 @@ } }, "node_modules/remark-lint-no-tabs": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-tabs/-/remark-lint-no-tabs-4.0.0.tgz", - "integrity": "sha512-rQR7LDdcw047ajB3D+v9uzdB8aZfZtEdlUJvQXKkcVDteWiuXGC3PcIrmM/8n3J/wlFMuwoAaW2IcdlJf8HzXQ==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-tabs/-/remark-lint-no-tabs-4.0.1.tgz", + "integrity": "sha512-+lhGUgY3jhTwWn1x+tTIJNy5Fbs2NcYXCobRY7xeszY0VKPCBF2GyELafOVnr+iTmosXLuhZPp5YwNezQKH9IQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unified-lint-rule": "^3.0.0", @@ -12620,10 +12661,11 @@ } }, "node_modules/remark-lint-no-unused-definitions": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-unused-definitions/-/remark-lint-no-unused-definitions-4.0.0.tgz", - "integrity": "sha512-YCZ6k575NCTx7mnN+9ls0G6YgMsZHi0LYQqfLW8MNVHBtbpTBvfmk8I39bmsvuKWeBD98weZoXSDqIiIGg+Q/g==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-unused-definitions/-/remark-lint-no-unused-definitions-4.0.1.tgz", + "integrity": "sha512-AdMbaCeMpj32HvDUuyI+bQyu/405Nby/rgFW8XDpI7U7ufPhHl+jj9J4NgeW7Z8DrODGr0iFgPNt6JtNLskFdA==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -12770,10 +12812,11 @@ } }, "node_modules/remark-lint-ordered-list-marker-style": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-ordered-list-marker-style/-/remark-lint-ordered-list-marker-style-4.0.0.tgz", - "integrity": "sha512-xZ7Xppy5fzACH4b9h1b4lTzVtNY2AlUkNTfl1Oe6cIKN8tk3juFxN0wL2RpktPtSZ7iRIabzFmg6l8WPhlASJA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-ordered-list-marker-style/-/remark-lint-ordered-list-marker-style-4.0.1.tgz", + "integrity": "sha512-vZTAbstcBPbGwJacwldGzdGmKwy5/4r29SZ9nQkME4alEl5B1ReSBlYa8t7QnTSW7+tqvA9Sg71RPadgAKWa4w==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -12921,10 +12964,11 @@ } }, "node_modules/remark-lint-ordered-list-marker-value": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-ordered-list-marker-value/-/remark-lint-ordered-list-marker-value-4.0.0.tgz", - "integrity": "sha512-7UjNU2Nv9LGEONTU9GPmTVoNoGKD5aL1X2xHzMbSJiTc50bfcazYqZawO+qj1pQ04WPhto1qHnl0HRB5wwSVwA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-ordered-list-marker-value/-/remark-lint-ordered-list-marker-value-4.0.1.tgz", + "integrity": "sha512-HQb1MrArvApREC1/I6bkiFlZVDjngsuII29n8E8StnAaHOMN3hVYy6wJ9Uk+O3+X9O8v7fDsZPqFUHSfJhERXQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -13073,10 +13117,11 @@ } }, "node_modules/remark-lint-rule-style": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-rule-style/-/remark-lint-rule-style-4.0.0.tgz", - "integrity": "sha512-Kt7IHMB5IbLgRFKaFUmB895sV3PTD0MBgN9CvXKxr1wHFF43S6tabjFIBSoQqyJRlhH0S3rK6Lvopofa009gLg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-rule-style/-/remark-lint-rule-style-4.0.1.tgz", + "integrity": "sha512-gl1Ft13oTS3dJUCsWZzxD/5dAwI1HON67KU7uNfODD5gXJ8Y11deOWbun190ma7XbYdD7P0l8VT2HeRtEQzrWg==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -13223,10 +13268,11 @@ } }, "node_modules/remark-lint-strong-marker": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-strong-marker/-/remark-lint-strong-marker-4.0.0.tgz", - "integrity": "sha512-YcvuzakYhQWdCH+1E30sUY+wyvq+PNa77NZAMAYO/cS/pZczFB+q4Ccttw4Q+No/chX8oMfe0GYtm8dDWLei/g==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-strong-marker/-/remark-lint-strong-marker-4.0.1.tgz", + "integrity": "sha512-KaGtj/OWEP4eoafevnlp3NsEVwC7yGEjBJ6uFMzfjNoXyjATdfZ2euB/AfKVt/A/FdZeeMeVoAUFH4DL+hScLQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unified-lint-rule": "^3.0.0", @@ -13372,10 +13418,11 @@ } }, "node_modules/remark-lint-table-cell-padding": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-table-cell-padding/-/remark-lint-table-cell-padding-5.0.0.tgz", - "integrity": "sha512-LNyiHDQZBIOqcQGG1tYsZHW7g0v8OyRmRgDrD5WEsMaAYfM6EiECUokN/Q4py9h4oM/2KUSrdZbtfuZmy87/kA==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/remark-lint-table-cell-padding/-/remark-lint-table-cell-padding-5.1.1.tgz", + "integrity": "sha512-6fgVA1iINBoAJaZMOnSsxrF9Qj9+hmCqrsrqZqgJJETjT1ODGH64iAN1/6vHR7dIwmy73d6ysB2WrGyKhVlK3A==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", @@ -13525,10 +13572,11 @@ } }, "node_modules/remark-lint-table-pipe-alignment": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-table-pipe-alignment/-/remark-lint-table-pipe-alignment-4.0.0.tgz", - "integrity": "sha512-nx+xpEIWQRLOcq9hIbUIvhSE1NYRmDJmCY3cMoHJ1sIW7dRXMHyWfpWTgu7mpREKwSQdE0q4qnzk8McQQSkIcg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/remark-lint-table-pipe-alignment/-/remark-lint-table-pipe-alignment-4.1.1.tgz", + "integrity": "sha512-9VxivIJaDonrd/Jgkim1oYQ5MIqhWmyJggr2AqtiizwqxT4epRsWmLOz+/sk7PtTGoT/MtwndhlbM3lxuVXFow==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", @@ -13677,10 +13725,11 @@ } }, "node_modules/remark-lint-table-pipes": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-table-pipes/-/remark-lint-table-pipes-5.0.0.tgz", - "integrity": "sha512-e7jzAScDrt5+eMomh099TZJBN2K9ldDxBu9iYhNu5C0YsdAvnckJkgilsuClxFpmx4LCVYaX0EGbt/hQ3LB3xg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-table-pipes/-/remark-lint-table-pipes-5.0.1.tgz", + "integrity": "sha512-oOkRC0WRRDwvodfffGafoBFBTGwy9udQgKtxN53apmZpOmaUAxTi833ite0jMo078+LehNftO5bxrElZ9EQUlQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", @@ -13827,10 +13876,11 @@ } }, "node_modules/remark-lint-unordered-list-marker-style": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-unordered-list-marker-style/-/remark-lint-unordered-list-marker-style-4.0.0.tgz", - "integrity": "sha512-XlP4Wr4KJNovyWVv0H5axfUlF23iE9Kt2SxaVq4+ieum5YcMmKE6KsL+aqt3kiJb60SH1u6a0bxKFvdM/9riOA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-unordered-list-marker-style/-/remark-lint-unordered-list-marker-style-4.0.1.tgz", + "integrity": "sha512-HMrVQC0Qbr8ktSy+1lJGRGU10qecL3T14L6s/THEQXR5Tk0wcsLLG0auNvB4r2+H+ClhVO/Vnm1TEosh1OCsfw==", "dev": true, + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -14267,10 +14317,11 @@ } }, "node_modules/remark-preset-lint-consistent": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/remark-preset-lint-consistent/-/remark-preset-lint-consistent-6.0.0.tgz", - "integrity": "sha512-W3fwxajdietwjnFyTH5x2le63hxWGVOXxIs7KjRqU+5wkkN6ZQyuwPeeomblmS9wQr50fkidhXNHNDyCXtqgxQ==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/remark-preset-lint-consistent/-/remark-preset-lint-consistent-6.0.1.tgz", + "integrity": "sha512-SOLdA36UOU1hiGFm6HAqN9+DORGJPVWxU/EvPVkknTr9V4ULhlzHEJ8OVRMVX3jqoy4lrwb4IqiboVz0YLA7+Q==", "dev": true, + "license": "MIT", "dependencies": { "remark-lint": "^10.0.0", "remark-lint-blockquote-indentation": "^4.0.0", @@ -14361,10 +14412,11 @@ } }, "node_modules/remark-preset-lint-markdown-style-guide": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/remark-preset-lint-markdown-style-guide/-/remark-preset-lint-markdown-style-guide-6.0.0.tgz", - "integrity": "sha512-izsfNTHeqrRP64VWV6OdJnSUDwKFSthMKiiDcu14ODpPV0t7YiotCQWzgc7L4eW9Ctcp4aB4nHNLSuDmwhEWrQ==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/remark-preset-lint-markdown-style-guide/-/remark-preset-lint-markdown-style-guide-6.0.1.tgz", + "integrity": "sha512-hVCRMC8PZlI9hnXkZdrvg4n4j1aD//xHWj26Q7iFAbDB3JKtW1Ne72P7QNVyppmdrR6Gj84zhG3qphOLo8/i8A==", "dev": true, + "license": "MIT", "dependencies": { "remark-lint": "^10.0.0", "remark-lint-blockquote-indentation": "^4.0.0", @@ -14484,10 +14536,11 @@ } }, "node_modules/remark-preset-lint-recommended": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/remark-preset-lint-recommended/-/remark-preset-lint-recommended-7.0.0.tgz", - "integrity": "sha512-A9aPDL78OO12xG2a83DVd+M2QzdBMjn545fbXj40BFJdpt9t//MADkPAwRfpMCBkKi+iECPUTFCb3Jm8SsFG2w==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/remark-preset-lint-recommended/-/remark-preset-lint-recommended-7.0.1.tgz", + "integrity": "sha512-j1CY5u48PtZl872BQ40uWSQMT3R4gXKp0FUgevMu5gW7hFMtvaCiDq+BfhzeR8XKKiW9nIMZGfIMZHostz5X4g==", "dev": true, + "license": "MIT", "dependencies": { "remark-lint": "^10.0.0", "remark-lint-final-newline": "^3.0.0", @@ -20876,9 +20929,9 @@ } }, "remark-lint": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-10.0.0.tgz", - "integrity": "sha512-E8yHHDOJ8b+qI0G49BRu24pe8t0fNNBWv8ENQJpCGNrVeTeyBIGEbaUe1yuF7OG8faA6PVpcN/pqWjzW9fcBWQ==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-10.0.1.tgz", + "integrity": "sha512-1+PYGFziOg4pH7DDf1uMd4AR3YuO2EMnds/SdIWMPGT7CAfDRSnAmpxPsJD0Ds3IKpn97h3d5KPGf1WFOg6hXQ==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -20949,9 +21002,9 @@ } }, "remark-lint-blockquote-indentation": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-blockquote-indentation/-/remark-lint-blockquote-indentation-4.0.0.tgz", - "integrity": "sha512-hdUvn+KsJbBKpY9jLY01PmfpJ/WGhLu9GJMXQGU8ADXJc+F5DWSgKAr6GQ1IUKqvGYdEML/KZ61WomWFUuecVA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-blockquote-indentation/-/remark-lint-blockquote-indentation-4.0.1.tgz", + "integrity": "sha512-7BhOsImFgTD7IIliu2tt+yJbx5gbMbXCOspc3VdYf/87iLJdWKqJoMy2V6DZG7kBjBlBsIZi38fDDngJttXt4w==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -21065,9 +21118,9 @@ } }, "remark-lint-checkbox-character-style": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-checkbox-character-style/-/remark-lint-checkbox-character-style-5.0.0.tgz", - "integrity": "sha512-K0G/Nok59fb2q5KUxcemBVt+ymnhTkDVLJAatZ4PAh9At8y0DGctHdU27jWsuvO0Fs7Zy62Usk7IJE2VO89p1w==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-checkbox-character-style/-/remark-lint-checkbox-character-style-5.0.1.tgz", + "integrity": "sha512-6qilm7XQXOcTvjFEqqNY57Ki7md9rkSdpMIfIzVXdEnI4Npl2BnUff6ANrGRM7qTgJTrloaf8H0eQ91urcU6Og==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -21181,9 +21234,9 @@ } }, "remark-lint-checkbox-content-indent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-checkbox-content-indent/-/remark-lint-checkbox-content-indent-5.0.0.tgz", - "integrity": "sha512-7L25a7TEfdogFSh4HDOnB+GTTTEiXJDMlceUPft9bzIjElI8Hm2+a2D8jUQn4ahj+j/3LmdZW4GjAeyfdPuqTA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-checkbox-content-indent/-/remark-lint-checkbox-content-indent-5.0.1.tgz", + "integrity": "sha512-R1gV4vGkgJQZQFIGve1paj4mVDUWlgX0KAHhjNpSyzuwuSIDoxWpEuSJSxcnczESgcjM4yVrZqEGMYi/fqZK0w==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -21342,9 +21395,9 @@ } }, "remark-lint-code-block-style": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-code-block-style/-/remark-lint-code-block-style-4.0.0.tgz", - "integrity": "sha512-LKBKMVruEO0tzDnnnqi1TfUcnwY6Mo7cVtZM4E4pKt3KMhtvgU2wD68/MxDOEJd0pmnLrEgIadv74bY0gWhZpg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-code-block-style/-/remark-lint-code-block-style-4.0.1.tgz", + "integrity": "sha512-d4mHsEpv1yqXWl2dd+28tGRX0Lzk5qw7cfxAQVkOXPUONhsMFwXJEBeeqZokeG4lOKtkKdIJR7ezScDfWR0X4w==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -21458,9 +21511,9 @@ } }, "remark-lint-definition-case": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-definition-case/-/remark-lint-definition-case-4.0.0.tgz", - "integrity": "sha512-XBmMmj8ii0KZUuJf7ZaVXDGp2+DWE02re9qn/6mV23rBpsDmpz7U1lQWRlwFQIE5q5bxIxP5pX7hDeTH0Egy9Q==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-definition-case/-/remark-lint-definition-case-4.0.1.tgz", + "integrity": "sha512-BItJMeXyEBKW/beM7gFLMt3flnyNoRDd8yNFq+7pIeFjO7KWGRxBWUaNgk/tFEPyQcGeCqrNS3nS0ic7qi7I2w==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -21563,9 +21616,9 @@ } }, "remark-lint-definition-spacing": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-definition-spacing/-/remark-lint-definition-spacing-4.0.0.tgz", - "integrity": "sha512-t6nP8unz6z/DLBTWeOmDFHPFbX3E2PbNgt2fTazRbVnMC6z3o25hBzg5hI6DL0MPt2ZTRX++rJsGRjb+vgh/tQ==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-definition-spacing/-/remark-lint-definition-spacing-4.0.1.tgz", + "integrity": "sha512-ZjShKaBUGeHrZyIZWwOZOxX3guj/P7gRR5wbDADQctL4oK+ZLQfOvJFmAsF1nD4gNr0Ficjd0AuiWxQcc1qTMA==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -21785,9 +21838,9 @@ } }, "remark-lint-fenced-code-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-fenced-code-flag/-/remark-lint-fenced-code-flag-4.0.0.tgz", - "integrity": "sha512-Zs0wJd4nRvBo/9NWQVfWg5Ykapbo0Zzw/SyZc3f0h73S1gTZZcfeU+bA5oDivlBdcUgLBsyHRE0QaoaVvN3/Wg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/remark-lint-fenced-code-flag/-/remark-lint-fenced-code-flag-4.1.1.tgz", + "integrity": "sha512-hKPqowc79jrJL47AfnqDThvE8Q249nHCleR5nxuf9ybriMqcAHYxragKzU5c4W1fNy20bTfFdZz/iAAQAk9kwg==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -21901,9 +21954,9 @@ } }, "remark-lint-fenced-code-marker": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-fenced-code-marker/-/remark-lint-fenced-code-marker-4.0.0.tgz", - "integrity": "sha512-WFN88Rx78m4/HSbW3Kx2XAYbVfzYns4bJd9qpwDD90DA3nc59zciYd01xi6Bk3n9vSs5gIlmG7xkwxVHHJ8KCA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-fenced-code-marker/-/remark-lint-fenced-code-marker-4.0.1.tgz", + "integrity": "sha512-uI91OcVPKjNxV+vpjDW9T64hkE0a/CRn3JhwdMxUAJYpVsKnA7PFPSFJOx/abNsVZHNSe7ZFGgGdaH/lqgSizA==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -22017,9 +22070,9 @@ } }, "remark-lint-file-extension": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-file-extension/-/remark-lint-file-extension-3.0.0.tgz", - "integrity": "sha512-wrOKiGvcl/ftB7FkeX2/l13ALvhKXV77HGR8AXo86cVY2pD+K0WdOC52DV3ldgpUXpWzE9kcgF8bbkxwzKpFFg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-file-extension/-/remark-lint-file-extension-3.0.1.tgz", + "integrity": "sha512-1Ca5Dgu9J/j1fb7nvzNXh2xy4ija03igiP5i4le64LfrlloGax4VWcG/M7uL+CpRTFVqEJMWw0iKDEZxYSgImg==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -22102,9 +22155,9 @@ } }, "remark-lint-final-definition": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/remark-lint-final-definition/-/remark-lint-final-definition-4.0.1.tgz", - "integrity": "sha512-51T9oSdA7wuhjSdgGo0snO1BY39Igt9cJQi7XpgtgFsbfQk8zSSAUAc/rLabY6+YCTpcPs6qmwvLXZ4mPX6Qlg==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/remark-lint-final-definition/-/remark-lint-final-definition-4.0.2.tgz", + "integrity": "sha512-fz3UAcFQef77Zb8rz4za2R6y7pdyJot22iGtFoNIKdtbcNa8IKKEVoY3NIfrsLfhrjwzcha1Sp3fFA9NF6lc4w==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -22220,9 +22273,9 @@ } }, "remark-lint-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-final-newline/-/remark-lint-final-newline-3.0.0.tgz", - "integrity": "sha512-NaPyn6FiOn3IV/6gIcwWfJmgraPT2IaVLjhakfPglZkKVfn/FrOfETyY8Bp+HLoSRI9967OH0yRDnK7/pPIWeQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-final-newline/-/remark-lint-final-newline-3.0.1.tgz", + "integrity": "sha512-q5diKHD6BMbzqWqgvYPOB8AJgLrMzEMBAprNXjcpKoZ/uCRqly+gxjco+qVUMtMWSd+P+KXZZEqoa7Y6QiOudw==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -22306,9 +22359,9 @@ } }, "remark-lint-hard-break-spaces": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-hard-break-spaces/-/remark-lint-hard-break-spaces-4.0.0.tgz", - "integrity": "sha512-zCTq7/xfM0ZL3bMopXse9DH2nk38wE1LrxmYwnTrqASBLnEAJWE2U2//tRGVMEBfSAnNvmIo96twz6zkLWjbGA==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/remark-lint-hard-break-spaces/-/remark-lint-hard-break-spaces-4.1.1.tgz", + "integrity": "sha512-AKDPDt39fvmr3yk38OKZEWJxxCOOUBE+96AsBfs+ExS5LW6oLa9041X5ahFDQHvHGzdoremEIaaElursaPEkNg==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -22431,9 +22484,9 @@ } }, "remark-lint-heading-increment": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-heading-increment/-/remark-lint-heading-increment-4.0.0.tgz", - "integrity": "sha512-TARnsjXWzY/yLwxh/y4+KnDSXO3Koue8Crp55T8G9pjj3vw+XgTAG35zSpIIY9HmGiQ2a3R0SOj2pAxATpnckg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-heading-increment/-/remark-lint-heading-increment-4.0.1.tgz", + "integrity": "sha512-uat7RTQn0hGlMv62p7yjLlg3tO3RljFbH6C+0M+5BNEF+s3NrA8jJgqW0UwLLNdCd3EABCKaWloHumT57ND7PQ==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -22538,9 +22591,9 @@ } }, "remark-lint-heading-style": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-heading-style/-/remark-lint-heading-style-4.0.0.tgz", - "integrity": "sha512-dQ6Jul5K0+aNUvrq4W7H0+osSoC9hsmwHZqBFq000+eMP/hWJqI8tuudw1rap8HHYuOsKLRbB5q+Fr7G+3Vw+Q==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-heading-style/-/remark-lint-heading-style-4.0.1.tgz", + "integrity": "sha512-+rUpJ/N2CGC5xPgZ18XgsCsUBtadgEhdTi0BJPrsFmHPzL22BUHajeg9im8Y7zphUcbi1qFiKuxZd2nzDgZSXQ==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -22716,9 +22769,9 @@ } }, "remark-lint-link-title-style": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-link-title-style/-/remark-lint-link-title-style-4.0.0.tgz", - "integrity": "sha512-cihTO5dkhjMj/evYIDAvRdQHD82OQeF4fNAq8FLb81HmFKo77VlSF6CK55H1bvlZogfJG58uN/5d1tSsOdcEbg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-link-title-style/-/remark-lint-link-title-style-4.0.1.tgz", + "integrity": "sha512-MtmnYrhjhRXR0zeiyYf/7GBlUF5KAPypJb345KjyDluOhI4Wj4VAXvVQuov/MFc3y8p/1yVwv3QDYv6yue8/wQ==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -22831,9 +22884,9 @@ } }, "remark-lint-list-item-bullet-indent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-list-item-bullet-indent/-/remark-lint-list-item-bullet-indent-5.0.0.tgz", - "integrity": "sha512-qq22QaxsDjfsL7aWGIPmP3P0N99CJBQQW1+iSrhYAMCDzqVlw6I3wPNAeR6s8mcoeHT8YlT6eQH3V8xJ0SlW6w==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-list-item-bullet-indent/-/remark-lint-list-item-bullet-indent-5.0.1.tgz", + "integrity": "sha512-LKuTxkw5aYChzZoF3BkfaBheSCHs0T8n8dPHLQEuOLo6iC5wy98iyryz0KZ61GD8stlZgQO2KdWSdnP6vr40Iw==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -22926,9 +22979,9 @@ } }, "remark-lint-list-item-content-indent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-list-item-content-indent/-/remark-lint-list-item-content-indent-4.0.0.tgz", - "integrity": "sha512-L4GZgWQQ54qWKbnDle3dbEOtnq+qdmZJ70lpM3yMFEMHs4xejqPKsIoiYeUtIV0rYHHCWS7IlLzcgYUK9vENQw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-list-item-content-indent/-/remark-lint-list-item-content-indent-4.0.1.tgz", + "integrity": "sha512-KSopxxp64O6dLuTQ2sWaTqgjKWr1+AoB1QCTektMJ3mfHfn0QyZzC2CZbBU22KGzBhiYXv9cIxlJlxUtq2NqHg==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -23043,9 +23096,9 @@ } }, "remark-lint-list-item-indent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-list-item-indent/-/remark-lint-list-item-indent-4.0.0.tgz", - "integrity": "sha512-Yd6/g8CH9e4vlPAPNgl7F575uKhP+pTo/qwGkE61GOcgEVNJ/529hjumUhyQ4sOAX0YAPAjxvq6fJvb4AhVOOA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-list-item-indent/-/remark-lint-list-item-indent-4.0.1.tgz", + "integrity": "sha512-gJd1Q+jOAeTgmGRsdMpnRh01DUrAm0O5PCQxE8ttv1QZOV015p/qJH+B4N6QSmcUuPokHLAh9USuq05C73qpiA==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -23276,9 +23329,9 @@ } }, "remark-lint-maximum-heading-length": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-maximum-heading-length/-/remark-lint-maximum-heading-length-4.0.0.tgz", - "integrity": "sha512-UCQxUd0zZyi6RUbpoK5KsxC50ppVqVk0hSgrSPot4wB6PHRgYMALU2fDkEcAjLDc/Y2TayG3IaZEKdqe+84Cwg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/remark-lint-maximum-heading-length/-/remark-lint-maximum-heading-length-4.1.1.tgz", + "integrity": "sha512-99yonukJ+e0uhx0zGH4uq6H9mhO7FA1ufmuToODH1N+X3ja61Grvlvvlq9UbP9+gbfbWgN97QGKPaTlE29FpaQ==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -23528,9 +23581,9 @@ } }, "remark-lint-no-blockquote-without-marker": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-blockquote-without-marker/-/remark-lint-no-blockquote-without-marker-6.0.0.tgz", - "integrity": "sha512-fBhoTpkWcl5tG4FdwPdJIyb8XLrdr6MdLk1+K2BQ6Rom3rRsIYvuox4ohxOunNrXuth8xyw8kC6wDmODR44oFw==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-blockquote-without-marker/-/remark-lint-no-blockquote-without-marker-6.0.1.tgz", + "integrity": "sha512-b4IOkNcG7C16HYAdKUeAhO7qPt45m+v7SeYbVrqvbSFtlD3EUBL8fgHRgLK1mdujFXDP1VguOEMx+Txv8JOT4w==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -23647,9 +23700,9 @@ } }, "remark-lint-no-consecutive-blank-lines": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-consecutive-blank-lines/-/remark-lint-no-consecutive-blank-lines-5.0.0.tgz", - "integrity": "sha512-HsDZbFlelBVO3mEJDXd9v4z0HLB8pqxWnsV+I4ILYFp5lKYf6NxJaLBWFtP1gAg1+95WxityGLkGtYqmicDjpg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-consecutive-blank-lines/-/remark-lint-no-consecutive-blank-lines-5.0.1.tgz", + "integrity": "sha512-yLtYCrEBtGDao4ozmZruRzjMYAcBVFK69PoYjPfNwFO8pQ/LPt8KCq6oyg1ronNyRbDYEGqVdLIHcT/zL3LjPA==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -23886,9 +23939,9 @@ } }, "remark-lint-no-duplicate-definitions": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-duplicate-definitions/-/remark-lint-no-duplicate-definitions-4.0.0.tgz", - "integrity": "sha512-21fcOACkCyhNsHkedKlpvqIywYx+5zGR507bW8e59gzdGhTbnBwQ9du4ACmN9jxPTfIBhUVMz0bWezkGrHE7Bg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-duplicate-definitions/-/remark-lint-no-duplicate-definitions-4.0.1.tgz", + "integrity": "sha512-Ek+A/xDkv5Nn+BXCFmf+uOrFSajCHj6CjhsHjtROgVUeEPj726yYekDBoDRA0Y3+z+U30AsJoHgf/9Jj1IFSug==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -23993,9 +24046,9 @@ } }, "remark-lint-no-duplicate-headings": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-duplicate-headings/-/remark-lint-no-duplicate-headings-4.0.0.tgz", - "integrity": "sha512-FgBU/JCdR5MitHM+hnOcgBGO5ZCNV8epzuHIglFlJeb8ow23YhhNgmGvyk7RGrZrYuU5R9uQq23N4dF0g9atCA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-duplicate-headings/-/remark-lint-no-duplicate-headings-4.0.1.tgz", + "integrity": "sha512-6lggqnpIe5FepikjYF2me3ovKV4oD/rAz8WmwVbLR2cLkce1iH+PB7jyxk/A2gQQqrDcIlRMA5Ct2Yj56cEwhQ==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -24110,9 +24163,9 @@ } }, "remark-lint-no-emphasis-as-heading": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-emphasis-as-heading/-/remark-lint-no-emphasis-as-heading-4.0.0.tgz", - "integrity": "sha512-JViGYbuO/xzZThK+qVTNjtLM0v1xMTWFTWt2OJzAkDaGS6T9ZB5ZtRVSBFEMG0SF3dvpJwxe+3ABTsuPBdlYsA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-emphasis-as-heading/-/remark-lint-no-emphasis-as-heading-4.0.1.tgz", + "integrity": "sha512-zzI/C330qdKO9FB3h6IUtOG36FSrS5nfJ7qxp0atXGYtHyg+Ag7dPC/0FzchOVsxofQm0QTstVoIARt/9TiN5g==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -24267,9 +24320,9 @@ } }, "remark-lint-no-empty-url": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-empty-url/-/remark-lint-no-empty-url-4.0.0.tgz", - "integrity": "sha512-2zJxrSnL42wGe+CSZepBzoj8d/FeL/QU8GM6TEO/5qGfXwvJD7s2v6q074UJU0CAaWlWRqSxElescwk3yGQddA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-empty-url/-/remark-lint-no-empty-url-4.0.1.tgz", + "integrity": "sha512-FSQIO+Q63kNNSUfbvvWPz6ES4q1gJIc4aMjohch9bfKwcv6wWZc6UkjlMMi823I124p6onrY/F8KKECv06H5YQ==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -24371,9 +24424,9 @@ } }, "remark-lint-no-file-name-articles": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-articles/-/remark-lint-no-file-name-articles-3.0.0.tgz", - "integrity": "sha512-il4IseupahbV2TVfFjfDVL/EQw7jBWVlMVsv4K2cgl5uPIjiCjFGQypqKnWl6pZDN0oNOs/DE8gBdyuDjldJaA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-articles/-/remark-lint-no-file-name-articles-3.0.1.tgz", + "integrity": "sha512-h31ZDDJV2T6g9WLBrXg1CJ1m8M170O/tlDPAEPGCa/rxwKvMcfum4yicaot0ZKbUZ1uEPjVSUPDeo3sU0zciCQ==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -24455,9 +24508,9 @@ } }, "remark-lint-no-file-name-consecutive-dashes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-consecutive-dashes/-/remark-lint-no-file-name-consecutive-dashes-3.0.0.tgz", - "integrity": "sha512-3vSI1LOQlu8NSCpWLsKELa8dS9HU+YVZE0U43/DNkdEcnZmlJLpTHQjBTMZUHQipRgoOO+TOSyXFyN/H+2lbuQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-consecutive-dashes/-/remark-lint-no-file-name-consecutive-dashes-3.0.1.tgz", + "integrity": "sha512-qGJRZ81sowEjv1dBodbHZ29pDZbrFpxiQQ6gBvkkHkkoYPekdnr8iUxmV38HcqH8+JNW1O4ELr+m71AA9/34Mw==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -24539,9 +24592,9 @@ } }, "remark-lint-no-file-name-irregular-characters": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-irregular-characters/-/remark-lint-no-file-name-irregular-characters-3.0.0.tgz", - "integrity": "sha512-DhGreliHNU7lLTARQujsaLAn8fUPY0V+H0LSmOUuowBZPtIRWeNdQhunSp96RvsuYdqAdERXe0WuH58i3pRqrg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-irregular-characters/-/remark-lint-no-file-name-irregular-characters-3.0.1.tgz", + "integrity": "sha512-kNm16eDnPqbN05W0RLIedHi40YzHf1esPHbNKv12AljKWptdCTS72uGjAbqUSZ48dRoKtJzL0HJ0OAqXIWUyxA==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -24623,9 +24676,9 @@ } }, "remark-lint-no-file-name-mixed-case": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-mixed-case/-/remark-lint-no-file-name-mixed-case-3.0.0.tgz", - "integrity": "sha512-MXXNHdGB6P46itkf8gRP0kxQL85KfAj9YOOBqNtGsgI/8J5rsyM/rz1Ac20Xe+5C5oGi71+7EO/TExKu/+7dfw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-mixed-case/-/remark-lint-no-file-name-mixed-case-3.0.1.tgz", + "integrity": "sha512-cXVY0gM6DIHHK+mUhQVZ/WLh4cNfzEDpM54LNJBnflR9n9r6eNLR3JlWFRviTL4xRrQ5FXisBSlBa87BquiFVA==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -24707,9 +24760,9 @@ } }, "remark-lint-no-file-name-outer-dashes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-outer-dashes/-/remark-lint-no-file-name-outer-dashes-3.0.0.tgz", - "integrity": "sha512-3kgamCp39mdlCtqF/+JLwwS4VpSj5wvVwRythUfrpW7993I9kF67dBsaU545aEzWSK+UJZqjb40i0m2VfnBRfQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-outer-dashes/-/remark-lint-no-file-name-outer-dashes-3.0.1.tgz", + "integrity": "sha512-QIMrBPZKZ6BwQRPM65HhEHcJv6+wZnZ4z2ikvx2ht40cSmIN7ZTL7wKKJlnpF+4Ioi9XUj+cRHWqEhwJ9LCQIw==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -24791,9 +24844,9 @@ } }, "remark-lint-no-heading-content-indent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-heading-content-indent/-/remark-lint-no-heading-content-indent-5.0.0.tgz", - "integrity": "sha512-psYSlD2BjcVkgpeXOLwPcYFBrbtJWp8E8JX1J4vSfoHPeY6aIxgYxXkf57cjGTApfRL8xawBmMDiF1FgQvpZYg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-heading-content-indent/-/remark-lint-no-heading-content-indent-5.0.1.tgz", + "integrity": "sha512-YIWktnZo7M9aw7PGnHdshvetSH3Y0qW+Fm143R66zsk5lLzn1XA5NEd/MtDzP8tSxxV+gcv+bDd5St1QUI4oSQ==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -24907,9 +24960,9 @@ } }, "remark-lint-no-heading-indent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-heading-indent/-/remark-lint-no-heading-indent-5.0.0.tgz", - "integrity": "sha512-JWGIWhaEzH00HywI0DHex92tJ5Mw7l11shQ6/MGhRjYsHMRWcwWcVeOuktVMe/BiQbg0hRoE4+g0z2VgUD6Cqw==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-heading-indent/-/remark-lint-no-heading-indent-5.0.1.tgz", + "integrity": "sha512-R/KkR9Qfh0AM3asadSnQQXMHu6BNZxPbxLI9h9JBPIZM+EtzycDlhaAHbOlQUdaHA5UEANhYENZBLrueH50Cdg==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -25023,9 +25076,9 @@ } }, "remark-lint-no-heading-like-paragraph": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-heading-like-paragraph/-/remark-lint-no-heading-like-paragraph-4.0.0.tgz", - "integrity": "sha512-6P22xHF+2omrQUA9ujQ5yBUlZr3goaAxoa1t3wNSIydzqkbgwLS+RlpGsVvilW1Q8h4JgWpB42Zpflat6xr90g==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-heading-like-paragraph/-/remark-lint-no-heading-like-paragraph-4.0.1.tgz", + "integrity": "sha512-1sscTjv/F/mK5cNThz6fu57xcLgLdB0rl9vJ3BEwh7U4V5cIKp1tdFQhaguweSBnKCjCVaiU7HsEdle01Ai07Q==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -25254,9 +25307,9 @@ } }, "remark-lint-no-literal-urls": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-literal-urls/-/remark-lint-no-literal-urls-4.0.0.tgz", - "integrity": "sha512-rl/3Ai4Ax9IH/fRpOJZuXk1HgYX6oFTauhmBOilpqbq/YT2kN3FuXaneXdRfKv1bgMdHaLKxHWxGj/mDyA2n8w==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-literal-urls/-/remark-lint-no-literal-urls-4.0.1.tgz", + "integrity": "sha512-RhTANFkFFXE6bM+WxWcPo2TTPEfkWG3lJZU50ycW7tJJmxUzDNzRed/z80EVJIdGwFa0NntVooLUJp3xrogalQ==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -25379,9 +25432,9 @@ } }, "remark-lint-no-multiple-toplevel-headings": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-multiple-toplevel-headings/-/remark-lint-no-multiple-toplevel-headings-4.0.0.tgz", - "integrity": "sha512-JW11iYxza7asDdhQuKfr8SH1u4NBOCQ4U7Ru0HrKCPcT4y/AB1C1il5uMQzbcervgYPBq69xzyQ24+AJeL0t3A==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-multiple-toplevel-headings/-/remark-lint-no-multiple-toplevel-headings-4.0.1.tgz", + "integrity": "sha512-8sepobIOu3PlDOuMH7jtri+LH4tFNVQU+aqKSkrlNRdp831fYz9S+jA2crTVqWqxVbTwiF96uJWePv8/9qmHnA==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -25486,9 +25539,9 @@ } }, "remark-lint-no-reference-like-url": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-reference-like-url/-/remark-lint-no-reference-like-url-4.0.0.tgz", - "integrity": "sha512-YkP8qWdrWDr9s8JLbJoC/U5Z0fU7hpa59Nin0i8zEOtD9coiYoI/YtXRKqSXuAKDmweb+JckhqtKuGJS5u77+w==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-reference-like-url/-/remark-lint-no-reference-like-url-4.0.1.tgz", + "integrity": "sha512-GXS73779bPnJSqvCfOK2XzGzCWL5ggyk53KE049oOYTS55vmc26PjeW+ykbGfXIazRazZ1DLGaAqNoU9jCnZ4w==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -25624,9 +25677,9 @@ } }, "remark-lint-no-shell-dollars": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-shell-dollars/-/remark-lint-no-shell-dollars-4.0.0.tgz", - "integrity": "sha512-ye2h8FzjsgqqQV0HHN2g9N4FqI3eD9Gpgu7tU5ADIJyQ3mUJdwBoFn7IlGnpmumR1fb/l6u/AhRavIZxXYqG+Q==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-shell-dollars/-/remark-lint-no-shell-dollars-4.0.1.tgz", + "integrity": "sha512-UPE1DNCIkLtnS3YFD065Gkq5lQqfndBDpX8Ct/Zjn7M0/hzCyf9B6tpwCU0I20m9jzhS/CSY6mxYnAiEg+KkFA==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -25730,9 +25783,9 @@ } }, "remark-lint-no-shortcut-reference-image": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-shortcut-reference-image/-/remark-lint-no-shortcut-reference-image-4.0.0.tgz", - "integrity": "sha512-YEiCpW5F/8/LZyxlOuVK2L/n0NJ1AB0AJK7oP39OVyEk3Xl7w+JQi6nZ3KiH6REh+PWGqKn6M0KEPL9cT/iAOw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-shortcut-reference-image/-/remark-lint-no-shortcut-reference-image-4.0.1.tgz", + "integrity": "sha512-hQhJ3Dr8ZWRdj7qm6+9vcPpqtGchhENA2UHOmcTraLf6dN1cFATCgY/HbTbRIN6NkG/EEClTgRC1QCokWR2Mmw==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -25938,9 +25991,9 @@ } }, "remark-lint-no-table-indentation": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-table-indentation/-/remark-lint-no-table-indentation-5.0.0.tgz", - "integrity": "sha512-MaLmnzgirpnRiRjWwrsyOX0RmP2eG4YAv169MtsxTVa6O3CpUDwTuTzivudE9L0kVvTlyF9DXEmdyjm85LDyVA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-table-indentation/-/remark-lint-no-table-indentation-5.0.1.tgz", + "integrity": "sha512-LHw9MGsuilM+3HkbRFZmdSE4T+sziaQzULH5ImYkLH2MLF8GKnAm2mgtveLZcW01wqFV2oEbpF1Y/s/QloXT7w==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -26056,9 +26109,9 @@ } }, "remark-lint-no-tabs": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-tabs/-/remark-lint-no-tabs-4.0.0.tgz", - "integrity": "sha512-rQR7LDdcw047ajB3D+v9uzdB8aZfZtEdlUJvQXKkcVDteWiuXGC3PcIrmM/8n3J/wlFMuwoAaW2IcdlJf8HzXQ==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-tabs/-/remark-lint-no-tabs-4.0.1.tgz", + "integrity": "sha512-+lhGUgY3jhTwWn1x+tTIJNy5Fbs2NcYXCobRY7xeszY0VKPCBF2GyELafOVnr+iTmosXLuhZPp5YwNezQKH9IQ==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -26259,9 +26312,9 @@ } }, "remark-lint-no-unused-definitions": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-no-unused-definitions/-/remark-lint-no-unused-definitions-4.0.0.tgz", - "integrity": "sha512-YCZ6k575NCTx7mnN+9ls0G6YgMsZHi0LYQqfLW8MNVHBtbpTBvfmk8I39bmsvuKWeBD98weZoXSDqIiIGg+Q/g==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-no-unused-definitions/-/remark-lint-no-unused-definitions-4.0.1.tgz", + "integrity": "sha512-AdMbaCeMpj32HvDUuyI+bQyu/405Nby/rgFW8XDpI7U7ufPhHl+jj9J4NgeW7Z8DrODGr0iFgPNt6JtNLskFdA==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -26375,9 +26428,9 @@ } }, "remark-lint-ordered-list-marker-style": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-ordered-list-marker-style/-/remark-lint-ordered-list-marker-style-4.0.0.tgz", - "integrity": "sha512-xZ7Xppy5fzACH4b9h1b4lTzVtNY2AlUkNTfl1Oe6cIKN8tk3juFxN0wL2RpktPtSZ7iRIabzFmg6l8WPhlASJA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-ordered-list-marker-style/-/remark-lint-ordered-list-marker-style-4.0.1.tgz", + "integrity": "sha512-vZTAbstcBPbGwJacwldGzdGmKwy5/4r29SZ9nQkME4alEl5B1ReSBlYa8t7QnTSW7+tqvA9Sg71RPadgAKWa4w==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -26492,9 +26545,9 @@ } }, "remark-lint-ordered-list-marker-value": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-ordered-list-marker-value/-/remark-lint-ordered-list-marker-value-4.0.0.tgz", - "integrity": "sha512-7UjNU2Nv9LGEONTU9GPmTVoNoGKD5aL1X2xHzMbSJiTc50bfcazYqZawO+qj1pQ04WPhto1qHnl0HRB5wwSVwA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-ordered-list-marker-value/-/remark-lint-ordered-list-marker-value-4.0.1.tgz", + "integrity": "sha512-HQb1MrArvApREC1/I6bkiFlZVDjngsuII29n8E8StnAaHOMN3hVYy6wJ9Uk+O3+X9O8v7fDsZPqFUHSfJhERXQ==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -26610,9 +26663,9 @@ } }, "remark-lint-rule-style": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-rule-style/-/remark-lint-rule-style-4.0.0.tgz", - "integrity": "sha512-Kt7IHMB5IbLgRFKaFUmB895sV3PTD0MBgN9CvXKxr1wHFF43S6tabjFIBSoQqyJRlhH0S3rK6Lvopofa009gLg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-rule-style/-/remark-lint-rule-style-4.0.1.tgz", + "integrity": "sha512-gl1Ft13oTS3dJUCsWZzxD/5dAwI1HON67KU7uNfODD5gXJ8Y11deOWbun190ma7XbYdD7P0l8VT2HeRtEQzrWg==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -26726,9 +26779,9 @@ } }, "remark-lint-strong-marker": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-strong-marker/-/remark-lint-strong-marker-4.0.0.tgz", - "integrity": "sha512-YcvuzakYhQWdCH+1E30sUY+wyvq+PNa77NZAMAYO/cS/pZczFB+q4Ccttw4Q+No/chX8oMfe0GYtm8dDWLei/g==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-strong-marker/-/remark-lint-strong-marker-4.0.1.tgz", + "integrity": "sha512-KaGtj/OWEP4eoafevnlp3NsEVwC7yGEjBJ6uFMzfjNoXyjATdfZ2euB/AfKVt/A/FdZeeMeVoAUFH4DL+hScLQ==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -26841,9 +26894,9 @@ } }, "remark-lint-table-cell-padding": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-table-cell-padding/-/remark-lint-table-cell-padding-5.0.0.tgz", - "integrity": "sha512-LNyiHDQZBIOqcQGG1tYsZHW7g0v8OyRmRgDrD5WEsMaAYfM6EiECUokN/Q4py9h4oM/2KUSrdZbtfuZmy87/kA==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/remark-lint-table-cell-padding/-/remark-lint-table-cell-padding-5.1.1.tgz", + "integrity": "sha512-6fgVA1iINBoAJaZMOnSsxrF9Qj9+hmCqrsrqZqgJJETjT1ODGH64iAN1/6vHR7dIwmy73d6ysB2WrGyKhVlK3A==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -26960,9 +27013,9 @@ } }, "remark-lint-table-pipe-alignment": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-table-pipe-alignment/-/remark-lint-table-pipe-alignment-4.0.0.tgz", - "integrity": "sha512-nx+xpEIWQRLOcq9hIbUIvhSE1NYRmDJmCY3cMoHJ1sIW7dRXMHyWfpWTgu7mpREKwSQdE0q4qnzk8McQQSkIcg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/remark-lint-table-pipe-alignment/-/remark-lint-table-pipe-alignment-4.1.1.tgz", + "integrity": "sha512-9VxivIJaDonrd/Jgkim1oYQ5MIqhWmyJggr2AqtiizwqxT4epRsWmLOz+/sk7PtTGoT/MtwndhlbM3lxuVXFow==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -27078,9 +27131,9 @@ } }, "remark-lint-table-pipes": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-table-pipes/-/remark-lint-table-pipes-5.0.0.tgz", - "integrity": "sha512-e7jzAScDrt5+eMomh099TZJBN2K9ldDxBu9iYhNu5C0YsdAvnckJkgilsuClxFpmx4LCVYaX0EGbt/hQ3LB3xg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-table-pipes/-/remark-lint-table-pipes-5.0.1.tgz", + "integrity": "sha512-oOkRC0WRRDwvodfffGafoBFBTGwy9udQgKtxN53apmZpOmaUAxTi833ite0jMo078+LehNftO5bxrElZ9EQUlQ==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -27194,9 +27247,9 @@ } }, "remark-lint-unordered-list-marker-style": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/remark-lint-unordered-list-marker-style/-/remark-lint-unordered-list-marker-style-4.0.0.tgz", - "integrity": "sha512-XlP4Wr4KJNovyWVv0H5axfUlF23iE9Kt2SxaVq4+ieum5YcMmKE6KsL+aqt3kiJb60SH1u6a0bxKFvdM/9riOA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-lint-unordered-list-marker-style/-/remark-lint-unordered-list-marker-style-4.0.1.tgz", + "integrity": "sha512-HMrVQC0Qbr8ktSy+1lJGRGU10qecL3T14L6s/THEQXR5Tk0wcsLLG0auNvB4r2+H+ClhVO/Vnm1TEosh1OCsfw==", "dev": true, "requires": { "@types/mdast": "^4.0.0", @@ -27490,9 +27543,9 @@ } }, "remark-preset-lint-consistent": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/remark-preset-lint-consistent/-/remark-preset-lint-consistent-6.0.0.tgz", - "integrity": "sha512-W3fwxajdietwjnFyTH5x2le63hxWGVOXxIs7KjRqU+5wkkN6ZQyuwPeeomblmS9wQr50fkidhXNHNDyCXtqgxQ==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/remark-preset-lint-consistent/-/remark-preset-lint-consistent-6.0.1.tgz", + "integrity": "sha512-SOLdA36UOU1hiGFm6HAqN9+DORGJPVWxU/EvPVkknTr9V4ULhlzHEJ8OVRMVX3jqoy4lrwb4IqiboVz0YLA7+Q==", "dev": true, "requires": { "remark-lint": "^10.0.0", @@ -27566,9 +27619,9 @@ } }, "remark-preset-lint-markdown-style-guide": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/remark-preset-lint-markdown-style-guide/-/remark-preset-lint-markdown-style-guide-6.0.0.tgz", - "integrity": "sha512-izsfNTHeqrRP64VWV6OdJnSUDwKFSthMKiiDcu14ODpPV0t7YiotCQWzgc7L4eW9Ctcp4aB4nHNLSuDmwhEWrQ==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/remark-preset-lint-markdown-style-guide/-/remark-preset-lint-markdown-style-guide-6.0.1.tgz", + "integrity": "sha512-hVCRMC8PZlI9hnXkZdrvg4n4j1aD//xHWj26Q7iFAbDB3JKtW1Ne72P7QNVyppmdrR6Gj84zhG3qphOLo8/i8A==", "dev": true, "requires": { "remark-lint": "^10.0.0", @@ -27671,9 +27724,9 @@ } }, "remark-preset-lint-recommended": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/remark-preset-lint-recommended/-/remark-preset-lint-recommended-7.0.0.tgz", - "integrity": "sha512-A9aPDL78OO12xG2a83DVd+M2QzdBMjn545fbXj40BFJdpt9t//MADkPAwRfpMCBkKi+iECPUTFCb3Jm8SsFG2w==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/remark-preset-lint-recommended/-/remark-preset-lint-recommended-7.0.1.tgz", + "integrity": "sha512-j1CY5u48PtZl872BQ40uWSQMT3R4gXKp0FUgevMu5gW7hFMtvaCiDq+BfhzeR8XKKiW9nIMZGfIMZHostz5X4g==", "dev": true, "requires": { "remark-lint": "^10.0.0", diff --git a/package.json b/package.json index 244d6aae0d..9f93b4bc98 100644 --- a/package.json +++ b/package.json @@ -32,65 +32,65 @@ "remark-cli": "^12.0.1", "remark-frontmatter": "^5.0.0", "remark-heading-gap": "^6.0.0", - "remark-lint": "^10.0.0", - "remark-lint-blockquote-indentation": "^4.0.0", - "remark-lint-checkbox-character-style": "^5.0.0", - "remark-lint-checkbox-content-indent": "^5.0.0", + "remark-lint": "^10.0.1", + "remark-lint-blockquote-indentation": "^4.0.1", + "remark-lint-checkbox-character-style": "^5.0.1", + "remark-lint-checkbox-content-indent": "^5.0.1", "remark-lint-code": "^2.0.0", - "remark-lint-code-block-style": "^4.0.0", - "remark-lint-definition-case": "^4.0.0", - "remark-lint-definition-spacing": "^4.0.0", - "remark-lint-fenced-code-flag": "^4.0.0", - "remark-lint-fenced-code-marker": "^4.0.0", - "remark-lint-file-extension": "^3.0.0", - "remark-lint-final-definition": "^4.0.1", - "remark-lint-final-newline": "^3.0.0", - "remark-lint-hard-break-spaces": "^4.0.0", - "remark-lint-heading-increment": "^4.0.0", - "remark-lint-heading-style": "^4.0.0", + "remark-lint-code-block-style": "^4.0.1", + "remark-lint-definition-case": "^4.0.1", + "remark-lint-definition-spacing": "^4.0.1", + "remark-lint-fenced-code-flag": "^4.1.1", + "remark-lint-fenced-code-marker": "^4.0.1", + "remark-lint-file-extension": "^3.0.1", + "remark-lint-final-definition": "^4.0.2", + "remark-lint-final-newline": "^3.0.1", + "remark-lint-hard-break-spaces": "^4.1.1", + "remark-lint-heading-increment": "^4.0.1", + "remark-lint-heading-style": "^4.0.1", "remark-lint-heading-whitespace": "^1.0.0", - "remark-lint-link-title-style": "^4.0.0", - "remark-lint-list-item-bullet-indent": "^5.0.0", - "remark-lint-list-item-content-indent": "^4.0.0", - "remark-lint-list-item-indent": "^4.0.0", - "remark-lint-maximum-heading-length": "^4.0.0", - "remark-lint-no-blockquote-without-marker": "^6.0.0", - "remark-lint-no-consecutive-blank-lines": "^5.0.0", + "remark-lint-link-title-style": "^4.0.1", + "remark-lint-list-item-bullet-indent": "^5.0.1", + "remark-lint-list-item-content-indent": "^4.0.1", + "remark-lint-list-item-indent": "^4.0.1", + "remark-lint-maximum-heading-length": "^4.1.1", + "remark-lint-no-blockquote-without-marker": "^6.0.1", + "remark-lint-no-consecutive-blank-lines": "^5.0.1", "remark-lint-no-dead-urls": "^2.0.1", - "remark-lint-no-duplicate-definitions": "^4.0.0", - "remark-lint-no-duplicate-headings": "^4.0.0", - "remark-lint-no-emphasis-as-heading": "^4.0.0", + "remark-lint-no-duplicate-definitions": "^4.0.1", + "remark-lint-no-duplicate-headings": "^4.0.1", + "remark-lint-no-emphasis-as-heading": "^4.0.1", "remark-lint-no-empty-sections": "^4.0.0", - "remark-lint-no-empty-url": "^4.0.0", - "remark-lint-no-file-name-articles": "^3.0.0", - "remark-lint-no-file-name-consecutive-dashes": "^3.0.0", - "remark-lint-no-file-name-irregular-characters": "^3.0.0", - "remark-lint-no-file-name-mixed-case": "^3.0.0", - "remark-lint-no-file-name-outer-dashes": "^3.0.0", - "remark-lint-no-heading-content-indent": "^5.0.0", - "remark-lint-no-heading-indent": "^5.0.0", - "remark-lint-no-heading-like-paragraph": "^4.0.0", - "remark-lint-no-literal-urls": "^4.0.0", - "remark-lint-no-multiple-toplevel-headings": "^4.0.0", - "remark-lint-no-reference-like-url": "^4.0.0", + "remark-lint-no-empty-url": "^4.0.1", + "remark-lint-no-file-name-articles": "^3.0.1", + "remark-lint-no-file-name-consecutive-dashes": "^3.0.1", + "remark-lint-no-file-name-irregular-characters": "^3.0.1", + "remark-lint-no-file-name-mixed-case": "^3.0.1", + "remark-lint-no-file-name-outer-dashes": "^3.0.1", + "remark-lint-no-heading-content-indent": "^5.0.1", + "remark-lint-no-heading-indent": "^5.0.1", + "remark-lint-no-heading-like-paragraph": "^4.0.1", + "remark-lint-no-literal-urls": "^4.0.1", + "remark-lint-no-multiple-toplevel-headings": "^4.0.1", + "remark-lint-no-reference-like-url": "^4.0.1", "remark-lint-no-repeat-punctuation": "^0.1.4", - "remark-lint-no-shell-dollars": "^4.0.0", - "remark-lint-no-shortcut-reference-image": "^4.0.0", - "remark-lint-no-table-indentation": "^5.0.0", - "remark-lint-no-tabs": "^4.0.0", - "remark-lint-no-unused-definitions": "^4.0.0", - "remark-lint-ordered-list-marker-style": "^4.0.0", - "remark-lint-ordered-list-marker-value": "^4.0.0", - "remark-lint-rule-style": "^4.0.0", - "remark-lint-strong-marker": "^4.0.0", - "remark-lint-table-cell-padding": "^5.0.0", - "remark-lint-table-pipe-alignment": "^4.0.0", - "remark-lint-table-pipes": "^5.0.0", - "remark-lint-unordered-list-marker-style": "^4.0.0", + "remark-lint-no-shell-dollars": "^4.0.1", + "remark-lint-no-shortcut-reference-image": "^4.0.1", + "remark-lint-no-table-indentation": "^5.0.1", + "remark-lint-no-tabs": "^4.0.1", + "remark-lint-no-unused-definitions": "^4.0.1", + "remark-lint-ordered-list-marker-style": "^4.0.1", + "remark-lint-ordered-list-marker-value": "^4.0.1", + "remark-lint-rule-style": "^4.0.1", + "remark-lint-strong-marker": "^4.0.1", + "remark-lint-table-cell-padding": "^5.1.1", + "remark-lint-table-pipe-alignment": "^4.1.1", + "remark-lint-table-pipes": "^5.0.1", + "remark-lint-unordered-list-marker-style": "^4.0.1", "remark-lint-write-good": "^1.2.0", - "remark-preset-lint-consistent": "^6.0.0", - "remark-preset-lint-markdown-style-guide": "^6.0.0", - "remark-preset-lint-recommended": "^7.0.0", + "remark-preset-lint-consistent": "^6.0.1", + "remark-preset-lint-markdown-style-guide": "^6.0.1", + "remark-preset-lint-recommended": "^7.0.1", "remark-retext": "^6.0.0", "remark-textr": "^6.1.0", "remark-validate-links": "^13.0.2" From 972ce7138792faf19fc76e12c8f1d0cdf8a6b992 Mon Sep 17 00:00:00 2001 From: Stefan Schick Date: Thu, 30 Jan 2025 15:49:04 +0100 Subject: [PATCH 044/107] Add Test and add EnumConverter --- src/GitVersion.App.Tests/ArgumentParserTests.cs | 7 +++++++ src/GitVersion.App/OverrideConfigurationOptionParser.cs | 4 +++- .../VersionCalculation/VersionStrategies.cs | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/GitVersion.App.Tests/ArgumentParserTests.cs b/src/GitVersion.App.Tests/ArgumentParserTests.cs index 6569742bb3..f4c5d197e1 100644 --- a/src/GitVersion.App.Tests/ArgumentParserTests.cs +++ b/src/GitVersion.App.Tests/ArgumentParserTests.cs @@ -533,6 +533,13 @@ private static IEnumerable OverrideConfigWithSingleOptionTestData( UpdateBuildNumber = true } ); + yield return new TestCaseData( + "strategies=[\"None\",\"Mainline\"]", + new GitVersionConfiguration() + { + VersionStrategies = [ VersionStrategies.None, VersionStrategies.Mainline] + } + ); } [TestCaseSource(nameof(OverrideConfigWithMultipleOptionsTestData))] diff --git a/src/GitVersion.App/OverrideConfigurationOptionParser.cs b/src/GitVersion.App/OverrideConfigurationOptionParser.cs index 9b85428f71..1d4d6fa985 100644 --- a/src/GitVersion.App/OverrideConfigurationOptionParser.cs +++ b/src/GitVersion.App/OverrideConfigurationOptionParser.cs @@ -1,4 +1,5 @@ using GitVersion.Configuration; +using GitVersion.VersionCalculation; namespace GitVersion; @@ -45,7 +46,8 @@ private static bool IsSupportedPropertyType(Type propertyType) return unwrappedType == typeof(string) || unwrappedType.IsEnum || unwrappedType == typeof(int) - || unwrappedType == typeof(bool); + || unwrappedType == typeof(bool) + || unwrappedType == typeof(VersionStrategies[]); } internal void SetValue(string key, string value) => overrideConfiguration[key] = QuotedStringHelpers.UnquoteText(value); diff --git a/src/GitVersion.Core/VersionCalculation/VersionStrategies.cs b/src/GitVersion.Core/VersionCalculation/VersionStrategies.cs index 4fe020c87a..4bef24d860 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionStrategies.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionStrategies.cs @@ -1,6 +1,7 @@ namespace GitVersion.VersionCalculation; [Flags] +[JsonConverter(typeof(JsonStringEnumConverter))] public enum VersionStrategies { None = 0, From 72df047fc20f9d9a5b076f9481820b8e8bb93396 Mon Sep 17 00:00:00 2001 From: Stefan Schick Date: Fri, 31 Jan 2025 12:53:22 +0100 Subject: [PATCH 045/107] Implement custom deserializer --- .../ConfigurationSerializer.cs | 2 ++ src/GitVersion.Core/GitVersion.Core.csproj | 1 + src/GitVersion.Core/PublicAPI.Shipped.txt | 6 ++++ .../VersionCalculation/VersionStrategies.cs | 1 - .../VersionStrategiesConverter.cs | 34 +++++++++++++++++++ 5 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs diff --git a/src/GitVersion.Configuration/ConfigurationSerializer.cs b/src/GitVersion.Configuration/ConfigurationSerializer.cs index df18446214..bb87dce97a 100644 --- a/src/GitVersion.Configuration/ConfigurationSerializer.cs +++ b/src/GitVersion.Configuration/ConfigurationSerializer.cs @@ -1,3 +1,4 @@ +using GitVersion.VersionCalculation; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.TypeInspectors; @@ -8,6 +9,7 @@ internal class ConfigurationSerializer : IConfigurationSerializer { private static IDeserializer Deserializer => new DeserializerBuilder() .WithNamingConvention(HyphenatedNamingConvention.Instance) + .WithTypeConverter(VersionStrategiesConverter.Instance) .WithTypeInspector(inspector => new JsonPropertyNameInspector(inspector)) .Build(); diff --git a/src/GitVersion.Core/GitVersion.Core.csproj b/src/GitVersion.Core/GitVersion.Core.csproj index a11a076110..5f82cba761 100644 --- a/src/GitVersion.Core/GitVersion.Core.csproj +++ b/src/GitVersion.Core/GitVersion.Core.csproj @@ -15,6 +15,7 @@ + diff --git a/src/GitVersion.Core/PublicAPI.Shipped.txt b/src/GitVersion.Core/PublicAPI.Shipped.txt index e8e7ed46a5..ea6aeafe73 100644 --- a/src/GitVersion.Core/PublicAPI.Shipped.txt +++ b/src/GitVersion.Core/PublicAPI.Shipped.txt @@ -707,6 +707,12 @@ GitVersion.VersionCalculation.VersionStrategies.None = 0 -> GitVersion.VersionCa GitVersion.VersionCalculation.VersionStrategies.TaggedCommit = 8 -> GitVersion.VersionCalculation.VersionStrategies GitVersion.VersionCalculation.VersionStrategies.TrackReleaseBranches = 16 -> GitVersion.VersionCalculation.VersionStrategies GitVersion.VersionCalculation.VersionStrategies.VersionInBranchName = 32 -> GitVersion.VersionCalculation.VersionStrategies +GitVersion.VersionCalculation.VersionStrategiesConverter +GitVersion.VersionCalculation.VersionStrategiesConverter.VersionStrategiesConverter() -> void +static readonly GitVersion.VersionCalculation.VersionStrategiesConverter.Instance -> YamlDotNet.Serialization.IYamlTypeConverter! +GitVersion.VersionCalculation.VersionStrategiesConverter.Accepts(System.Type type) -> bool +GitVersion.VersionCalculation.VersionStrategiesConverter.ReadYaml(YamlDotNet.Core.IParser! parser, System.Type! type, YamlDotNet.Serialization.ObjectDeserializer! rootDeserializer) -> object? +GitVersion.VersionCalculation.VersionStrategiesConverter.WriteYaml(YamlDotNet.Core.IEmitter! emitter, object? value, System.Type! type, YamlDotNet.Serialization.ObjectSerializer! serializer) -> void GitVersion.VersionCalculation.VersionStrategyModule GitVersion.VersionCalculation.VersionStrategyModule.RegisterTypes(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void GitVersion.VersionCalculation.VersionStrategyModule.VersionStrategyModule() -> void diff --git a/src/GitVersion.Core/VersionCalculation/VersionStrategies.cs b/src/GitVersion.Core/VersionCalculation/VersionStrategies.cs index 4bef24d860..4fe020c87a 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionStrategies.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionStrategies.cs @@ -1,7 +1,6 @@ namespace GitVersion.VersionCalculation; [Flags] -[JsonConverter(typeof(JsonStringEnumConverter))] public enum VersionStrategies { None = 0, diff --git a/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs b/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs new file mode 100644 index 0000000000..fe67c5b42b --- /dev/null +++ b/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs @@ -0,0 +1,34 @@ +using YamlDotNet.Core; +using YamlDotNet.Core.Events; +using YamlDotNet.Serialization; +using YamlDotNet.Serialization.NamingConventions; + +namespace GitVersion.VersionCalculation; + +public class VersionStrategiesConverter : IYamlTypeConverter +{ + public static readonly IYamlTypeConverter Instance = new VersionStrategiesConverter(); + + public bool Accepts(Type type) + { + return type == typeof(VersionStrategies[]); + } + + public object? ReadYaml(IParser parser, Type type, ObjectDeserializer rootDeserializer) + { + string data = parser.Consume().Value; + + var deserializer = new DeserializerBuilder() + .WithNamingConvention(UnderscoredNamingConvention.Instance) // see height_in_inches in sample yml + .Build(); + + VersionStrategies[] strategies = deserializer.Deserialize(data); + + return strategies; + } + + public void WriteYaml(IEmitter emitter, object? value, Type type, ObjectSerializer serializer) + { + // Convert from an object to text during serialization. + } +} From 1bad89ada2fe3869e76a2e9a5b8637a925cc60ec Mon Sep 17 00:00:00 2001 From: Stefan Schick Date: Fri, 31 Jan 2025 13:23:37 +0100 Subject: [PATCH 046/107] Add throw statement for serialization --- .../VersionCalculation/VersionStrategiesConverter.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs b/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs index fe67c5b42b..cefc60403b 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs @@ -30,5 +30,6 @@ public bool Accepts(Type type) public void WriteYaml(IEmitter emitter, object? value, Type type, ObjectSerializer serializer) { // Convert from an object to text during serialization. + throw new NotImplementedException(); } } From 8adfe8d39678ffd93301e85adb7816f882c3ffeb Mon Sep 17 00:00:00 2001 From: Stefan Schick Date: Fri, 31 Jan 2025 15:44:56 +0100 Subject: [PATCH 047/107] Implement Serialization --- .../VersionCalculation/VersionStrategiesConverter.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs b/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs index cefc60403b..fc8ada9478 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs @@ -29,7 +29,15 @@ public bool Accepts(Type type) public void WriteYaml(IEmitter emitter, object? value, Type type, ObjectSerializer serializer) { - // Convert from an object to text during serialization. - throw new NotImplementedException(); + VersionStrategies[] strategies = (VersionStrategies[])value!; + + var s = new SerializerBuilder() + .JsonCompatible() // <- Looks good + //.WithDefaultScalarStyle(ScalarStyle.DoubleQuoted) + //.WithNamingConvention(CamelCaseNamingConvention.Instance) + .Build(); + var data = s.Serialize(strategies); + + emitter.Emit(new Scalar(data)); } } From eaa470dab7761b7a484ab92d43a4ccf4b3d4660c Mon Sep 17 00:00:00 2001 From: Stefan Schick Date: Fri, 31 Jan 2025 16:37:36 +0100 Subject: [PATCH 048/107] Extend converter --- .../VersionStrategiesConverter.cs | 38 ++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs b/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs index fc8ada9478..e115ca5056 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs @@ -9,22 +9,34 @@ public class VersionStrategiesConverter : IYamlTypeConverter { public static readonly IYamlTypeConverter Instance = new VersionStrategiesConverter(); - public bool Accepts(Type type) - { - return type == typeof(VersionStrategies[]); - } + public bool Accepts(Type type) => type == typeof(VersionStrategies[]); public object? ReadYaml(IParser parser, Type type, ObjectDeserializer rootDeserializer) { - string data = parser.Consume().Value; - - var deserializer = new DeserializerBuilder() - .WithNamingConvention(UnderscoredNamingConvention.Instance) // see height_in_inches in sample yml - .Build(); - - VersionStrategies[] strategies = deserializer.Deserialize(data); - - return strategies; + List strategies = new(); + + if (parser.TryConsume(out var _)) + { + while (!parser.TryConsume(out var _)) + { + string data = parser.Consume().Value; + + var strategy = Enum.Parse(data); + strategies.Add(strategy); + } + } + else + { + string data = parser.Consume().Value; + + var deserializer = new DeserializerBuilder() + .WithNamingConvention(UnderscoredNamingConvention.Instance) // see height_in_inches in sample yml + .Build(); + + strategies = deserializer.Deserialize>(data); + } + + return strategies.ToArray(); } public void WriteYaml(IEmitter emitter, object? value, Type type, ObjectSerializer serializer) From de6e886b390a63dab6dd6d8c753261b4bb2b91d3 Mon Sep 17 00:00:00 2001 From: Stefan Schick Date: Mon, 3 Feb 2025 08:36:12 +0100 Subject: [PATCH 049/107] Remove comments --- .../VersionCalculation/VersionStrategiesConverter.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs b/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs index e115ca5056..0718238ff7 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs @@ -30,7 +30,7 @@ public class VersionStrategiesConverter : IYamlTypeConverter string data = parser.Consume().Value; var deserializer = new DeserializerBuilder() - .WithNamingConvention(UnderscoredNamingConvention.Instance) // see height_in_inches in sample yml + .WithNamingConvention(UnderscoredNamingConvention.Instance) .Build(); strategies = deserializer.Deserialize>(data); @@ -44,9 +44,7 @@ public void WriteYaml(IEmitter emitter, object? value, Type type, ObjectSerializ VersionStrategies[] strategies = (VersionStrategies[])value!; var s = new SerializerBuilder() - .JsonCompatible() // <- Looks good - //.WithDefaultScalarStyle(ScalarStyle.DoubleQuoted) - //.WithNamingConvention(CamelCaseNamingConvention.Instance) + .JsonCompatible() .Build(); var data = s.Serialize(strategies); From 81267646bc82270bee9a67c8a3a628ba43b01d77 Mon Sep 17 00:00:00 2001 From: Stefan Schick Date: Mon, 3 Feb 2025 09:03:42 +0100 Subject: [PATCH 050/107] Add nullability annotation for public API --- src/GitVersion.Core/PublicAPI.Shipped.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitVersion.Core/PublicAPI.Shipped.txt b/src/GitVersion.Core/PublicAPI.Shipped.txt index ea6aeafe73..b1101b9c68 100644 --- a/src/GitVersion.Core/PublicAPI.Shipped.txt +++ b/src/GitVersion.Core/PublicAPI.Shipped.txt @@ -710,7 +710,7 @@ GitVersion.VersionCalculation.VersionStrategies.VersionInBranchName = 32 -> GitV GitVersion.VersionCalculation.VersionStrategiesConverter GitVersion.VersionCalculation.VersionStrategiesConverter.VersionStrategiesConverter() -> void static readonly GitVersion.VersionCalculation.VersionStrategiesConverter.Instance -> YamlDotNet.Serialization.IYamlTypeConverter! -GitVersion.VersionCalculation.VersionStrategiesConverter.Accepts(System.Type type) -> bool +GitVersion.VersionCalculation.VersionStrategiesConverter.Accepts(System.Type! type) -> bool GitVersion.VersionCalculation.VersionStrategiesConverter.ReadYaml(YamlDotNet.Core.IParser! parser, System.Type! type, YamlDotNet.Serialization.ObjectDeserializer! rootDeserializer) -> object? GitVersion.VersionCalculation.VersionStrategiesConverter.WriteYaml(YamlDotNet.Core.IEmitter! emitter, object? value, System.Type! type, YamlDotNet.Serialization.ObjectSerializer! serializer) -> void GitVersion.VersionCalculation.VersionStrategyModule From bd6b03c627f54f7c80e28911cfdfa93c0ebafa06 Mon Sep 17 00:00:00 2001 From: Stefan Schick Date: Mon, 3 Feb 2025 09:12:53 +0100 Subject: [PATCH 051/107] Fix formatting issue in test --- src/GitVersion.App.Tests/ArgumentParserTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GitVersion.App.Tests/ArgumentParserTests.cs b/src/GitVersion.App.Tests/ArgumentParserTests.cs index f4c5d197e1..c9d678043a 100644 --- a/src/GitVersion.App.Tests/ArgumentParserTests.cs +++ b/src/GitVersion.App.Tests/ArgumentParserTests.cs @@ -535,9 +535,9 @@ private static IEnumerable OverrideConfigWithSingleOptionTestData( ); yield return new TestCaseData( "strategies=[\"None\",\"Mainline\"]", - new GitVersionConfiguration() + new GitVersionConfiguration { - VersionStrategies = [ VersionStrategies.None, VersionStrategies.Mainline] + VersionStrategies = [VersionStrategies.None, VersionStrategies.Mainline] } ); } From 3e74e07dc01a03b00cdc1b424970ad71946e3dcd Mon Sep 17 00:00:00 2001 From: Stefan Schick Date: Tue, 4 Feb 2025 09:40:42 +0100 Subject: [PATCH 052/107] Move VersionStrategiesConverter to GitVersion.Configuration --- src/GitVersion.Configuration/ConfigurationSerializer.cs | 1 - .../VersionStrategiesConverter.cs | 5 +++-- src/GitVersion.Core/GitVersion.Core.csproj | 1 - src/GitVersion.Core/PublicAPI.Shipped.txt | 6 ------ 4 files changed, 3 insertions(+), 10 deletions(-) rename src/{GitVersion.Core/VersionCalculation => GitVersion.Configuration}/VersionStrategiesConverter.cs (91%) diff --git a/src/GitVersion.Configuration/ConfigurationSerializer.cs b/src/GitVersion.Configuration/ConfigurationSerializer.cs index bb87dce97a..9d66d0012c 100644 --- a/src/GitVersion.Configuration/ConfigurationSerializer.cs +++ b/src/GitVersion.Configuration/ConfigurationSerializer.cs @@ -1,4 +1,3 @@ -using GitVersion.VersionCalculation; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.TypeInspectors; diff --git a/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs b/src/GitVersion.Configuration/VersionStrategiesConverter.cs similarity index 91% rename from src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs rename to src/GitVersion.Configuration/VersionStrategiesConverter.cs index 0718238ff7..7d790154cf 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionStrategiesConverter.cs +++ b/src/GitVersion.Configuration/VersionStrategiesConverter.cs @@ -1,11 +1,12 @@ +using GitVersion.VersionCalculation; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; -namespace GitVersion.VersionCalculation; +namespace GitVersion.Configuration; -public class VersionStrategiesConverter : IYamlTypeConverter +internal class VersionStrategiesConverter : IYamlTypeConverter { public static readonly IYamlTypeConverter Instance = new VersionStrategiesConverter(); diff --git a/src/GitVersion.Core/GitVersion.Core.csproj b/src/GitVersion.Core/GitVersion.Core.csproj index 5f82cba761..a11a076110 100644 --- a/src/GitVersion.Core/GitVersion.Core.csproj +++ b/src/GitVersion.Core/GitVersion.Core.csproj @@ -15,7 +15,6 @@ - diff --git a/src/GitVersion.Core/PublicAPI.Shipped.txt b/src/GitVersion.Core/PublicAPI.Shipped.txt index b1101b9c68..e8e7ed46a5 100644 --- a/src/GitVersion.Core/PublicAPI.Shipped.txt +++ b/src/GitVersion.Core/PublicAPI.Shipped.txt @@ -707,12 +707,6 @@ GitVersion.VersionCalculation.VersionStrategies.None = 0 -> GitVersion.VersionCa GitVersion.VersionCalculation.VersionStrategies.TaggedCommit = 8 -> GitVersion.VersionCalculation.VersionStrategies GitVersion.VersionCalculation.VersionStrategies.TrackReleaseBranches = 16 -> GitVersion.VersionCalculation.VersionStrategies GitVersion.VersionCalculation.VersionStrategies.VersionInBranchName = 32 -> GitVersion.VersionCalculation.VersionStrategies -GitVersion.VersionCalculation.VersionStrategiesConverter -GitVersion.VersionCalculation.VersionStrategiesConverter.VersionStrategiesConverter() -> void -static readonly GitVersion.VersionCalculation.VersionStrategiesConverter.Instance -> YamlDotNet.Serialization.IYamlTypeConverter! -GitVersion.VersionCalculation.VersionStrategiesConverter.Accepts(System.Type! type) -> bool -GitVersion.VersionCalculation.VersionStrategiesConverter.ReadYaml(YamlDotNet.Core.IParser! parser, System.Type! type, YamlDotNet.Serialization.ObjectDeserializer! rootDeserializer) -> object? -GitVersion.VersionCalculation.VersionStrategiesConverter.WriteYaml(YamlDotNet.Core.IEmitter! emitter, object? value, System.Type! type, YamlDotNet.Serialization.ObjectSerializer! serializer) -> void GitVersion.VersionCalculation.VersionStrategyModule GitVersion.VersionCalculation.VersionStrategyModule.RegisterTypes(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void GitVersion.VersionCalculation.VersionStrategyModule.VersionStrategyModule() -> void From ef99d8fdb25eb0c6192559aae1c2eab3444de2c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2025 15:45:45 +0000 Subject: [PATCH 053/107] (deps): Bump Polly from 8.5.1 to 8.5.2 in /src Bumps [Polly](https://github.com/App-vNext/Polly) from 8.5.1 to 8.5.2. - [Release notes](https://github.com/App-vNext/Polly/releases) - [Changelog](https://github.com/App-vNext/Polly/blob/main/CHANGELOG.md) - [Commits](https://github.com/App-vNext/Polly/compare/8.5.1...8.5.2) --- updated-dependencies: - dependency-name: Polly dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 69f15bafea..b0ab87c29b 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -14,7 +14,7 @@ - + From 39ecbaccfbd6a30f269731e41e5122ab1d0aa7c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2025 15:40:31 +0000 Subject: [PATCH 054/107] (deps): Bump Polly from 8.5.1 to 8.5.2 in /new-cli Bumps [Polly](https://github.com/App-vNext/Polly) from 8.5.1 to 8.5.2. - [Release notes](https://github.com/App-vNext/Polly/releases) - [Changelog](https://github.com/App-vNext/Polly/blob/main/CHANGELOG.md) - [Commits](https://github.com/App-vNext/Polly/compare/8.5.1...8.5.2) --- updated-dependencies: - dependency-name: Polly dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index 0498da41e5..85e43c6011 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -11,7 +11,7 @@ - + From 1a4595c4cc302a1fd6570e02b2d4c6ba50593f66 Mon Sep 17 00:00:00 2001 From: abdullah-aleiti Date: Fri, 7 Feb 2025 16:33:36 +0300 Subject: [PATCH 055/107] docs: fix grammar --- docs/input/docs/reference/modes/continuous-delivery.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/input/docs/reference/modes/continuous-delivery.md b/docs/input/docs/reference/modes/continuous-delivery.md index ee5c1df4cf..bc93a85bc4 100644 --- a/docs/input/docs/reference/modes/continuous-delivery.md +++ b/docs/input/docs/reference/modes/continuous-delivery.md @@ -19,7 +19,7 @@ on the issues of incrementing automatically. ## How Continuous Delivery affects GitVersion -Continuous delivery is good when you deploy continuously to an testing system. +Continuous delivery is good when you deploy continuously to a testing system. * 1.1.0-3 * 1.1.0-2 (tag: 1.1.0-2) <-- This is the version which has been deployed on testing From fc5bd988f17f721541a16e91bbb6687e10564515 Mon Sep 17 00:00:00 2001 From: Bi0T1N Date: Sat, 8 Feb 2025 12:13:11 +0100 Subject: [PATCH 056/107] Replace C# extension with official C# Dev Kit --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c8de2ac6d0..69b116d50b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -41,7 +41,7 @@ }, // Add the IDs of extensions you want installed when the container is created. "extensions": [ - "ms-dotnettools.csharp", + "ms-dotnettools.csdevkit", "EditorConfig.EditorConfig", "streetsidesoftware.code-spell-checker" ] From cedcda1405a2241e3f6b50211b8b5f4881fc4eb6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Feb 2025 16:25:32 +0000 Subject: [PATCH 057/107] (deps): Bump the analyzers group across 2 directories with 2 updates Bumps the analyzers group with 2 updates in the /new-cli directory: [Roslynator.Analyzers](https://github.com/dotnet/roslynator) and [Roslynator.Formatting.Analyzers](https://github.com/dotnet/roslynator). Bumps the analyzers group with 2 updates in the /src directory: [Roslynator.Analyzers](https://github.com/dotnet/roslynator) and [Roslynator.Formatting.Analyzers](https://github.com/dotnet/roslynator). Updates `Roslynator.Analyzers` from 4.12.11 to 4.13.0 - [Release notes](https://github.com/dotnet/roslynator/releases) - [Changelog](https://github.com/dotnet/roslynator/blob/main/ChangeLog.md) - [Commits](https://github.com/dotnet/roslynator/compare/v4.12.11...v4.13.0) Updates `Roslynator.Formatting.Analyzers` from 4.12.11 to 4.13.0 - [Release notes](https://github.com/dotnet/roslynator/releases) - [Changelog](https://github.com/dotnet/roslynator/blob/main/ChangeLog.md) - [Commits](https://github.com/dotnet/roslynator/compare/v4.12.11...v4.13.0) Updates `Roslynator.Analyzers` from 4.12.11 to 4.13.0 - [Release notes](https://github.com/dotnet/roslynator/releases) - [Changelog](https://github.com/dotnet/roslynator/blob/main/ChangeLog.md) - [Commits](https://github.com/dotnet/roslynator/compare/v4.12.11...v4.13.0) Updates `Roslynator.Formatting.Analyzers` from 4.12.11 to 4.13.0 - [Release notes](https://github.com/dotnet/roslynator/releases) - [Changelog](https://github.com/dotnet/roslynator/blob/main/ChangeLog.md) - [Commits](https://github.com/dotnet/roslynator/compare/v4.12.11...v4.13.0) --- updated-dependencies: - dependency-name: Roslynator.Analyzers dependency-type: direct:production update-type: version-update:semver-minor dependency-group: analyzers - dependency-name: Roslynator.Formatting.Analyzers dependency-type: direct:production update-type: version-update:semver-minor dependency-group: analyzers - dependency-name: Roslynator.Analyzers dependency-type: direct:production update-type: version-update:semver-minor dependency-group: analyzers - dependency-name: Roslynator.Formatting.Analyzers dependency-type: direct:production update-type: version-update:semver-minor dependency-group: analyzers ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 4 ++-- src/Directory.Packages.props | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index 85e43c6011..f86fd80080 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -12,8 +12,8 @@ - - + + diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index b0ab87c29b..300a56175e 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -15,8 +15,8 @@ - - + + From 611c663635ca197c4779e06a772db8396ffe2d7b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Feb 2025 16:28:26 +0000 Subject: [PATCH 058/107] (deps): Bump the microsoft group across 2 directories with 11 updates Bumps the microsoft group with 2 updates in the /new-cli directory: [System.Text.Json](https://github.com/dotnet/runtime) and [Microsoft.Extensions.DependencyInjection.Abstractions](https://github.com/dotnet/runtime). Bumps the microsoft group with 11 updates in the /src directory: | Package | From | To | | --- | --- | --- | | [System.Text.Json](https://github.com/dotnet/runtime) | `9.0.1` | `9.0.2` | | [Microsoft.Extensions.DependencyInjection.Abstractions](https://github.com/dotnet/runtime) | `9.0.1` | `9.0.2` | | [Microsoft.Extensions.Configuration.CommandLine](https://github.com/dotnet/runtime) | `9.0.1` | `9.0.2` | | [Microsoft.Extensions.DependencyInjection](https://github.com/dotnet/runtime) | `9.0.1` | `9.0.2` | | [Microsoft.Extensions.FileSystemGlobbing](https://github.com/dotnet/runtime) | `9.0.1` | `9.0.2` | | [Microsoft.Extensions.FileSystemGlobbing](https://github.com/dotnet/runtime) | `9.0.1` | `9.0.2` | | [Microsoft.Extensions.Hosting](https://github.com/dotnet/runtime) | `9.0.1` | `9.0.2` | | [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) | `17.12.0` | `17.13.0` | | [Microsoft.Bcl.AsyncInterfaces](https://github.com/dotnet/runtime) | `9.0.1` | `9.0.2` | | [Microsoft.Build.Utilities.Core](https://github.com/dotnet/msbuild) | `17.12.6` | `17.13.9` | | [System.Drawing.Common](https://github.com/dotnet/winforms) | `9.0.1` | `9.0.2` | | [System.Security.Cryptography.Xml](https://github.com/dotnet/runtime) | `9.0.1` | `9.0.2` | Updates `System.Text.Json` from 9.0.1 to 9.0.2 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.1...v9.0.2) Updates `Microsoft.Extensions.DependencyInjection.Abstractions` from 9.0.1 to 9.0.2 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.1...v9.0.2) Updates `System.Text.Json` from 9.0.1 to 9.0.2 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.1...v9.0.2) Updates `Microsoft.Extensions.DependencyInjection.Abstractions` from 9.0.1 to 9.0.2 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.1...v9.0.2) Updates `Microsoft.Extensions.Configuration.CommandLine` from 9.0.1 to 9.0.2 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.1...v9.0.2) Updates `Microsoft.Extensions.DependencyInjection` from 9.0.1 to 9.0.2 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.1...v9.0.2) Updates `Microsoft.Extensions.FileSystemGlobbing` from 9.0.1 to 9.0.2 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.1...v9.0.2) Updates `Microsoft.Extensions.FileSystemGlobbing` from 9.0.1 to 9.0.2 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.1...v9.0.2) Updates `Microsoft.Extensions.Hosting` from 9.0.1 to 9.0.2 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.1...v9.0.2) Updates `Microsoft.NET.Test.Sdk` from 17.12.0 to 17.13.0 - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.12.0...v17.13.0) Updates `Microsoft.Bcl.AsyncInterfaces` from 9.0.1 to 9.0.2 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.1...v9.0.2) Updates `Microsoft.Build.Utilities.Core` from 17.12.6 to 17.13.9 - [Release notes](https://github.com/dotnet/msbuild/releases) - [Changelog](https://github.com/dotnet/msbuild/blob/main/documentation/Changelog.md) - [Commits](https://github.com/dotnet/msbuild/compare/v17.12.6...v17.13.9) Updates `System.Drawing.Common` from 9.0.1 to 9.0.2 - [Release notes](https://github.com/dotnet/winforms/releases) - [Changelog](https://github.com/dotnet/winforms/blob/main/docs/release-activity.md) - [Commits](https://github.com/dotnet/winforms/compare/v9.0.1...v9.0.2) Updates `System.Security.Cryptography.Xml` from 9.0.1 to 9.0.2 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.1...v9.0.2) --- updated-dependencies: - dependency-name: System.Text.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: Microsoft.Extensions.DependencyInjection.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: System.Text.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: Microsoft.Extensions.DependencyInjection.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: Microsoft.Extensions.Configuration.CommandLine dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: Microsoft.Extensions.DependencyInjection dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: Microsoft.Extensions.FileSystemGlobbing dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: Microsoft.Extensions.FileSystemGlobbing dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: Microsoft.Extensions.Hosting dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor dependency-group: microsoft - dependency-name: Microsoft.Bcl.AsyncInterfaces dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: Microsoft.Build.Utilities.Core dependency-type: direct:production update-type: version-update:semver-minor dependency-group: microsoft - dependency-name: System.Drawing.Common dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: System.Security.Cryptography.Xml dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 4 ++-- src/Directory.Packages.props | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index f86fd80080..7efe417c6b 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -10,7 +10,7 @@ - + @@ -21,6 +21,6 @@ - + \ No newline at end of file diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 300a56175e..225e2a962b 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -11,8 +11,8 @@ - - + + @@ -22,23 +22,23 @@ - + - - - - - - + + + + + + - - - + + + From e7c49f4195027084818eb3678b3cb7d89ce54e49 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Feb 2025 16:57:52 +0000 Subject: [PATCH 059/107] (deps): Bump JunitXml.TestLogger from 5.0.0 to 6.0.0 in /src Bumps [JunitXml.TestLogger](https://github.com/spekt/testlogger) from 5.0.0 to 6.0.0. - [Release notes](https://github.com/spekt/testlogger/releases) - [Changelog](https://github.com/spekt/testlogger/blob/master/CHANGELOG.md) - [Commits](https://github.com/spekt/testlogger/compare/v5.0.0...v6.0.0) --- updated-dependencies: - dependency-name: JunitXml.TestLogger dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 225e2a962b..d2c0cec67e 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -20,7 +20,7 @@ - + From c0a78dcbb7a30bea6652fa3d7e2c6d99e0457ff2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Feb 2025 17:35:22 +0000 Subject: [PATCH 060/107] (deps): Bump NUnit3TestAdapter from 4.6.0 to 5.0.0 in /src Bumps [NUnit3TestAdapter](https://github.com/nunit/nunit3-vs-adapter) from 4.6.0 to 5.0.0. - [Release notes](https://github.com/nunit/nunit3-vs-adapter/releases) - [Commits](https://github.com/nunit/nunit3-vs-adapter/compare/V4.6.0...V5.0.0) --- updated-dependencies: - dependency-name: NUnit3TestAdapter dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index d2c0cec67e..dc78029018 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -34,7 +34,7 @@ - + From 8b17c0f925e46237d9a50387cb84ecea3315b0e6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Feb 2025 16:53:32 +0000 Subject: [PATCH 061/107] (deps): Bump the analyzers group across 2 directories with 2 updates Bumps the analyzers group with 2 updates in the /new-cli directory: [Roslynator.Analyzers](https://github.com/dotnet/roslynator) and [Roslynator.Formatting.Analyzers](https://github.com/dotnet/roslynator). Bumps the analyzers group with 2 updates in the /src directory: [Roslynator.Analyzers](https://github.com/dotnet/roslynator) and [Roslynator.Formatting.Analyzers](https://github.com/dotnet/roslynator). Updates `Roslynator.Analyzers` from 4.13.0 to 4.13.1 - [Release notes](https://github.com/dotnet/roslynator/releases) - [Changelog](https://github.com/dotnet/roslynator/blob/main/ChangeLog.md) - [Commits](https://github.com/dotnet/roslynator/compare/v4.13.0...v4.13.1) Updates `Roslynator.Formatting.Analyzers` from 4.13.0 to 4.13.1 - [Release notes](https://github.com/dotnet/roslynator/releases) - [Changelog](https://github.com/dotnet/roslynator/blob/main/ChangeLog.md) - [Commits](https://github.com/dotnet/roslynator/compare/v4.13.0...v4.13.1) Updates `Roslynator.Analyzers` from 4.13.0 to 4.13.1 - [Release notes](https://github.com/dotnet/roslynator/releases) - [Changelog](https://github.com/dotnet/roslynator/blob/main/ChangeLog.md) - [Commits](https://github.com/dotnet/roslynator/compare/v4.13.0...v4.13.1) Updates `Roslynator.Formatting.Analyzers` from 4.13.0 to 4.13.1 - [Release notes](https://github.com/dotnet/roslynator/releases) - [Changelog](https://github.com/dotnet/roslynator/blob/main/ChangeLog.md) - [Commits](https://github.com/dotnet/roslynator/compare/v4.13.0...v4.13.1) --- updated-dependencies: - dependency-name: Roslynator.Analyzers dependency-type: direct:production update-type: version-update:semver-patch dependency-group: analyzers - dependency-name: Roslynator.Formatting.Analyzers dependency-type: direct:production update-type: version-update:semver-patch dependency-group: analyzers - dependency-name: Roslynator.Analyzers dependency-type: direct:production update-type: version-update:semver-patch dependency-group: analyzers - dependency-name: Roslynator.Formatting.Analyzers dependency-type: direct:production update-type: version-update:semver-patch dependency-group: analyzers ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 4 ++-- src/Directory.Packages.props | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index 7efe417c6b..484bf7508e 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -12,8 +12,8 @@ - - + + diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index dc78029018..01fe6f6143 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -15,8 +15,8 @@ - - + + From 46aa2420206518c2696e2683a7548793439c941e Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Mon, 24 Feb 2025 21:59:53 +0100 Subject: [PATCH 062/107] cleanup --- .github/workflows/_artifacts_linux.yml | 1 + .github/workflows/_docker.yml | 1 + .github/workflows/_docker_manifests.yml | 1 + .github/workflows/_prepare.yml | 5 +++++ build/build/Tasks/Package/PackageNuget.cs | 4 ++-- 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/_artifacts_linux.yml b/.github/workflows/_artifacts_linux.yml index 813732178b..4bd3272370 100644 --- a/.github/workflows/_artifacts_linux.yml +++ b/.github/workflows/_artifacts_linux.yml @@ -13,6 +13,7 @@ on: dotnet_versions: required: true type: string + env: DOTNET_INSTALL_DIR: "./.dotnet" DOTNET_ROLL_FORWARD: "Major" diff --git a/.github/workflows/_docker.yml b/.github/workflows/_docker.yml index 5ca990810d..8d3d3129cc 100644 --- a/.github/workflows/_docker.yml +++ b/.github/workflows/_docker.yml @@ -13,6 +13,7 @@ on: dotnet_versions: required: true type: string + env: DOTNET_INSTALL_DIR: "./.dotnet" DOTNET_ROLL_FORWARD: "Major" diff --git a/.github/workflows/_docker_manifests.yml b/.github/workflows/_docker_manifests.yml index 1212d8b4a7..07df99a950 100644 --- a/.github/workflows/_docker_manifests.yml +++ b/.github/workflows/_docker_manifests.yml @@ -7,6 +7,7 @@ on: dotnet_versions: required: true type: string + env: DOTNET_INSTALL_DIR: "./.dotnet" DOTNET_ROLL_FORWARD: "Major" diff --git a/.github/workflows/_prepare.yml b/.github/workflows/_prepare.yml index 58c8e6b9b1..f227724340 100644 --- a/.github/workflows/_prepare.yml +++ b/.github/workflows/_prepare.yml @@ -7,6 +7,11 @@ on: dotnet_versions: description: 'List of .NET versions' value: ${{ jobs.set_matrix.outputs.dotnet_versions }} + +env: + DOTNET_INSTALL_DIR: "./.dotnet" + DOTNET_ROLL_FORWARD: "Major" + jobs: prepare: name: ${{ matrix.os }} diff --git a/build/build/Tasks/Package/PackageNuget.cs b/build/build/Tasks/Package/PackageNuget.cs index 64186050c9..cfd2a35f78 100644 --- a/build/build/Tasks/Package/PackageNuget.cs +++ b/build/build/Tasks/Package/PackageNuget.cs @@ -25,10 +25,10 @@ private static void PackageWithCli(BuildContext context) // GitVersion.MsBuild, global tool & core context.DotNetPack("./src/GitVersion.Core", settings); - settings.ArgumentCustomization = arg => arg.Append("/p:PackAsTool=true"); + settings.ArgumentCustomization = arg => arg.Append("-p:PackAsTool=true"); context.DotNetPack("./src/GitVersion.App", settings); - settings.ArgumentCustomization = arg => arg.Append("/p:IsPackaging=true"); + settings.ArgumentCustomization = arg => arg.Append("-p:IsPackaging=true"); context.DotNetPack("./src/GitVersion.MsBuild", settings); } } From 2e2cfc6ad51731fffe040bf2f506a54f43a56700 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Feb 2025 15:51:27 +0000 Subject: [PATCH 063/107] (deps): Bump dotnet-sdk from 9.0.102 to 9.0.200 Bumps [dotnet-sdk](https://github.com/dotnet/sdk) from 9.0.102 to 9.0.200. - [Release notes](https://github.com/dotnet/sdk/releases) - [Commits](https://github.com/dotnet/sdk/compare/v9.0.102...v9.0.200) --- updated-dependencies: - dependency-name: dotnet-sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build/build/Tasks/Package/PackageNuget.cs | 2 +- global.json | 2 +- new-cli/GitVersion.Common.Command/ICommand.cs | 2 +- src/GitVersion.App/IGlobbingResolver.cs | 2 +- src/GitVersion.Core/Configuration/IBranchConfiguration.cs | 4 ++-- .../Configuration/IConfigurationSerializer.cs | 4 ++-- src/GitVersion.Core/Configuration/IIgnoreConfiguration.cs | 2 +- .../Configuration/IPreventIncrementConfiguration.cs | 6 +++--- src/GitVersion.Core/Output/IConverterContext.cs | 2 +- src/GitVersion.Core/Output/IVersionConverter.cs | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/build/build/Tasks/Package/PackageNuget.cs b/build/build/Tasks/Package/PackageNuget.cs index cfd2a35f78..300c32848f 100644 --- a/build/build/Tasks/Package/PackageNuget.cs +++ b/build/build/Tasks/Package/PackageNuget.cs @@ -25,7 +25,7 @@ private static void PackageWithCli(BuildContext context) // GitVersion.MsBuild, global tool & core context.DotNetPack("./src/GitVersion.Core", settings); - settings.ArgumentCustomization = arg => arg.Append("-p:PackAsTool=true"); + settings.ArgumentCustomization = arg => arg.Append("-p:PackAsTool=true").Append("-p:BuildInParallel=false"); context.DotNetPack("./src/GitVersion.App", settings); settings.ArgumentCustomization = arg => arg.Append("-p:IsPackaging=true"); diff --git a/global.json b/global.json index 63f9762c77..d5acb9d0bc 100644 --- a/global.json +++ b/global.json @@ -5,6 +5,6 @@ "src" ], "sdk": { - "version": "9.0.102" + "version": "9.0.200" } } diff --git a/new-cli/GitVersion.Common.Command/ICommand.cs b/new-cli/GitVersion.Common.Command/ICommand.cs index 9b630a7177..6f2723e5cf 100644 --- a/new-cli/GitVersion.Common.Command/ICommand.cs +++ b/new-cli/GitVersion.Common.Command/ICommand.cs @@ -2,7 +2,7 @@ namespace GitVersion; public interface ICommand { - public Task InvokeAsync(T settings, CancellationToken cancellationToken = default); + Task InvokeAsync(T settings, CancellationToken cancellationToken = default); } public interface ICommandImpl diff --git a/src/GitVersion.App/IGlobbingResolver.cs b/src/GitVersion.App/IGlobbingResolver.cs index a65374573d..6bfa777fb1 100644 --- a/src/GitVersion.App/IGlobbingResolver.cs +++ b/src/GitVersion.App/IGlobbingResolver.cs @@ -2,5 +2,5 @@ namespace GitVersion; internal interface IGlobbingResolver { - public IEnumerable Resolve(string workingDirectory, string pattern); + IEnumerable Resolve(string workingDirectory, string pattern); } diff --git a/src/GitVersion.Core/Configuration/IBranchConfiguration.cs b/src/GitVersion.Core/Configuration/IBranchConfiguration.cs index 209168bb9d..8a72789533 100644 --- a/src/GitVersion.Core/Configuration/IBranchConfiguration.cs +++ b/src/GitVersion.Core/Configuration/IBranchConfiguration.cs @@ -20,9 +20,9 @@ public interface IBranchConfiguration CommitMessageIncrementMode? CommitMessageIncrementing { get; } - public string? RegularExpression { get; } + string? RegularExpression { get; } - public bool IsMatch(string branchName) + bool IsMatch(string branchName) { if (string.IsNullOrWhiteSpace(RegularExpression)) { diff --git a/src/GitVersion.Core/Configuration/IConfigurationSerializer.cs b/src/GitVersion.Core/Configuration/IConfigurationSerializer.cs index 312e0e3feb..abb3d744b3 100644 --- a/src/GitVersion.Core/Configuration/IConfigurationSerializer.cs +++ b/src/GitVersion.Core/Configuration/IConfigurationSerializer.cs @@ -2,7 +2,7 @@ namespace GitVersion.Configuration; internal interface IConfigurationSerializer { - public T Deserialize(string input); + T Deserialize(string input); string Serialize(object graph); - public IGitVersionConfiguration? ReadConfiguration(string input); + IGitVersionConfiguration? ReadConfiguration(string input); } diff --git a/src/GitVersion.Core/Configuration/IIgnoreConfiguration.cs b/src/GitVersion.Core/Configuration/IIgnoreConfiguration.cs index 21efe431d6..f836d52915 100644 --- a/src/GitVersion.Core/Configuration/IIgnoreConfiguration.cs +++ b/src/GitVersion.Core/Configuration/IIgnoreConfiguration.cs @@ -6,5 +6,5 @@ public interface IIgnoreConfiguration IReadOnlySet Shas { get; } - public bool IsEmpty => Before == null && Shas.Count == 0; + bool IsEmpty => Before == null && Shas.Count == 0; } diff --git a/src/GitVersion.Core/Configuration/IPreventIncrementConfiguration.cs b/src/GitVersion.Core/Configuration/IPreventIncrementConfiguration.cs index 1769ed0cac..bc8c1b9460 100644 --- a/src/GitVersion.Core/Configuration/IPreventIncrementConfiguration.cs +++ b/src/GitVersion.Core/Configuration/IPreventIncrementConfiguration.cs @@ -2,9 +2,9 @@ namespace GitVersion.Configuration; public interface IPreventIncrementConfiguration { - public bool? OfMergedBranch { get; } + bool? OfMergedBranch { get; } - public bool? WhenBranchMerged { get; } + bool? WhenBranchMerged { get; } - public bool? WhenCurrentCommitTagged { get; } + bool? WhenCurrentCommitTagged { get; } } diff --git a/src/GitVersion.Core/Output/IConverterContext.cs b/src/GitVersion.Core/Output/IConverterContext.cs index 2df5562e71..eb8d0a4d32 100644 --- a/src/GitVersion.Core/Output/IConverterContext.cs +++ b/src/GitVersion.Core/Output/IConverterContext.cs @@ -2,5 +2,5 @@ namespace GitVersion; public interface IConverterContext { - public string WorkingDirectory { get; } + string WorkingDirectory { get; } } diff --git a/src/GitVersion.Core/Output/IVersionConverter.cs b/src/GitVersion.Core/Output/IVersionConverter.cs index 34d34a8454..22fdd9a75d 100644 --- a/src/GitVersion.Core/Output/IVersionConverter.cs +++ b/src/GitVersion.Core/Output/IVersionConverter.cs @@ -4,5 +4,5 @@ namespace GitVersion; public interface IVersionConverter : IDisposable where T : IConverterContext { - public void Execute(GitVersionVariables variables, T context); + void Execute(GitVersionVariables variables, T context); } From c23c6a0e3a29ca1965900233b57120e9ef404f52 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 26 Feb 2025 12:47:34 +0000 Subject: [PATCH 064/107] (deps): Bump the microsoft group across 2 directories with 4 updates Bumps the microsoft group with 2 updates in the /new-cli directory: [Microsoft.CodeAnalysis.Analyzers](https://github.com/dotnet/roslyn-analyzers) and [Microsoft.CodeAnalysis.CSharp](https://github.com/dotnet/roslyn). Bumps the microsoft group with 3 updates in the /src directory: [Microsoft.CodeAnalysis.Common](https://github.com/dotnet/roslyn), [Microsoft.CodeAnalysis.CSharp](https://github.com/dotnet/roslyn) and [Microsoft.CodeAnalysis.VisualBasic](https://github.com/dotnet/roslyn). Updates `Microsoft.CodeAnalysis.Analyzers` from 3.11.0 to 3.11.0 - [Release notes](https://github.com/dotnet/roslyn-analyzers/releases) - [Changelog](https://github.com/dotnet/roslyn-analyzers/blob/main/PostReleaseActivities.md) - [Commits](https://github.com/dotnet/roslyn-analyzers/commits) Updates `Microsoft.CodeAnalysis.CSharp` from 4.12.0 to 4.13.0 - [Release notes](https://github.com/dotnet/roslyn/releases) - [Changelog](https://github.com/dotnet/roslyn/blob/main/docs/Breaking%20API%20Changes.md) - [Commits](https://github.com/dotnet/roslyn/commits) Updates `Microsoft.CodeAnalysis.Common` from 4.12.0 to 4.13.0 - [Release notes](https://github.com/dotnet/roslyn/releases) - [Changelog](https://github.com/dotnet/roslyn/blob/main/docs/Breaking%20API%20Changes.md) - [Commits](https://github.com/dotnet/roslyn/commits) Updates `Microsoft.CodeAnalysis.CSharp` from 4.12.0 to 4.13.0 - [Release notes](https://github.com/dotnet/roslyn/releases) - [Changelog](https://github.com/dotnet/roslyn/blob/main/docs/Breaking%20API%20Changes.md) - [Commits](https://github.com/dotnet/roslyn/commits) Updates `Microsoft.CodeAnalysis.Common` from 4.12.0 to 4.13.0 - [Release notes](https://github.com/dotnet/roslyn/releases) - [Changelog](https://github.com/dotnet/roslyn/blob/main/docs/Breaking%20API%20Changes.md) - [Commits](https://github.com/dotnet/roslyn/commits) Updates `Microsoft.CodeAnalysis.VisualBasic` from 4.12.0 to 4.13.0 - [Release notes](https://github.com/dotnet/roslyn/releases) - [Changelog](https://github.com/dotnet/roslyn/blob/main/docs/Breaking%20API%20Changes.md) - [Commits](https://github.com/dotnet/roslyn/commits) --- updated-dependencies: - dependency-name: Microsoft.CodeAnalysis.Analyzers dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: Microsoft.CodeAnalysis.CSharp dependency-type: direct:production update-type: version-update:semver-minor dependency-group: microsoft - dependency-name: Microsoft.CodeAnalysis.Common dependency-type: direct:production update-type: version-update:semver-minor dependency-group: microsoft - dependency-name: Microsoft.CodeAnalysis.CSharp dependency-type: direct:production update-type: version-update:semver-minor dependency-group: microsoft - dependency-name: Microsoft.CodeAnalysis.Common dependency-type: direct:production update-type: version-update:semver-minor dependency-group: microsoft - dependency-name: Microsoft.CodeAnalysis.VisualBasic dependency-type: direct:production update-type: version-update:semver-minor dependency-group: microsoft ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 2 +- src/Directory.Packages.props | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index 484bf7508e..4fceffd909 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -6,7 +6,7 @@ - + diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 01fe6f6143..206e2aba10 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -6,9 +6,9 @@ - - - + + + From dc4d28afa1a1d14884284c5d0e99447a5dc0a3e9 Mon Sep 17 00:00:00 2001 From: Bi0T1N Date: Fri, 21 Feb 2025 23:04:34 +0100 Subject: [PATCH 065/107] Support for dotted versions of the GitVersion config files by default follow the convention of having a leading dot for config files used e.g. for .gitignore, .editorconfig, .gitattributes, etc --- docs/input/docs/usage/cli/arguments.md | 8 +++---- .../OverrideConfigurationOptionParser.cs | 2 +- .../ConfigurationFileLocatorTests.cs | 14 +++++++++++++ .../ConfigurationFileLocator.cs | 21 +++++++++++++------ .../Core/GitVersionExecutorTests.cs | 2 ++ 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/docs/input/docs/usage/cli/arguments.md b/docs/input/docs/usage/cli/arguments.md index c47e115ba7..01d773c752 100644 --- a/docs/input/docs/usage/cli/arguments.md +++ b/docs/input/docs/usage/cli/arguments.md @@ -41,9 +41,9 @@ GitVersion [path] E.g. /output json /format {SemVer} - will output `1.2.3+beta.4` /output json /format {Major}.{Minor} - will output `1.2` /l Path to logfile. - /config Path to config file (defaults to GitVersion.yml or GitVersion.yaml) + /config Path to config file (defaults to GitVersion.yml, GitVersion.yaml, .GitVersion.yml or .GitVersion.yaml) /showconfig Outputs the effective GitVersion config (defaults + custom - from GitVersion.yml or GitVersion.yaml) in yaml format + from GitVersion.yml, GitVersion.yaml, .GitVersion.yml or .GitVersion.yaml) in yaml format /overrideconfig Overrides GitVersion config values inline (semicolon- separated key value pairs e.g. /overrideconfig tag-prefix=Foo) @@ -97,7 +97,7 @@ GitVersion [path] ## Override config -`/overrideconfig [key=value]` will override appropriate `key` from 'GitVersion.yml' or 'GitVersion.yaml'. +`/overrideconfig [key=value]` will override appropriate `key` from 'GitVersion.yml', 'GitVersion.yaml', '.GitVersion.yml' or '.GitVersion.yaml'. To specify multiple options add multiple `/overrideconfig [key=value]` entries: `/overrideconfig key1=value1 /overrideconfig key2=value2`. @@ -129,7 +129,7 @@ Following options are supported: Read more about [Configuration](/docs/reference/configuration). -Using `override-config` on the command line will not change the contents of the config file `GitVersion.yml` or `GitVersion.yaml`. +Using `override-config` on the command line will not change the contents of the config file `GitVersion.yml`, `GitVersion.yaml`, `.GitVersion.yml` or `.GitVersion.yaml`. ### Example: How to override configuration option 'tag-prefix' to use prefix 'custom' diff --git a/src/GitVersion.App/OverrideConfigurationOptionParser.cs b/src/GitVersion.App/OverrideConfigurationOptionParser.cs index 1d4d6fa985..f3e886ddcf 100644 --- a/src/GitVersion.App/OverrideConfigurationOptionParser.cs +++ b/src/GitVersion.App/OverrideConfigurationOptionParser.cs @@ -18,7 +18,7 @@ internal class OverrideConfigurationOptionParser /// /// /// - /// Lookup keys are created from to match 'GitVersion.yml' or 'GitVersion.yaml' file + /// Lookup keys are created from to match 'GitVersion.yml', 'GitVersion.yaml', '.GitVersion.yml' or '.GitVersion.yaml' file /// options as close as possible. /// private static ILookup GetSupportedProperties() => typeof(GitVersionConfiguration).GetProperties(BindingFlags.Public | BindingFlags.Instance) diff --git a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationFileLocatorTests.cs b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationFileLocatorTests.cs index 48c43afa15..1f2db614d3 100644 --- a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationFileLocatorTests.cs +++ b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationFileLocatorTests.cs @@ -37,8 +37,20 @@ public void Setup() [TestCase(ConfigurationFileLocator.DefaultFileName, ConfigurationFileLocator.DefaultFileName)] [TestCase(ConfigurationFileLocator.DefaultFileName, ConfigurationFileLocator.DefaultAlternativeFileName)] + [TestCase(ConfigurationFileLocator.DefaultFileName, ConfigurationFileLocator.DefaultFileNameDotted)] + [TestCase(ConfigurationFileLocator.DefaultFileName, ConfigurationFileLocator.DefaultAlternativeFileNameDotted)] [TestCase(ConfigurationFileLocator.DefaultAlternativeFileName, ConfigurationFileLocator.DefaultFileName)] [TestCase(ConfigurationFileLocator.DefaultAlternativeFileName, ConfigurationFileLocator.DefaultAlternativeFileName)] + [TestCase(ConfigurationFileLocator.DefaultAlternativeFileName, ConfigurationFileLocator.DefaultFileNameDotted)] + [TestCase(ConfigurationFileLocator.DefaultAlternativeFileName, ConfigurationFileLocator.DefaultAlternativeFileNameDotted)] + [TestCase(ConfigurationFileLocator.DefaultFileNameDotted, ConfigurationFileLocator.DefaultFileName)] + [TestCase(ConfigurationFileLocator.DefaultFileNameDotted, ConfigurationFileLocator.DefaultAlternativeFileName)] + [TestCase(ConfigurationFileLocator.DefaultFileNameDotted, ConfigurationFileLocator.DefaultFileNameDotted)] + [TestCase(ConfigurationFileLocator.DefaultFileNameDotted, ConfigurationFileLocator.DefaultAlternativeFileNameDotted)] + [TestCase(ConfigurationFileLocator.DefaultAlternativeFileNameDotted, ConfigurationFileLocator.DefaultFileName)] + [TestCase(ConfigurationFileLocator.DefaultAlternativeFileNameDotted, ConfigurationFileLocator.DefaultAlternativeFileName)] + [TestCase(ConfigurationFileLocator.DefaultAlternativeFileNameDotted, ConfigurationFileLocator.DefaultFileNameDotted)] + [TestCase(ConfigurationFileLocator.DefaultAlternativeFileNameDotted, ConfigurationFileLocator.DefaultAlternativeFileNameDotted)] public void ThrowsExceptionOnAmbiguousConfigFileLocation(string repoConfigFile, string workingConfigFile) { using var repositoryConfigFilePath = this.fileSystem.SetupConfigFile(path: this.repoPath, fileName: repoConfigFile); @@ -52,6 +64,8 @@ public void ThrowsExceptionOnAmbiguousConfigFileLocation(string repoConfigFile, [TestCase(ConfigurationFileLocator.DefaultFileName)] [TestCase(ConfigurationFileLocator.DefaultAlternativeFileName)] + [TestCase(ConfigurationFileLocator.DefaultFileNameDotted)] + [TestCase(ConfigurationFileLocator.DefaultAlternativeFileNameDotted)] public void NoWarnOnGitVersionYmlFile(string configurationFile) { using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, fileName: configurationFile); diff --git a/src/GitVersion.Configuration/ConfigurationFileLocator.cs b/src/GitVersion.Configuration/ConfigurationFileLocator.cs index 6d23ac35c5..14c8c69156 100644 --- a/src/GitVersion.Configuration/ConfigurationFileLocator.cs +++ b/src/GitVersion.Configuration/ConfigurationFileLocator.cs @@ -13,6 +13,9 @@ internal class ConfigurationFileLocator( { public const string DefaultFileName = "GitVersion.yml"; public const string DefaultAlternativeFileName = "GitVersion.yaml"; + public const string DefaultFileNameDotted = $".{DefaultFileName}"; + public const string DefaultAlternativeFileNameDotted = $".{DefaultAlternativeFileName}"; + public List PossibleConfigFileNames = [DefaultFileName, DefaultAlternativeFileName, DefaultFileNameDotted, DefaultAlternativeFileNameDotted]; private readonly IFileSystem fileSystem = fileSystem.NotNull(); private readonly ILog log = log.NotNull(); @@ -30,11 +33,17 @@ public void Verify(string? workingDirectory, string? projectRootDirectory) public string? GetConfigurationFile(string? directory) { if (directory is null) return null; - string?[] candidates = [this.ConfigurationFile, DefaultFileName, DefaultAlternativeFileName]; - var candidatePaths = - from candidate in candidates - where !candidate.IsNullOrWhiteSpace() - select PathHelper.Combine(directory, candidate); + var candidateList = new List(PossibleConfigFileNames); + if (!this.ConfigurationFile.IsNullOrEmpty()) + { + // give configuration value the highest priority + candidateList.Insert(0, this.ConfigurationFile); + } + + var candidatePaths = candidateList + .Where(candidate => !string.IsNullOrWhiteSpace(candidate)) + .Select(candidate => PathHelper.Combine(directory, candidate)) + .ToList(); foreach (var candidatePath in candidatePaths) { @@ -65,7 +74,7 @@ private void WarnAboutAmbiguousConfigFileSelection(string? workingDirectory, str if (!hasConfigInProjectRootDirectory && !hasConfigInWorkingDirectory) { - if (this.ConfigurationFile is not (DefaultFileName or DefaultAlternativeFileName)) + if (!PossibleConfigFileNames.Any(entry => entry.Equals(this.ConfigurationFile))) { workingConfigFile = PathHelper.Combine(workingDirectory, this.ConfigurationFile); projectRootConfigFile = PathHelper.Combine(projectRootDirectory, this.ConfigurationFile); diff --git a/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs b/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs index 2fea817d8f..f2dac1d3f8 100644 --- a/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs +++ b/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs @@ -243,6 +243,8 @@ public void CacheFileIsMissing() [TestCase(ConfigurationFileLocator.DefaultFileName)] [TestCase(ConfigurationFileLocator.DefaultAlternativeFileName)] + [TestCase(ConfigurationFileLocator.DefaultFileNameDotted)] + [TestCase(ConfigurationFileLocator.DefaultAlternativeFileNameDotted)] public void ConfigChangeInvalidatesCache(string configFileName) { const string versionCacheFileContent = """ From 53a6329a9cb843d93bd9f3897be22c72c27092f9 Mon Sep 17 00:00:00 2001 From: Bi0T1N Date: Wed, 26 Feb 2025 20:48:27 +0100 Subject: [PATCH 066/107] Rename PossibleConfigFileNames to SupportedConfigFileNames --- src/GitVersion.Configuration/ConfigurationFileLocator.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GitVersion.Configuration/ConfigurationFileLocator.cs b/src/GitVersion.Configuration/ConfigurationFileLocator.cs index 14c8c69156..c05ceeb24b 100644 --- a/src/GitVersion.Configuration/ConfigurationFileLocator.cs +++ b/src/GitVersion.Configuration/ConfigurationFileLocator.cs @@ -15,7 +15,7 @@ internal class ConfigurationFileLocator( public const string DefaultAlternativeFileName = "GitVersion.yaml"; public const string DefaultFileNameDotted = $".{DefaultFileName}"; public const string DefaultAlternativeFileNameDotted = $".{DefaultAlternativeFileName}"; - public List PossibleConfigFileNames = [DefaultFileName, DefaultAlternativeFileName, DefaultFileNameDotted, DefaultAlternativeFileNameDotted]; + public List SupportedConfigFileNames = [DefaultFileName, DefaultAlternativeFileName, DefaultFileNameDotted, DefaultAlternativeFileNameDotted]; private readonly IFileSystem fileSystem = fileSystem.NotNull(); private readonly ILog log = log.NotNull(); @@ -33,7 +33,7 @@ public void Verify(string? workingDirectory, string? projectRootDirectory) public string? GetConfigurationFile(string? directory) { if (directory is null) return null; - var candidateList = new List(PossibleConfigFileNames); + var candidateList = new List(SupportedConfigFileNames); if (!this.ConfigurationFile.IsNullOrEmpty()) { // give configuration value the highest priority @@ -74,7 +74,7 @@ private void WarnAboutAmbiguousConfigFileSelection(string? workingDirectory, str if (!hasConfigInProjectRootDirectory && !hasConfigInWorkingDirectory) { - if (!PossibleConfigFileNames.Any(entry => entry.Equals(this.ConfigurationFile))) + if (!SupportedConfigFileNames.Any(entry => entry.Equals(this.ConfigurationFile))) { workingConfigFile = PathHelper.Combine(workingDirectory, this.ConfigurationFile); projectRootConfigFile = PathHelper.Combine(projectRootDirectory, this.ConfigurationFile); From 6d61b3dce0fc4362007f786e8350500e353aaadf Mon Sep 17 00:00:00 2001 From: Bi0T1N Date: Wed, 26 Feb 2025 20:50:06 +0100 Subject: [PATCH 067/107] Use case insensitive comparison for config filenames --- .../Configuration/ConfigurationFileLocatorTests.cs | 12 ++++++++++++ .../ConfigurationFileLocator.cs | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationFileLocatorTests.cs b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationFileLocatorTests.cs index 1f2db614d3..e89ac22636 100644 --- a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationFileLocatorTests.cs +++ b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationFileLocatorTests.cs @@ -73,6 +73,18 @@ public void NoWarnOnGitVersionYmlFile(string configurationFile) Should.NotThrow(() => this.configurationProvider.ProvideForDirectory(this.repoPath)); } + [TestCase(ConfigurationFileLocator.DefaultFileName)] + [TestCase(ConfigurationFileLocator.DefaultAlternativeFileName)] + [TestCase(ConfigurationFileLocator.DefaultFileNameDotted)] + [TestCase(ConfigurationFileLocator.DefaultAlternativeFileNameDotted)] + public void NoWarnOnLowercasedGitVersionYmlFile(string configurationFile) + { + var lowercasedConfigurationFile = configurationFile.ToLower(); + using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, fileName: lowercasedConfigurationFile); + + Should.NotThrow(() => this.configurationProvider.ProvideForDirectory(this.repoPath)); + } + [Test] public void NoWarnOnNoGitVersionYmlFile() => Should.NotThrow(() => this.configurationProvider.ProvideForDirectory(this.repoPath)); } diff --git a/src/GitVersion.Configuration/ConfigurationFileLocator.cs b/src/GitVersion.Configuration/ConfigurationFileLocator.cs index c05ceeb24b..3bd9556e80 100644 --- a/src/GitVersion.Configuration/ConfigurationFileLocator.cs +++ b/src/GitVersion.Configuration/ConfigurationFileLocator.cs @@ -74,7 +74,7 @@ private void WarnAboutAmbiguousConfigFileSelection(string? workingDirectory, str if (!hasConfigInProjectRootDirectory && !hasConfigInWorkingDirectory) { - if (!SupportedConfigFileNames.Any(entry => entry.Equals(this.ConfigurationFile))) + if (!SupportedConfigFileNames.Any(entry => entry.Equals(this.ConfigurationFile, StringComparison.OrdinalIgnoreCase))) { workingConfigFile = PathHelper.Combine(workingDirectory, this.ConfigurationFile); projectRootConfigFile = PathHelper.Combine(projectRootDirectory, this.ConfigurationFile); From ea037470fd46fa257a292216859b828b92c76c58 Mon Sep 17 00:00:00 2001 From: Bi0T1N Date: Wed, 26 Feb 2025 20:57:28 +0100 Subject: [PATCH 068/107] Change candidates section to use old code syntax --- .../ConfigurationFileLocator.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/GitVersion.Configuration/ConfigurationFileLocator.cs b/src/GitVersion.Configuration/ConfigurationFileLocator.cs index 3bd9556e80..6b7ce942c2 100644 --- a/src/GitVersion.Configuration/ConfigurationFileLocator.cs +++ b/src/GitVersion.Configuration/ConfigurationFileLocator.cs @@ -33,17 +33,12 @@ public void Verify(string? workingDirectory, string? projectRootDirectory) public string? GetConfigurationFile(string? directory) { if (directory is null) return null; - var candidateList = new List(SupportedConfigFileNames); - if (!this.ConfigurationFile.IsNullOrEmpty()) - { - // give configuration value the highest priority - candidateList.Insert(0, this.ConfigurationFile); - } - var candidatePaths = candidateList - .Where(candidate => !string.IsNullOrWhiteSpace(candidate)) - .Select(candidate => PathHelper.Combine(directory, candidate)) - .ToList(); + string?[] candidates = [this.ConfigurationFile, ..SupportedConfigFileNames]; + var candidatePaths = + from candidate in candidates + where !candidate.IsNullOrWhiteSpace() + select PathHelper.Combine(directory, candidate); foreach (var candidatePath in candidatePaths) { From 91af21378e890b07b2807e882890605ff3096048 Mon Sep 17 00:00:00 2001 From: Bi0T1N Date: Wed, 26 Feb 2025 21:12:24 +0100 Subject: [PATCH 069/107] Make dotnet format happy with syntax --- src/GitVersion.Configuration/ConfigurationFileLocator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitVersion.Configuration/ConfigurationFileLocator.cs b/src/GitVersion.Configuration/ConfigurationFileLocator.cs index 6b7ce942c2..0354d9a0c9 100644 --- a/src/GitVersion.Configuration/ConfigurationFileLocator.cs +++ b/src/GitVersion.Configuration/ConfigurationFileLocator.cs @@ -34,7 +34,7 @@ public void Verify(string? workingDirectory, string? projectRootDirectory) { if (directory is null) return null; - string?[] candidates = [this.ConfigurationFile, ..SupportedConfigFileNames]; + string?[] candidates = [this.ConfigurationFile, .. SupportedConfigFileNames]; var candidatePaths = from candidate in candidates where !candidate.IsNullOrWhiteSpace() From 9bb94bcfb7ea088ee97068d1deb3b518bbf63264 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Mar 2025 15:48:21 +0000 Subject: [PATCH 070/107] (docs deps): Bump remark-validate-links in the remark group Bumps the remark group with 1 update: [remark-validate-links](https://github.com/remarkjs/remark-validate-links). Updates `remark-validate-links` from 13.0.2 to 13.1.0 - [Release notes](https://github.com/remarkjs/remark-validate-links/releases) - [Commits](https://github.com/remarkjs/remark-validate-links/compare/13.0.2...13.1.0) --- updated-dependencies: - dependency-name: remark-validate-links dependency-type: direct:development update-type: version-update:semver-minor dependency-group: remark ... Signed-off-by: dependabot[bot] --- package-lock.json | 15 ++++++++------- package.json | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2951e77495..2a225d49b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -72,7 +72,7 @@ "remark-preset-lint-recommended": "^7.0.1", "remark-retext": "^6.0.0", "remark-textr": "^6.1.0", - "remark-validate-links": "^13.0.2" + "remark-validate-links": "^13.1.0" } }, "node_modules/@babel/code-frame": { @@ -14888,10 +14888,11 @@ } }, "node_modules/remark-validate-links": { - "version": "13.0.2", - "resolved": "https://registry.npmjs.org/remark-validate-links/-/remark-validate-links-13.0.2.tgz", - "integrity": "sha512-YZPiB6eWT6sjVYD+TXisCGzNZwbWmtnqeA6rr7zlYz7LrtKENaT+fPIRjG16tW4dv85su2VsWdw7e3cqS+2Tog==", + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/remark-validate-links/-/remark-validate-links-13.1.0.tgz", + "integrity": "sha512-z+glZ4zoRyrWimQHtoqJEFJdPoIR1R1SDr/JoWjmS6EsYlyhxNuCHtIt165gmV7ltOSFJ+rGsipqRGfBPInd7A==", "dev": true, + "license": "MIT", "dependencies": { "@types/hosted-git-info": "^3.0.0", "@types/mdast": "^4.0.0", @@ -28007,9 +28008,9 @@ } }, "remark-validate-links": { - "version": "13.0.2", - "resolved": "https://registry.npmjs.org/remark-validate-links/-/remark-validate-links-13.0.2.tgz", - "integrity": "sha512-YZPiB6eWT6sjVYD+TXisCGzNZwbWmtnqeA6rr7zlYz7LrtKENaT+fPIRjG16tW4dv85su2VsWdw7e3cqS+2Tog==", + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/remark-validate-links/-/remark-validate-links-13.1.0.tgz", + "integrity": "sha512-z+glZ4zoRyrWimQHtoqJEFJdPoIR1R1SDr/JoWjmS6EsYlyhxNuCHtIt165gmV7ltOSFJ+rGsipqRGfBPInd7A==", "dev": true, "requires": { "@types/hosted-git-info": "^3.0.0", diff --git a/package.json b/package.json index 9f93b4bc98..3502300036 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "remark-preset-lint-recommended": "^7.0.1", "remark-retext": "^6.0.0", "remark-textr": "^6.1.0", - "remark-validate-links": "^13.0.2" + "remark-validate-links": "^13.1.0" }, "overrides": { "got": "^11.8.5" From 47a3c8d755f3cef47e487f44784cb2cf1f0cf61f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Mar 2025 15:43:30 +0000 Subject: [PATCH 071/107] (deps): Bump System.CommandLine Bumps the microsoft group with 1 update in the /new-cli directory: [System.CommandLine](https://github.com/dotnet/command-line-api). Updates `System.CommandLine` from 2.0.0-beta4.25072.1 to 2.0.0-beta4.25153.1 - [Release notes](https://github.com/dotnet/command-line-api/releases) - [Changelog](https://github.com/dotnet/command-line-api/blob/main/docs/History.md) - [Commits](https://github.com/dotnet/command-line-api/commits) --- updated-dependencies: - dependency-name: System.CommandLine dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index 4fceffd909..eec8c27572 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -20,7 +20,7 @@ - + \ No newline at end of file From 9f1be5b05a31b0360dcce5d757ba7230d667ea19 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Wed, 5 Mar 2025 22:18:21 +0100 Subject: [PATCH 072/107] cleanup --- .../GitVersion.App.Tests.csproj | 1 - .../Helpers/ProgramFixture.cs | 2 +- src/GitVersion.App/GlobbingResolver.cs | 3 +- .../Agents/AzurePipelines.cs | 2 +- .../VersionStrategiesConverter.cs | 4 +- .../Extensions/MockCollectionExtensions.cs | 6 +- ...EffectiveBranchConfigurationFinderTests.cs | 14 ++-- .../ShaVersionFilterTests.cs | 4 +- .../Helpers/DirectoryHelper.cs | 6 +- .../VersionSearchStrategies/BaseVersion.cs | 4 +- src/GitVersion.LibGit2Sharp/Git/Remote.cs | 2 +- .../GitVersion.MsBuild.Tests.csproj | 1 - .../GenerateGitVersionInformationTest.cs | 1 - .../Tasks/TestTaskBase.cs | 2 +- .../Tasks/UpdateAssemblyInfoTaskTest.cs | 1 - .../Fixtures/RepositoryFixtureBase.cs | 1 - .../GitVersion.Testing.csproj | 9 +++ .../Helpers/DirectoryHelper.cs | 79 ------------------- 18 files changed, 34 insertions(+), 108 deletions(-) rename src/{GitVersion.Core.Tests => GitVersion.Core}/Helpers/DirectoryHelper.cs (96%) delete mode 100644 src/GitVersion.Testing/Helpers/DirectoryHelper.cs diff --git a/src/GitVersion.App.Tests/GitVersion.App.Tests.csproj b/src/GitVersion.App.Tests/GitVersion.App.Tests.csproj index 111e288a9f..fbddfbedb5 100644 --- a/src/GitVersion.App.Tests/GitVersion.App.Tests.csproj +++ b/src/GitVersion.App.Tests/GitVersion.App.Tests.csproj @@ -15,7 +15,6 @@ - diff --git a/src/GitVersion.App.Tests/Helpers/ProgramFixture.cs b/src/GitVersion.App.Tests/Helpers/ProgramFixture.cs index 1fa2d6268c..cb663b43aa 100644 --- a/src/GitVersion.App.Tests/Helpers/ProgramFixture.cs +++ b/src/GitVersion.App.Tests/Helpers/ProgramFixture.cs @@ -49,7 +49,7 @@ public void WithEnv(params KeyValuePair[] envs) public Task Run(string arg) { - var args = arg.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); + var args = arg.Split([' '], StringSplitOptions.RemoveEmptyEntries).ToArray(); return Run(args); } diff --git a/src/GitVersion.App/GlobbingResolver.cs b/src/GitVersion.App/GlobbingResolver.cs index 43851b5435..d17606436a 100644 --- a/src/GitVersion.App/GlobbingResolver.cs +++ b/src/GitVersion.App/GlobbingResolver.cs @@ -13,5 +13,6 @@ public IEnumerable Resolve(string workingDirectory, string pattern) return this.matcher.Execute(GetDirectoryInfoWrapper(workingDirectory)).Files.Select(file => file.Path); } - protected virtual DirectoryInfoBase GetDirectoryInfoWrapper(string workingDirectory) => new DirectoryInfoWrapper(new DirectoryInfo(workingDirectory)); + private static DirectoryInfoWrapper GetDirectoryInfoWrapper(string workingDirectory) + => new(new DirectoryInfo(workingDirectory)); } diff --git a/src/GitVersion.BuildAgents/Agents/AzurePipelines.cs b/src/GitVersion.BuildAgents/Agents/AzurePipelines.cs index 31d44ea671..e29ab4062d 100644 --- a/src/GitVersion.BuildAgents/Agents/AzurePipelines.cs +++ b/src/GitVersion.BuildAgents/Agents/AzurePipelines.cs @@ -35,7 +35,7 @@ public override string GenerateSetVersionMessage(GitVersionVariables variables) if (buildNumberEnv == newBuildNumber) { var buildNumber = variables.FullSemVer.EndsWith("+0") - ? variables.FullSemVer.Substring(0, variables.FullSemVer.Length - 2) + ? variables.FullSemVer[..^2] : variables.FullSemVer; return $"##vso[build.updatebuildnumber]{buildNumber}"; diff --git a/src/GitVersion.Configuration/VersionStrategiesConverter.cs b/src/GitVersion.Configuration/VersionStrategiesConverter.cs index 7d790154cf..b4144464d4 100644 --- a/src/GitVersion.Configuration/VersionStrategiesConverter.cs +++ b/src/GitVersion.Configuration/VersionStrategiesConverter.cs @@ -12,9 +12,9 @@ internal class VersionStrategiesConverter : IYamlTypeConverter public bool Accepts(Type type) => type == typeof(VersionStrategies[]); - public object? ReadYaml(IParser parser, Type type, ObjectDeserializer rootDeserializer) + public object ReadYaml(IParser parser, Type type, ObjectDeserializer rootDeserializer) { - List strategies = new(); + List strategies = []; if (parser.TryConsume(out var _)) { diff --git a/src/GitVersion.Core.Tests/Extensions/MockCollectionExtensions.cs b/src/GitVersion.Core.Tests/Extensions/MockCollectionExtensions.cs index 7feb8ed156..81c3191326 100644 --- a/src/GitVersion.Core.Tests/Extensions/MockCollectionExtensions.cs +++ b/src/GitVersion.Core.Tests/Extensions/MockCollectionExtensions.cs @@ -11,5 +11,9 @@ private static IEnumerator GetEnumerator(params T[] itemsToReturn) } public static void MockCollectionReturn(this IEnumerable items, params T[] itemsToReturn) - => items.GetEnumerator().Returns(_ => GetEnumerator(itemsToReturn)); + { + var enumerator = items.GetEnumerator(); + enumerator.Returns(_ => GetEnumerator(itemsToReturn)); + enumerator.Dispose(); + } } diff --git a/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs index 4a4b295da0..35bd07d123 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs @@ -46,7 +46,7 @@ public void When_getting_configurations_of_a_branch_with_versioning_mode_Given_f .WithBranch("develop", builder => builder.WithDeploymentMode(null).WithIncrement(IncrementStrategy.Inherit)) .Build(); var repositoryStoreMock = Substitute.For(); - repositoryStoreMock.GetSourceBranches(developBranchMock, configuration, Arg.Any>()).Returns(new[] { mainBranchMock }); + repositoryStoreMock.GetSourceBranches(developBranchMock, configuration, Arg.Any>()).Returns([mainBranchMock]); var unitUnderTest = new EffectiveBranchConfigurationFinder(Substitute.For(), repositoryStoreMock); @@ -75,7 +75,7 @@ public void When_getting_configurations_of_a_branch_with_versioning_mode_Given_p .Build(); var repositoryStoreMock = Substitute.For(); - repositoryStoreMock.GetSourceBranches(developBranchMock, configuration, Arg.Any>()).Returns(new[] { mainBranchMock }); + repositoryStoreMock.GetSourceBranches(developBranchMock, configuration, Arg.Any>()).Returns([mainBranchMock]); var unitUnderTest = new EffectiveBranchConfigurationFinder(Substitute.For(), repositoryStoreMock); @@ -109,7 +109,7 @@ public void When_getting_configurations_of_a_branch_with_tag_alpha_Given_branch_ .Build(); var repositoryStoreMock = Substitute.For(); - repositoryStoreMock.GetSourceBranches(developBranchMock, configuration, Arg.Any>()).Returns(new[] { mainBranchMock }); + repositoryStoreMock.GetSourceBranches(developBranchMock, configuration, Arg.Any>()).Returns([mainBranchMock]); var unitUnderTest = new EffectiveBranchConfigurationFinder(Substitute.For(), repositoryStoreMock); @@ -136,7 +136,7 @@ public void When_getting_configurations_of_a_branch_without_tag_Given_branch_whi .Build(); var repositoryStoreMock = Substitute.For(); - repositoryStoreMock.GetSourceBranches(developBranchMock, configuration, Arg.Any>()).Returns(new[] { mainBranchMock }); + repositoryStoreMock.GetSourceBranches(developBranchMock, configuration, Arg.Any>()).Returns([mainBranchMock]); var unitUnderTest = new EffectiveBranchConfigurationFinder(Substitute.For(), repositoryStoreMock); @@ -292,7 +292,7 @@ public void When_getting_configurations_of_an_unknown_branch_Given_fallback_conf .Build(); var repositoryStoreMock = Substitute.For(); var developBranchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); - repositoryStoreMock.GetSourceBranches(unknownBranchMock, configuration, Arg.Any>()).Returns(new[] { developBranchMock }); + repositoryStoreMock.GetSourceBranches(unknownBranchMock, configuration, Arg.Any>()).Returns([developBranchMock]); var unitUnderTest = new EffectiveBranchConfigurationFinder(Substitute.For(), repositoryStoreMock); @@ -325,7 +325,7 @@ public void When_getting_configurations_of_an_unknown_branch_Given_fallback_conf .Build(); var repositoryStoreMock = Substitute.For(); var developBranchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); - repositoryStoreMock.GetSourceBranches(unknownBranchMock, configuration, Arg.Any>()).Returns(new[] { developBranchMock }); + repositoryStoreMock.GetSourceBranches(unknownBranchMock, configuration, Arg.Any>()).Returns([developBranchMock]); var unitUnderTest = new EffectiveBranchConfigurationFinder(Substitute.For(), repositoryStoreMock); @@ -360,7 +360,7 @@ public void When_getting_configurations_of_an_unknown_branch_Given_fallback_and_ .Build(); var repositoryStoreMock = Substitute.For(); var developBranchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); - repositoryStoreMock.GetSourceBranches(Arg.Any(), Arg.Any(), Arg.Any>()).Returns(new[] { developBranchMock }); + repositoryStoreMock.GetSourceBranches(Arg.Any(), Arg.Any(), Arg.Any>()).Returns([developBranchMock]); var unitUnderTest = new EffectiveBranchConfigurationFinder(Substitute.For(), repositoryStoreMock); diff --git a/src/GitVersion.Core.Tests/VersionCalculation/ShaVersionFilterTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/ShaVersionFilterTests.cs index 86be277b52..9ad4953bbe 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/ShaVersionFilterTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/ShaVersionFilterTests.cs @@ -10,7 +10,7 @@ public class ShaVersionFilterTests : TestBase public void VerifyNullGuard() { var commit = GitToolsTestingExtensions.CreateMockCommit(); - var sut = new ShaVersionFilter(new[] { commit.Sha }); + var sut = new ShaVersionFilter([commit.Sha]); Should.Throw(() => sut.Exclude(null!, out _)); } @@ -20,7 +20,7 @@ public void WhenShaMatchShouldExcludeWithReason() { var commit = GitToolsTestingExtensions.CreateMockCommit(); BaseVersion version = new("dummy", new SemanticVersion(1), commit); - var sut = new ShaVersionFilter(new[] { commit.Sha }); + var sut = new ShaVersionFilter([commit.Sha]); sut.Exclude(version, out var reason).ShouldBeTrue(); reason.ShouldNotBeNullOrWhiteSpace(); diff --git a/src/GitVersion.Core.Tests/Helpers/DirectoryHelper.cs b/src/GitVersion.Core/Helpers/DirectoryHelper.cs similarity index 96% rename from src/GitVersion.Core.Tests/Helpers/DirectoryHelper.cs rename to src/GitVersion.Core/Helpers/DirectoryHelper.cs index d7c6f74f02..0bf996404e 100644 --- a/src/GitVersion.Core.Tests/Helpers/DirectoryHelper.cs +++ b/src/GitVersion.Core/Helpers/DirectoryHelper.cs @@ -1,8 +1,6 @@ -using GitVersion.Helpers; +namespace GitVersion.Helpers; -namespace GitVersion.Core.Tests.Helpers; - -public static class DirectoryHelper +internal static class DirectoryHelper { private static readonly Dictionary ToRename = new() { diff --git a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/BaseVersion.cs b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/BaseVersion.cs index 16aec5ce62..28a574b6a0 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/BaseVersion.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/BaseVersion.cs @@ -55,9 +55,7 @@ public override string ToString() stringBuilder.Append($"{Source}: "); stringBuilder.Append(Operator.ForceIncrement ? "Force version increment " : "Version increment "); - if (SemanticVersion is not null) - stringBuilder.Append($"'{SemanticVersion:f}' "); - + stringBuilder.Append($"'{SemanticVersion:f}' "); stringBuilder.Append($"+semver '{Operator.Increment}'"); if (Operator.Label is null) diff --git a/src/GitVersion.LibGit2Sharp/Git/Remote.cs b/src/GitVersion.LibGit2Sharp/Git/Remote.cs index a41d7d5e80..9b409824e7 100644 --- a/src/GitVersion.LibGit2Sharp/Git/Remote.cs +++ b/src/GitVersion.LibGit2Sharp/Git/Remote.cs @@ -23,7 +23,7 @@ public IEnumerable RefSpecs { var refSpecs = this.innerRemote.RefSpecs; return refSpecs is null - ? Enumerable.Empty() + ? [] : new RefSpecCollection((LibGit2Sharp.RefSpecCollection)refSpecs); } } diff --git a/src/GitVersion.MsBuild.Tests/GitVersion.MsBuild.Tests.csproj b/src/GitVersion.MsBuild.Tests/GitVersion.MsBuild.Tests.csproj index 428b5be4a2..6fa47ea425 100644 --- a/src/GitVersion.MsBuild.Tests/GitVersion.MsBuild.Tests.csproj +++ b/src/GitVersion.MsBuild.Tests/GitVersion.MsBuild.Tests.csproj @@ -26,7 +26,6 @@ - diff --git a/src/GitVersion.MsBuild.Tests/Tasks/GenerateGitVersionInformationTest.cs b/src/GitVersion.MsBuild.Tests/Tasks/GenerateGitVersionInformationTest.cs index a98a3d224e..9f3f86bfda 100644 --- a/src/GitVersion.MsBuild.Tests/Tasks/GenerateGitVersionInformationTest.cs +++ b/src/GitVersion.MsBuild.Tests/Tasks/GenerateGitVersionInformationTest.cs @@ -1,4 +1,3 @@ -using GitVersion.Core.Tests.Helpers; using GitVersion.Helpers; using GitVersion.MsBuild.Tasks; using GitVersion.MsBuild.Tests.Helpers; diff --git a/src/GitVersion.MsBuild.Tests/Tasks/TestTaskBase.cs b/src/GitVersion.MsBuild.Tests/Tasks/TestTaskBase.cs index ed19e7ad0c..5247f91e14 100644 --- a/src/GitVersion.MsBuild.Tests/Tasks/TestTaskBase.cs +++ b/src/GitVersion.MsBuild.Tests/Tasks/TestTaskBase.cs @@ -71,7 +71,7 @@ protected static MsBuildTaskFixtureResult ExecuteMsBuildTaskInGitHubActions("GITHUB_ACTIONS", "true")); var result = msbuildFixture.Execute(task); if (!result.Success) Console.WriteLine(result.Log); diff --git a/src/GitVersion.MsBuild.Tests/Tasks/UpdateAssemblyInfoTaskTest.cs b/src/GitVersion.MsBuild.Tests/Tasks/UpdateAssemblyInfoTaskTest.cs index 651f9895e5..beaaa8ef94 100644 --- a/src/GitVersion.MsBuild.Tests/Tasks/UpdateAssemblyInfoTaskTest.cs +++ b/src/GitVersion.MsBuild.Tests/Tasks/UpdateAssemblyInfoTaskTest.cs @@ -1,4 +1,3 @@ -using GitVersion.Core.Tests.Helpers; using GitVersion.Helpers; using GitVersion.MsBuild.Tasks; using GitVersion.MsBuild.Tests.Helpers; diff --git a/src/GitVersion.Testing/Fixtures/RepositoryFixtureBase.cs b/src/GitVersion.Testing/Fixtures/RepositoryFixtureBase.cs index 1ac92f2086..aed81489f4 100644 --- a/src/GitVersion.Testing/Fixtures/RepositoryFixtureBase.cs +++ b/src/GitVersion.Testing/Fixtures/RepositoryFixtureBase.cs @@ -1,5 +1,4 @@ using GitVersion.Helpers; -using GitVersion.Testing.Internal; using LibGit2Sharp; using Shouldly; diff --git a/src/GitVersion.Testing/GitVersion.Testing.csproj b/src/GitVersion.Testing/GitVersion.Testing.csproj index 48fca60324..c17ce24c9c 100644 --- a/src/GitVersion.Testing/GitVersion.Testing.csproj +++ b/src/GitVersion.Testing/GitVersion.Testing.csproj @@ -6,6 +6,15 @@ + + + + + + + + + diff --git a/src/GitVersion.Testing/Helpers/DirectoryHelper.cs b/src/GitVersion.Testing/Helpers/DirectoryHelper.cs deleted file mode 100644 index d8137e267d..0000000000 --- a/src/GitVersion.Testing/Helpers/DirectoryHelper.cs +++ /dev/null @@ -1,79 +0,0 @@ -using GitVersion.Helpers; - -namespace GitVersion.Testing.Internal; - -internal static class DirectoryHelper -{ - private static readonly Dictionary ToRename = new() - { - { "gitted", ".git" }, - { "gitmodules", ".gitmodules" } - }; - - public static void CopyFilesRecursively(DirectoryInfo source, DirectoryInfo target) - { - // From http://stackoverflow.com/questions/58744/best-way-to-copy-the-entire-contents-of-a-directory-in-c/58779#58779 - - foreach (var dir in source.GetDirectories()) - { - CopyFilesRecursively(dir, target.CreateSubdirectory(Rename(dir.Name))); - } - - foreach (var file in source.GetFiles()) - { - file.CopyTo(PathHelper.Combine(target.FullName, Rename(file.Name))); - } - } - - private static string Rename(string name) => ToRename.GetValueOrDefault(name, name); - - public static void DeleteSubDirectories(string parentPath) - { - var dirs = Directory.GetDirectories(parentPath); - foreach (var dir in dirs) - { - DeleteDirectory(dir); - } - } - - public static void DeleteDirectory(string directoryPath) - { - // From http://stackoverflow.com/questions/329355/cannot-delete-directory-with-directory-deletepath-true/329502#329502 - - if (!Directory.Exists(directoryPath)) - { - Trace.WriteLine($"Directory '{directoryPath}' is missing and can't be removed."); - - return; - } - - var files = Directory.GetFiles(directoryPath); - var dirs = Directory.GetDirectories(directoryPath); - - foreach (var file in files) - { - File.SetAttributes(file, FileAttributes.Normal); - File.Delete(file); - } - - foreach (var dir in dirs) - { - DeleteDirectory(dir); - } - - File.SetAttributes(directoryPath, FileAttributes.Normal); - try - { - Directory.Delete(directoryPath, false); - } - catch (IOException) - { - Trace.WriteLine(string.Format("{0}The directory '{1}' could not be deleted!" + - "{0}Most of the time, this is due to an external process accessing the files in the temporary repositories created during the test runs, and keeping a handle on the directory, thus preventing the deletion of those files." + - "{0}Known and common causes include:" + - "{0}- Windows Search Indexer (go to the Indexing Options, in the Windows Control Panel, and exclude the bin folder of LibGit2Sharp.Tests)" + - "{0}- Antivirus (exclude the bin folder of LibGit2Sharp.Tests from the paths scanned by your real-time antivirus){0}", - SysEnv.NewLine, Path.GetFullPath(directoryPath))); - } - } -} From b1a1b465d02fd9a1f874708e7c3b8c741ffa4cf2 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Wed, 5 Mar 2025 21:49:38 +0100 Subject: [PATCH 073/107] GitToolsTestingExtensions => GitRepositoryTestingExtensions --- ...s.cs => GitRepositoryTestingExtensions.cs} | 2 +- .../Helpers/GitVersionContextBuilder.cs | 8 ++-- ...EffectiveBranchConfigurationFinderTests.cs | 40 +++++++++---------- .../MinDateVersionFilterTests.cs | 4 +- .../ShaVersionFilterTests.cs | 6 +-- ...nfiguredNextVersionVersionStrategyTests.cs | 2 +- .../MergeMessageBaseVersionStrategyTests.cs | 8 ++-- .../GitVersion.MsBuild.Tests.csproj | 2 +- ...s.cs => GitRepositoryTestingExtensions.cs} | 2 +- 9 files changed, 37 insertions(+), 37 deletions(-) rename src/GitVersion.Core.Tests/Extensions/{GitToolsTestingExtensions.cs => GitRepositoryTestingExtensions.cs} (99%) rename src/GitVersion.MsBuild.Tests/Helpers/{GitToolsTestingExtensions.cs => GitRepositoryTestingExtensions.cs} (96%) diff --git a/src/GitVersion.Core.Tests/Extensions/GitToolsTestingExtensions.cs b/src/GitVersion.Core.Tests/Extensions/GitRepositoryTestingExtensions.cs similarity index 99% rename from src/GitVersion.Core.Tests/Extensions/GitToolsTestingExtensions.cs rename to src/GitVersion.Core.Tests/Extensions/GitRepositoryTestingExtensions.cs index 7e20ec2aaf..97fdf611d9 100644 --- a/src/GitVersion.Core.Tests/Extensions/GitToolsTestingExtensions.cs +++ b/src/GitVersion.Core.Tests/Extensions/GitRepositoryTestingExtensions.cs @@ -12,7 +12,7 @@ namespace GitVersion.Core.Tests; -public static class GitToolsTestingExtensions +public static class GitRepositoryTestingExtensions { private static int commitCount = 1; private static readonly DateTimeOffset when = DateTimeOffset.Now; diff --git a/src/GitVersion.Core.Tests/Helpers/GitVersionContextBuilder.cs b/src/GitVersion.Core.Tests/Helpers/GitVersionContextBuilder.cs index eb76416658..045c930d87 100644 --- a/src/GitVersion.Core.Tests/Helpers/GitVersionContextBuilder.cs +++ b/src/GitVersion.Core.Tests/Helpers/GitVersionContextBuilder.cs @@ -42,8 +42,8 @@ private GitVersionContextBuilder WithBranch(string branchName) private GitVersionContextBuilder AddBranch(string branchName) { - var mockCommit = GitToolsTestingExtensions.CreateMockCommit(); - var mockBranch = GitToolsTestingExtensions.CreateMockBranch(branchName, mockCommit); + var mockCommit = GitRepositoryTestingExtensions.CreateMockCommit(); + var mockBranch = GitRepositoryTestingExtensions.CreateMockBranch(branchName, mockCommit); this.repository ??= CreateRepository(); @@ -71,8 +71,8 @@ public void Build() private static IGitRepository CreateRepository() { - var mockCommit = GitToolsTestingExtensions.CreateMockCommit(); - var mockBranch = GitToolsTestingExtensions.CreateMockBranch(TestBase.MainBranch, mockCommit); + var mockCommit = GitRepositoryTestingExtensions.CreateMockCommit(); + var mockBranch = GitRepositoryTestingExtensions.CreateMockBranch(TestBase.MainBranch, mockCommit); var branches = Substitute.For(); branches.MockCollectionReturn(mockBranch); diff --git a/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs index 35bd07d123..ba682c3543 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/EffectiveBranchConfigurationFinderTests.cs @@ -14,7 +14,7 @@ public void When_getting_configurations_of_a_branch_without_versioning_mode_Give DeploymentMode versioningMode) { // Arrange - var branchMock = GitToolsTestingExtensions.CreateMockBranch("main", GitToolsTestingExtensions.CreateMockCommit()); + var branchMock = GitRepositoryTestingExtensions.CreateMockBranch("main", GitRepositoryTestingExtensions.CreateMockCommit()); var configuration = GitFlowConfigurationBuilder.New .WithDeploymentMode(versioningMode) .WithBranch("main", builder => builder.WithDeploymentMode(null)) @@ -38,8 +38,8 @@ public void When_getting_configurations_of_a_branch_with_versioning_mode_Given_f DeploymentMode versioningMode) { // Arrange - var mainBranchMock = GitToolsTestingExtensions.CreateMockBranch("main", GitToolsTestingExtensions.CreateMockCommit()); - var developBranchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); + var mainBranchMock = GitRepositoryTestingExtensions.CreateMockBranch("main", GitRepositoryTestingExtensions.CreateMockCommit()); + var developBranchMock = GitRepositoryTestingExtensions.CreateMockBranch("develop", GitRepositoryTestingExtensions.CreateMockCommit()); var configuration = GitFlowConfigurationBuilder.New .WithDeploymentMode(null) .WithBranch("main", builder => builder.WithDeploymentMode(versioningMode)) @@ -64,8 +64,8 @@ public void When_getting_configurations_of_a_branch_with_versioning_mode_Given_p DeploymentMode versioningMode) { // Arrange - var mainBranchMock = GitToolsTestingExtensions.CreateMockBranch("main", GitToolsTestingExtensions.CreateMockCommit()); - var developBranchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); + var mainBranchMock = GitRepositoryTestingExtensions.CreateMockBranch("main", GitRepositoryTestingExtensions.CreateMockCommit()); + var developBranchMock = GitRepositoryTestingExtensions.CreateMockBranch("develop", GitRepositoryTestingExtensions.CreateMockCommit()); var configuration = GitFlowConfigurationBuilder.New .WithDeploymentMode(null) .WithBranch("main", builder => builder.WithDeploymentMode(versioningMode)) @@ -99,8 +99,8 @@ public void When_getting_configurations_of_a_branch_with_versioning_mode_Given_p public void When_getting_configurations_of_a_branch_with_tag_alpha_Given_branch_which_inherits_from_parent_branch_Then_result_should_have_tag_alpha() { // Arrange - var mainBranchMock = GitToolsTestingExtensions.CreateMockBranch("main", GitToolsTestingExtensions.CreateMockCommit()); - var developBranchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); + var mainBranchMock = GitRepositoryTestingExtensions.CreateMockBranch("main", GitRepositoryTestingExtensions.CreateMockCommit()); + var developBranchMock = GitRepositoryTestingExtensions.CreateMockBranch("develop", GitRepositoryTestingExtensions.CreateMockCommit()); var configuration = GitFlowConfigurationBuilder.New .WithBranch("main", builder => builder.WithLabel(string.Empty)) .WithBranch("develop", builder => builder @@ -126,8 +126,8 @@ public void When_getting_configurations_of_a_branch_with_tag_alpha_Given_branch_ public void When_getting_configurations_of_a_branch_without_tag_Given_branch_which_inherits_from_parent_branch_Then_result_should_have_tag_from_parent() { // Arrange - var mainBranchMock = GitToolsTestingExtensions.CreateMockBranch("main", GitToolsTestingExtensions.CreateMockCommit()); - var developBranchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); + var mainBranchMock = GitRepositoryTestingExtensions.CreateMockBranch("main", GitRepositoryTestingExtensions.CreateMockCommit()); + var developBranchMock = GitRepositoryTestingExtensions.CreateMockBranch("develop", GitRepositoryTestingExtensions.CreateMockCommit()); var configuration = GitFlowConfigurationBuilder.New .WithBranch("main", builder => builder.WithLabel(string.Empty)) .WithBranch("develop", builder => builder @@ -154,7 +154,7 @@ public void When_getting_configurations_of_a_branch_without_tag_Given_branch_whi public void UsesFirstBranchConfigWhenMultipleMatch(string branchName, IncrementStrategy incrementStrategy, string label) { // Arrange - var releaseBranchMock = GitToolsTestingExtensions.CreateMockBranch(branchName, GitToolsTestingExtensions.CreateMockCommit()); + var releaseBranchMock = GitRepositoryTestingExtensions.CreateMockBranch(branchName, GitRepositoryTestingExtensions.CreateMockCommit()); var configuration = GitFlowConfigurationBuilder.New .WithoutBranches() .WithBranch("release/latest", builder => builder @@ -188,7 +188,7 @@ public void UsesFirstBranchConfigWhenMultipleMatch(string branchName, IncrementS public void When_getting_configurations_of_an_orphaned_branch_Given_fallback_configuration_with_increment_inherit_Then_result_should_be_empty() { // Arrange - var branchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); + var branchMock = GitRepositoryTestingExtensions.CreateMockBranch("develop", GitRepositoryTestingExtensions.CreateMockCommit()); var configuration = GitFlowConfigurationBuilder.New .WithIncrement(IncrementStrategy.Inherit) .WithBranch("develop", builder => builder.WithIncrement(IncrementStrategy.Inherit)) @@ -213,7 +213,7 @@ public void When_getting_configurations_of_an_orphaned_branch_Given_fallback_con IncrementStrategy fallbackIncrement) { // Arrange - var branchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); + var branchMock = GitRepositoryTestingExtensions.CreateMockBranch("develop", GitRepositoryTestingExtensions.CreateMockCommit()); var configuration = GitFlowConfigurationBuilder.New .WithIncrement(fallbackIncrement) .WithBranch("develop", builder => builder.WithIncrement(IncrementStrategy.Inherit)) @@ -236,7 +236,7 @@ public void When_getting_configurations_of_an_orphaned_branch_Given_fallback_con public void When_getting_configurations_of_an_unknown_branch_Given_fallback_and_unknown_configuration_with_increment_inherit_Then_result_should_be_empty() { // Arrange - var branchMock = GitToolsTestingExtensions.CreateMockBranch("unknown", GitToolsTestingExtensions.CreateMockCommit()); + var branchMock = GitRepositoryTestingExtensions.CreateMockBranch("unknown", GitRepositoryTestingExtensions.CreateMockCommit()); var configuration = GitFlowConfigurationBuilder.New .WithIncrement(IncrementStrategy.Inherit) .WithBranch("unknown", builder => builder.WithIncrement(IncrementStrategy.Inherit)) @@ -261,7 +261,7 @@ public void When_getting_configurations_of_an_unknown_branch_Given_fallback_conf IncrementStrategy fallbackIncrement) { // Arrange - var branchMock = GitToolsTestingExtensions.CreateMockBranch("unknown", GitToolsTestingExtensions.CreateMockCommit()); + var branchMock = GitRepositoryTestingExtensions.CreateMockBranch("unknown", GitRepositoryTestingExtensions.CreateMockCommit()); var configuration = GitFlowConfigurationBuilder.New .WithIncrement(fallbackIncrement) .WithBranch("unknown", builder => builder.WithIncrement(IncrementStrategy.Inherit)) @@ -285,13 +285,13 @@ public void When_getting_configurations_of_an_unknown_branch_Given_fallback_conf IncrementStrategy fallbackIncrement, IncrementStrategy developIncrement) { // Arrange - var unknownBranchMock = GitToolsTestingExtensions.CreateMockBranch("unknown", GitToolsTestingExtensions.CreateMockCommit()); + var unknownBranchMock = GitRepositoryTestingExtensions.CreateMockBranch("unknown", GitRepositoryTestingExtensions.CreateMockCommit()); var configuration = GitFlowConfigurationBuilder.New .WithIncrement(fallbackIncrement) .WithBranch("develop", builder => builder.WithIncrement(developIncrement)) .Build(); var repositoryStoreMock = Substitute.For(); - var developBranchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); + var developBranchMock = GitRepositoryTestingExtensions.CreateMockBranch("develop", GitRepositoryTestingExtensions.CreateMockCommit()); repositoryStoreMock.GetSourceBranches(unknownBranchMock, configuration, Arg.Any>()).Returns([developBranchMock]); var unitUnderTest = new EffectiveBranchConfigurationFinder(Substitute.For(), repositoryStoreMock); @@ -318,13 +318,13 @@ public void When_getting_configurations_of_an_unknown_branch_Given_fallback_conf IncrementStrategy fallbackIncrement) { // Arrange - var unknownBranchMock = GitToolsTestingExtensions.CreateMockBranch("unknown", GitToolsTestingExtensions.CreateMockCommit()); + var unknownBranchMock = GitRepositoryTestingExtensions.CreateMockBranch("unknown", GitRepositoryTestingExtensions.CreateMockCommit()); var configuration = GitFlowConfigurationBuilder.New .WithIncrement(fallbackIncrement) .WithBranch("develop", builder => builder.WithIncrement(IncrementStrategy.Inherit)) .Build(); var repositoryStoreMock = Substitute.For(); - var developBranchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); + var developBranchMock = GitRepositoryTestingExtensions.CreateMockBranch("develop", GitRepositoryTestingExtensions.CreateMockCommit()); repositoryStoreMock.GetSourceBranches(unknownBranchMock, configuration, Arg.Any>()).Returns([developBranchMock]); var unitUnderTest = new EffectiveBranchConfigurationFinder(Substitute.For(), repositoryStoreMock); @@ -353,13 +353,13 @@ public void When_getting_configurations_of_an_unknown_branch_Given_fallback_and_ IncrementStrategy developBranchIncrement) { // Arrange - var unknownBranchMock = GitToolsTestingExtensions.CreateMockBranch("unknown", GitToolsTestingExtensions.CreateMockCommit()); + var unknownBranchMock = GitRepositoryTestingExtensions.CreateMockBranch("unknown", GitRepositoryTestingExtensions.CreateMockCommit()); var configuration = GitFlowConfigurationBuilder.New .WithIncrement(IncrementStrategy.Inherit) .WithBranch("develop", builder => builder.WithIncrement(developBranchIncrement)) .Build(); var repositoryStoreMock = Substitute.For(); - var developBranchMock = GitToolsTestingExtensions.CreateMockBranch("develop", GitToolsTestingExtensions.CreateMockCommit()); + var developBranchMock = GitRepositoryTestingExtensions.CreateMockBranch("develop", GitRepositoryTestingExtensions.CreateMockCommit()); repositoryStoreMock.GetSourceBranches(Arg.Any(), Arg.Any(), Arg.Any>()).Returns([developBranchMock]); var unitUnderTest = new EffectiveBranchConfigurationFinder(Substitute.For(), repositoryStoreMock); diff --git a/src/GitVersion.Core.Tests/VersionCalculation/MinDateVersionFilterTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/MinDateVersionFilterTests.cs index bd5438ecc7..86f41c787c 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/MinDateVersionFilterTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/MinDateVersionFilterTests.cs @@ -18,7 +18,7 @@ public void VerifyNullGuard() [Test] public void WhenCommitShouldExcludeWithReason() { - var commit = GitToolsTestingExtensions.CreateMockCommit(); + var commit = GitRepositoryTestingExtensions.CreateMockCommit(); BaseVersion version = new("dummy", new SemanticVersion(1), commit); var futureDate = DateTimeOffset.UtcNow.AddYears(1); var sut = new MinDateVersionFilter(futureDate); @@ -30,7 +30,7 @@ public void WhenCommitShouldExcludeWithReason() [Test] public void WhenShaMismatchShouldNotExclude() { - var commit = GitToolsTestingExtensions.CreateMockCommit(); + var commit = GitRepositoryTestingExtensions.CreateMockCommit(); BaseVersion version = new("dummy", new SemanticVersion(1), commit); var pastDate = DateTimeOffset.UtcNow.AddYears(-1); var sut = new MinDateVersionFilter(pastDate); diff --git a/src/GitVersion.Core.Tests/VersionCalculation/ShaVersionFilterTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/ShaVersionFilterTests.cs index 9ad4953bbe..69b95b9f20 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/ShaVersionFilterTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/ShaVersionFilterTests.cs @@ -9,7 +9,7 @@ public class ShaVersionFilterTests : TestBase [Test] public void VerifyNullGuard() { - var commit = GitToolsTestingExtensions.CreateMockCommit(); + var commit = GitRepositoryTestingExtensions.CreateMockCommit(); var sut = new ShaVersionFilter([commit.Sha]); Should.Throw(() => sut.Exclude(null!, out _)); @@ -18,7 +18,7 @@ public void VerifyNullGuard() [Test] public void WhenShaMatchShouldExcludeWithReason() { - var commit = GitToolsTestingExtensions.CreateMockCommit(); + var commit = GitRepositoryTestingExtensions.CreateMockCommit(); BaseVersion version = new("dummy", new SemanticVersion(1), commit); var sut = new ShaVersionFilter([commit.Sha]); @@ -29,7 +29,7 @@ public void WhenShaMatchShouldExcludeWithReason() [Test] public void WhenShaMismatchShouldNotExclude() { - var commit = GitToolsTestingExtensions.CreateMockCommit(); + var commit = GitRepositoryTestingExtensions.CreateMockCommit(); BaseVersion version = new("dummy", new SemanticVersion(1), commit); var sut = new ShaVersionFilter(["mismatched"]); diff --git a/src/GitVersion.Core.Tests/VersionCalculation/Strategies/ConfiguredNextVersionVersionStrategyTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/Strategies/ConfiguredNextVersionVersionStrategyTests.cs index 369124aae4..bd06aceb05 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/Strategies/ConfiguredNextVersionVersionStrategyTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/Strategies/ConfiguredNextVersionVersionStrategyTests.cs @@ -81,7 +81,7 @@ public void ConfiguredNextVersionTestShouldFail(string nextVersion, SemanticVers contextBuilder.ServicesProvider.ShouldNotBeNull(); var strategy = contextBuilder.ServicesProvider.GetServiceForType(); var context = contextBuilder.ServicesProvider.GetRequiredService>().Value; - var branchMock = GitToolsTestingExtensions.CreateMockBranch("main", GitToolsTestingExtensions.CreateMockCommit()); + var branchMock = GitRepositoryTestingExtensions.CreateMockBranch("main", GitRepositoryTestingExtensions.CreateMockCommit()); strategy.ShouldNotBeNull(); return strategy.GetBaseVersions(context.Configuration.GetEffectiveBranchConfiguration(branchMock)).SingleOrDefault(); diff --git a/src/GitVersion.Core.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs index 0f34c39434..fccd3fcd36 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/Strategies/MergeMessageBaseVersionStrategyTests.cs @@ -15,11 +15,11 @@ public void ShouldNotAllowIncrementOfVersion() { // When a branch is merged in you want to start building stable packages of that version // So we shouldn't bump the version - var mockCommit = GitToolsTestingExtensions.CreateMockCommit(); + var mockCommit = GitRepositoryTestingExtensions.CreateMockCommit(); mockCommit.Message.Returns("Merge branch 'release-0.1.5'"); mockCommit.Parents.Returns(GetParents(true)); - var mockBranch = GitToolsTestingExtensions.CreateMockBranch(MainBranch, mockCommit); + var mockBranch = GitRepositoryTestingExtensions.CreateMockBranch(MainBranch, mockCommit); var branches = Substitute.For(); branches.MockCollectionReturn(mockBranch); @@ -154,11 +154,11 @@ public void TakesVersionFromMergeOfConfiguredReleaseBranch(string message, strin private static void AssertMergeMessage(string message, string? expectedVersion, IEnumerable parents, IReadOnlyDictionary? configuration = null) { - var commit = GitToolsTestingExtensions.CreateMockCommit(); + var commit = GitRepositoryTestingExtensions.CreateMockCommit(); commit.Message.Returns(message); commit.Parents.Returns(parents); - var mockBranch = GitToolsTestingExtensions.CreateMockBranch(MainBranch, commit, GitToolsTestingExtensions.CreateMockCommit()); + var mockBranch = GitRepositoryTestingExtensions.CreateMockBranch(MainBranch, commit, GitRepositoryTestingExtensions.CreateMockCommit()); var mockRepository = Substitute.For(); mockRepository.Head.Returns(mockBranch); diff --git a/src/GitVersion.MsBuild.Tests/GitVersion.MsBuild.Tests.csproj b/src/GitVersion.MsBuild.Tests/GitVersion.MsBuild.Tests.csproj index 6fa47ea425..42bf2b0fa1 100644 --- a/src/GitVersion.MsBuild.Tests/GitVersion.MsBuild.Tests.csproj +++ b/src/GitVersion.MsBuild.Tests/GitVersion.MsBuild.Tests.csproj @@ -31,7 +31,7 @@ - + diff --git a/src/GitVersion.MsBuild.Tests/Helpers/GitToolsTestingExtensions.cs b/src/GitVersion.MsBuild.Tests/Helpers/GitRepositoryTestingExtensions.cs similarity index 96% rename from src/GitVersion.MsBuild.Tests/Helpers/GitToolsTestingExtensions.cs rename to src/GitVersion.MsBuild.Tests/Helpers/GitRepositoryTestingExtensions.cs index 73aff7d672..1e6069f57d 100644 --- a/src/GitVersion.MsBuild.Tests/Helpers/GitToolsTestingExtensions.cs +++ b/src/GitVersion.MsBuild.Tests/Helpers/GitRepositoryTestingExtensions.cs @@ -6,7 +6,7 @@ namespace GitVersion.MsBuild.Tests.Helpers; -public static class GitToolsTestingExtensions +public static class GitRepositoryTestingExtensions { /// /// Simulates running on build server From 36f3a0a2d2ee4af283992f9b03db6508569a0afc Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Wed, 5 Mar 2025 21:51:58 +0100 Subject: [PATCH 074/107] move FileAppender to GitVersion.App --- .../Logging => GitVersion.App}/FileAppender.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) rename src/{GitVersion.Core/Logging => GitVersion.App}/FileAppender.cs (94%) diff --git a/src/GitVersion.Core/Logging/FileAppender.cs b/src/GitVersion.App/FileAppender.cs similarity index 94% rename from src/GitVersion.Core/Logging/FileAppender.cs rename to src/GitVersion.App/FileAppender.cs index a5c8f56a78..8d2fc8f8a2 100644 --- a/src/GitVersion.Core/Logging/FileAppender.cs +++ b/src/GitVersion.App/FileAppender.cs @@ -1,6 +1,7 @@ using GitVersion.Helpers; +using GitVersion.Logging; -namespace GitVersion.Logging; +namespace GitVersion; internal class FileAppender : ILogAppender { From 380874e8193e6fb44b9b5228e59ca0737fcf8e9f Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Wed, 5 Mar 2025 22:25:01 +0100 Subject: [PATCH 075/107] added IFileSystem to BuildAgentBase --- .../Agents/BuildServerBaseTests.cs | 2 +- src/GitVersion.BuildAgents/Agents/AppVeyor.cs | 2 +- src/GitVersion.BuildAgents/Agents/AzurePipelines.cs | 2 +- src/GitVersion.BuildAgents/Agents/BitBucketPipelines.cs | 2 +- src/GitVersion.BuildAgents/Agents/BuildKite.cs | 2 +- src/GitVersion.BuildAgents/Agents/CodeBuild.cs | 2 +- src/GitVersion.BuildAgents/Agents/ContinuaCi.cs | 2 +- src/GitVersion.BuildAgents/Agents/Drone.cs | 2 +- src/GitVersion.BuildAgents/Agents/EnvRun.cs | 2 +- src/GitVersion.BuildAgents/Agents/GitHubActions.cs | 2 +- src/GitVersion.BuildAgents/Agents/GitLabCi.cs | 2 +- src/GitVersion.BuildAgents/Agents/Jenkins.cs | 2 +- src/GitVersion.BuildAgents/Agents/MyGet.cs | 2 +- src/GitVersion.BuildAgents/Agents/SpaceAutomation.cs | 2 +- src/GitVersion.BuildAgents/Agents/TeamCity.cs | 2 +- src/GitVersion.BuildAgents/Agents/TravisCI.cs | 2 +- src/GitVersion.Core/Agents/BuildAgentBase.cs | 5 +++-- src/GitVersion.Core/Agents/LocalBuild.cs | 2 +- 18 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/GitVersion.BuildAgents.Tests/Agents/BuildServerBaseTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/BuildServerBaseTests.cs index 9666ef0e79..f1e0166beb 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/BuildServerBaseTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/BuildServerBaseTests.cs @@ -48,7 +48,7 @@ public void BuildNumberIsFullSemVer() writes.ShouldNotContain(x => x != null && x.StartsWith("Executing GenerateSetVersionMessage for ")); } - private class BuildAgent(IEnvironment environment, ILog log) : BuildAgentBase(environment, log) + private class BuildAgent(IEnvironment environment, ILog log, IFileSystem fileSystem) : BuildAgentBase(environment, log, fileSystem) { protected override string EnvironmentVariable => throw new NotImplementedException(); diff --git a/src/GitVersion.BuildAgents/Agents/AppVeyor.cs b/src/GitVersion.BuildAgents/Agents/AppVeyor.cs index 580b9adc29..b1b38db2da 100644 --- a/src/GitVersion.BuildAgents/Agents/AppVeyor.cs +++ b/src/GitVersion.BuildAgents/Agents/AppVeyor.cs @@ -4,7 +4,7 @@ namespace GitVersion.Agents; -internal class AppVeyor(IEnvironment environment, ILog log) : BuildAgentBase(environment, log) +internal class AppVeyor(IEnvironment environment, ILog log, IFileSystem fileSystem) : BuildAgentBase(environment, log, fileSystem) { public const string EnvironmentVariableName = "APPVEYOR"; diff --git a/src/GitVersion.BuildAgents/Agents/AzurePipelines.cs b/src/GitVersion.BuildAgents/Agents/AzurePipelines.cs index e29ab4062d..8c4e11b372 100644 --- a/src/GitVersion.BuildAgents/Agents/AzurePipelines.cs +++ b/src/GitVersion.BuildAgents/Agents/AzurePipelines.cs @@ -4,7 +4,7 @@ namespace GitVersion.Agents; -internal class AzurePipelines(IEnvironment environment, ILog log) : BuildAgentBase(environment, log) +internal class AzurePipelines(IEnvironment environment, ILog log, IFileSystem fileSystem) : BuildAgentBase(environment, log, fileSystem) { public const string EnvironmentVariableName = "TF_BUILD"; diff --git a/src/GitVersion.BuildAgents/Agents/BitBucketPipelines.cs b/src/GitVersion.BuildAgents/Agents/BitBucketPipelines.cs index 61d62465f0..3574271132 100644 --- a/src/GitVersion.BuildAgents/Agents/BitBucketPipelines.cs +++ b/src/GitVersion.BuildAgents/Agents/BitBucketPipelines.cs @@ -12,7 +12,7 @@ internal class BitBucketPipelines : BuildAgentBase private string? propertyFile; private string? ps1File; - public BitBucketPipelines(IEnvironment environment, ILog log) : base(environment, log) + public BitBucketPipelines(IEnvironment environment, ILog log, IFileSystem fileSystem) : base(environment, log, fileSystem) { WithPropertyFile("gitversion.properties"); WithPowershellFile("gitversion.ps1"); diff --git a/src/GitVersion.BuildAgents/Agents/BuildKite.cs b/src/GitVersion.BuildAgents/Agents/BuildKite.cs index 2b5a1bf12d..8fc493c4b5 100644 --- a/src/GitVersion.BuildAgents/Agents/BuildKite.cs +++ b/src/GitVersion.BuildAgents/Agents/BuildKite.cs @@ -3,7 +3,7 @@ namespace GitVersion.Agents; -internal class BuildKite(IEnvironment environment, ILog log) : BuildAgentBase(environment, log) +internal class BuildKite(IEnvironment environment, ILog log, IFileSystem fileSystem) : BuildAgentBase(environment, log, fileSystem) { public const string EnvironmentVariableName = "BUILDKITE"; diff --git a/src/GitVersion.BuildAgents/Agents/CodeBuild.cs b/src/GitVersion.BuildAgents/Agents/CodeBuild.cs index 402c97f055..7bf2d84560 100644 --- a/src/GitVersion.BuildAgents/Agents/CodeBuild.cs +++ b/src/GitVersion.BuildAgents/Agents/CodeBuild.cs @@ -10,7 +10,7 @@ internal sealed class CodeBuild : BuildAgentBase public const string WebHookEnvironmentVariableName = "CODEBUILD_WEBHOOK_HEAD_REF"; public const string SourceVersionEnvironmentVariableName = "CODEBUILD_SOURCE_VERSION"; - public CodeBuild(IEnvironment environment, ILog log) : base(environment, log) => WithPropertyFile("gitversion.properties"); + public CodeBuild(IEnvironment environment, ILog log, IFileSystem fileSystem) : base(environment, log, fileSystem) => WithPropertyFile("gitversion.properties"); public void WithPropertyFile(string propertiesFileName) => this.file = propertiesFileName; diff --git a/src/GitVersion.BuildAgents/Agents/ContinuaCi.cs b/src/GitVersion.BuildAgents/Agents/ContinuaCi.cs index fa96cdc04b..30d650c415 100644 --- a/src/GitVersion.BuildAgents/Agents/ContinuaCi.cs +++ b/src/GitVersion.BuildAgents/Agents/ContinuaCi.cs @@ -3,7 +3,7 @@ namespace GitVersion.Agents; -internal class ContinuaCi(IEnvironment environment, ILog log) : BuildAgentBase(environment, log) +internal class ContinuaCi(IEnvironment environment, ILog log, IFileSystem fileSystem) : BuildAgentBase(environment, log, fileSystem) { public const string EnvironmentVariableName = "ContinuaCI.Version"; diff --git a/src/GitVersion.BuildAgents/Agents/Drone.cs b/src/GitVersion.BuildAgents/Agents/Drone.cs index 2504ea927c..6054e91805 100644 --- a/src/GitVersion.BuildAgents/Agents/Drone.cs +++ b/src/GitVersion.BuildAgents/Agents/Drone.cs @@ -4,7 +4,7 @@ namespace GitVersion.Agents; -internal class Drone(IEnvironment environment, ILog log) : BuildAgentBase(environment, log) +internal class Drone(IEnvironment environment, ILog log, IFileSystem fileSystem) : BuildAgentBase(environment, log, fileSystem) { public const string EnvironmentVariableName = "DRONE"; protected override string EnvironmentVariable => EnvironmentVariableName; diff --git a/src/GitVersion.BuildAgents/Agents/EnvRun.cs b/src/GitVersion.BuildAgents/Agents/EnvRun.cs index 52092c8da1..1c55255757 100644 --- a/src/GitVersion.BuildAgents/Agents/EnvRun.cs +++ b/src/GitVersion.BuildAgents/Agents/EnvRun.cs @@ -4,7 +4,7 @@ namespace GitVersion.Agents; -internal class EnvRun(IEnvironment environment, ILog log) : BuildAgentBase(environment, log) +internal class EnvRun(IEnvironment environment, ILog log, IFileSystem fileSystem) : BuildAgentBase(environment, log, fileSystem) { public const string EnvironmentVariableName = "ENVRUN_DATABASE"; protected override string EnvironmentVariable => EnvironmentVariableName; diff --git a/src/GitVersion.BuildAgents/Agents/GitHubActions.cs b/src/GitVersion.BuildAgents/Agents/GitHubActions.cs index 7d5b8a9122..521ff47d0a 100644 --- a/src/GitVersion.BuildAgents/Agents/GitHubActions.cs +++ b/src/GitVersion.BuildAgents/Agents/GitHubActions.cs @@ -4,7 +4,7 @@ namespace GitVersion.Agents; -internal class GitHubActions(IEnvironment environment, ILog log) : BuildAgentBase(environment, log) +internal class GitHubActions(IEnvironment environment, ILog log, IFileSystem fileSystem) : BuildAgentBase(environment, log, fileSystem) { // https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables#default-environment-variables diff --git a/src/GitVersion.BuildAgents/Agents/GitLabCi.cs b/src/GitVersion.BuildAgents/Agents/GitLabCi.cs index 23c0e912a1..0c29e423a1 100644 --- a/src/GitVersion.BuildAgents/Agents/GitLabCi.cs +++ b/src/GitVersion.BuildAgents/Agents/GitLabCi.cs @@ -8,7 +8,7 @@ internal class GitLabCi : BuildAgentBase public const string EnvironmentVariableName = "GITLAB_CI"; private string? file; - public GitLabCi(IEnvironment environment, ILog log) : base(environment, log) => WithPropertyFile("gitversion.properties"); + public GitLabCi(IEnvironment environment, ILog log, IFileSystem fileSystem) : base(environment, log, fileSystem) => WithPropertyFile("gitversion.properties"); public void WithPropertyFile(string propertiesFileName) => this.file = propertiesFileName; diff --git a/src/GitVersion.BuildAgents/Agents/Jenkins.cs b/src/GitVersion.BuildAgents/Agents/Jenkins.cs index dfd45beb16..6030ba0d93 100644 --- a/src/GitVersion.BuildAgents/Agents/Jenkins.cs +++ b/src/GitVersion.BuildAgents/Agents/Jenkins.cs @@ -10,7 +10,7 @@ internal class Jenkins : BuildAgentBase private string? file; protected override string EnvironmentVariable => EnvironmentVariableName; - public Jenkins(IEnvironment environment, ILog log) : base(environment, log) => WithPropertyFile("gitversion.properties"); + public Jenkins(IEnvironment environment, ILog log, IFileSystem fileSystem) : base(environment, log, fileSystem) => WithPropertyFile("gitversion.properties"); public void WithPropertyFile(string propertiesFileName) => this.file = propertiesFileName; diff --git a/src/GitVersion.BuildAgents/Agents/MyGet.cs b/src/GitVersion.BuildAgents/Agents/MyGet.cs index 42fc06de29..4d488834ea 100644 --- a/src/GitVersion.BuildAgents/Agents/MyGet.cs +++ b/src/GitVersion.BuildAgents/Agents/MyGet.cs @@ -5,7 +5,7 @@ namespace GitVersion.Agents; -internal class MyGet(IEnvironment environment, ILog log) : BuildAgentBase(environment, log) +internal class MyGet(IEnvironment environment, ILog log, IFileSystem fileSystem) : BuildAgentBase(environment, log, fileSystem) { public const string EnvironmentVariableName = "BuildRunner"; protected override string EnvironmentVariable => EnvironmentVariableName; diff --git a/src/GitVersion.BuildAgents/Agents/SpaceAutomation.cs b/src/GitVersion.BuildAgents/Agents/SpaceAutomation.cs index 10882a2fef..41b2b3f941 100644 --- a/src/GitVersion.BuildAgents/Agents/SpaceAutomation.cs +++ b/src/GitVersion.BuildAgents/Agents/SpaceAutomation.cs @@ -3,7 +3,7 @@ namespace GitVersion.Agents; -internal class SpaceAutomation(IEnvironment environment, ILog log) : BuildAgentBase(environment, log) +internal class SpaceAutomation(IEnvironment environment, ILog log, IFileSystem fileSystem) : BuildAgentBase(environment, log, fileSystem) { public const string EnvironmentVariableName = "JB_SPACE_PROJECT_KEY"; diff --git a/src/GitVersion.BuildAgents/Agents/TeamCity.cs b/src/GitVersion.BuildAgents/Agents/TeamCity.cs index 91d1915ba0..84f60b2749 100644 --- a/src/GitVersion.BuildAgents/Agents/TeamCity.cs +++ b/src/GitVersion.BuildAgents/Agents/TeamCity.cs @@ -5,7 +5,7 @@ namespace GitVersion.Agents; -internal class TeamCity(IEnvironment environment, ILog log) : BuildAgentBase(environment, log) +internal class TeamCity(IEnvironment environment, ILog log, IFileSystem fileSystem) : BuildAgentBase(environment, log, fileSystem) { public const string EnvironmentVariableName = "TEAMCITY_VERSION"; diff --git a/src/GitVersion.BuildAgents/Agents/TravisCI.cs b/src/GitVersion.BuildAgents/Agents/TravisCI.cs index 70bef8c2f6..6109006a21 100644 --- a/src/GitVersion.BuildAgents/Agents/TravisCI.cs +++ b/src/GitVersion.BuildAgents/Agents/TravisCI.cs @@ -3,7 +3,7 @@ namespace GitVersion.Agents; -internal class TravisCi(IEnvironment environment, ILog log) : BuildAgentBase(environment, log) +internal class TravisCi(IEnvironment environment, ILog log, IFileSystem fileSystem) : BuildAgentBase(environment, log, fileSystem) { public const string EnvironmentVariableName = "TRAVIS"; protected override string EnvironmentVariable => EnvironmentVariableName; diff --git a/src/GitVersion.Core/Agents/BuildAgentBase.cs b/src/GitVersion.Core/Agents/BuildAgentBase.cs index 29840605bb..1514d42f4e 100644 --- a/src/GitVersion.Core/Agents/BuildAgentBase.cs +++ b/src/GitVersion.Core/Agents/BuildAgentBase.cs @@ -4,10 +4,11 @@ namespace GitVersion.Agents; -internal abstract class BuildAgentBase(IEnvironment environment, ILog log) : ICurrentBuildAgent +internal abstract class BuildAgentBase(IEnvironment environment, ILog log, IFileSystem fileSystem) : ICurrentBuildAgent { protected readonly ILog Log = log.NotNull(); - protected IEnvironment Environment { get; } = environment.NotNull(); + protected readonly IEnvironment Environment = environment.NotNull(); + protected readonly IFileSystem FileSystem = fileSystem.NotNull(); protected abstract string EnvironmentVariable { get; } public virtual bool IsDefault => false; diff --git a/src/GitVersion.Core/Agents/LocalBuild.cs b/src/GitVersion.Core/Agents/LocalBuild.cs index 11a636b352..60a9613e6b 100644 --- a/src/GitVersion.Core/Agents/LocalBuild.cs +++ b/src/GitVersion.Core/Agents/LocalBuild.cs @@ -3,7 +3,7 @@ namespace GitVersion.Agents; -internal class LocalBuild(IEnvironment environment, ILog log) : BuildAgentBase(environment, log) +internal class LocalBuild(IEnvironment environment, ILog log, IFileSystem fileSystem) : BuildAgentBase(environment, log, fileSystem) { public override bool IsDefault => true; From f705ee97f01d412a85b5ccbea69215830eb3603f Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Wed, 5 Mar 2025 22:26:44 +0100 Subject: [PATCH 076/107] simplified GitVersionTaskBase --- .../Helpers/MsBuildTaskFixture.cs | 2 +- .../Tasks/TestTaskBase.cs | 11 -------- src/GitVersion.MsBuild/GitVersionTaskBase.cs | 9 +----- src/GitVersion.MsBuild/GitVersionTasks.cs | 28 ++++++++++--------- src/GitVersion.MsBuild/PublicAPI.Shipped.txt | 8 ------ .../Tasks/GenerateGitVersionInformation.cs | 2 -- src/GitVersion.MsBuild/Tasks/GetVersion.cs | 2 -- .../Tasks/UpdateAssemblyInfo.cs | 2 -- .../Tasks/WriteVersionInfoToBuildLog.cs | 5 +--- 9 files changed, 18 insertions(+), 51 deletions(-) diff --git a/src/GitVersion.MsBuild.Tests/Helpers/MsBuildTaskFixture.cs b/src/GitVersion.MsBuild.Tests/Helpers/MsBuildTaskFixture.cs index 2c9ac2b028..0e8eac0e9a 100644 --- a/src/GitVersion.MsBuild.Tests/Helpers/MsBuildTaskFixture.cs +++ b/src/GitVersion.MsBuild.Tests/Helpers/MsBuildTaskFixture.cs @@ -23,7 +23,7 @@ public MsBuildTaskFixtureResult Execute(T task) where T : GitVersionTaskBa task.VersionFile = versionFile; - var result = task.Execute(); + var result = GitVersionTasks.Execute(task); return new MsBuildTaskFixtureResult(fixture) { diff --git a/src/GitVersion.MsBuild.Tests/Tasks/TestTaskBase.cs b/src/GitVersion.MsBuild.Tests/Tasks/TestTaskBase.cs index 5247f91e14..8c0df2dea9 100644 --- a/src/GitVersion.MsBuild.Tests/Tasks/TestTaskBase.cs +++ b/src/GitVersion.MsBuild.Tests/Tasks/TestTaskBase.cs @@ -1,10 +1,8 @@ using GitVersion.Agents; using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; -using GitVersion.Extensions; using GitVersion.Helpers; using GitVersion.MsBuild.Tests.Helpers; -using GitVersion.Output; using LibGit2Sharp; using Microsoft.Build.Utilities.ProjectCreation; @@ -22,7 +20,6 @@ protected static MsBuildTaskFixtureResult ExecuteMsBuildTask(T task) where { var fixture = CreateLocalRepositoryFixture(); task.SolutionDirectory = fixture.RepositoryPath; - AddOverrides(task); var msbuildFixture = new MsBuildTaskFixture(fixture); var result = msbuildFixture.Execute(task); if (!result.Success) Console.WriteLine(result.Log); @@ -46,7 +43,6 @@ protected static MsBuildTaskFixtureResult ExecuteMsBuildTaskInAzurePipeline ExecuteMsBuildTaskInGitHubActions("GITHUB_ACTIONS", "true")); var result = msbuildFixture.Execute(task); @@ -92,12 +87,6 @@ protected static MsBuildExeFixtureResult ExecuteMsBuildExeInAzurePipeline(Action if (!result.MsBuild.OverallSuccess) Console.WriteLine(result.Output); return result; } - private static void AddOverrides(GitVersionTaskBase task) => - task.WithOverrides(services => - { - services.AddModule(new GitVersionBuildAgentsModule()); - services.AddModule(new GitVersionOutputModule()); - }); private static EmptyRepositoryFixture CreateLocalRepositoryFixture() { diff --git a/src/GitVersion.MsBuild/GitVersionTaskBase.cs b/src/GitVersion.MsBuild/GitVersionTaskBase.cs index 1be2bafb80..a7fb78a9ac 100644 --- a/src/GitVersion.MsBuild/GitVersionTaskBase.cs +++ b/src/GitVersion.MsBuild/GitVersionTaskBase.cs @@ -1,6 +1,5 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; -using Microsoft.Extensions.DependencyInjection; namespace GitVersion.MsBuild; @@ -18,11 +17,5 @@ public abstract class GitVersionTaskBase : ITask public TaskLoggingHelper Log { get; } - public bool Execute() => OnExecute(); - - protected abstract bool OnExecute(); - - public Action? Overrides { get; set; } - - public void WithOverrides(Action overrides) => Overrides = overrides; + public bool Execute() => GitVersionTasks.Execute(this); } diff --git a/src/GitVersion.MsBuild/GitVersionTasks.cs b/src/GitVersion.MsBuild/GitVersionTasks.cs index c2facf75d9..7a32e88101 100644 --- a/src/GitVersion.MsBuild/GitVersionTasks.cs +++ b/src/GitVersion.MsBuild/GitVersionTasks.cs @@ -11,24 +11,27 @@ namespace GitVersion.MsBuild; internal static class GitVersionTasks { - public static bool GetVersion(GetVersion task) => ExecuteGitVersionTask(task, executor => executor.GetVersion(task)); - - public static bool UpdateAssemblyInfo(UpdateAssemblyInfo task) => ExecuteGitVersionTask(task, executor => executor.UpdateAssemblyInfo(task)); - - public static bool GenerateGitVersionInformation(GenerateGitVersionInformation task) => ExecuteGitVersionTask(task, executor => executor.GenerateGitVersionInformation(task)); - - public static bool WriteVersionInfoToBuildLog(WriteVersionInfoToBuildLog task) => ExecuteGitVersionTask(task, executor => executor.WriteVersionInfoToBuildLog(task)); + public static bool Execute(GitVersionTaskBase task) + { + var serviceProvider = BuildServiceProvider(task); + var executor = serviceProvider.GetRequiredService(); + return task switch + { + GetVersion getVersion => ExecuteGitVersionTask(getVersion, () => executor.GetVersion(getVersion)), + UpdateAssemblyInfo updateAssemblyInfo => ExecuteGitVersionTask(updateAssemblyInfo, () => executor.UpdateAssemblyInfo(updateAssemblyInfo)), + GenerateGitVersionInformation generateGitVersionInformation => ExecuteGitVersionTask(generateGitVersionInformation, () => executor.GenerateGitVersionInformation(generateGitVersionInformation)), + WriteVersionInfoToBuildLog writeVersionInfoToBuildLog => ExecuteGitVersionTask(writeVersionInfoToBuildLog, () => executor.WriteVersionInfoToBuildLog(writeVersionInfoToBuildLog)), + _ => throw new NotSupportedException($"Task type {task.GetType().Name} is not supported") + }; + } - private static bool ExecuteGitVersionTask(T task, Action action) + private static bool ExecuteGitVersionTask(T task, Action action) where T : GitVersionTaskBase { var taskLog = task.Log; try { - var sp = BuildServiceProvider(task); - var gitVersionTaskExecutor = sp.GetRequiredService(); - - action(gitVersionTaskExecutor); + action(); } catch (WarningException errorException) { @@ -75,7 +78,6 @@ private static IServiceProvider BuildServiceProvider(GitVersionTaskBase task) services.AddModule(new GitVersionOutputModule()); services.AddModule(new GitVersionMsBuildModule()); services.AddSingleton(new MsBuildAdapter(task.Log)); - task.Overrides?.Invoke(services); var sp = services.BuildServiceProvider(); Configure(sp, task); diff --git a/src/GitVersion.MsBuild/PublicAPI.Shipped.txt b/src/GitVersion.MsBuild/PublicAPI.Shipped.txt index b395a292de..3325cd24ce 100644 --- a/src/GitVersion.MsBuild/PublicAPI.Shipped.txt +++ b/src/GitVersion.MsBuild/PublicAPI.Shipped.txt @@ -1,5 +1,4 @@ #nullable enable -abstract GitVersion.MsBuild.GitVersionTaskBase.OnExecute() -> bool GitVersion.MsBuild.GitVersionMsBuildModule GitVersion.MsBuild.GitVersionMsBuildModule.GitVersionMsBuildModule() -> void GitVersion.MsBuild.GitVersionMsBuildModule.RegisterTypes(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void @@ -11,13 +10,10 @@ GitVersion.MsBuild.GitVersionTaskBase.GitVersionTaskBase() -> void GitVersion.MsBuild.GitVersionTaskBase.HostObject.get -> Microsoft.Build.Framework.ITaskHost! GitVersion.MsBuild.GitVersionTaskBase.HostObject.set -> void GitVersion.MsBuild.GitVersionTaskBase.Log.get -> Microsoft.Build.Utilities.TaskLoggingHelper! -GitVersion.MsBuild.GitVersionTaskBase.Overrides.get -> System.Action? -GitVersion.MsBuild.GitVersionTaskBase.Overrides.set -> void GitVersion.MsBuild.GitVersionTaskBase.SolutionDirectory.get -> string! GitVersion.MsBuild.GitVersionTaskBase.SolutionDirectory.set -> void GitVersion.MsBuild.GitVersionTaskBase.VersionFile.get -> string! GitVersion.MsBuild.GitVersionTaskBase.VersionFile.set -> void -GitVersion.MsBuild.GitVersionTaskBase.WithOverrides(System.Action! overrides) -> void GitVersion.MsBuild.Tasks.GenerateGitVersionInformation GitVersion.MsBuild.Tasks.GenerateGitVersionInformation.GenerateGitVersionInformation() -> void GitVersion.MsBuild.Tasks.GenerateGitVersionInformation.GitVersionInformationFilePath.get -> string! @@ -98,7 +94,3 @@ GitVersion.MsBuild.Tasks.UpdateAssemblyInfo.ProjectFile.set -> void GitVersion.MsBuild.Tasks.UpdateAssemblyInfo.UpdateAssemblyInfo() -> void GitVersion.MsBuild.Tasks.WriteVersionInfoToBuildLog GitVersion.MsBuild.Tasks.WriteVersionInfoToBuildLog.WriteVersionInfoToBuildLog() -> void -override GitVersion.MsBuild.Tasks.GenerateGitVersionInformation.OnExecute() -> bool -override GitVersion.MsBuild.Tasks.GetVersion.OnExecute() -> bool -override GitVersion.MsBuild.Tasks.UpdateAssemblyInfo.OnExecute() -> bool -override GitVersion.MsBuild.Tasks.WriteVersionInfoToBuildLog.OnExecute() -> bool diff --git a/src/GitVersion.MsBuild/Tasks/GenerateGitVersionInformation.cs b/src/GitVersion.MsBuild/Tasks/GenerateGitVersionInformation.cs index 92c0fb95af..b192216a1c 100644 --- a/src/GitVersion.MsBuild/Tasks/GenerateGitVersionInformation.cs +++ b/src/GitVersion.MsBuild/Tasks/GenerateGitVersionInformation.cs @@ -19,6 +19,4 @@ public class GenerateGitVersionInformation : GitVersionTaskBase [Output] public string GitVersionInformationFilePath { get; set; } - - protected override bool OnExecute() => GitVersionTasks.GenerateGitVersionInformation(this); } diff --git a/src/GitVersion.MsBuild/Tasks/GetVersion.cs b/src/GitVersion.MsBuild/Tasks/GetVersion.cs index 3fca217eef..2a3e695a99 100644 --- a/src/GitVersion.MsBuild/Tasks/GetVersion.cs +++ b/src/GitVersion.MsBuild/Tasks/GetVersion.cs @@ -78,6 +78,4 @@ public class GetVersion : GitVersionTaskBase [Output] public string UncommittedChanges { get; set; } - - protected override bool OnExecute() => GitVersionTasks.GetVersion(this); } diff --git a/src/GitVersion.MsBuild/Tasks/UpdateAssemblyInfo.cs b/src/GitVersion.MsBuild/Tasks/UpdateAssemblyInfo.cs index 41fefe580d..b243cfa606 100644 --- a/src/GitVersion.MsBuild/Tasks/UpdateAssemblyInfo.cs +++ b/src/GitVersion.MsBuild/Tasks/UpdateAssemblyInfo.cs @@ -18,6 +18,4 @@ public class UpdateAssemblyInfo : GitVersionTaskBase [Output] public string AssemblyInfoTempFilePath { get; set; } - - protected override bool OnExecute() => GitVersionTasks.UpdateAssemblyInfo(this); } diff --git a/src/GitVersion.MsBuild/Tasks/WriteVersionInfoToBuildLog.cs b/src/GitVersion.MsBuild/Tasks/WriteVersionInfoToBuildLog.cs index b92f7dd187..3ee822c61e 100644 --- a/src/GitVersion.MsBuild/Tasks/WriteVersionInfoToBuildLog.cs +++ b/src/GitVersion.MsBuild/Tasks/WriteVersionInfoToBuildLog.cs @@ -1,6 +1,3 @@ namespace GitVersion.MsBuild.Tasks; -public class WriteVersionInfoToBuildLog : GitVersionTaskBase -{ - protected override bool OnExecute() => GitVersionTasks.WriteVersionInfoToBuildLog(this); -} +public class WriteVersionInfoToBuildLog : GitVersionTaskBase; From 6ce23010a30c7740c992b422fd6094efe16b246f Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Thu, 6 Mar 2025 00:48:07 +0100 Subject: [PATCH 077/107] FileHelper => AssemblyInfoFileHelper --- ...ests.cs => AssemblyInfoFileHelperTests.cs} | 10 ++--- .../Helpers/MsBuildExeFixture.cs | 2 +- .../InvalidFileCheckerTests.cs | 38 +++++++++---------- .../GenerateGitVersionInformationTest.cs | 24 ++++++------ .../Tasks/UpdateAssemblyInfoTaskTest.cs | 16 ++++---- .../GitVersionTaskExecutor.cs | 5 +-- ...ileHelper.cs => AssemblyInfoFileHelper.cs} | 2 +- 7 files changed, 48 insertions(+), 49 deletions(-) rename src/GitVersion.MsBuild.Tests/{FileHelperTests.cs => AssemblyInfoFileHelperTests.cs} (69%) rename src/GitVersion.MsBuild/Helpers/{FileHelper.cs => AssemblyInfoFileHelper.cs} (98%) diff --git a/src/GitVersion.MsBuild.Tests/FileHelperTests.cs b/src/GitVersion.MsBuild.Tests/AssemblyInfoFileHelperTests.cs similarity index 69% rename from src/GitVersion.MsBuild.Tests/FileHelperTests.cs rename to src/GitVersion.MsBuild.Tests/AssemblyInfoFileHelperTests.cs index 6056bc5202..ddb4139b33 100644 --- a/src/GitVersion.MsBuild.Tests/FileHelperTests.cs +++ b/src/GitVersion.MsBuild.Tests/AssemblyInfoFileHelperTests.cs @@ -1,7 +1,7 @@ namespace GitVersion.MsBuild.Tests; [TestFixture] -public class FileHelperTests +public class AssemblyInfoFileHelperTests { [Test] [TestCase("C#", "cs")] @@ -12,11 +12,11 @@ public void GetFileExtensionShouldReturnCorrectExtension(string language, string { if (expectedExtension != null) { - Assert.That(FileHelper.GetFileExtension(language), Is.EqualTo(expectedExtension)); + Assert.That(AssemblyInfoFileHelper.GetFileExtension(language), Is.EqualTo(expectedExtension)); } else { - Assert.That((TestDelegate)(() => FileHelper.GetFileExtension(language)), Throws.ArgumentException.With.Message.EqualTo($"Unknown language detected: '{language}'")); + Assert.That((TestDelegate)(() => AssemblyInfoFileHelper.GetFileExtension(language)), Throws.ArgumentException.With.Message.EqualTo($"Unknown language detected: '{language}'")); } } @@ -35,10 +35,10 @@ public void GetFileWriteInfoShouldCreateConstantNamedFileWhenIntermediateOutputP [Test] public void GetFileWriteInfoShouldCreateRandomNamedFileWhenNoIntermediateOutputPath() { - var fileInfo = FileHelper.GetFileWriteInfo(null, "C#", "MyProject.csproj", "GeneratedVersionInformation"); + var fileInfo = AssemblyInfoFileHelper.GetFileWriteInfo(null, "C#", "MyProject.csproj", "GeneratedVersionInformation"); Assert.Multiple(() => { - Assert.That(fileInfo.WorkingDirectory, Is.EqualTo(FileHelper.TempPath)); + Assert.That(fileInfo.WorkingDirectory, Is.EqualTo(AssemblyInfoFileHelper.TempPath)); Assert.That(fileInfo.FileName, Does.StartWith("GeneratedVersionInformation_MyProject_").And.EndsWith(".g.cs")); Assert.That(fileInfo.FileExtension, Is.EqualTo("cs")); }); diff --git a/src/GitVersion.MsBuild.Tests/Helpers/MsBuildExeFixture.cs b/src/GitVersion.MsBuild.Tests/Helpers/MsBuildExeFixture.cs index b05fe01433..c0a0bc82b0 100644 --- a/src/GitVersion.MsBuild.Tests/Helpers/MsBuildExeFixture.cs +++ b/src/GitVersion.MsBuild.Tests/Helpers/MsBuildExeFixture.cs @@ -22,7 +22,7 @@ public class MsBuildExeFixture public MsBuildExeFixture(RepositoryFixtureBase fixture, string workingDirectory = "", string language = "C#") { - var projectExtension = FileHelper.GetProjectExtension(language); + var projectExtension = AssemblyInfoFileHelper.GetProjectExtension(language); this.fixture = fixture; this.ProjectPath = PathHelper.Combine(workingDirectory, $"app.{projectExtension}"); diff --git a/src/GitVersion.MsBuild.Tests/InvalidFileCheckerTests.cs b/src/GitVersion.MsBuild.Tests/InvalidFileCheckerTests.cs index 5eb2c3f2f9..17d2aeae8a 100644 --- a/src/GitVersion.MsBuild.Tests/InvalidFileCheckerTests.cs +++ b/src/GitVersion.MsBuild.Tests/InvalidFileCheckerTests.cs @@ -39,7 +39,7 @@ public void VerifyIgnoreNonAssemblyInfoFile() """); } - FileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "SomeOtherFile.cs" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "SomeOtherFile.cs" }], this.projectFile); } [Test] @@ -57,7 +57,7 @@ public void VerifyAttributeFoundCSharp([Values("AssemblyVersion", "AssemblyFileV """, attribute); } - var ex = Assert.Throws(() => FileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile), attribute); + var ex = Assert.Throws(() => AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile), attribute); ex.ShouldNotBeNull(); Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.cs")); } @@ -78,7 +78,7 @@ public void VerifyUnformattedAttributeFoundCSharp([Values("AssemblyVersion", "As """, attribute); } - var ex = Assert.Throws(() => FileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile), attribute); + var ex = Assert.Throws(() => AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile), attribute); ex.ShouldNotBeNull(); Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.cs")); } @@ -98,7 +98,7 @@ public void VerifyCommentWorksCSharp([Values("AssemblyVersion", "AssemblyFileVer """, attribute); } - FileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile); } [Test] @@ -115,7 +115,7 @@ public void VerifyCommentWithNoNewLineAtEndWorksCSharp([Values("AssemblyVersion" """, attribute); } - FileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile); } [Test] @@ -136,7 +136,7 @@ public class Temp """, attribute); } - FileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile); } [Test] @@ -156,7 +156,7 @@ public class {0} """, attribute); } - FileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile); } [Test] @@ -174,7 +174,7 @@ Imports System.Reflection """, attribute); } - var ex = Assert.Throws(() => FileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile), attribute); + var ex = Assert.Throws(() => AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile), attribute); ex.ShouldNotBeNull(); Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.vb")); } @@ -195,7 +195,7 @@ Imports System.Reflection """, attribute); } - var ex = Assert.Throws(() => FileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile), attribute); + var ex = Assert.Throws(() => AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile), attribute); ex.ShouldNotBeNull(); Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.vb")); } @@ -215,7 +215,7 @@ Imports System.Reflection """, attribute); } - FileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile); } [Test] @@ -232,7 +232,7 @@ Imports System.Reflection """, attribute); } - FileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile); } [Test] @@ -252,7 +252,7 @@ End Class """, attribute); } - FileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile); } [Test] @@ -271,7 +271,7 @@ End Class """, attribute); } - FileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile); } [Test] @@ -289,7 +289,7 @@ open System.Reflection """, attribute); } - var ex = Assert.Throws(() => FileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile), attribute); + var ex = Assert.Throws(() => AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile), attribute); ex.ShouldNotBeNull(); Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.fs")); } @@ -310,7 +310,7 @@ open System.Reflection """, attribute); } - var ex = Assert.Throws(() => FileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile), attribute); + var ex = Assert.Throws(() => AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile), attribute); ex.ShouldNotBeNull(); Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.fs")); } @@ -330,7 +330,7 @@ open System.Reflection """, attribute); } - FileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile); } [Test] @@ -347,7 +347,7 @@ open System.Reflection """, attribute); } - FileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile); } [Test] @@ -366,7 +366,7 @@ type Temp() = """, attribute); } - FileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile); } [Test] @@ -384,6 +384,6 @@ open System.Reflection """, attribute); } - FileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile); } } diff --git a/src/GitVersion.MsBuild.Tests/Tasks/GenerateGitVersionInformationTest.cs b/src/GitVersion.MsBuild.Tests/Tasks/GenerateGitVersionInformationTest.cs index 9f3f86bfda..6de414702a 100644 --- a/src/GitVersion.MsBuild.Tests/Tasks/GenerateGitVersionInformationTest.cs +++ b/src/GitVersion.MsBuild.Tests/Tasks/GenerateGitVersionInformationTest.cs @@ -21,7 +21,7 @@ public class GenerateGitVersionInformationTest : TestTaskBase [TestCaseSource(nameof(Languages))] public void GenerateGitVersionInformationTaskShouldCreateFile(string language) { - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); var task = new GenerateGitVersionInformation { Language = language }; using var result = ExecuteMsBuildTask(task); @@ -42,7 +42,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFile(string language) [TestCaseSource(nameof(Languages))] public void GenerateGitVersionInformationTaskShouldCreateFileInBuildServer(string language) { - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); var task = new GenerateGitVersionInformation { Language = language }; using var result = ExecuteMsBuildTaskInAzurePipeline(task); @@ -65,7 +65,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuild( { const string taskName = nameof(GenerateGitVersionInformation); const string outputProperty = nameof(GenerateGitVersionInformation.GitVersionInformationFilePath); - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); using var result = ExecuteMsBuildExe(project => AddGenerateGitVersionInformationTask(project, taskName, taskName, outputProperty, language), language); @@ -92,7 +92,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildI { const string taskName = nameof(GenerateGitVersionInformation); const string outputProperty = nameof(GenerateGitVersionInformation.GitVersionInformationFilePath); - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); using var result = ExecuteMsBuildExeInAzurePipeline(project => AddGenerateGitVersionInformationTask(project, taskName, taskName, outputProperty, language), language); @@ -117,7 +117,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildI [TestCaseSource(nameof(Languages))] public void GenerateGitVersionInformationTaskShouldCreateFileWhenIntermediateOutputPathDoesNotExist(string language) { - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); var task = new GenerateGitVersionInformation { Language = language, IntermediateOutputPath = Guid.NewGuid().ToString("N") }; using var result = ExecuteMsBuildTask(task); @@ -139,7 +139,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenIntermediateOut [TestCaseSource(nameof(Languages))] public void GenerateGitVersionInformationTaskShouldCreateFileInBuildServerWhenIntermediateOutputPathDoesNotExist(string language) { - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); var task = new GenerateGitVersionInformation { Language = language, IntermediateOutputPath = Guid.NewGuid().ToString("N") }; using var result = ExecuteMsBuildTaskInAzurePipeline(task); @@ -165,7 +165,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildA const string outputProperty = nameof(GenerateGitVersionInformation.GitVersionInformationFilePath); var randDir = Guid.NewGuid().ToString("N"); - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); using var result = ExecuteMsBuildExe(project => { var intermediateOutputPath = PathHelper.Combine("$(MSBuildProjectDirectory)", randDir); @@ -196,7 +196,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildA const string outputProperty = nameof(GenerateGitVersionInformation.GitVersionInformationFilePath); var randDir = Guid.NewGuid().ToString("N"); - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); using var result = ExecuteMsBuildExeInAzurePipeline(project => { var intermediateOutputPath = PathHelper.Combine("$(MSBuildProjectDirectory)", randDir); @@ -227,7 +227,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildA const string outputProperty = nameof(GenerateGitVersionInformation.GitVersionInformationFilePath); var randDir = Guid.NewGuid().ToString("N"); - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); using var result = ExecuteMsBuildExe(project => { var intermediateOutputPath = PathHelper.Combine("$(MSBuildProjectDirectory)", randDir); @@ -260,7 +260,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildA const string outputProperty = nameof(GenerateGitVersionInformation.GitVersionInformationFilePath); var randDir = Guid.NewGuid().ToString("N"); - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); using var result = ExecuteMsBuildExeInAzurePipeline(project => { var intermediateOutputPath = PathHelper.Combine("$(MSBuildProjectDirectory)", randDir); @@ -288,7 +288,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildA [TestCaseSource(nameof(Languages))] public void GenerateGitVersionInformationTaskShouldCreateFileWithUseProjectNamespaceSetAndRootNamespaceUnSet(string language) { - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); var task = new GenerateGitVersionInformation { Language = language, @@ -314,7 +314,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWithUseProjectNames [TestCaseSource(nameof(Languages))] public void GenerateGitVersionInformationTaskShouldCreateFileWithUseProjectNamespaceSetAndRootNamespaceIsSet(string language) { - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); var task = new GenerateGitVersionInformation { Language = language, diff --git a/src/GitVersion.MsBuild.Tests/Tasks/UpdateAssemblyInfoTaskTest.cs b/src/GitVersion.MsBuild.Tests/Tasks/UpdateAssemblyInfoTaskTest.cs index beaaa8ef94..b353bb6af2 100644 --- a/src/GitVersion.MsBuild.Tests/Tasks/UpdateAssemblyInfoTaskTest.cs +++ b/src/GitVersion.MsBuild.Tests/Tasks/UpdateAssemblyInfoTaskTest.cs @@ -19,7 +19,7 @@ public class UpdateAssemblyInfoTaskTest : TestTaskBase [TestCaseSource(nameof(Languages))] public void UpdateAssemblyInfoTaskShouldCreateFile(string language) { - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); var task = new UpdateAssemblyInfo { Language = language }; using var result = ExecuteMsBuildTask(task); @@ -36,7 +36,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFile(string language) [TestCaseSource(nameof(Languages))] public void UpdateAssemblyInfoTaskShouldCreateFileInBuildServer(string language) { - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); var task = new UpdateAssemblyInfo { Language = language }; using var result = ExecuteMsBuildTaskInAzurePipeline(task); @@ -56,7 +56,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFileWhenRunWithMsBuild(string lang const string taskName = nameof(UpdateAssemblyInfo); const string outputProperty = nameof(UpdateAssemblyInfo.AssemblyInfoTempFilePath); - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); using var result = ExecuteMsBuildExe(project => AddUpdateAssemblyInfoTask(project, taskName, taskName, outputProperty, language), language); @@ -79,7 +79,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFileWhenRunWithMsBuildInBuildServe const string taskName = nameof(UpdateAssemblyInfo); const string outputProperty = nameof(UpdateAssemblyInfo.AssemblyInfoTempFilePath); - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); using var result = ExecuteMsBuildExeInAzurePipeline(project => AddUpdateAssemblyInfoTask(project, taskName, taskName, outputProperty, language), language); @@ -99,7 +99,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFileWhenRunWithMsBuildInBuildServe [TestCaseSource(nameof(Languages))] public void UpdateAssemblyInfoTaskShouldCreateFileWhenIntermediateOutputPathDoesNotExist(string language) { - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); var task = new UpdateAssemblyInfo { Language = language, IntermediateOutputPath = Guid.NewGuid().ToString("N") }; using var result = ExecuteMsBuildTask(task); @@ -117,7 +117,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFileWhenIntermediateOutputPathDoes [TestCaseSource(nameof(Languages))] public void UpdateAssemblyInfoTaskShouldCreateFileWhenIntermediateOutputPathDoesNotExistInBuildServer(string language) { - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); var task = new UpdateAssemblyInfo { Language = language, IntermediateOutputPath = Guid.NewGuid().ToString("N") }; using var result = ExecuteMsBuildTaskInAzurePipeline(task); @@ -139,7 +139,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFileWhenRunWithMsBuildAndIntermedi const string outputProperty = nameof(UpdateAssemblyInfo.AssemblyInfoTempFilePath); var randDir = Guid.NewGuid().ToString("N"); - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); using var result = ExecuteMsBuildExe(project => { var intermediateOutputPath = PathHelper.Combine("$(MSBuildProjectDirectory)", randDir); @@ -166,7 +166,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFileWhenRunWithMsBuildAndIntermedi const string outputProperty = nameof(UpdateAssemblyInfo.AssemblyInfoTempFilePath); var randDir = Guid.NewGuid().ToString("N"); - var extension = FileHelper.GetFileExtension(language); + var extension = AssemblyInfoFileHelper.GetFileExtension(language); using var result = ExecuteMsBuildExeInAzurePipeline(project => { var intermediateOutputPath = PathHelper.Combine("$(MSBuildProjectDirectory)", randDir); diff --git a/src/GitVersion.MsBuild/GitVersionTaskExecutor.cs b/src/GitVersion.MsBuild/GitVersionTaskExecutor.cs index d51d364d95..2052267982 100644 --- a/src/GitVersion.MsBuild/GitVersionTaskExecutor.cs +++ b/src/GitVersion.MsBuild/GitVersionTaskExecutor.cs @@ -34,8 +34,7 @@ public void GetVersion(GetVersion task) public void UpdateAssemblyInfo(UpdateAssemblyInfo task) { var versionVariables = GitVersionVariables(task); - DeleteTempFiles(); - FileHelper.CheckForInvalidFiles(task.CompileFiles, task.ProjectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles(task.CompileFiles, task.ProjectFile); if (!string.IsNullOrEmpty(task.IntermediateOutputPath)) { @@ -110,7 +109,7 @@ public void WriteVersionInfoToBuildLog(WriteVersionInfoToBuildLog task) private void DeleteTempFiles() { - var tempPath = FileHelper.TempPath; + var tempPath = AssemblyInfoFileHelper.TempPath; if (!this.fileSystem.DirectoryExists(tempPath)) { return; diff --git a/src/GitVersion.MsBuild/Helpers/FileHelper.cs b/src/GitVersion.MsBuild/Helpers/AssemblyInfoFileHelper.cs similarity index 98% rename from src/GitVersion.MsBuild/Helpers/FileHelper.cs rename to src/GitVersion.MsBuild/Helpers/AssemblyInfoFileHelper.cs index ce3d1e9da7..b9491aa569 100644 --- a/src/GitVersion.MsBuild/Helpers/FileHelper.cs +++ b/src/GitVersion.MsBuild/Helpers/AssemblyInfoFileHelper.cs @@ -6,7 +6,7 @@ namespace GitVersion.MsBuild; -internal static class FileHelper +internal static class AssemblyInfoFileHelper { public static readonly string TempPath = MakeAndGetTempPath(); From 61876fc1f9b5fcd8da46c3407e314eab62b151c3 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Thu, 6 Mar 2025 01:05:04 +0100 Subject: [PATCH 078/107] added System.IO.Abstractions package replaced own IFileSystem with the one from the package replaced System.IO.(File|FileInfo|Directory|DirectoryInfo) --- new-cli/Directory.Packages.props | 1 + .../GitVersion.Common.csproj | 1 - new-cli/GitVersion.Core/CoreModule.cs | 1 + .../GitVersion.Core/GitVersion.Core.csproj | 4 +- src/Directory.Packages.props | 1 + .../ArgumentParserTests.cs | 27 +++--- src/GitVersion.App/ArgumentParser.cs | 7 +- src/GitVersion.App/FileAppender.cs | 12 ++- src/GitVersion.App/GitVersionExecutor.cs | 9 +- .../Agents/BitBucketPipelinesTests.cs | 15 +-- .../Agents/BuildServerBaseTests.cs | 1 + .../Agents/CodeBuildTests.cs | 9 +- .../Agents/EnvRunTests.cs | 7 +- .../Agents/GitHubActionsTests.cs | 9 +- .../Agents/GitLabCiTests.cs | 13 ++- .../Agents/JenkinsTests.cs | 9 +- src/GitVersion.BuildAgents/Agents/AppVeyor.cs | 1 + .../Agents/AzurePipelines.cs | 1 + .../Agents/BitBucketPipelines.cs | 5 +- .../Agents/BuildKite.cs | 1 + .../Agents/CodeBuild.cs | 3 +- .../Agents/ContinuaCi.cs | 1 + src/GitVersion.BuildAgents/Agents/Drone.cs | 1 + src/GitVersion.BuildAgents/Agents/EnvRun.cs | 3 +- .../Agents/GitHubActions.cs | 3 +- src/GitVersion.BuildAgents/Agents/GitLabCi.cs | 3 +- src/GitVersion.BuildAgents/Agents/Jenkins.cs | 3 +- src/GitVersion.BuildAgents/Agents/MyGet.cs | 1 + .../Agents/SpaceAutomation.cs | 1 + src/GitVersion.BuildAgents/Agents/TeamCity.cs | 1 + src/GitVersion.BuildAgents/Agents/TravisCI.cs | 1 + .../ConfigurationFileLocatorTests.cs | 1 + .../ConfigurationProviderTests.cs | 1 + .../Configuration/Extensions.cs | 9 +- .../ConfigurationFileLocator.cs | 3 +- .../ConfigurationProvider.cs | 5 +- .../Core/DynamicRepositoryTests.cs | 5 +- .../Core/GitVersionExecutorTests.cs | 27 ++++-- .../Core/GitVersionToolDirectoryTests.cs | 8 +- .../DocumentationTests.cs | 26 +++-- .../GitVersionVariablesExtensions.cs | 1 + .../Helpers/GitVersionCoreTestModule.cs | 1 + .../IntegrationTests/FileSystemTests.cs | 53 ----------- .../IntegrationTests/OtherScenarios.cs | 8 +- .../IntegrationTests/WorktreeScenarios.cs | 6 +- src/GitVersion.Core/Agents/BuildAgentBase.cs | 1 + src/GitVersion.Core/Agents/LocalBuild.cs | 1 + .../Core/Abstractions/IFileSystem.cs | 21 ---- src/GitVersion.Core/Core/FileSystem.cs | 59 ------------ src/GitVersion.Core/Core/GitPreparer.cs | 3 +- .../Extensions/ConfigurationExtensions.cs | 7 +- .../Extensions/FileSystemExtensions.cs | 13 +++ src/GitVersion.Core/GitVersion.Core.csproj | 1 + src/GitVersion.Core/GitVersionCommonModule.cs | 1 + .../Helpers/DirectoryHelper.cs | 31 ------ src/GitVersion.Core/Helpers/EncodingHelper.cs | 95 ------------------- src/GitVersion.Core/PublicAPI.Shipped.txt | 20 ---- src/GitVersion.Core/PublicAPI.Unshipped.txt | 2 + .../Caching/GitVersionCacheKeyFactory.cs | 17 ++-- .../Caching/GitVersionCacheProvider.cs | 7 +- .../Git/GitRepositoryInfo.cs | 18 ++-- .../InvalidFileCheckerTests.cs | 87 +++++++++-------- .../GenerateGitVersionInformationTest.cs | 24 ++--- .../Tasks/TestTaskBase.cs | 11 +++ .../Tasks/UpdateAssemblyInfoTaskTest.cs | 16 ++-- .../Tasks/WriteVersionInfoTest.cs | 10 +- .../GitVersionTaskExecutor.cs | 25 ++--- .../Helpers/AssemblyInfoFileHelper.cs | 17 ++-- .../Output/AssemblyInfoFileUpdaterTests.cs | 54 ++++++----- .../Output/GitVersionInfoGeneratorTests.cs | 13 +-- .../Output/ProjectFileUpdaterTests.cs | 16 ++-- .../Output/WixFileTests.cs | 11 ++- .../AssemblyInfo/AssemblyInfoFileUpdater.cs | 33 +++---- .../AssemblyInfo/ProjectFileUpdater.cs | 25 ++--- .../GitVersionInfo/GitVersionInfoGenerator.cs | 7 +- .../OutputGenerator/OutputGenerator.cs | 3 +- .../Serializer/VersionVariableSerializer.cs | 5 +- .../WixUpdater/WixVersionFileUpdater.cs | 11 ++- 78 files changed, 413 insertions(+), 561 deletions(-) delete mode 100644 src/GitVersion.Core.Tests/IntegrationTests/FileSystemTests.cs delete mode 100644 src/GitVersion.Core/Core/Abstractions/IFileSystem.cs delete mode 100644 src/GitVersion.Core/Core/FileSystem.cs create mode 100644 src/GitVersion.Core/Extensions/FileSystemExtensions.cs delete mode 100644 src/GitVersion.Core/Helpers/EncodingHelper.cs diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index eec8c27572..5a744aa636 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -21,6 +21,7 @@ + \ No newline at end of file diff --git a/new-cli/GitVersion.Common/GitVersion.Common.csproj b/new-cli/GitVersion.Common/GitVersion.Common.csproj index f224f9e121..50d31943ff 100644 --- a/new-cli/GitVersion.Common/GitVersion.Common.csproj +++ b/new-cli/GitVersion.Common/GitVersion.Common.csproj @@ -4,7 +4,6 @@ - diff --git a/new-cli/GitVersion.Core/CoreModule.cs b/new-cli/GitVersion.Core/CoreModule.cs index 4521f28dee..f3312b5dd2 100644 --- a/new-cli/GitVersion.Core/CoreModule.cs +++ b/new-cli/GitVersion.Core/CoreModule.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Infrastructure; namespace GitVersion; diff --git a/new-cli/GitVersion.Core/GitVersion.Core.csproj b/new-cli/GitVersion.Core/GitVersion.Core.csproj index b96d2f9f1a..47fe040631 100644 --- a/new-cli/GitVersion.Core/GitVersion.Core.csproj +++ b/new-cli/GitVersion.Core/GitVersion.Core.csproj @@ -8,13 +8,11 @@ + Infrastructure\Environment.cs - - Infrastructure\FileSystem.cs - diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 206e2aba10..11d3a28cbd 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -37,6 +37,7 @@ + diff --git a/src/GitVersion.App.Tests/ArgumentParserTests.cs b/src/GitVersion.App.Tests/ArgumentParserTests.cs index c9d678043a..a42b4e2c22 100644 --- a/src/GitVersion.App.Tests/ArgumentParserTests.cs +++ b/src/GitVersion.App.Tests/ArgumentParserTests.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Helpers; @@ -283,7 +284,7 @@ public void UpdateAssemblyInfoWithFilename() using var repo = new EmptyRepositoryFixture(); var assemblyFile = PathHelper.Combine(repo.RepositoryPath, "CommonAssemblyInfo.cs"); - using var file = File.Create(assemblyFile); + using var file = this.fileSystem.File.Create(assemblyFile); var arguments = this.argumentParser.ParseArguments($"-targetpath {repo.RepositoryPath} -updateAssemblyInfo CommonAssemblyInfo.cs"); arguments.UpdateAssemblyInfo.ShouldBe(true); @@ -297,10 +298,10 @@ public void UpdateAssemblyInfoWithMultipleFilenames() using var repo = new EmptyRepositoryFixture(); var assemblyFile1 = PathHelper.Combine(repo.RepositoryPath, "CommonAssemblyInfo.cs"); - using var file = File.Create(assemblyFile1); + using var file = this.fileSystem.File.Create(assemblyFile1); var assemblyFile2 = PathHelper.Combine(repo.RepositoryPath, "VersionAssemblyInfo.cs"); - using var file2 = File.Create(assemblyFile2); + using var file2 = this.fileSystem.File.Create(assemblyFile2); var arguments = this.argumentParser.ParseArguments($"-targetpath {repo.RepositoryPath} -updateAssemblyInfo CommonAssemblyInfo.cs VersionAssemblyInfo.cs"); arguments.UpdateAssemblyInfo.ShouldBe(true); @@ -315,10 +316,10 @@ public void UpdateProjectFilesWithMultipleFilenames() using var repo = new EmptyRepositoryFixture(); var assemblyFile1 = PathHelper.Combine(repo.RepositoryPath, "CommonAssemblyInfo.csproj"); - using var file = File.Create(assemblyFile1); + using var file = this.fileSystem.File.Create(assemblyFile1); var assemblyFile2 = PathHelper.Combine(repo.RepositoryPath, "VersionAssemblyInfo.csproj"); - using var file2 = File.Create(assemblyFile2); + using var file2 = this.fileSystem.File.Create(assemblyFile2); var arguments = this.argumentParser.ParseArguments($"-targetpath {repo.RepositoryPath} -updateProjectFiles CommonAssemblyInfo.csproj VersionAssemblyInfo.csproj"); arguments.UpdateProjectFiles.ShouldBe(true); @@ -333,16 +334,16 @@ public void UpdateAssemblyInfoWithMultipleFilenamesMatchingGlobbing() using var repo = new EmptyRepositoryFixture(); var assemblyFile1 = PathHelper.Combine(repo.RepositoryPath, "CommonAssemblyInfo.cs"); - using var file = File.Create(assemblyFile1); + using var file = this.fileSystem.File.Create(assemblyFile1); var assemblyFile2 = PathHelper.Combine(repo.RepositoryPath, "VersionAssemblyInfo.cs"); - using var file2 = File.Create(assemblyFile2); + using var file2 = this.fileSystem.File.Create(assemblyFile2); var subdir = PathHelper.Combine(repo.RepositoryPath, "subdir"); - this.fileSystem.CreateDirectory(subdir); + this.fileSystem.Directory.CreateDirectory(subdir); var assemblyFile3 = PathHelper.Combine(subdir, "LocalAssemblyInfo.cs"); - using var file3 = File.Create(assemblyFile3); + using var file3 = this.fileSystem.File.Create(assemblyFile3); var arguments = this.argumentParser.ParseArguments($"-targetpath {repo.RepositoryPath} -updateAssemblyInfo **/*AssemblyInfo.cs"); arguments.UpdateAssemblyInfo.ShouldBe(true); @@ -358,10 +359,10 @@ public void UpdateAssemblyInfoWithRelativeFilename() using var repo = new EmptyRepositoryFixture(); var assemblyFile = PathHelper.Combine(repo.RepositoryPath, "CommonAssemblyInfo.cs"); - using var file = File.Create(assemblyFile); + using var file = this.fileSystem.File.Create(assemblyFile); var targetPath = PathHelper.Combine(repo.RepositoryPath, "subdir1", "subdir2"); - this.fileSystem.CreateDirectory(targetPath); + this.fileSystem.Directory.CreateDirectory(targetPath); var arguments = this.argumentParser.ParseArguments($"-targetpath {targetPath} -updateAssemblyInfo ..\\..\\CommonAssemblyInfo.cs"); arguments.UpdateAssemblyInfo.ShouldBe(true); @@ -765,9 +766,9 @@ public void ThrowIfConfigurationFileDoesNotExist(string configFile) => public void EnsureConfigurationFileIsSet() { var configFile = PathHelper.GetTempPath() + Guid.NewGuid() + ".yaml"; - File.WriteAllText(configFile, "next-version: 1.0.0"); + this.fileSystem.File.WriteAllText(configFile, "next-version: 1.0.0"); var arguments = this.argumentParser.ParseArguments($"-config {configFile}"); arguments.ConfigurationFile.ShouldBe(configFile); - File.Delete(configFile); + this.fileSystem.File.Delete(configFile); } } diff --git a/src/GitVersion.App/ArgumentParser.cs b/src/GitVersion.App/ArgumentParser.cs index 7e273f99da..26fb7af233 100644 --- a/src/GitVersion.App/ArgumentParser.cs +++ b/src/GitVersion.App/ArgumentParser.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Agents; using GitVersion.Extensions; using GitVersion.Helpers; @@ -108,13 +109,13 @@ private void ValidateConfigurationFile(Arguments arguments) if (Path.IsPathRooted(arguments.ConfigurationFile)) { - if (!this.fileSystem.Exists(arguments.ConfigurationFile)) throw new WarningException($"Could not find config file at '{arguments.ConfigurationFile}'"); + if (!this.fileSystem.File.Exists(arguments.ConfigurationFile)) throw new WarningException($"Could not find config file at '{arguments.ConfigurationFile}'"); arguments.ConfigurationFile = Path.GetFullPath(arguments.ConfigurationFile); } else { var configFilePath = Path.GetFullPath(PathHelper.Combine(arguments.TargetPath, arguments.ConfigurationFile)); - if (!this.fileSystem.Exists(configFilePath)) throw new WarningException($"Could not find config file at '{configFilePath}'"); + if (!this.fileSystem.File.Exists(configFilePath)) throw new WarningException($"Could not find config file at '{configFilePath}'"); arguments.ConfigurationFile = configFilePath; } } @@ -166,7 +167,7 @@ private void ParseTargetPath(Arguments arguments, string? name, IReadOnlyList this.log.Info(logMessage)); } - if (!this.fileSystem.DirectoryExists(workingDirectory)) + if (!this.fileSystem.Directory.Exists(workingDirectory)) { this.log.Warning($"The working directory '{workingDirectory}' does not exist."); } @@ -159,7 +160,7 @@ private bool HandleNonMainCommand(GitVersionOptions gitVersionOptions, out int e return false; } - private static void ConfigureLogging(GitVersionOptions gitVersionOptions, ILog log) + private static void ConfigureLogging(GitVersionOptions gitVersionOptions, ILog log, IFileSystem fileSystem) { if (gitVersionOptions.Output.Contains(OutputType.BuildServer) || gitVersionOptions.LogFilePath == "console") { @@ -168,7 +169,7 @@ private static void ConfigureLogging(GitVersionOptions gitVersionOptions, ILog l if (gitVersionOptions.LogFilePath != null && gitVersionOptions.LogFilePath != "console") { - log.AddLogAppender(new FileAppender(gitVersionOptions.LogFilePath)); + log.AddLogAppender(new FileAppender(fileSystem, gitVersionOptions.LogFilePath)); } } } diff --git a/src/GitVersion.BuildAgents.Tests/Agents/BitBucketPipelinesTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/BitBucketPipelinesTests.cs index 3cae60d9ad..21a4bf6c79 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/BitBucketPipelinesTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/BitBucketPipelinesTests.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Helpers; @@ -10,6 +11,7 @@ namespace GitVersion.Agents.Tests; public class BitBucketPipelinesTests : TestBase { private IEnvironment environment; + private IFileSystem fileSystem; private BitBucketPipelines buildServer; private IServiceProvider sp; @@ -18,6 +20,7 @@ public void SetEnvironmentVariableForTest() { this.sp = ConfigureServices(services => services.AddSingleton()); this.environment = this.sp.GetRequiredService(); + this.fileSystem = this.sp.GetRequiredService(); this.buildServer = this.sp.GetRequiredService(); this.environment.SetEnvironmentVariable(BitBucketPipelines.EnvironmentVariableName, "MyWorkspace"); @@ -128,8 +131,8 @@ public void WriteAllVariablesToTheTextWriter() } finally { - File.Delete(propertyFile); - File.Delete(ps1File); + this.fileSystem.File.Delete(propertyFile); + this.fileSystem.File.Delete(ps1File); } } @@ -156,18 +159,18 @@ private void AssertVariablesAreWrittenToFile(string propertyFile, string ps1File writes[1].ShouldBe("1.2.3-beta.1+5"); - File.Exists(propertyFile).ShouldBe(true); + this.fileSystem.File.Exists(propertyFile).ShouldBe(true); - var props = File.ReadAllText(propertyFile); + var props = this.fileSystem.File.ReadAllText(propertyFile); props.ShouldContain("export GITVERSION_MAJOR=1"); props.ShouldContain("export GITVERSION_MINOR=2"); props.ShouldContain("export GITVERSION_SHA=f28807e615e9f06aec8a33c87780374e0c1f6fb8"); props.ShouldContain("export GITVERSION_COMMITDATE=2022-04-06"); - File.Exists(ps1File).ShouldBe(true); + this.fileSystem.File.Exists(ps1File).ShouldBe(true); - var psProps = File.ReadAllText(ps1File); + var psProps = this.fileSystem.File.ReadAllText(ps1File); psProps.ShouldContain("$GITVERSION_MAJOR = \"1\""); psProps.ShouldContain("$GITVERSION_MINOR = \"2\""); diff --git a/src/GitVersion.BuildAgents.Tests/Agents/BuildServerBaseTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/BuildServerBaseTests.cs index f1e0166beb..0042b69743 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/BuildServerBaseTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/BuildServerBaseTests.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Logging; diff --git a/src/GitVersion.BuildAgents.Tests/Agents/CodeBuildTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/CodeBuildTests.cs index cdc5de2b10..2ca79a443a 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/CodeBuildTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/CodeBuildTests.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Helpers; @@ -10,6 +11,7 @@ namespace GitVersion.Agents.Tests; public sealed class CodeBuildTests : TestBase { private IEnvironment environment; + private IFileSystem fileSystem; private IServiceProvider sp; private CodeBuild buildServer; @@ -18,6 +20,7 @@ public void SetUp() { this.sp = ConfigureServices(services => services.AddSingleton()); this.environment = this.sp.GetRequiredService(); + this.fileSystem = this.sp.GetRequiredService(); this.buildServer = this.sp.GetRequiredService(); } @@ -62,7 +65,7 @@ public void WriteAllVariablesToTheTextWriter() } finally { - File.Delete(f); + this.fileSystem.File.Delete(f); } } @@ -92,9 +95,9 @@ private void AssertVariablesAreWrittenToFile(string file) writes[1].ShouldBe("1.2.3-beta.1+5"); - File.Exists(file).ShouldBe(true); + this.fileSystem.File.Exists(file).ShouldBe(true); - var props = File.ReadAllText(file); + var props = this.fileSystem.File.ReadAllText(file); props.ShouldContain("GitVersion_Major=1"); props.ShouldContain("GitVersion_Minor=2"); diff --git a/src/GitVersion.BuildAgents.Tests/Agents/EnvRunTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/EnvRunTests.cs index 34aba8ec1b..f7df7ae10d 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/EnvRunTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/EnvRunTests.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Core.Tests.Helpers; using GitVersion.Helpers; using Microsoft.Extensions.DependencyInjection; @@ -10,6 +11,7 @@ public class EnvRunTests : TestBase private const string EnvVarName = "ENVRUN_DATABASE"; private string mFilePath; private IEnvironment environment; + private IFileSystem fileSystem; private EnvRun buildServer; [SetUp] @@ -17,19 +19,20 @@ public void SetEnvironmentVariableForTest() { var sp = ConfigureServices(services => services.AddSingleton()); this.environment = sp.GetRequiredService(); + this.fileSystem = sp.GetRequiredService(); this.buildServer = sp.GetRequiredService(); // set environment variable and create an empty envrun file to indicate that EnvRun is running... this.mFilePath = PathHelper.Combine(PathHelper.GetTempPath(), "envrun.db"); this.environment.SetEnvironmentVariable(EnvVarName, this.mFilePath); - File.OpenWrite(this.mFilePath).Dispose(); + this.fileSystem.File.OpenWrite(this.mFilePath).Dispose(); } [TearDown] public void ClearEnvironmentVariableForTest() { this.environment.SetEnvironmentVariable(EnvVarName, null); - File.Delete(this.mFilePath); + this.fileSystem.File.Delete(this.mFilePath); } [Test] diff --git a/src/GitVersion.BuildAgents.Tests/Agents/GitHubActionsTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/GitHubActionsTests.cs index b5fd21fd0f..bae9b0d150 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/GitHubActionsTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/GitHubActionsTests.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Core.Tests.Helpers; using GitVersion.Helpers; using Microsoft.Extensions.DependencyInjection; @@ -8,6 +9,7 @@ namespace GitVersion.Agents.Tests; public class GitHubActionsTests : TestBase { private IEnvironment environment; + private IFileSystem fileSystem; private GitHubActions buildServer; private string? githubSetEnvironmentTempFilePath; @@ -16,6 +18,7 @@ public void SetUp() { var sp = ConfigureServices(services => services.AddSingleton()); this.environment = sp.GetRequiredService(); + this.fileSystem = sp.GetRequiredService(); this.buildServer = sp.GetRequiredService(); this.environment.SetEnvironmentVariable(GitHubActions.EnvironmentVariableName, "true"); this.environment.SetEnvironmentVariable("GITHUB_REF_TYPE", "branch"); @@ -29,10 +32,10 @@ public void TearDown() { this.environment.SetEnvironmentVariable(GitHubActions.EnvironmentVariableName, null); this.environment.SetEnvironmentVariable(GitHubActions.GitHubSetEnvTempFileEnvironmentVariableName, null); - if (this.githubSetEnvironmentTempFilePath == null || !File.Exists(this.githubSetEnvironmentTempFilePath)) + if (this.githubSetEnvironmentTempFilePath == null || !this.fileSystem.File.Exists(this.githubSetEnvironmentTempFilePath)) return; - File.Delete(this.githubSetEnvironmentTempFilePath); + this.fileSystem.File.Delete(this.githubSetEnvironmentTempFilePath); this.githubSetEnvironmentTempFilePath = null; } @@ -145,7 +148,7 @@ public void ShouldWriteIntegration() var expectedFileContents = new List { "GitVersion_Major=1.0.0" }; this.githubSetEnvironmentTempFilePath.ShouldNotBeNull(); - var actualFileContents = File.ReadAllLines(this.githubSetEnvironmentTempFilePath); + var actualFileContents = this.fileSystem.File.ReadAllLines(this.githubSetEnvironmentTempFilePath); actualFileContents.ShouldBe(expectedFileContents); } diff --git a/src/GitVersion.BuildAgents.Tests/Agents/GitLabCiTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/GitLabCiTests.cs index 2e5eba6ea1..bb809fc409 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/GitLabCiTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/GitLabCiTests.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Helpers; @@ -9,16 +10,18 @@ namespace GitVersion.Agents.Tests; [TestFixture] public class GitLabCiTests : TestBase { + private IEnvironment environment; + private IFileSystem fileSystem; private IServiceProvider sp; private GitLabCi buildServer; - private IEnvironment environment; [SetUp] public void SetUp() { this.sp = ConfigureServices(services => services.AddSingleton()); - this.buildServer = this.sp.GetRequiredService(); this.environment = this.sp.GetRequiredService(); + this.fileSystem = this.sp.GetRequiredService(); + this.buildServer = this.sp.GetRequiredService(); this.environment.SetEnvironmentVariable(GitLabCi.EnvironmentVariableName, "true"); } @@ -102,7 +105,7 @@ public void WriteAllVariablesToTheTextWriter() } finally { - File.Delete(f); + this.fileSystem.File.Delete(f); } } @@ -132,9 +135,9 @@ private void AssertVariablesAreWrittenToFile(string file) writes[1].ShouldBe("1.2.3-beta.1+5"); - File.Exists(file).ShouldBe(true); + this.fileSystem.File.Exists(file).ShouldBe(true); - var props = File.ReadAllText(file); + var props = this.fileSystem.File.ReadAllText(file); props.ShouldContain("GitVersion_Major=1"); props.ShouldContain("GitVersion_Minor=2"); diff --git a/src/GitVersion.BuildAgents.Tests/Agents/JenkinsTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/JenkinsTests.cs index 12ab86d632..8e8719761a 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/JenkinsTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/JenkinsTests.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Helpers; @@ -14,6 +15,7 @@ public class JenkinsTests : TestBase private const string localBranch = "GIT_LOCAL_BRANCH"; private const string pipelineBranch = "BRANCH_NAME"; private IEnvironment environment; + private IFileSystem fileSystem; private IServiceProvider sp; private Jenkins buildServer; @@ -22,6 +24,7 @@ public void SetUp() { this.sp = ConfigureServices(services => services.AddSingleton()); this.environment = this.sp.GetRequiredService(); + this.fileSystem = this.sp.GetRequiredService(); this.buildServer = this.sp.GetRequiredService(); } @@ -118,7 +121,7 @@ public void WriteAllVariablesToTheTextWriter() } finally { - File.Delete(f); + this.fileSystem.File.Delete(f); } } @@ -144,9 +147,9 @@ private void AssertVariablesAreWrittenToFile(string file) writes[1].ShouldBe("1.2.3-beta.1+5"); - File.Exists(file).ShouldBe(true); + this.fileSystem.File.Exists(file).ShouldBe(true); - var props = File.ReadAllText(file); + var props = this.fileSystem.File.ReadAllText(file); props.ShouldContain("GitVersion_Major=1"); props.ShouldContain("GitVersion_Minor=2"); diff --git a/src/GitVersion.BuildAgents/Agents/AppVeyor.cs b/src/GitVersion.BuildAgents/Agents/AppVeyor.cs index b1b38db2da..c3b73be7f9 100644 --- a/src/GitVersion.BuildAgents/Agents/AppVeyor.cs +++ b/src/GitVersion.BuildAgents/Agents/AppVeyor.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Extensions; using GitVersion.Logging; using GitVersion.OutputVariables; diff --git a/src/GitVersion.BuildAgents/Agents/AzurePipelines.cs b/src/GitVersion.BuildAgents/Agents/AzurePipelines.cs index 8c4e11b372..b6fca6b9ac 100644 --- a/src/GitVersion.BuildAgents/Agents/AzurePipelines.cs +++ b/src/GitVersion.BuildAgents/Agents/AzurePipelines.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Extensions; using GitVersion.Logging; using GitVersion.OutputVariables; diff --git a/src/GitVersion.BuildAgents/Agents/BitBucketPipelines.cs b/src/GitVersion.BuildAgents/Agents/BitBucketPipelines.cs index 3574271132..b2954465f5 100644 --- a/src/GitVersion.BuildAgents/Agents/BitBucketPipelines.cs +++ b/src/GitVersion.BuildAgents/Agents/BitBucketPipelines.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Logging; using GitVersion.OutputVariables; @@ -54,13 +55,13 @@ public override void WriteIntegration(Action writer, GitVersionVariable .Select(variable => $"export GITVERSION_{variable.Key.ToUpperInvariant()}={variable.Value}") .ToList(); - File.WriteAllLines(this.propertyFile, exports); + this.FileSystem.File.WriteAllLines(this.propertyFile, exports); var psExports = variables .Select(variable => $"$GITVERSION_{variable.Key.ToUpperInvariant()} = \"{variable.Value}\"") .ToList(); - File.WriteAllLines(this.ps1File, psExports); + this.FileSystem.File.WriteAllLines(this.ps1File, psExports); } public override string? GetCurrentBranch(bool usingDynamicRepos) diff --git a/src/GitVersion.BuildAgents/Agents/BuildKite.cs b/src/GitVersion.BuildAgents/Agents/BuildKite.cs index 8fc493c4b5..dbd0d58d2a 100644 --- a/src/GitVersion.BuildAgents/Agents/BuildKite.cs +++ b/src/GitVersion.BuildAgents/Agents/BuildKite.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Logging; using GitVersion.OutputVariables; diff --git a/src/GitVersion.BuildAgents/Agents/CodeBuild.cs b/src/GitVersion.BuildAgents/Agents/CodeBuild.cs index 7bf2d84560..791ac37e85 100644 --- a/src/GitVersion.BuildAgents/Agents/CodeBuild.cs +++ b/src/GitVersion.BuildAgents/Agents/CodeBuild.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Extensions; using GitVersion.Logging; using GitVersion.OutputVariables; @@ -37,7 +38,7 @@ public override void WriteIntegration(Action writer, GitVersionVariable base.WriteIntegration(writer, variables, updateBuildNumber); writer($"Outputting variables to '{this.file}' ... "); - File.WriteAllLines(this.file, GenerateBuildLogOutput(variables)); + this.FileSystem.File.WriteAllLines(this.file, GenerateBuildLogOutput(variables)); } public override bool PreventFetch() => true; diff --git a/src/GitVersion.BuildAgents/Agents/ContinuaCi.cs b/src/GitVersion.BuildAgents/Agents/ContinuaCi.cs index 30d650c415..08b90a6e5a 100644 --- a/src/GitVersion.BuildAgents/Agents/ContinuaCi.cs +++ b/src/GitVersion.BuildAgents/Agents/ContinuaCi.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Logging; using GitVersion.OutputVariables; diff --git a/src/GitVersion.BuildAgents/Agents/Drone.cs b/src/GitVersion.BuildAgents/Agents/Drone.cs index 6054e91805..503815e33a 100644 --- a/src/GitVersion.BuildAgents/Agents/Drone.cs +++ b/src/GitVersion.BuildAgents/Agents/Drone.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Extensions; using GitVersion.Logging; using GitVersion.OutputVariables; diff --git a/src/GitVersion.BuildAgents/Agents/EnvRun.cs b/src/GitVersion.BuildAgents/Agents/EnvRun.cs index 1c55255757..171b945dfd 100644 --- a/src/GitVersion.BuildAgents/Agents/EnvRun.cs +++ b/src/GitVersion.BuildAgents/Agents/EnvRun.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Extensions; using GitVersion.Logging; using GitVersion.OutputVariables; @@ -13,7 +14,7 @@ public override bool CanApplyToCurrentContext() var envRunDatabasePath = Environment.GetEnvironmentVariable(EnvironmentVariableName); if (!envRunDatabasePath.IsNullOrEmpty()) { - if (!File.Exists(envRunDatabasePath)) + if (!this.FileSystem.File.Exists(envRunDatabasePath)) { this.Log.Error($"The database file of EnvRun.exe was not found at {envRunDatabasePath}."); return false; diff --git a/src/GitVersion.BuildAgents/Agents/GitHubActions.cs b/src/GitVersion.BuildAgents/Agents/GitHubActions.cs index 521ff47d0a..ff4a16d653 100644 --- a/src/GitVersion.BuildAgents/Agents/GitHubActions.cs +++ b/src/GitVersion.BuildAgents/Agents/GitHubActions.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Extensions; using GitVersion.Logging; using GitVersion.OutputVariables; @@ -31,7 +32,7 @@ public override void WriteIntegration(Action writer, GitVersionVariable if (gitHubSetEnvFilePath != null) { writer($"Writing version variables to $GITHUB_ENV file for '{GetType().Name}'."); - using var streamWriter = File.AppendText(gitHubSetEnvFilePath); + using var streamWriter = this.FileSystem.File.AppendText(gitHubSetEnvFilePath); foreach (var (key, value) in variables) { if (!value.IsNullOrEmpty()) diff --git a/src/GitVersion.BuildAgents/Agents/GitLabCi.cs b/src/GitVersion.BuildAgents/Agents/GitLabCi.cs index 0c29e423a1..350b75d849 100644 --- a/src/GitVersion.BuildAgents/Agents/GitLabCi.cs +++ b/src/GitVersion.BuildAgents/Agents/GitLabCi.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Logging; using GitVersion.OutputVariables; @@ -44,6 +45,6 @@ public override void WriteIntegration(Action writer, GitVersionVariable base.WriteIntegration(writer, variables, updateBuildNumber); writer($"Outputting variables to '{this.file}' ... "); - File.WriteAllLines(this.file, GenerateBuildLogOutput(variables)); + this.FileSystem.File.WriteAllLines(this.file, GenerateBuildLogOutput(variables)); } } diff --git a/src/GitVersion.BuildAgents/Agents/Jenkins.cs b/src/GitVersion.BuildAgents/Agents/Jenkins.cs index 6030ba0d93..e23a8be632 100644 --- a/src/GitVersion.BuildAgents/Agents/Jenkins.cs +++ b/src/GitVersion.BuildAgents/Agents/Jenkins.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Extensions; using GitVersion.Logging; using GitVersion.OutputVariables; @@ -43,6 +44,6 @@ public override void WriteIntegration(Action writer, GitVersionVariable base.WriteIntegration(writer, variables, updateBuildNumber); writer($"Outputting variables to '{this.file}' ... "); - File.WriteAllLines(this.file, GenerateBuildLogOutput(variables)); + this.FileSystem.File.WriteAllLines(this.file, GenerateBuildLogOutput(variables)); } } diff --git a/src/GitVersion.BuildAgents/Agents/MyGet.cs b/src/GitVersion.BuildAgents/Agents/MyGet.cs index 4d488834ea..ea82a27056 100644 --- a/src/GitVersion.BuildAgents/Agents/MyGet.cs +++ b/src/GitVersion.BuildAgents/Agents/MyGet.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Extensions; using GitVersion.Helpers; using GitVersion.Logging; diff --git a/src/GitVersion.BuildAgents/Agents/SpaceAutomation.cs b/src/GitVersion.BuildAgents/Agents/SpaceAutomation.cs index 41b2b3f941..1518eea9a9 100644 --- a/src/GitVersion.BuildAgents/Agents/SpaceAutomation.cs +++ b/src/GitVersion.BuildAgents/Agents/SpaceAutomation.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Logging; using GitVersion.OutputVariables; diff --git a/src/GitVersion.BuildAgents/Agents/TeamCity.cs b/src/GitVersion.BuildAgents/Agents/TeamCity.cs index 84f60b2749..30bce327d3 100644 --- a/src/GitVersion.BuildAgents/Agents/TeamCity.cs +++ b/src/GitVersion.BuildAgents/Agents/TeamCity.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Extensions; using GitVersion.Helpers; using GitVersion.Logging; diff --git a/src/GitVersion.BuildAgents/Agents/TravisCI.cs b/src/GitVersion.BuildAgents/Agents/TravisCI.cs index 6109006a21..ca4e0764a1 100644 --- a/src/GitVersion.BuildAgents/Agents/TravisCI.cs +++ b/src/GitVersion.BuildAgents/Agents/TravisCI.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Logging; using GitVersion.OutputVariables; diff --git a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationFileLocatorTests.cs b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationFileLocatorTests.cs index e89ac22636..3d83a38e23 100644 --- a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationFileLocatorTests.cs +++ b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationFileLocatorTests.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Configuration; using GitVersion.Configuration.Tests.Configuration; using GitVersion.Core.Tests.Helpers; diff --git a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs index ca721c3a18..206b1573c6 100644 --- a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs +++ b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using System.Runtime.CompilerServices; using GitVersion.Configuration; using GitVersion.Configuration.Tests.Configuration; diff --git a/src/GitVersion.Configuration.Tests/Configuration/Extensions.cs b/src/GitVersion.Configuration.Tests/Configuration/Extensions.cs index 6000db6c6c..e6f9932e03 100644 --- a/src/GitVersion.Configuration.Tests/Configuration/Extensions.cs +++ b/src/GitVersion.Configuration.Tests/Configuration/Extensions.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Extensions; using GitVersion.Helpers; @@ -14,13 +15,13 @@ public static IDisposable SetupConfigFile(this IFileSystem fileSystem, s var fullPath = PathHelper.Combine(path, fileName); var directory = PathHelper.GetDirectoryName(fullPath); - if (!fileSystem.DirectoryExists(directory)) + if (!fileSystem.Directory.Exists(directory)) { - fileSystem.CreateDirectory(directory); + fileSystem.Directory.CreateDirectory(directory); } - fileSystem.WriteAllText(fullPath, text); + fileSystem.File.WriteAllText(fullPath, text); - return Disposable.Create(fullPath, () => fileSystem.Delete(fullPath)); + return Disposable.Create(fullPath, () => fileSystem.File.Delete(fullPath)); } } diff --git a/src/GitVersion.Configuration/ConfigurationFileLocator.cs b/src/GitVersion.Configuration/ConfigurationFileLocator.cs index 0354d9a0c9..efe686af59 100644 --- a/src/GitVersion.Configuration/ConfigurationFileLocator.cs +++ b/src/GitVersion.Configuration/ConfigurationFileLocator.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Extensions; using GitVersion.Helpers; using GitVersion.Logging; @@ -43,7 +44,7 @@ from candidate in candidates foreach (var candidatePath in candidatePaths) { this.log.Debug($"Trying to find configuration file at '{candidatePath}'"); - if (fileSystem.Exists(candidatePath)) + if (fileSystem.File.Exists(candidatePath)) { this.log.Info($"Found configuration file at '{candidatePath}'"); return candidatePath; diff --git a/src/GitVersion.Configuration/ConfigurationProvider.cs b/src/GitVersion.Configuration/ConfigurationProvider.cs index cf1a89a74f..1a506c080a 100644 --- a/src/GitVersion.Configuration/ConfigurationProvider.cs +++ b/src/GitVersion.Configuration/ConfigurationProvider.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Configuration.Workflows; using GitVersion.Extensions; using Microsoft.Extensions.Options; @@ -71,8 +72,8 @@ private IGitVersionConfiguration ProvideConfiguration(string? configFile, private IReadOnlyDictionary? ReadOverrideConfiguration(string? configFilePath) { - if (configFilePath == null || !fileSystem.Exists(configFilePath)) return null; - var content = fileSystem.ReadAllText(configFilePath); + if (configFilePath == null || !fileSystem.File.Exists(configFilePath)) return null; + var content = fileSystem.File.ReadAllText(configFilePath); return configurationSerializer.Deserialize>(content); } diff --git a/src/GitVersion.Core.Tests/Core/DynamicRepositoryTests.cs b/src/GitVersion.Core.Tests/Core/DynamicRepositoryTests.cs index 9fe51feda9..a8b0ca9985 100644 --- a/src/GitVersion.Core.Tests/Core/DynamicRepositoryTests.cs +++ b/src/GitVersion.Core.Tests/Core/DynamicRepositoryTests.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Core.Tests.Helpers; using GitVersion.Helpers; using Microsoft.Extensions.DependencyInjection; @@ -49,8 +50,8 @@ public void FindsVersionInDynamicRepo(string name, string url, string targetBran gitPreparer.Prepare(); var fileSystem = sp.GetRequiredService(); - fileSystem.CreateDirectory(dynamicDirectory); - fileSystem.CreateDirectory(workingDirectory); + fileSystem.Directory.CreateDirectory(dynamicDirectory); + fileSystem.Directory.CreateDirectory(workingDirectory); var gitVersionCalculator = sp.GetRequiredService(); diff --git a/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs b/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs index f2dac1d3f8..6bb47da39c 100644 --- a/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs +++ b/src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs @@ -1,6 +1,8 @@ +using System.IO.Abstractions; using GitVersion.Agents; using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; +using GitVersion.Extensions; using GitVersion.Git; using GitVersion.Helpers; using GitVersion.Logging; @@ -147,7 +149,7 @@ public void CacheFileExistsOnDisk() var cacheKey = cacheKeyFactory.Create(null); var cacheFileName = this.gitVersionCacheProvider.GetCacheFileName(cacheKey); - this.fileSystem.WriteAllText(cacheFileName, versionCacheFileContent); + this.fileSystem.File.WriteAllText(cacheFileName, versionCacheFileContent); versionVariables = gitVersionCalculator.CalculateVersionVariables(); versionVariables.AssemblySemVer.ShouldBe("4.10.3.0"); @@ -199,7 +201,7 @@ public void CacheFileExistsOnDiskWhenOverrideConfigIsSpecifiedVersionShouldBeDyn var cacheKeyFactory = this.sp.GetRequiredService(); var cacheKey = cacheKeyFactory.Create(null); var cacheFileName = this.gitVersionCacheProvider.GetCacheFileName(cacheKey); - this.fileSystem.WriteAllText(cacheFileName, versionCacheFileContent); + this.fileSystem.File.WriteAllText(cacheFileName, versionCacheFileContent); var cacheDirectory = this.gitVersionCacheProvider.GetCacheDirectory(); @@ -292,13 +294,13 @@ public void ConfigChangeInvalidatesCache(string configFileName) var cacheKey = cacheKeyFactory.Create(null); var cacheFileName = this.gitVersionCacheProvider.GetCacheFileName(cacheKey); - this.fileSystem.WriteAllText(cacheFileName, versionCacheFileContent); + this.fileSystem.File.WriteAllText(cacheFileName, versionCacheFileContent); versionVariables = gitVersionCalculator.CalculateVersionVariables(); versionVariables.AssemblySemVer.ShouldBe("4.10.3.0"); var configPath = PathHelper.Combine(fixture.RepositoryPath, configFileName); - this.fileSystem.WriteAllText(configPath, "next-version: 5.0.0"); + this.fileSystem.File.WriteAllText(configPath, "next-version: 5.0.0"); gitVersionCalculator = GetGitVersionCalculator(gitVersionOptions, fs: this.fileSystem); @@ -354,7 +356,7 @@ public void NoCacheBypassesCache() var cacheKey = cacheKeyFactory.Create(null); var cacheFileName = this.gitVersionCacheProvider.GetCacheFileName(cacheKey); - this.fileSystem.WriteAllText(cacheFileName, versionCacheFileContent); + this.fileSystem.File.WriteAllText(cacheFileName, versionCacheFileContent); versionVariables = gitVersionCalculator.CalculateVersionVariables(); versionVariables.AssemblySemVer.ShouldBe("4.10.3.0"); @@ -478,8 +480,9 @@ public void GetDotGitDirectoryWorktree() public void CalculateVersionFromWorktreeHead() { // Setup + this.fileSystem = new FileSystem(); using var fixture = new EmptyRepositoryFixture(); - var repoDir = new DirectoryInfo(fixture.RepositoryPath); + var repoDir = fileSystem.DirectoryInfo.New(fixture.RepositoryPath); var worktreePath = PathHelper.Combine(repoDir.Parent?.FullName, $"{repoDir.Name}-v1"); fixture.Repository.MakeATaggedCommit("v1.0.0"); @@ -492,7 +495,7 @@ public void CalculateVersionFromWorktreeHead() var gitVersionOptions = new GitVersionOptions { WorkingDirectory = worktreeFixture.RepositoryPath }; - var sut = GetGitVersionCalculator(gitVersionOptions); + var sut = GetGitVersionCalculator(gitVersionOptions, fs: this.fileSystem); // Execute var version = sut.CalculateVersionVariables(); @@ -590,9 +593,9 @@ public void CalculateVersionVariables_ShallowFetch_ThrowException() exception?.Message.ShouldBe("Repository is a shallow clone. Git repositories must contain the full history. See https://gitversion.net/docs/reference/requirements#unshallow for more info."); } - private static string GetWorktreePath(EmptyRepositoryFixture fixture) + private string GetWorktreePath(EmptyRepositoryFixture fixture) { - var worktreePath = PathHelper.Combine(Directory.GetParent(fixture.RepositoryPath)?.FullName, Guid.NewGuid().ToString()); + var worktreePath = PathHelper.Combine(this.fileSystem.Directory.GetParent(fixture.RepositoryPath)?.FullName, Guid.NewGuid().ToString()); return worktreePath; } @@ -625,6 +628,10 @@ private static IServiceProvider GetServiceProvider(GitVersionOptions gitVersionO if (environment != null) services.AddSingleton(environment); var options = Options.Create(gitVersionOptions); services.AddSingleton(options); - services.AddSingleton(new GitRepositoryInfo(options)); + services.AddSingleton(sp => + { + var fs = sp.GetRequiredService(); + return new GitRepositoryInfo(fs, options); + }); }); } diff --git a/src/GitVersion.Core.Tests/Core/GitVersionToolDirectoryTests.cs b/src/GitVersion.Core.Tests/Core/GitVersionToolDirectoryTests.cs index 35e976bcb6..59fee991b9 100644 --- a/src/GitVersion.Core.Tests/Core/GitVersionToolDirectoryTests.cs +++ b/src/GitVersion.Core.Tests/Core/GitVersionToolDirectoryTests.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Core.Tests.Helpers; using GitVersion.Helpers; using LibGit2Sharp; @@ -11,17 +12,20 @@ public class GitVersionTaskDirectoryTests : TestBase { private string gitDirectory; private string workDirectory; + private IFileSystem fileSystem; [SetUp] public void SetUp() { + var sp = ConfigureServices(); + this.fileSystem = sp.GetRequiredService(); this.workDirectory = PathHelper.Combine(PathHelper.GetTempPath(), Guid.NewGuid().ToString()); this.gitDirectory = Repository.Init(this.workDirectory).TrimEnd(Path.DirectorySeparatorChar); Assert.That(this.gitDirectory, Is.Not.Null); } [TearDown] - public void Cleanup() => Directory.Delete(this.workDirectory, true); + public void Cleanup() => this.fileSystem.Directory.Delete(this.workDirectory, true); [Test] public void FindsGitDirectory() @@ -43,7 +47,7 @@ public void FindsGitDirectory() public void FindsGitDirectoryInParent() { var childDir = PathHelper.Combine(this.workDirectory, "child"); - Directory.CreateDirectory(childDir); + this.fileSystem.Directory.CreateDirectory(childDir); var exception = Assert.Catch(() => { diff --git a/src/GitVersion.Core.Tests/DocumentationTests.cs b/src/GitVersion.Core.Tests/DocumentationTests.cs index 8ac444b4fd..fe753448a5 100644 --- a/src/GitVersion.Core.Tests/DocumentationTests.cs +++ b/src/GitVersion.Core.Tests/DocumentationTests.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Helpers; @@ -8,10 +9,15 @@ namespace GitVersion.Core.Tests; [TestFixture] public class DocumentationTests : TestBase { - private DirectoryInfo docsDirectory; + private IFileSystem fileSystem; + private IDirectoryInfo docsDirectory; [OneTimeSetUp] - public void OneTimeSetUp() => this.docsDirectory = GetDocsDirectory(); + public void OneTimeSetUp() + { + this.fileSystem = new FileSystem(); + this.docsDirectory = GetDocsDirectory(); + } [Test] public void ConfigurationDocumentationIsUpToDate() @@ -56,28 +62,28 @@ private string ReadDocumentationFile(string relativeDocumentationFilePath) { var documentationFilePath = PathHelper.Combine(this.docsDirectory.FullName, relativeDocumentationFilePath); // Normalize path separators and such. - documentationFilePath = new FileInfo(documentationFilePath).FullName; + documentationFilePath = fileSystem.FileInfo.New(documentationFilePath).FullName; - if (!File.Exists(documentationFilePath)) + if (!this.fileSystem.File.Exists(documentationFilePath)) { throw new FileNotFoundException($"The documentation file '{documentationFilePath}' couldn't be found.", documentationFilePath); } - return File.ReadAllText(documentationFilePath); + return this.fileSystem.File.ReadAllText(documentationFilePath); } - private static DirectoryInfo GetDocsDirectory() + private IDirectoryInfo GetDocsDirectory() { - var currentDirectory = new FileInfo(typeof(DocumentationTests).Assembly.Location).Directory; + var currentDirectory = this.fileSystem.FileInfo.New(typeof(DocumentationTests).Assembly.Location).Directory; while (currentDirectory != null) { - var docsDirectory = currentDirectory + var searchedDirectory = currentDirectory .EnumerateDirectories("docs", SearchOption.TopDirectoryOnly) .FirstOrDefault(); - if (docsDirectory != null) + if (searchedDirectory != null) { - currentDirectory = docsDirectory; + currentDirectory = searchedDirectory; break; } diff --git a/src/GitVersion.Core.Tests/Extensions/GitVersionVariablesExtensions.cs b/src/GitVersion.Core.Tests/Extensions/GitVersionVariablesExtensions.cs index 063470e5a3..6d0ae5575e 100644 --- a/src/GitVersion.Core.Tests/Extensions/GitVersionVariablesExtensions.cs +++ b/src/GitVersion.Core.Tests/Extensions/GitVersionVariablesExtensions.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.OutputVariables; namespace GitVersion.Core.Tests; diff --git a/src/GitVersion.Core.Tests/Helpers/GitVersionCoreTestModule.cs b/src/GitVersion.Core.Tests/Helpers/GitVersionCoreTestModule.cs index 755287a94d..e46989145f 100644 --- a/src/GitVersion.Core.Tests/Helpers/GitVersionCoreTestModule.cs +++ b/src/GitVersion.Core.Tests/Helpers/GitVersionCoreTestModule.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Agents; using GitVersion.Configuration; using GitVersion.Extensions; diff --git a/src/GitVersion.Core.Tests/IntegrationTests/FileSystemTests.cs b/src/GitVersion.Core.Tests/IntegrationTests/FileSystemTests.cs deleted file mode 100644 index 5c81294ff3..0000000000 --- a/src/GitVersion.Core.Tests/IntegrationTests/FileSystemTests.cs +++ /dev/null @@ -1,53 +0,0 @@ -using GitVersion.Core.Tests.Helpers; - -namespace GitVersion.Core.Tests.IntegrationTests; - -[TestFixture] -public class FileSystemTests : TestBase -{ - public string TempFilePath { get; set; } - - [SetUp] - public void CreateTempFile() => TempFilePath = Path.GetTempFileName(); - - [TearDown] - public void Cleanup() => File.Delete(TempFilePath); - - [TestCase("utf-32")] - [TestCase("utf-32BE")] - [TestCase("utf-16")] - [TestCase("utf-16BE")] - [TestCase("utf-8")] - public void WhenFileExistsWithEncodingPreambleEncodingIsPreservedAfterWriteAll(string encodingName) - { - var encoding = Encoding.GetEncoding(encodingName); - - File.WriteAllText(TempFilePath, "(-‸ლ)", encoding); - - var fileSystem = new FileSystem(); - fileSystem.WriteAllText(TempFilePath, @"¯\(◉◡◔)/¯"); - - using var stream = File.OpenRead(TempFilePath); - var preamble = encoding.GetPreamble(); - var bytes = new byte[preamble.Length]; - _ = stream.Read(bytes, 0, preamble.Length); - - bytes.ShouldBe(preamble); - } - - [Test] - public void WhenFileDoesNotExistCreateWithUtf8WithPreamble() - { - var encoding = Encoding.UTF8; - - var fileSystem = new FileSystem(); - fileSystem.WriteAllText(TempFilePath, "╚(ಠ_ಠ)=┐"); - - using var stream = File.OpenRead(TempFilePath); - var preamble = encoding.GetPreamble(); - var bytes = new byte[preamble.Length]; - _ = stream.Read(bytes, 0, preamble.Length); - - bytes.ShouldBe(preamble); - } -} diff --git a/src/GitVersion.Core.Tests/IntegrationTests/OtherScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/OtherScenarios.cs index de62c1008f..d47a10b7cd 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/OtherScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/OtherScenarios.cs @@ -1,10 +1,12 @@ using System.Globalization; +using System.IO.Abstractions; using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Extensions; using GitVersion.Helpers; using GitVersion.VersionCalculation; using LibGit2Sharp; +using Microsoft.Extensions.DependencyInjection; namespace GitVersion.Core.Tests.IntegrationTests; @@ -102,6 +104,8 @@ public void DoNotBlowUpWhenDevelopAndFeatureBranchPointAtSameCommit() [TestCase(false, 5)] public void HasDirtyFlagWhenUncommittedChangesAreInRepository(bool stageFile, int numberOfFiles) { + var sp = ConfigureServices(); + var fileSystem = sp.GetRequiredService(); using var fixture = new EmptyRepositoryFixture(); fixture.MakeACommit(); @@ -109,8 +113,8 @@ public void HasDirtyFlagWhenUncommittedChangesAreInRepository(bool stageFile, in { var tempFile = Path.GetTempFileName(); var repoFile = PathHelper.Combine(fixture.RepositoryPath, Path.GetFileNameWithoutExtension(tempFile) + ".txt"); - File.Move(tempFile, repoFile); - File.WriteAllText(repoFile, $"Hello world / testfile {i}"); + fileSystem.File.Move(tempFile, repoFile); + fileSystem.File.WriteAllText(repoFile, $"Hello world / testfile {i}"); if (stageFile) Commands.Stage(fixture.Repository, repoFile); diff --git a/src/GitVersion.Core.Tests/IntegrationTests/WorktreeScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/WorktreeScenarios.cs index 32a1c2b4f3..8d31541820 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/WorktreeScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/WorktreeScenarios.cs @@ -1,6 +1,8 @@ +using System.IO.Abstractions; using GitVersion.Core.Tests.Helpers; using GitVersion.Helpers; using LibGit2Sharp; +using Microsoft.Extensions.DependencyInjection; namespace GitVersion.Core.Tests.IntegrationTests; @@ -10,8 +12,10 @@ public class WorktreeScenarios : TestBase [Test] public void UseWorktreeRepositoryForVersion() { + var sp = ConfigureServices(); + var fileSystem = sp.GetRequiredService(); using var fixture = new EmptyRepositoryFixture(); - var repoDir = new DirectoryInfo(fixture.RepositoryPath); + var repoDir = fileSystem.DirectoryInfo.New(fixture.RepositoryPath); repoDir.Parent.ShouldNotBeNull(); var worktreePath = PathHelper.Combine(repoDir.Parent.FullName, $"{repoDir.Name}-v1"); diff --git a/src/GitVersion.Core/Agents/BuildAgentBase.cs b/src/GitVersion.Core/Agents/BuildAgentBase.cs index 1514d42f4e..c30dd82949 100644 --- a/src/GitVersion.Core/Agents/BuildAgentBase.cs +++ b/src/GitVersion.Core/Agents/BuildAgentBase.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Extensions; using GitVersion.Logging; using GitVersion.OutputVariables; diff --git a/src/GitVersion.Core/Agents/LocalBuild.cs b/src/GitVersion.Core/Agents/LocalBuild.cs index 60a9613e6b..bb14a6d815 100644 --- a/src/GitVersion.Core/Agents/LocalBuild.cs +++ b/src/GitVersion.Core/Agents/LocalBuild.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Logging; using GitVersion.OutputVariables; diff --git a/src/GitVersion.Core/Core/Abstractions/IFileSystem.cs b/src/GitVersion.Core/Core/Abstractions/IFileSystem.cs deleted file mode 100644 index 7678d8c373..0000000000 --- a/src/GitVersion.Core/Core/Abstractions/IFileSystem.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace GitVersion; - -public interface IFileSystem -{ - void Copy(string from, string to, bool overwrite); - void Move(string from, string to); - bool Exists(string file); - void Delete(string path); - string ReadAllText(string path); - void WriteAllText(string? file, string fileContents); - void WriteAllText(string? file, string fileContents, Encoding encoding); - Stream OpenWrite(string path); - Stream OpenRead(string path); - void CreateDirectory(string path); - bool DirectoryExists(string path); - string[] GetFiles(string path); - string[] GetDirectories(string path); - IEnumerable DirectoryEnumerateFiles(string? directory, string searchPattern, SearchOption searchOption); - long GetLastDirectoryWrite(string path); - long GetLastWriteTime(string path); -} diff --git a/src/GitVersion.Core/Core/FileSystem.cs b/src/GitVersion.Core/Core/FileSystem.cs deleted file mode 100644 index 1187b06528..0000000000 --- a/src/GitVersion.Core/Core/FileSystem.cs +++ /dev/null @@ -1,59 +0,0 @@ -using GitVersion.Helpers; - -namespace GitVersion; - -internal class FileSystem : IFileSystem -{ - public void Copy(string from, string to, bool overwrite) => File.Copy(from, to, overwrite); - - public void Move(string from, string to) => File.Move(from, to); - - public bool Exists(string file) => File.Exists(file); - - public void Delete(string path) => File.Delete(path); - - public string ReadAllText(string path) => File.ReadAllText(path); - - public void WriteAllText(string? file, string fileContents) - { - // Opinionated decision to use UTF8 with BOM when creating new files or when the existing - // encoding was not easily detected due to the file not having an encoding preamble. - var encoding = EncodingHelper.DetectEncoding(file) ?? Encoding.UTF8; - WriteAllText(file, fileContents, encoding); - } - - public void WriteAllText(string? file, string fileContents, Encoding encoding) - { - ArgumentException.ThrowIfNullOrWhiteSpace(file); - - File.WriteAllText(file, fileContents, encoding); - } - - public Stream OpenWrite(string path) => File.OpenWrite(path); - - public Stream OpenRead(string path) => File.OpenRead(path); - - public void CreateDirectory(string path) => Directory.CreateDirectory(path); - - public bool DirectoryExists(string path) => Directory.Exists(path); - - public string[] GetFiles(string path) => Directory.GetFiles(path); - - public string[] GetDirectories(string path) => Directory.GetDirectories(path); - - public IEnumerable DirectoryEnumerateFiles(string? directory, string searchPattern, SearchOption searchOption) - { - ArgumentException.ThrowIfNullOrWhiteSpace(directory); - - return Directory.EnumerateFiles(directory, searchPattern, searchOption); - } - - public long GetLastWriteTime(string path) => File.GetLastWriteTime(path).Ticks; - - public long GetLastDirectoryWrite(string path) => new DirectoryInfo(path) - .GetDirectories("*.*", SearchOption.AllDirectories) - .Select(d => d.LastWriteTimeUtc) - .DefaultIfEmpty() - .Max() - .Ticks; -} diff --git a/src/GitVersion.Core/Core/GitPreparer.cs b/src/GitVersion.Core/Core/GitPreparer.cs index f159e05a0d..a1fffa9746 100644 --- a/src/GitVersion.Core/Core/GitPreparer.cs +++ b/src/GitVersion.Core/Core/GitPreparer.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Agents; using GitVersion.Configuration; using GitVersion.Extensions; @@ -118,7 +119,7 @@ private void CreateDynamicRepository(string? targetBranch) { throw new("Dynamic Git repositories should have a path specified"); } - if (!this.fileSystem.DirectoryExists(gitDirectory)) + if (!this.fileSystem.Directory.Exists(gitDirectory)) { CloneRepository(gitVersionOptions.RepositoryInfo.TargetUrl, gitDirectory, authentication); } diff --git a/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs b/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs index a1e0b4bf7a..82c7b8a47f 100644 --- a/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs +++ b/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Core; using GitVersion.Extensions; using GitVersion.Git; @@ -122,18 +123,18 @@ public static (string GitDirectory, string WorkingTreeDirectory)? FindGitDir(thi while (startingDir is not null) { var dirOrFilePath = PathHelper.Combine(startingDir, ".git"); - if (fileSystem.DirectoryExists(dirOrFilePath)) + if (fileSystem.Directory.Exists(dirOrFilePath)) { return (dirOrFilePath, Path.GetDirectoryName(dirOrFilePath)!); } - if (fileSystem.Exists(dirOrFilePath)) + if (fileSystem.File.Exists(dirOrFilePath)) { string? relativeGitDirPath = ReadGitDirFromFile(dirOrFilePath); if (!string.IsNullOrWhiteSpace(relativeGitDirPath)) { var fullGitDirPath = Path.GetFullPath(PathHelper.Combine(startingDir, relativeGitDirPath)); - if (fileSystem.DirectoryExists(fullGitDirPath)) + if (fileSystem.Directory.Exists(fullGitDirPath)) { return (fullGitDirPath, Path.GetDirectoryName(dirOrFilePath)!); } diff --git a/src/GitVersion.Core/Extensions/FileSystemExtensions.cs b/src/GitVersion.Core/Extensions/FileSystemExtensions.cs new file mode 100644 index 0000000000..213eea6a76 --- /dev/null +++ b/src/GitVersion.Core/Extensions/FileSystemExtensions.cs @@ -0,0 +1,13 @@ +using System.IO.Abstractions; + +namespace GitVersion.Extensions; + +public static class FileSystemExtensions +{ + public static long GetLastDirectoryWrite(this IFileSystem fileSystem, string path) => fileSystem.DirectoryInfo.New(path) + .GetDirectories("*.*", SearchOption.AllDirectories) + .Select(d => d.LastWriteTimeUtc) + .DefaultIfEmpty() + .Max() + .Ticks; +} diff --git a/src/GitVersion.Core/GitVersion.Core.csproj b/src/GitVersion.Core/GitVersion.Core.csproj index a11a076110..bc311c70f1 100644 --- a/src/GitVersion.Core/GitVersion.Core.csproj +++ b/src/GitVersion.Core/GitVersion.Core.csproj @@ -15,6 +15,7 @@ + diff --git a/src/GitVersion.Core/GitVersionCommonModule.cs b/src/GitVersion.Core/GitVersionCommonModule.cs index a4e0b53642..767b780e52 100644 --- a/src/GitVersion.Core/GitVersionCommonModule.cs +++ b/src/GitVersion.Core/GitVersionCommonModule.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Agents; using GitVersion.Logging; using Microsoft.Extensions.DependencyInjection; diff --git a/src/GitVersion.Core/Helpers/DirectoryHelper.cs b/src/GitVersion.Core/Helpers/DirectoryHelper.cs index 0bf996404e..5acff873bf 100644 --- a/src/GitVersion.Core/Helpers/DirectoryHelper.cs +++ b/src/GitVersion.Core/Helpers/DirectoryHelper.cs @@ -2,37 +2,6 @@ namespace GitVersion.Helpers; internal static class DirectoryHelper { - private static readonly Dictionary ToRename = new() - { - { "gitted", ".git" }, - { "gitmodules", ".gitmodules" } - }; - - public static void CopyFilesRecursively(DirectoryInfo source, DirectoryInfo target) - { - // From http://stackoverflow.com/questions/58744/best-way-to-copy-the-entire-contents-of-a-directory-in-c/58779#58779 - - foreach (var dir in source.GetDirectories()) - { - CopyFilesRecursively(dir, target.CreateSubdirectory(Rename(dir.Name))); - } - foreach (var file in source.GetFiles()) - { - file.CopyTo(PathHelper.Combine(target.FullName, Rename(file.Name))); - } - } - - private static string Rename(string name) => ToRename.GetValueOrDefault(name, name); - - public static void DeleteSubDirectories(string parentPath) - { - var dirs = Directory.GetDirectories(parentPath); - foreach (var dir in dirs) - { - DeleteDirectory(dir); - } - } - public static void DeleteDirectory(string directoryPath) { // From http://stackoverflow.com/questions/329355/cannot-delete-directory-with-directory-deletepath-true/329502#329502 diff --git a/src/GitVersion.Core/Helpers/EncodingHelper.cs b/src/GitVersion.Core/Helpers/EncodingHelper.cs deleted file mode 100644 index 8f0e3af85f..0000000000 --- a/src/GitVersion.Core/Helpers/EncodingHelper.cs +++ /dev/null @@ -1,95 +0,0 @@ -namespace GitVersion.Helpers; - -public static class EncodingHelper -{ - private static IList? encodingsWithPreambles; - - private static int maxPreambleLength; - - /// - /// Detects the encoding of a file if and only if it includes a preamble . - /// - /// The file name to check the encoding of. - /// The encoding of the file if it has a preamble otherwise null. - public static Encoding? DetectEncoding(string? filename) - { - if (string.IsNullOrEmpty(filename) || !File.Exists(filename)) - { - return null; - } - - if (encodingsWithPreambles == null) - { - ScanEncodings(); - } - - using var stream = File.OpenRead(filename); - // No bytes? No encoding! - if (stream.Length == 0) - { - return null; - } - - // Read the minimum amount necessary. - var length = stream.Length > maxPreambleLength ? maxPreambleLength : stream.Length; - - var bytes = new byte[length]; - _ = stream.Read(bytes, 0, (int)length); - return DetectEncoding(bytes); - } - - /// - /// Returns the first encoding where all the preamble bytes match exactly. - /// - /// The bytes to check for a matching preamble. - /// The encoding that has a matching preamble or null if one was not found. - public static Encoding? DetectEncoding(IList bytes) - { - if (bytes.Count == 0) - { - return null; - } - - if (encodingsWithPreambles == null) - { - ScanEncodings(); - } - - return encodingsWithPreambles?.FirstOrDefault(encoding => PreambleMatches(encoding, bytes)); - } - - /// - /// Returns an ordered list of encodings that have preambles ordered by the length of the - /// preamble longest to shortest. This prevents a short preamble masking a longer one - /// later in the list. - /// - /// An ordered list of encodings and corresponding preambles. - private static void ScanEncodings() - { - var encodings = (Encoding.GetEncodings()); - encodingsWithPreambles = (from info in encodings - let encoding = info.GetEncoding() - let preamble = encoding.GetPreamble() - where preamble.Length > 0 - orderby preamble.Length descending - select encoding).ToList(); - - var encodingWithLongestPreamble = encodingsWithPreambles.FirstOrDefault(); - maxPreambleLength = encodingWithLongestPreamble?.GetPreamble().Length ?? 0; - } - - /// - /// Verifies that all bytes of an encoding's preamble are present at the beginning of some sample data. - /// - /// The encoding to check against. - /// The data to test. - /// A boolean indicating if a preamble match was found. - private static bool PreambleMatches(Encoding encoding, IList data) - { - var preamble = encoding.GetPreamble(); - if (preamble.Length > data.Count) - return false; - - return !preamble.Where((preambleByte, index) => data[index] != preambleByte).Any(); - } -} diff --git a/src/GitVersion.Core/PublicAPI.Shipped.txt b/src/GitVersion.Core/PublicAPI.Shipped.txt index e8e7ed46a5..646e2c5952 100644 --- a/src/GitVersion.Core/PublicAPI.Shipped.txt +++ b/src/GitVersion.Core/PublicAPI.Shipped.txt @@ -331,7 +331,6 @@ GitVersion.GitVersionOptions.WixInfo.get -> GitVersion.WixInfo! GitVersion.GitVersionOptions.WorkingDirectory.get -> string! GitVersion.GitVersionOptions.WorkingDirectory.set -> void GitVersion.Helpers.Disposable -GitVersion.Helpers.EncodingHelper GitVersion.Helpers.IDisposable GitVersion.Helpers.IDisposable.Value.get -> T GitVersion.Helpers.LambdaEqualityHelper @@ -352,23 +351,6 @@ GitVersion.IConverterContext.WorkingDirectory.get -> string! GitVersion.IEnvironment GitVersion.IEnvironment.GetEnvironmentVariable(string! variableName) -> string? GitVersion.IEnvironment.SetEnvironmentVariable(string! variableName, string? value) -> void -GitVersion.IFileSystem -GitVersion.IFileSystem.Copy(string! from, string! to, bool overwrite) -> void -GitVersion.IFileSystem.CreateDirectory(string! path) -> void -GitVersion.IFileSystem.Delete(string! path) -> void -GitVersion.IFileSystem.DirectoryEnumerateFiles(string? directory, string! searchPattern, System.IO.SearchOption searchOption) -> System.Collections.Generic.IEnumerable! -GitVersion.IFileSystem.DirectoryExists(string! path) -> bool -GitVersion.IFileSystem.Exists(string! file) -> bool -GitVersion.IFileSystem.GetDirectories(string! path) -> string![]! -GitVersion.IFileSystem.GetFiles(string! path) -> string![]! -GitVersion.IFileSystem.GetLastDirectoryWrite(string! path) -> long -GitVersion.IFileSystem.GetLastWriteTime(string! path) -> long -GitVersion.IFileSystem.Move(string! from, string! to) -> void -GitVersion.IFileSystem.OpenRead(string! path) -> System.IO.Stream! -GitVersion.IFileSystem.OpenWrite(string! path) -> System.IO.Stream! -GitVersion.IFileSystem.ReadAllText(string! path) -> string! -GitVersion.IFileSystem.WriteAllText(string? file, string! fileContents, System.Text.Encoding! encoding) -> void -GitVersion.IFileSystem.WriteAllText(string? file, string! fileContents) -> void GitVersion.IGitPreparer GitVersion.IGitPreparer.EnsureLocalBranchExistsForCurrentBranch(GitVersion.Git.IRemote! remote, string! currentBranch) -> void GitVersion.IGitPreparer.Prepare() -> void @@ -778,8 +760,6 @@ static GitVersion.Git.ReferenceName.operator ==(GitVersion.Git.ReferenceName? le static GitVersion.Git.ReferenceName.Parse(string! canonicalName) -> GitVersion.Git.ReferenceName! 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(string? filename) -> System.Text.Encoding? -static GitVersion.Helpers.EncodingHelper.DetectEncoding(System.Collections.Generic.IList! bytes) -> System.Text.Encoding? static GitVersion.Helpers.ServiceMessageEscapeHelper.EscapeValue(string? value) -> string? 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 diff --git a/src/GitVersion.Core/PublicAPI.Unshipped.txt b/src/GitVersion.Core/PublicAPI.Unshipped.txt index 7dc5c58110..57bf801923 100644 --- a/src/GitVersion.Core/PublicAPI.Unshipped.txt +++ b/src/GitVersion.Core/PublicAPI.Unshipped.txt @@ -1 +1,3 @@ #nullable enable +GitVersion.Extensions.FileSystemExtensions +static GitVersion.Extensions.FileSystemExtensions.GetLastDirectoryWrite(this System.IO.Abstractions.IFileSystem! fileSystem, string! path) -> long diff --git a/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheKeyFactory.cs b/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheKeyFactory.cs index c91350e733..908f1a8124 100644 --- a/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheKeyFactory.cs +++ b/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheKeyFactory.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using System.Security.Cryptography; using GitVersion.Common; using GitVersion.Configuration; @@ -57,7 +58,7 @@ private List CalculateDirectoryContents(string root) // examined for files. var dirs = new Stack(); - if (!this.fileSystem.DirectoryExists(root)) + if (!this.fileSystem.Directory.Exists(root)) { throw new DirectoryNotFoundException($"Root directory does not exist: {root}"); } @@ -68,13 +69,13 @@ private List CalculateDirectoryContents(string root) { var currentDir = dirs.Pop(); - var di = new DirectoryInfo(currentDir); + var di = this.fileSystem.DirectoryInfo.New(currentDir); result.Add(di.Name); string[] subDirs; try { - subDirs = this.fileSystem.GetDirectories(currentDir); + subDirs = this.fileSystem.Directory.GetDirectories(currentDir); } // An UnauthorizedAccessException exception will be thrown if we do not have // discovery permission on a folder or file. It may or may not be acceptable @@ -99,7 +100,7 @@ private List CalculateDirectoryContents(string root) string[] files; try { - files = this.fileSystem.GetFiles(currentDir); + files = this.fileSystem.Directory.GetFiles(currentDir); } catch (UnauthorizedAccessException e) { @@ -116,9 +117,9 @@ private List CalculateDirectoryContents(string root) { try { - if (!this.fileSystem.Exists(file)) continue; + if (!this.fileSystem.File.Exists(file)) continue; result.Add(Path.GetFileName(file)); - result.Add(this.fileSystem.ReadAllText(file)); + result.Add(this.fileSystem.File.ReadAllText(file)); } catch (IOException e) { @@ -174,9 +175,9 @@ private string GetConfigFileHash() var configFilePath = this.configFileLocator.GetConfigurationFile(workingDirectory) ?? this.configFileLocator.GetConfigurationFile(projectRootDirectory); if (configFilePath == null) return string.Empty; - if (!this.fileSystem.Exists(configFilePath)) return string.Empty; + if (!this.fileSystem.File.Exists(configFilePath)) return string.Empty; - var configFileContent = this.fileSystem.ReadAllText(configFilePath); + var configFileContent = this.fileSystem.File.ReadAllText(configFilePath); return GetHash(configFileContent); } diff --git a/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheProvider.cs b/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheProvider.cs index 63a67e6afb..59363dc86f 100644 --- a/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheProvider.cs +++ b/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheProvider.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Extensions; using GitVersion.Git; using GitVersion.Helpers; @@ -46,7 +47,7 @@ public void WriteVariablesToDiskCache(GitVersionVariables versionVariables) var cacheFileName = GetCacheFileName(cacheKey); using (this.log.IndentLog($"Loading version variables from disk cache file {cacheFileName}")) { - if (!this.fileSystem.Exists(cacheFileName)) + if (!this.fileSystem.File.Exists(cacheFileName)) { this.log.Info($"Cache file {cacheFileName} not found."); return null; @@ -63,7 +64,7 @@ public void WriteVariablesToDiskCache(GitVersionVariables versionVariables) this.log.Info(ex.ToString()); try { - this.fileSystem.Delete(cacheFileName); + this.fileSystem.File.Delete(cacheFileName); } catch (Exception deleteEx) { @@ -92,7 +93,7 @@ private string PrepareCacheDirectory() var cacheDir = GetCacheDirectory(); // If the cacheDir already exists, CreateDirectory just won't do anything (it won't fail). @asbjornu - this.fileSystem.CreateDirectory(cacheDir); + this.fileSystem.Directory.CreateDirectory(cacheDir); return cacheDir; } diff --git a/src/GitVersion.LibGit2Sharp/Git/GitRepositoryInfo.cs b/src/GitVersion.LibGit2Sharp/Git/GitRepositoryInfo.cs index c429db97cf..9cbf267f9d 100644 --- a/src/GitVersion.LibGit2Sharp/Git/GitRepositoryInfo.cs +++ b/src/GitVersion.LibGit2Sharp/Git/GitRepositoryInfo.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Extensions; using GitVersion.Helpers; using LibGit2Sharp; @@ -7,17 +8,18 @@ namespace GitVersion.Git; internal class GitRepositoryInfo : IGitRepositoryInfo { - private readonly IOptions options; - private GitVersionOptions gitVersionOptions => this.options.Value; + private readonly IFileSystem fileSystem; + private readonly GitVersionOptions gitVersionOptions; private readonly Lazy dynamicGitRepositoryPath; private readonly Lazy dotGitDirectory; private readonly Lazy gitRootPath; private readonly Lazy projectRootDirectory; - public GitRepositoryInfo(IOptions options) + public GitRepositoryInfo(IFileSystem fileSystem, IOptions options) { - this.options = options.NotNull(); + this.fileSystem = fileSystem.NotNull(); + this.gitVersionOptions = options.NotNull().Value; this.dynamicGitRepositoryPath = new(GetDynamicGitRepositoryPath); this.dotGitDirectory = new(GetDotGitDirectory); @@ -43,7 +45,7 @@ public GitRepositoryInfo(IOptions options) var possiblePath = PathHelper.Combine(userTemp, repositoryName); // Verify that the existing directory is ok for us to use - if (Directory.Exists(possiblePath) && !GitRepoHasMatchingRemote(possiblePath, targetUrl)) + if (this.fileSystem.Directory.Exists(possiblePath) && !GitRepoHasMatchingRemote(possiblePath, targetUrl)) { var i = 1; var originalPath = possiblePath; @@ -51,7 +53,7 @@ public GitRepositoryInfo(IOptions options) do { possiblePath = $"{originalPath}_{i++}"; - possiblePathExists = Directory.Exists(possiblePath); + possiblePathExists = this.fileSystem.Directory.Exists(possiblePath); } while (possiblePathExists && !GitRepoHasMatchingRemote(possiblePath, targetUrl)); } @@ -69,9 +71,9 @@ public GitRepositoryInfo(IOptions options) if (gitDirectory.IsNullOrEmpty()) throw new DirectoryNotFoundException("Cannot find the .git directory"); - var directoryInfo = Directory.GetParent(gitDirectory) ?? throw new DirectoryNotFoundException("Cannot find the .git directory"); + var directoryInfo = this.fileSystem.Directory.GetParent(gitDirectory) ?? throw new DirectoryNotFoundException("Cannot find the .git directory"); return gitDirectory.Contains(PathHelper.Combine(".git", "worktrees")) - ? Directory.GetParent(directoryInfo.FullName)?.FullName + ? this.fileSystem.Directory.GetParent(directoryInfo.FullName)?.FullName : gitDirectory; } diff --git a/src/GitVersion.MsBuild.Tests/InvalidFileCheckerTests.cs b/src/GitVersion.MsBuild.Tests/InvalidFileCheckerTests.cs index 17d2aeae8a..2efca18ee2 100644 --- a/src/GitVersion.MsBuild.Tests/InvalidFileCheckerTests.cs +++ b/src/GitVersion.MsBuild.Tests/InvalidFileCheckerTests.cs @@ -1,6 +1,8 @@ +using System.IO.Abstractions; using GitVersion.Core.Tests.Helpers; using GitVersion.Helpers; using GitVersion.MsBuild.Tests.Mocks; +using Microsoft.Extensions.DependencyInjection; namespace GitVersion.MsBuild.Tests; @@ -9,25 +11,28 @@ public class InvalidFileCheckerTests : TestBase { private string projectDirectory; private string projectFile; + private IFileSystem fileSystem; [SetUp] public void CreateTemporaryProject() { + var sp = ConfigureServices(); + this.fileSystem = sp.GetRequiredService(); this.projectDirectory = PathHelper.Combine(PathHelper.GetTempPath(), Guid.NewGuid().ToString()); this.projectFile = PathHelper.Combine(this.projectDirectory, "Fake.csproj"); - Directory.CreateDirectory(this.projectDirectory); + this.fileSystem.Directory.CreateDirectory(this.projectDirectory); - File.Create(this.projectFile).Close(); + this.fileSystem.File.Create(this.projectFile).Close(); } [TearDown] - public void Cleanup() => Directory.Delete(this.projectDirectory, true); + public void Cleanup() => this.fileSystem.Directory.Delete(this.projectDirectory, true); [Test] public void VerifyIgnoreNonAssemblyInfoFile() { - using (var writer = File.CreateText(PathHelper.Combine(this.projectDirectory, "SomeOtherFile.cs"))) + using (var writer = this.fileSystem.File.CreateText(PathHelper.Combine(this.projectDirectory, "SomeOtherthis.fileSystem.File.cs"))) { writer.Write(""" @@ -39,13 +44,13 @@ public void VerifyIgnoreNonAssemblyInfoFile() """); } - AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "SomeOtherFile.cs" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, [new MockTaskItem { ItemSpec = "SomeOtherthis.fileSystem.File.cs" }], this.projectFile); } [Test] public void VerifyAttributeFoundCSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System.Reflection.AssemblyVersion")] string attribute) { - using (var writer = File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.cs"))) + using (var writer = this.fileSystem.File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.cs"))) { writer.Write(""" @@ -57,7 +62,7 @@ public void VerifyAttributeFoundCSharp([Values("AssemblyVersion", "AssemblyFileV """, attribute); } - var ex = Assert.Throws(() => AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile), attribute); + var ex = Assert.Throws(() => AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, [new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile), attribute); ex.ShouldNotBeNull(); Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.cs")); } @@ -65,7 +70,7 @@ public void VerifyAttributeFoundCSharp([Values("AssemblyVersion", "AssemblyFileV [Test] public void VerifyUnformattedAttributeFoundCSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System . Reflection . AssemblyVersion")] string attribute) { - using (var writer = File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.cs"))) + using (var writer = this.fileSystem.File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.cs"))) { writer.Write(""" @@ -78,7 +83,7 @@ public void VerifyUnformattedAttributeFoundCSharp([Values("AssemblyVersion", "As """, attribute); } - var ex = Assert.Throws(() => AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile), attribute); + var ex = Assert.Throws(() => AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, [new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile), attribute); ex.ShouldNotBeNull(); Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.cs")); } @@ -86,7 +91,7 @@ public void VerifyUnformattedAttributeFoundCSharp([Values("AssemblyVersion", "As [Test] public void VerifyCommentWorksCSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")] string attribute) { - using (var writer = File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.cs"))) + using (var writer = this.fileSystem.File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.cs"))) { writer.Write(""" @@ -98,13 +103,13 @@ public void VerifyCommentWorksCSharp([Values("AssemblyVersion", "AssemblyFileVer """, attribute); } - AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, [new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile); } [Test] public void VerifyCommentWithNoNewLineAtEndWorksCSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")] string attribute) { - using (var writer = File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.cs"))) + using (var writer = this.fileSystem.File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.cs"))) { writer.Write(""" @@ -115,13 +120,13 @@ public void VerifyCommentWithNoNewLineAtEndWorksCSharp([Values("AssemblyVersion" """, attribute); } - AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, [new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile); } [Test] public void VerifyStringWorksCSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")] string attribute) { - using (var writer = File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.cs"))) + using (var writer = this.fileSystem.File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.cs"))) { writer.Write(""" @@ -136,13 +141,13 @@ public class Temp """, attribute); } - AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, [new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile); } [Test] public void VerifyIdentifierWorksCSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")] string attribute) { - using (var writer = File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.cs"))) + using (var writer = this.fileSystem.File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.cs"))) { writer.Write(""" @@ -156,13 +161,13 @@ public class {0} """, attribute); } - AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, [new MockTaskItem { ItemSpec = "AssemblyInfo.cs" }], this.projectFile); } [Test] public void VerifyAttributeFoundVisualBasic([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System.Reflection.AssemblyVersion")] string attribute) { - using (var writer = File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.vb"))) + using (var writer = this.fileSystem.File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.vb"))) { writer.Write(""" @@ -174,7 +179,7 @@ Imports System.Reflection """, attribute); } - var ex = Assert.Throws(() => AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile), attribute); + var ex = Assert.Throws(() => AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, [new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile), attribute); ex.ShouldNotBeNull(); Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.vb")); } @@ -182,7 +187,7 @@ Imports System.Reflection [Test] public void VerifyUnformattedAttributeFoundVisualBasic([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System . Reflection . AssemblyVersion")] string attribute) { - using (var writer = File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.vb"))) + using (var writer = this.fileSystem.File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.vb"))) { writer.Write(""" @@ -195,7 +200,7 @@ Imports System.Reflection """, attribute); } - var ex = Assert.Throws(() => AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile), attribute); + var ex = Assert.Throws(() => AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, [new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile), attribute); ex.ShouldNotBeNull(); Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.vb")); } @@ -203,7 +208,7 @@ Imports System.Reflection [Test] public void VerifyCommentWorksVisualBasic([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")] string attribute) { - using (var writer = File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.vb"))) + using (var writer = this.fileSystem.File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.vb"))) { writer.Write(""" @@ -215,13 +220,13 @@ Imports System.Reflection """, attribute); } - AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, [new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile); } [Test] public void VerifyCommentWithNoNewLineAtEndWorksVisualBasic([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")] string attribute) { - using (var writer = File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.vb"))) + using (var writer = this.fileSystem.File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.vb"))) { writer.Write(""" @@ -232,13 +237,13 @@ Imports System.Reflection """, attribute); } - AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, [new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile); } [Test] public void VerifyStringWorksVisualBasic([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")] string attribute) { - using (var writer = File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.vb"))) + using (var writer = this.fileSystem.File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.vb"))) { writer.Write(""" @@ -252,13 +257,13 @@ End Class """, attribute); } - AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, [new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile); } [Test] public void VerifyIdentifierWorksVisualBasic([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")] string attribute) { - using (var writer = File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.vb"))) + using (var writer = this.fileSystem.File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.vb"))) { writer.Write(""" @@ -271,13 +276,13 @@ End Class """, attribute); } - AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, [new MockTaskItem { ItemSpec = "AssemblyInfo.vb" }], this.projectFile); } [Test] public void VerifyAttributeFoundFSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System.Reflection.AssemblyVersion")] string attribute) { - using (var writer = File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.fs"))) + using (var writer = this.fileSystem.File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.fs"))) { writer.Write(""" @@ -289,7 +294,7 @@ open System.Reflection """, attribute); } - var ex = Assert.Throws(() => AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile), attribute); + var ex = Assert.Throws(() => AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, [new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile), attribute); ex.ShouldNotBeNull(); Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.fs")); } @@ -297,7 +302,7 @@ open System.Reflection [Test] public void VerifyUnformattedAttributeFoundFSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System . Reflection . AssemblyVersion")] string attribute) { - using (var writer = File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.fs"))) + using (var writer = this.fileSystem.File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.fs"))) { writer.Write(""" @@ -310,7 +315,7 @@ open System.Reflection """, attribute); } - var ex = Assert.Throws(() => AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile), attribute); + var ex = Assert.Throws(() => AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, [new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile), attribute); ex.ShouldNotBeNull(); Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.fs")); } @@ -318,7 +323,7 @@ open System.Reflection [Test] public void VerifyCommentWorksFSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")] string attribute) { - using (var writer = File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.fs"))) + using (var writer = this.fileSystem.File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.fs"))) { writer.Write(""" @@ -330,13 +335,13 @@ open System.Reflection """, attribute); } - AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, [new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile); } [Test] public void VerifyCommentWithNoNewLineAtEndWorksFSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")] string attribute) { - using (var writer = File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.fs"))) + using (var writer = this.fileSystem.File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.fs"))) { writer.Write(""" @@ -347,13 +352,13 @@ open System.Reflection """, attribute); } - AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, [new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile); } [Test] public void VerifyStringWorksFSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")] string attribute) { - using (var writer = File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.fs"))) + using (var writer = this.fileSystem.File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.fs"))) { writer.Write(""" @@ -366,13 +371,13 @@ type Temp() = """, attribute); } - AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, [new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile); } [Test] public void VerifyIdentifierWorksFSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")] string attribute) { - using (var writer = File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.fs"))) + using (var writer = this.fileSystem.File.CreateText(PathHelper.Combine(this.projectDirectory, "AssemblyInfo.fs"))) { writer.Write(""" @@ -384,6 +389,6 @@ open System.Reflection """, attribute); } - AssemblyInfoFileHelper.CheckForInvalidFiles([new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, [new MockTaskItem { ItemSpec = "AssemblyInfo.fs" }], this.projectFile); } } diff --git a/src/GitVersion.MsBuild.Tests/Tasks/GenerateGitVersionInformationTest.cs b/src/GitVersion.MsBuild.Tests/Tasks/GenerateGitVersionInformationTest.cs index 6de414702a..ec0fb010bd 100644 --- a/src/GitVersion.MsBuild.Tests/Tasks/GenerateGitVersionInformationTest.cs +++ b/src/GitVersion.MsBuild.Tests/Tasks/GenerateGitVersionInformationTest.cs @@ -31,7 +31,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFile(string language) result.Task.GitVersionInformationFilePath.ShouldNotBeNull(); result.Task.GitVersionInformationFilePath.ShouldMatch($@"GitVersionInformation.*\.g\.{extension}"); - var fileContent = File.ReadAllText(result.Task.GitVersionInformationFilePath); + var fileContent = this.FileSystem.File.ReadAllText(result.Task.GitVersionInformationFilePath); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Major), "1")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Minor), "2")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Patch), "4")); @@ -52,7 +52,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileInBuildServer(strin result.Task.GitVersionInformationFilePath.ShouldNotBeNull(); result.Task.GitVersionInformationFilePath.ShouldMatch($@"GitVersionInformation.*\.g\.{extension}"); - var fileContent = File.ReadAllText(result.Task.GitVersionInformationFilePath); + var fileContent = this.FileSystem.File.ReadAllText(result.Task.GitVersionInformationFilePath); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Major), "1")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Minor), "0")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Patch), "1")); @@ -79,7 +79,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuild( var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), $"GitVersionInformation.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); - var fileContent = File.ReadAllText(generatedFilePath); + var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Major), "1")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Minor), "2")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Patch), "4")); @@ -106,7 +106,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildI var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), $"GitVersionInformation.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); - var fileContent = File.ReadAllText(generatedFilePath); + var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Major), "1")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Minor), "0")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Patch), "1")); @@ -127,7 +127,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenIntermediateOut result.Task.GitVersionInformationFilePath.ShouldNotBeNull(); result.Task.GitVersionInformationFilePath.ShouldMatch($@"GitVersionInformation.*\.g\.{extension}"); - var fileContent = File.ReadAllText(result.Task.GitVersionInformationFilePath); + var fileContent = this.FileSystem.File.ReadAllText(result.Task.GitVersionInformationFilePath); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Major), "1")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Minor), "2")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Patch), "4")); @@ -149,7 +149,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileInBuildServerWhenIn result.Task.GitVersionInformationFilePath.ShouldNotBeNull(); result.Task.GitVersionInformationFilePath.ShouldMatch($@"GitVersionInformation.*\.g\.{extension}"); - var fileContent = File.ReadAllText(result.Task.GitVersionInformationFilePath); + var fileContent = this.FileSystem.File.ReadAllText(result.Task.GitVersionInformationFilePath); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Major), "1")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Minor), "0")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Patch), "1")); @@ -181,7 +181,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildA var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), randDir, $"GitVersionInformation.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); - var fileContent = File.ReadAllText(generatedFilePath); + var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Major), "1")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Minor), "2")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Patch), "4")); @@ -212,7 +212,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildA var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), randDir, $"GitVersionInformation.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); - var fileContent = File.ReadAllText(generatedFilePath); + var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Major), "1")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Minor), "0")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Patch), "1")); @@ -243,7 +243,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildA var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), randDir, $"GitVersionInformation.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); - var fileContent = File.ReadAllText(generatedFilePath); + var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); TestContext.Out.WriteLine(fileContent); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Major), "1")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Minor), "2")); @@ -276,7 +276,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildA var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), randDir, $"GitVersionInformation.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); - var fileContent = File.ReadAllText(generatedFilePath); + var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Major), "1")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Minor), "0")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Patch), "1")); @@ -302,7 +302,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWithUseProjectNames result.Task.GitVersionInformationFilePath.ShouldNotBeNull(); result.Task.GitVersionInformationFilePath.ShouldMatch($@"GitVersionInformation.*\.g\.{extension}"); - var fileContent = File.ReadAllText(result.Task.GitVersionInformationFilePath); + var fileContent = this.FileSystem.File.ReadAllText(result.Task.GitVersionInformationFilePath); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Major), "1")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Minor), "2")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Patch), "4")); @@ -329,7 +329,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWithUseProjectNames result.Task.GitVersionInformationFilePath.ShouldNotBeNull(); result.Task.GitVersionInformationFilePath.ShouldMatch($@"GitVersionInformation.*\.g\.{extension}"); - var fileContent = File.ReadAllText(result.Task.GitVersionInformationFilePath); + var fileContent = this.FileSystem.File.ReadAllText(result.Task.GitVersionInformationFilePath); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Major), "1")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Minor), "2")); fileContent.ShouldMatch(string.Format(regexPattern, nameof(GitVersionVariables.Patch), "4")); diff --git a/src/GitVersion.MsBuild.Tests/Tasks/TestTaskBase.cs b/src/GitVersion.MsBuild.Tests/Tasks/TestTaskBase.cs index 8c0df2dea9..fc155e8bb3 100644 --- a/src/GitVersion.MsBuild.Tests/Tasks/TestTaskBase.cs +++ b/src/GitVersion.MsBuild.Tests/Tasks/TestTaskBase.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Agents; using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; @@ -5,11 +6,21 @@ using GitVersion.MsBuild.Tests.Helpers; using LibGit2Sharp; using Microsoft.Build.Utilities.ProjectCreation; +using Microsoft.Extensions.DependencyInjection; namespace GitVersion.MsBuild.Tests.Tasks; public class TestTaskBase : TestBase { + protected IFileSystem FileSystem; + + [SetUp] + public void SetUp() + { + var sp = ConfigureServices(); + this.FileSystem = sp.GetRequiredService(); + } + private static readonly IDictionary env = new Dictionary { { AzurePipelines.EnvironmentVariableName, "true" }, diff --git a/src/GitVersion.MsBuild.Tests/Tasks/UpdateAssemblyInfoTaskTest.cs b/src/GitVersion.MsBuild.Tests/Tasks/UpdateAssemblyInfoTaskTest.cs index b353bb6af2..17c7072665 100644 --- a/src/GitVersion.MsBuild.Tests/Tasks/UpdateAssemblyInfoTaskTest.cs +++ b/src/GitVersion.MsBuild.Tests/Tasks/UpdateAssemblyInfoTaskTest.cs @@ -29,7 +29,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFile(string language) result.Task.AssemblyInfoTempFilePath.ShouldNotBeNull(); result.Task.AssemblyInfoTempFilePath.ShouldMatch($@"AssemblyInfo.*\.g\.{extension}"); - var fileContent = File.ReadAllText(result.Task.AssemblyInfoTempFilePath); + var fileContent = this.FileSystem.File.ReadAllText(result.Task.AssemblyInfoTempFilePath); fileContent.ShouldContain(@"assembly: AssemblyVersion(""1.2.4.0"")"); } @@ -46,7 +46,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFileInBuildServer(string language) result.Task.AssemblyInfoTempFilePath.ShouldNotBeNull(); result.Task.AssemblyInfoTempFilePath.ShouldMatch($@"AssemblyInfo.*\.g\.{extension}"); - var fileContent = File.ReadAllText(result.Task.AssemblyInfoTempFilePath); + var fileContent = this.FileSystem.File.ReadAllText(result.Task.AssemblyInfoTempFilePath); fileContent.ShouldContain(@"assembly: AssemblyVersion(""1.0.1.0"")"); } @@ -69,7 +69,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFileWhenRunWithMsBuild(string lang var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), $"AssemblyInfo.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); - var fileContent = File.ReadAllText(generatedFilePath); + var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); fileContent.ShouldContain(@"assembly: AssemblyVersion(""1.2.4.0"")"); } @@ -92,7 +92,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFileWhenRunWithMsBuildInBuildServe var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), $"AssemblyInfo.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); - var fileContent = File.ReadAllText(generatedFilePath); + var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); fileContent.ShouldContain(@"assembly: AssemblyVersion(""1.0.1.0"")"); } @@ -109,7 +109,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFileWhenIntermediateOutputPathDoes result.Task.AssemblyInfoTempFilePath.ShouldNotBeNull(); result.Task.AssemblyInfoTempFilePath.ShouldMatch($@"AssemblyInfo.*\.g\.{extension}"); - var fileContent = File.ReadAllText(result.Task.AssemblyInfoTempFilePath); + var fileContent = this.FileSystem.File.ReadAllText(result.Task.AssemblyInfoTempFilePath); fileContent.ShouldContain(@"assembly: AssemblyVersion(""1.2.4.0"")"); DirectoryHelper.DeleteDirectory(task.IntermediateOutputPath); } @@ -127,7 +127,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFileWhenIntermediateOutputPathDoes result.Task.AssemblyInfoTempFilePath.ShouldNotBeNull(); result.Task.AssemblyInfoTempFilePath.ShouldMatch($@"AssemblyInfo.*\.g\.{extension}"); - var fileContent = File.ReadAllText(result.Task.AssemblyInfoTempFilePath); + var fileContent = this.FileSystem.File.ReadAllText(result.Task.AssemblyInfoTempFilePath); fileContent.ShouldContain(@"assembly: AssemblyVersion(""1.0.1.0"")"); DirectoryHelper.DeleteDirectory(task.IntermediateOutputPath); } @@ -155,7 +155,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFileWhenRunWithMsBuildAndIntermedi var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), randDir, $"AssemblyInfo.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); - var fileContent = File.ReadAllText(generatedFilePath); + var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); fileContent.ShouldContain(@"assembly: AssemblyVersion(""1.2.4.0"")"); } @@ -182,7 +182,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFileWhenRunWithMsBuildAndIntermedi var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), randDir, $"AssemblyInfo.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); - var fileContent = File.ReadAllText(generatedFilePath); + var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); fileContent.ShouldContain(@"assembly: AssemblyVersion(""1.0.1.0"")"); } diff --git a/src/GitVersion.MsBuild.Tests/Tasks/WriteVersionInfoTest.cs b/src/GitVersion.MsBuild.Tests/Tasks/WriteVersionInfoTest.cs index a941917b96..d45eff7758 100644 --- a/src/GitVersion.MsBuild.Tests/Tasks/WriteVersionInfoTest.cs +++ b/src/GitVersion.MsBuild.Tests/Tasks/WriteVersionInfoTest.cs @@ -74,21 +74,17 @@ public void WriteVersionInfoTaskShouldLogOutputVariablesToBuildOutputInGitHubAct envFilePath = $"{PathHelper.GetTempPath()}/github-env.txt"; SysEnv.SetEnvironmentVariable("GITHUB_ENV", envFilePath); - if (File.Exists(envFilePath)) - { - File.Delete(envFilePath); - } - var task = new WriteVersionInfoToBuildLog(); using var result = ExecuteMsBuildTaskInGitHubActions(task); result.Success.ShouldBe(true); result.Errors.ShouldBe(0); - string content = File.ReadAllText(envFilePath); + + string content = this.FileSystem.File.ReadAllText(envFilePath); content.ShouldContain("GitVersion_SemVer=1.0.1"); - File.Delete(envFilePath); + this.FileSystem.File.Delete(envFilePath); } [Test] diff --git a/src/GitVersion.MsBuild/GitVersionTaskExecutor.cs b/src/GitVersion.MsBuild/GitVersionTaskExecutor.cs index 2052267982..3686d25e56 100644 --- a/src/GitVersion.MsBuild/GitVersionTaskExecutor.cs +++ b/src/GitVersion.MsBuild/GitVersionTaskExecutor.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Configuration; using GitVersion.Extensions; using GitVersion.Helpers; @@ -34,20 +35,20 @@ public void GetVersion(GetVersion task) public void UpdateAssemblyInfo(UpdateAssemblyInfo task) { var versionVariables = GitVersionVariables(task); - AssemblyInfoFileHelper.CheckForInvalidFiles(task.CompileFiles, task.ProjectFile); + AssemblyInfoFileHelper.CheckForInvalidFiles(this.fileSystem, task.CompileFiles, task.ProjectFile); if (!string.IsNullOrEmpty(task.IntermediateOutputPath)) { // Ensure provided output path exists first. Fixes issue #2815. - fileSystem.CreateDirectory(task.IntermediateOutputPath); + fileSystem.Directory.CreateDirectory(task.IntermediateOutputPath); } var fileWriteInfo = task.IntermediateOutputPath.GetFileWriteInfo(task.Language, task.ProjectFile, "AssemblyInfo"); task.AssemblyInfoTempFilePath = PathHelper.Combine(fileWriteInfo.WorkingDirectory, fileWriteInfo.FileName); - if (!this.fileSystem.DirectoryExists(fileWriteInfo.WorkingDirectory)) + if (!this.fileSystem.Directory.Exists(fileWriteInfo.WorkingDirectory)) { - this.fileSystem.CreateDirectory(fileWriteInfo.WorkingDirectory); + this.fileSystem.Directory.CreateDirectory(fileWriteInfo.WorkingDirectory); } var gitVersionOptions = this.options.Value; gitVersionOptions.WorkingDirectory = fileWriteInfo.WorkingDirectory; @@ -65,15 +66,15 @@ public void GenerateGitVersionInformation(GenerateGitVersionInformation task) if (!string.IsNullOrEmpty(task.IntermediateOutputPath)) { // Ensure provided output path exists first. Fixes issue #2815. - fileSystem.CreateDirectory(task.IntermediateOutputPath); + fileSystem.Directory.CreateDirectory(task.IntermediateOutputPath); } var fileWriteInfo = task.IntermediateOutputPath.GetFileWriteInfo(task.Language, task.ProjectFile, "GitVersionInformation"); task.GitVersionInformationFilePath = PathHelper.Combine(fileWriteInfo.WorkingDirectory, fileWriteInfo.FileName); - if (!this.fileSystem.DirectoryExists(fileWriteInfo.WorkingDirectory)) + if (!this.fileSystem.Directory.Exists(fileWriteInfo.WorkingDirectory)) { - this.fileSystem.CreateDirectory(fileWriteInfo.WorkingDirectory); + this.fileSystem.Directory.CreateDirectory(fileWriteInfo.WorkingDirectory); } var gitVersionOptions = this.options.Value; gitVersionOptions.WorkingDirectory = fileWriteInfo.WorkingDirectory; @@ -110,18 +111,20 @@ public void WriteVersionInfoToBuildLog(WriteVersionInfoToBuildLog task) private void DeleteTempFiles() { var tempPath = AssemblyInfoFileHelper.TempPath; - if (!this.fileSystem.DirectoryExists(tempPath)) + if (!this.fileSystem.Directory.Exists(tempPath)) { return; } - foreach (var file in this.fileSystem.GetFiles(tempPath)) + foreach (var file in this.fileSystem.Directory.GetFiles(tempPath)) { - if (this.fileSystem.GetLastWriteTime(file) >= DateTime.Now.AddDays(-1).Ticks) + if (this.fileSystem.GetLastDirectoryWrite(file) >= DateTime.Now.AddDays(-1).Ticks) + { continue; + } try { - this.fileSystem.Delete(file); + this.fileSystem.File.Delete(file); } catch (UnauthorizedAccessException) { diff --git a/src/GitVersion.MsBuild/Helpers/AssemblyInfoFileHelper.cs b/src/GitVersion.MsBuild/Helpers/AssemblyInfoFileHelper.cs index b9491aa569..2bbbb2fb37 100644 --- a/src/GitVersion.MsBuild/Helpers/AssemblyInfoFileHelper.cs +++ b/src/GitVersion.MsBuild/Helpers/AssemblyInfoFileHelper.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using System.Text.RegularExpressions; using GitVersion.Helpers; using Microsoft.Build.Framework; @@ -28,16 +29,16 @@ internal static class AssemblyInfoFileHelper _ => throw new ArgumentException($"Unknown language detected: '{language}'") }; - public static void CheckForInvalidFiles(IEnumerable compileFiles, string projectFile) + public static void CheckForInvalidFiles(IFileSystem fileSystem, IEnumerable compileFiles, string projectFile) { - var invalidCompileFile = GetInvalidFiles(compileFiles, projectFile).FirstOrDefault(); + var invalidCompileFile = GetInvalidFiles(fileSystem, compileFiles, projectFile).FirstOrDefault(); if (invalidCompileFile != null) { throw new WarningException("File contains assembly version attributes which conflict with the attributes generated by GitVersion " + invalidCompileFile); } } - private static bool FileContainsVersionAttribute(string compileFile, string projectFile) + private static bool FileContainsVersionAttribute(IFileSystem fileSystem, string compileFile, string projectFile) { var compileFileExtension = Path.GetExtension(compileFile); @@ -49,23 +50,23 @@ private static bool FileContainsVersionAttribute(string compileFile, string proj _ => throw new WarningException("File with name containing AssemblyInfo could not be checked for assembly version attributes which conflict with the attributes generated by GitVersion " + compileFile) }; - return FileContainsVersionAttribute(compileFile, projectFile, attributeRegex, triviaRegex); + return FileContainsVersionAttribute(fileSystem, compileFile, projectFile, attributeRegex, triviaRegex); } - private static bool FileContainsVersionAttribute(string compileFile, string projectFile, Regex attributeRegex, Regex triviaRegex) + private static bool FileContainsVersionAttribute(IFileSystem fileSystem, string compileFile, string projectFile, Regex attributeRegex, Regex triviaRegex) { var combine = PathHelper.Combine(Path.GetDirectoryName(projectFile), compileFile); - var allText = File.ReadAllText(combine); + var allText = fileSystem.File.ReadAllText(combine); allText += PathHelper.NewLine; // Always add a new line, this handles the case for when a file ends with the EOF marker and no new line. var noCommentsOrStrings = triviaRegex.Replace(allText, me => me.Value.StartsWith("//") || me.Value.StartsWith("'") ? PathHelper.NewLine : string.Empty); return attributeRegex.IsMatch(noCommentsOrStrings); } - private static IEnumerable GetInvalidFiles(IEnumerable compileFiles, string projectFile) + private static IEnumerable GetInvalidFiles(IFileSystem fileSystem, IEnumerable compileFiles, string projectFile) => compileFiles.Select(x => x.ItemSpec) .Where(compileFile => compileFile.Contains("AssemblyInfo")) - .Where(s => FileContainsVersionAttribute(s, projectFile)); + .Where(filePath => FileContainsVersionAttribute(fileSystem, filePath, projectFile)); public static FileWriteInfo GetFileWriteInfo(this string? intermediateOutputPath, string language, string projectFile, string outputFileName) { diff --git a/src/GitVersion.Output.Tests/Output/AssemblyInfoFileUpdaterTests.cs b/src/GitVersion.Output.Tests/Output/AssemblyInfoFileUpdaterTests.cs index 557d7d1abd..bf5ea3e1d5 100644 --- a/src/GitVersion.Output.Tests/Output/AssemblyInfoFileUpdaterTests.cs +++ b/src/GitVersion.Output.Tests/Output/AssemblyInfoFileUpdaterTests.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Helpers; @@ -50,7 +51,7 @@ public void ShouldCreateAssemblyInfoFileWhenNotExistsAndEnsureAssemblyInfo(strin using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, this.fileSystem); assemblyInfoFileUpdater.Execute(variables, new(workingDir, true, assemblyInfoFile)); - this.fileSystem.ReadAllText(fullPath).ShouldMatchApproved(c => c.SubFolder(PathHelper.Combine("Approved", fileExtension))); + this.fileSystem.File.ReadAllText(fullPath).ShouldMatchApproved(c => c.SubFolder(PathHelper.Combine("Approved", fileExtension))); } [TestCase("cs")] @@ -67,7 +68,7 @@ public void ShouldCreateAssemblyInfoFileAtPathWhenNotExistsAndEnsureAssemblyInfo using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, this.fileSystem); assemblyInfoFileUpdater.Execute(variables, new(workingDir, true, assemblyInfoFile)); - this.fileSystem.ReadAllText(fullPath).ShouldMatchApproved(c => c.SubFolder(PathHelper.Combine("Approved", fileExtension))); + this.fileSystem.File.ReadAllText(fullPath).ShouldMatchApproved(c => c.SubFolder(PathHelper.Combine("Approved", fileExtension))); } [TestCase("cs")] @@ -84,7 +85,7 @@ public void ShouldCreateAssemblyInfoFilesAtPathWhenNotExistsAndEnsureAssemblyInf foreach (var item in assemblyInfoFiles) { var fullPath = PathHelper.Combine(workingDir, item); - this.fileSystem.ReadAllText(fullPath).ShouldMatchApproved(c => c.SubFolder(PathHelper.Combine("Approved", fileExtension))); + this.fileSystem.File.ReadAllText(fullPath).ShouldMatchApproved(c => c.SubFolder(PathHelper.Combine("Approved", fileExtension))); } } @@ -102,7 +103,7 @@ public void ShouldNotCreateAssemblyInfoFileWhenNotExistsAndNotEnsureAssemblyInfo using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, this.fileSystem); assemblyInfoFileUpdater.Execute(variables, new(workingDir, false, assemblyInfoFile)); - this.fileSystem.Exists(fullPath).ShouldBeFalse(); + this.fileSystem.File.Exists(fullPath).ShouldBeFalse(); } [Test] @@ -119,7 +120,7 @@ public void ShouldNotCreateAssemblyInfoFileForUnknownSourceCodeAndEnsureAssembly using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, this.fileSystem); assemblyInfoFileUpdater.Execute(variables, new(workingDir, true, assemblyInfoFile)); - this.fileSystem.Received(0).WriteAllText(fullPath, Arg.Any()); + this.fileSystem.Received(1).File.WriteAllText(fullPath, Arg.Any()); } [Test] @@ -135,7 +136,7 @@ public void ShouldStartSearchFromWorkingDirectory() using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, this.fileSystem); assemblyInfoFileUpdater.Execute(variables, new(workingDir, false, [.. assemblyInfoFiles])); - this.fileSystem.Received().DirectoryEnumerateFiles(Arg.Is(workingDir), Arg.Any(), Arg.Any()); + this.fileSystem.Received(1).Directory.EnumerateFiles(Arg.Is(workingDir), Arg.Any(), Arg.Any()); } [TestCase("cs", "[assembly: AssemblyVersion(\"1.0.0.0\")]\r\n[assembly: AssemblyInformationalVersion(\"1.0.0.0\")]\r\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]")] @@ -151,7 +152,7 @@ public void ShouldReplaceAssemblyVersion(string fileExtension, string assemblyFi using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, fs); assemblyInfoFileUpdater.Execute(variables, new(workingDir, false, assemblyInfoFile)); - fs.Received().WriteAllText(fileName, Arg.Is(s => + fs.Received().File.WriteAllText(fileName, Arg.Is(s => s.Contains(@"AssemblyVersion(""2.3.0.0"")") && s.Contains(@"AssemblyInformationalVersion(""2.3.1+3.Branch.foo.Sha.hash"")") && s.Contains(@"AssemblyFileVersion(""2.3.1.0"")"))); @@ -171,7 +172,7 @@ public void ShouldNotReplaceAssemblyVersionWhenVersionSchemeIsNone(string fileEx using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, fs); assemblyInfoFileUpdater.Execute(variables, new(workingDir, false, assemblyInfoFile)); - assemblyFileContent = fs.ReadAllText(fileName); + assemblyFileContent = fs.File.ReadAllText(fileName); assemblyFileContent.ShouldMatchApproved(c => c.SubFolder(PathHelper.Combine("Approved", fileExtension))); }); } @@ -189,7 +190,7 @@ public void ShouldReplaceAssemblyVersionInRelativePath(string fileExtension, str using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, fs); assemblyInfoFileUpdater.Execute(variables, new(workingDir, false, assemblyInfoFile)); - fs.Received().WriteAllText(fileName, Arg.Is(s => + fs.Received().File.WriteAllText(fileName, Arg.Is(s => s.Contains(@"AssemblyVersion(""2.3.0.0"")") && s.Contains(@"AssemblyInformationalVersion(""2.3.1+3.Branch.foo.Sha.hash"")") && s.Contains(@"AssemblyFileVersion(""2.3.1.0"")"))); @@ -209,7 +210,7 @@ public void ShouldReplaceAssemblyVersionInRelativePathWithWhiteSpace(string file using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, fs); assemblyInfoFileUpdater.Execute(variables, new(workingDir, false, assemblyInfoFile)); - fs.Received().WriteAllText(fileName, Arg.Is(s => + fs.Received().File.WriteAllText(fileName, Arg.Is(s => s.Contains(@"AssemblyVersion(""2.3.0.0"")") && s.Contains(@"AssemblyInformationalVersion(""2.3.1+3.Branch.foo.Sha.hash"")") && s.Contains(@"AssemblyFileVersion(""2.3.1.0"")"))); @@ -229,7 +230,7 @@ public void ShouldReplaceAssemblyVersionWithStar(string fileExtension, string as using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, fs); assemblyInfoFileUpdater.Execute(variables, new(workingDir, false, assemblyInfoFile)); - fs.Received().WriteAllText(fileName, Arg.Is(s => + fs.Received().File.WriteAllText(fileName, Arg.Is(s => s.Contains(@"AssemblyVersion(""2.3.0.0"")") && s.Contains(@"AssemblyInformationalVersion(""2.3.1+3.Branch.foo.Sha.hash"")") && s.Contains(@"AssemblyFileVersion(""2.3.1.0"")"))); @@ -249,7 +250,7 @@ public void ShouldReplaceAssemblyVersionWithAttributeSuffix(string fileExtension using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, fs); assemblyInfoFileUpdater.Execute(variables, new(workingDir, false, assemblyInfoFile)); - fs.Received().WriteAllText(fileName, Arg.Is(s => + fs.Received().File.WriteAllText(fileName, Arg.Is(s => !s.Contains(@"AssemblyVersionAttribute(""1.0.0.0"")") && !s.Contains(@"AssemblyInformationalVersionAttribute(""1.0.0.0"")") && !s.Contains(@"AssemblyFileVersionAttribute(""1.0.0.0"")") && @@ -272,7 +273,7 @@ public void ShouldAddAssemblyVersionIfMissingFromInfoFile(string fileExtension) using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, fs); assemblyInfoFileUpdater.Execute(variables, new(workingDir, false, assemblyInfoFile)); - fs.Received().WriteAllText(fileName, Arg.Is(s => + fs.Received().File.WriteAllText(fileName, Arg.Is(s => s.Contains(@"AssemblyVersion(""2.3.0.0"")") && s.Contains(@"AssemblyInformationalVersion(""2.3.1+3.Branch.foo.Sha.hash"")") && s.Contains(@"AssemblyFileVersion(""2.3.1.0"")"))); @@ -292,7 +293,7 @@ public void ShouldReplaceAlreadySubstitutedValues(string fileExtension, string a using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, fs); assemblyInfoFileUpdater.Execute(variables, new(workingDir, false, assemblyInfoFile)); - fs.Received().WriteAllText(fileName, Arg.Is(s => + fs.Received().File.WriteAllText(fileName, Arg.Is(s => s.Contains(@"AssemblyVersion(""2.3.0.0"")") && s.Contains(@"AssemblyInformationalVersion(""2.3.1+3.Branch.foo.Sha.hash"")") && s.Contains(@"AssemblyFileVersion(""2.3.1.0"")"))); @@ -312,7 +313,7 @@ public void ShouldReplaceAssemblyVersionWhenCreatingAssemblyVersionFileAndEnsure using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, fs); assemblyInfoFileUpdater.Execute(variables, new(workingDir, false, assemblyInfoFile)); - fs.Received().WriteAllText(fileName, Arg.Is(s => + fs.Received().File.WriteAllText(fileName, Arg.Is(s => s.Contains(@"AssemblyVersion(""2.3.1.0"")") && s.Contains(@"AssemblyInformationalVersion(""2.3.1+3.Branch.foo.Sha.hash"")") && s.Contains(@"AssemblyFileVersion(""2.3.1.0"")"))); @@ -332,7 +333,7 @@ public void ShouldReplaceAssemblyVersionInRelativePathWithVariables(string fileE using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, fs); assemblyInfoFileUpdater.Execute(variables, new(workingDir, false, assemblyInfoFile)); - fs.Received().WriteAllText(fileName, Arg.Is(s => + fs.Received().File.WriteAllText(fileName, Arg.Is(s => s.Contains(@"AssemblyVersion(""2.3.0.0"")") && s.Contains(@"AssemblyInformationalVersion(""2.3.1+3.Branch.foo.Sha.hash"")") && s.Contains(@"AssemblyFileVersion(""2.3.1.0"")"))); @@ -352,7 +353,7 @@ public void ShouldReplaceAssemblyVersionInRelativePathWithVariablesAndWhiteSpace using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, fs); assemblyInfoFileUpdater.Execute(variables, new(workingDir, false, assemblyInfoFile)); - fs.Received().WriteAllText(fileName, Arg.Is(s => + fs.Received().File.WriteAllText(fileName, Arg.Is(s => s.Contains(@"AssemblyVersion(""2.3.0.0"")") && s.Contains(@"AssemblyInformationalVersion(""2.3.1+3.Branch.foo.Sha.hash"")") && s.Contains(@"AssemblyFileVersion(""2.3.1.0"")"))); @@ -372,7 +373,7 @@ public void ShouldAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFile using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, fs); assemblyInfoFileUpdater.Execute(variables, new(workingDir, false, assemblyInfoFile)); - assemblyFileContent = fs.ReadAllText(fileName); + assemblyFileContent = fs.File.ReadAllText(fileName); assemblyFileContent.ShouldMatchApproved(c => c.SubFolder(PathHelper.Combine("Approved", fileExtension))); }); } @@ -390,7 +391,7 @@ public void Issue1183ShouldAddFSharpAssemblyInformationalVersionBesideOtherAttri using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, fs); assemblyInfoFileUpdater.Execute(variables, new(workingDir, false, assemblyInfoFile)); - assemblyFileContent = fs.ReadAllText(fileName); + assemblyFileContent = fs.File.ReadAllText(fileName); assemblyFileContent.ShouldMatchApproved(c => c.SubFolder(PathHelper.Combine("Approved", fileExtension))); }); } @@ -408,7 +409,7 @@ public void ShouldNotAddAssemblyInformationalVersionWhenVersionSchemeIsNone(stri using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, fs); assemblyInfoFileUpdater.Execute(variables, new(workingDir, false, assemblyInfoFile)); - assemblyFileContent = fs.ReadAllText(fileName); + assemblyFileContent = fs.File.ReadAllText(fileName); assemblyFileContent.ShouldMatchApproved(c => c.SubFolder(PathHelper.Combine("Approved", fileExtension))); }); } @@ -419,20 +420,23 @@ private void VerifyAssemblyInfoFile( AssemblyVersioningScheme versioningScheme = AssemblyVersioningScheme.MajorMinorPatch, Action? verify = null) { - this.fileSystem = Substitute.For(); + var file = Substitute.For(); var version = new SemanticVersion { BuildMetaData = new("versionSourceHash", 3, "foo", "hash", "shortHash", DateTimeOffset.Now, 0), Major = 2, Minor = 3, Patch = 1 }; - this.fileSystem.Exists(fileName).Returns(true); - this.fileSystem.ReadAllText(fileName).Returns(assemblyFileContent); - this.fileSystem.When(f => f.WriteAllText(fileName, Arg.Any())).Do(c => + file.Exists(fileName).Returns(true); + file.ReadAllText(fileName).Returns(assemblyFileContent); + file.When(f => f.WriteAllText(fileName, Arg.Any())).Do(c => { assemblyFileContent = c.ArgAt(1); - this.fileSystem.ReadAllText(fileName).Returns(assemblyFileContent); + file.ReadAllText(fileName).Returns(assemblyFileContent); }); var configuration = EmptyConfigurationBuilder.New.WithAssemblyVersioningScheme(versioningScheme).Build(); var variables = this.variableProvider.GetVariablesFor(version, configuration, 0); + this.fileSystem = Substitute.For(); + this.fileSystem.File.Returns(file); + this.fileSystem.FileInfo.Returns(new FileSystem().FileInfo); verify?.Invoke(this.fileSystem, variables); } } diff --git a/src/GitVersion.Output.Tests/Output/GitVersionInfoGeneratorTests.cs b/src/GitVersion.Output.Tests/Output/GitVersionInfoGeneratorTests.cs index 284f3d6b65..0d7fc9f14c 100644 --- a/src/GitVersion.Output.Tests/Output/GitVersionInfoGeneratorTests.cs +++ b/src/GitVersion.Output.Tests/Output/GitVersionInfoGeneratorTests.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Helpers; @@ -34,8 +35,8 @@ public void ShouldCreateFile(string fileExtension) var fileSystem = sp.GetRequiredService(); var directory = PathHelper.Combine(PathHelper.GetTempPath(), "GitVersionInfoGeneratorTests", Guid.NewGuid().ToString()); - if (!fileSystem.DirectoryExists(directory)) - fileSystem.CreateDirectory(directory); + if (!fileSystem.Directory.Exists(directory)) + fileSystem.Directory.CreateDirectory(directory); var fileName = "GitVersionInformation.g." + fileExtension; var fullPath = PathHelper.Combine(directory, fileName); @@ -45,7 +46,7 @@ public void ShouldCreateFile(string fileExtension) generator.Execute(variables, new(directory, fileName, fileExtension)); - fileSystem.ReadAllText(fullPath).ShouldMatchApproved(c => c.SubFolder(PathHelper.Combine("Approved", fileExtension))); + fileSystem.File.ReadAllText(fullPath).ShouldMatchApproved(c => c.SubFolder(PathHelper.Combine("Approved", fileExtension))); DirectoryHelper.DeleteDirectory(directory); } @@ -75,8 +76,8 @@ public void ShouldProperlyOutputNamespaceDeclaration(string fileExtension) var fileSystem = sp.GetRequiredService(); var directory = PathHelper.Combine(PathHelper.GetTempPath(), "GitVersionInfoGeneratorTests", Guid.NewGuid().ToString()); - if (!fileSystem.DirectoryExists(directory)) - fileSystem.CreateDirectory(directory); + if (!fileSystem.Directory.Exists(directory)) + fileSystem.Directory.CreateDirectory(directory); var fileName = "GitVersionInformation.g." + fileExtension; var fullPath = PathHelper.Combine(directory, fileName); @@ -86,7 +87,7 @@ public void ShouldProperlyOutputNamespaceDeclaration(string fileExtension) generator.Execute(variables, new(directory, fileName, fileExtension, targetNamespace)); - fileSystem.ReadAllText(fullPath).ShouldMatchApproved(c => c.SubFolder(PathHelper.Combine("Approved", fileExtension))); + fileSystem.File.ReadAllText(fullPath).ShouldMatchApproved(c => c.SubFolder(PathHelper.Combine("Approved", fileExtension))); DirectoryHelper.DeleteDirectory(directory); } diff --git a/src/GitVersion.Output.Tests/Output/ProjectFileUpdaterTests.cs b/src/GitVersion.Output.Tests/Output/ProjectFileUpdaterTests.cs index 4665479e8f..bca5e0cade 100644 --- a/src/GitVersion.Output.Tests/Output/ProjectFileUpdaterTests.cs +++ b/src/GitVersion.Output.Tests/Output/ProjectFileUpdaterTests.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using System.Xml.Linq; using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; @@ -293,7 +294,7 @@ public void UpdateProjectFileAddsVersionToFile(string xml) """; - var transformedXml = fs.ReadAllText(fileName); + var transformedXml = fs.File.ReadAllText(fileName); transformedXml.ShouldBe(XElement.Parse(expectedXml).ToString()); }); } @@ -304,20 +305,23 @@ private void VerifyAssemblyInfoFile( AssemblyVersioningScheme versioningScheme = AssemblyVersioningScheme.MajorMinorPatch, Action? verify = null) { - this.fileSystem = Substitute.For(); + var file = Substitute.For(); var version = new SemanticVersion { BuildMetaData = new("versionSourceHash", 3, "foo", "hash", "shortHash", DateTimeOffset.Now, 0), Major = 2, Minor = 3, Patch = 1 }; - this.fileSystem.Exists(fileName).Returns(true); - this.fileSystem.ReadAllText(fileName).Returns(projectFileContent); - this.fileSystem.When(f => f.WriteAllText(fileName, Arg.Any())).Do(c => + file.Exists(fileName).Returns(true); + file.ReadAllText(fileName).Returns(projectFileContent); + file.When(f => f.WriteAllText(fileName, Arg.Any())).Do(c => { projectFileContent = c.ArgAt(1); - this.fileSystem.ReadAllText(fileName).Returns(projectFileContent); + file.ReadAllText(fileName).Returns(projectFileContent); }); var configuration = EmptyConfigurationBuilder.New.WithAssemblyVersioningScheme(versioningScheme).Build(); var variables = this.variableProvider.GetVariablesFor(version, configuration, 0); + this.fileSystem = Substitute.For(); + this.fileSystem.File.Returns(file); + this.fileSystem.FileInfo.Returns(new FileSystem().FileInfo); verify?.Invoke(this.fileSystem, variables); } } diff --git a/src/GitVersion.Output.Tests/Output/WixFileTests.cs b/src/GitVersion.Output.Tests/Output/WixFileTests.cs index ebd91284f2..cda4d0c1a4 100644 --- a/src/GitVersion.Output.Tests/Output/WixFileTests.cs +++ b/src/GitVersion.Output.Tests/Output/WixFileTests.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Configuration; using GitVersion.Core.Tests.Helpers; using GitVersion.Helpers; @@ -58,7 +59,7 @@ public void UpdateWixVersionFile() var file = PathHelper.Combine(workingDir, WixVersionFileUpdater.WixVersionFileName); fileSystem - .ReadAllText(file) + .File.ReadAllText(file) .ShouldMatchApproved(c => c.SubFolder(PathHelper.Combine("Approved"))); } @@ -95,16 +96,16 @@ public void UpdateWixVersionFileWhenFileAlreadyExists() // fake an already existing file var file = PathHelper.Combine(workingDir, WixVersionFileUpdater.WixVersionFileName); - if (!fileSystem.DirectoryExists(workingDir)) + if (!fileSystem.Directory.Exists(workingDir)) { - fileSystem.CreateDirectory(workingDir); + fileSystem.Directory.CreateDirectory(workingDir); } - fileSystem.WriteAllText(file, new('x', 1024 * 1024)); + fileSystem.File.WriteAllText(file, new('x', 1024 * 1024)); wixVersionFileUpdater.Execute(versionVariables, new(workingDir)); fileSystem - .ReadAllText(file) + .File.ReadAllText(file) .ShouldMatchApproved(c => c.SubFolder(PathHelper.Combine("Approved"))); } } diff --git a/src/GitVersion.Output/AssemblyInfo/AssemblyInfoFileUpdater.cs b/src/GitVersion.Output/AssemblyInfo/AssemblyInfoFileUpdater.cs index e445500585..7510d8d8bd 100644 --- a/src/GitVersion.Output/AssemblyInfo/AssemblyInfoFileUpdater.cs +++ b/src/GitVersion.Output/AssemblyInfo/AssemblyInfoFileUpdater.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using System.Text.RegularExpressions; using GitVersion.Core; using GitVersion.Extensions; @@ -44,21 +45,21 @@ public void Execute(GitVersionVariables variables, AssemblyInfoContext context) { var localAssemblyInfo = assemblyInfoFile.FullName; var backupAssemblyInfo = localAssemblyInfo + ".bak"; - fileSystem.Copy(localAssemblyInfo, backupAssemblyInfo, true); + fileSystem.File.Copy(localAssemblyInfo, backupAssemblyInfo, true); this.restoreBackupTasks.Add(() => { - if (fileSystem.Exists(localAssemblyInfo)) + if (fileSystem.File.Exists(localAssemblyInfo)) { - fileSystem.Delete(localAssemblyInfo); + fileSystem.File.Delete(localAssemblyInfo); } - fileSystem.Move(backupAssemblyInfo, localAssemblyInfo); + fileSystem.File.Move(backupAssemblyInfo, localAssemblyInfo); }); - this.cleanupBackupTasks.Add(() => fileSystem.Delete(backupAssemblyInfo)); + this.cleanupBackupTasks.Add(() => fileSystem.File.Delete(backupAssemblyInfo)); - var originalFileContents = fileSystem.ReadAllText(localAssemblyInfo); + var originalFileContents = fileSystem.File.ReadAllText(localAssemblyInfo); var fileContents = originalFileContents; var appendedAttributes = false; @@ -85,7 +86,7 @@ public void Execute(GitVersionVariables variables, AssemblyInfoContext context) if (originalFileContents != fileContents) { - fileSystem.WriteAllText(localAssemblyInfo, fileContents); + fileSystem.File.WriteAllText(localAssemblyInfo, fileContents); } } CommitChanges(); @@ -143,7 +144,7 @@ private string ReplaceOrInsertAfterLastAssemblyAttributeOrAppend(Regex replaceRe return inputString; } - private IEnumerable GetAssemblyInfoFiles(AssemblyInfoContext context) + private IEnumerable GetAssemblyInfoFiles(AssemblyInfoContext context) { var workingDirectory = context.WorkingDirectory; var ensureAssemblyInfo = context.EnsureAssemblyInfo; @@ -157,15 +158,15 @@ private IEnumerable GetAssemblyInfoFiles(AssemblyInfoContext context) if (EnsureVersionAssemblyInfoFile(fullPath, ensureAssemblyInfo)) { - yield return new FileInfo(fullPath); + yield return fileSystem.FileInfo.New(fullPath); } } } else { - foreach (var item in fileSystem.DirectoryEnumerateFiles(workingDirectory, "AssemblyInfo.*", SearchOption.AllDirectories)) + foreach (var item in fileSystem.Directory.EnumerateFiles(workingDirectory, "AssemblyInfo.*", SearchOption.AllDirectories)) { - var assemblyInfoFile = new FileInfo(item); + var assemblyInfoFile = fileSystem.FileInfo.New(item); if (this.templateManager.IsSupported(assemblyInfoFile.Extension)) { @@ -178,7 +179,7 @@ private IEnumerable GetAssemblyInfoFiles(AssemblyInfoContext context) private bool EnsureVersionAssemblyInfoFile(string fullPath, bool ensureAssemblyInfo) { fullPath = fullPath.NotNull(); - if (fileSystem.Exists(fullPath)) + if (fileSystem.File.Exists(fullPath)) { return true; } @@ -192,14 +193,14 @@ private bool EnsureVersionAssemblyInfoFile(string fullPath, bool ensureAssemblyI if (!assemblyInfoSource.IsNullOrWhiteSpace()) { - var fileInfo = new FileInfo(fullPath); + var fileInfo = fileSystem.FileInfo.New(fullPath); - if (fileInfo.Directory != null && !fileSystem.DirectoryExists(fileInfo.Directory.FullName)) + if (fileInfo.Directory != null && !fileSystem.Directory.Exists(fileInfo.Directory.FullName)) { - fileSystem.CreateDirectory(fileInfo.Directory.FullName); + fileSystem.Directory.CreateDirectory(fileInfo.Directory.FullName); } - fileSystem.WriteAllText(fullPath, assemblyInfoSource); + fileSystem.File.WriteAllText(fullPath, assemblyInfoSource); return true; } diff --git a/src/GitVersion.Output/AssemblyInfo/ProjectFileUpdater.cs b/src/GitVersion.Output/AssemblyInfo/ProjectFileUpdater.cs index 8588f27153..163b0592a3 100644 --- a/src/GitVersion.Output/AssemblyInfo/ProjectFileUpdater.cs +++ b/src/GitVersion.Output/AssemblyInfo/ProjectFileUpdater.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using System.Xml.Linq; using GitVersion.Extensions; using GitVersion.Helpers; @@ -37,7 +38,7 @@ public void Execute(GitVersionVariables variables, AssemblyInfoContext context) { var localProjectFile = projectFile.FullName; - var originalFileContents = fileSystem.ReadAllText(localProjectFile); + var originalFileContents = fileSystem.File.ReadAllText(localProjectFile); XElement fileXml; try { @@ -57,19 +58,19 @@ public void Execute(GitVersionVariables variables, AssemblyInfoContext context) log.Debug($"Update file: {localProjectFile}"); var backupProjectFile = localProjectFile + ".bak"; - fileSystem.Copy(localProjectFile, backupProjectFile, true); + fileSystem.File.Copy(localProjectFile, backupProjectFile, true); this.restoreBackupTasks.Add(() => { - if (fileSystem.Exists(localProjectFile)) + if (fileSystem.File.Exists(localProjectFile)) { - fileSystem.Delete(localProjectFile); + fileSystem.File.Delete(localProjectFile); } - fileSystem.Move(backupProjectFile, localProjectFile); + fileSystem.File.Move(backupProjectFile, localProjectFile); }); - this.cleanupBackupTasks.Add(() => fileSystem.Delete(backupProjectFile)); + this.cleanupBackupTasks.Add(() => fileSystem.File.Delete(backupProjectFile)); if (!assemblyVersion.IsNullOrWhiteSpace()) { @@ -94,7 +95,7 @@ public void Execute(GitVersionVariables variables, AssemblyInfoContext context) var outputXmlString = fileXml.ToString(); if (originalFileContents != outputXmlString) { - fileSystem.WriteAllText(localProjectFile, outputXmlString); + fileSystem.File.WriteAllText(localProjectFile, outputXmlString); } } @@ -173,7 +174,7 @@ private void CommitChanges() this.restoreBackupTasks.Clear(); } - private IEnumerable GetProjectFiles(AssemblyInfoContext context) + private IEnumerable GetProjectFiles(AssemblyInfoContext context) { var workingDirectory = context.WorkingDirectory; var assemblyInfoFileNames = new HashSet(context.AssemblyInfoFiles); @@ -184,9 +185,9 @@ private IEnumerable GetProjectFiles(AssemblyInfoContext context) { var fullPath = PathHelper.Combine(workingDirectory, item); - if (fileSystem.Exists(fullPath)) + if (fileSystem.File.Exists(fullPath)) { - yield return new FileInfo(fullPath); + yield return fileSystem.FileInfo.New(fullPath); } else { @@ -196,9 +197,9 @@ private IEnumerable GetProjectFiles(AssemblyInfoContext context) } else { - foreach (var item in fileSystem.DirectoryEnumerateFiles(workingDirectory, "*", SearchOption.AllDirectories).Where(IsSupportedProjectFile)) + foreach (var item in fileSystem.Directory.EnumerateFiles(workingDirectory, "*", SearchOption.AllDirectories).Where(IsSupportedProjectFile)) { - var assemblyInfoFile = new FileInfo(item); + var assemblyInfoFile = fileSystem.FileInfo.New(item); yield return assemblyInfoFile; } diff --git a/src/GitVersion.Output/GitVersionInfo/GitVersionInfoGenerator.cs b/src/GitVersion.Output/GitVersionInfo/GitVersionInfoGenerator.cs index 683ede16e3..4ef2bf25b8 100644 --- a/src/GitVersion.Output/GitVersionInfo/GitVersionInfoGenerator.cs +++ b/src/GitVersion.Output/GitVersionInfo/GitVersionInfoGenerator.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Extensions; using GitVersion.Helpers; using GitVersion.OutputVariables; @@ -20,9 +21,9 @@ public void Execute(GitVersionVariables variables, GitVersionInfoContext context string? originalFileContents = null; - if (File.Exists(filePath)) + if (this.fileSystem.File.Exists(filePath)) { - originalFileContents = this.fileSystem.ReadAllText(filePath); + originalFileContents = this.fileSystem.File.ReadAllText(filePath); } var fileExtension = Path.GetExtension(filePath); @@ -53,7 +54,7 @@ public void Execute(GitVersionVariables variables, GitVersionInfoContext context if (fileContents != originalFileContents) { - this.fileSystem.WriteAllText(filePath, fileContents); + this.fileSystem.File.WriteAllText(filePath, fileContents); } return; diff --git a/src/GitVersion.Output/OutputGenerator/OutputGenerator.cs b/src/GitVersion.Output/OutputGenerator/OutputGenerator.cs index 24a715e95d..1da7fe356e 100644 --- a/src/GitVersion.Output/OutputGenerator/OutputGenerator.cs +++ b/src/GitVersion.Output/OutputGenerator/OutputGenerator.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Agents; using GitVersion.Extensions; using GitVersion.Helpers; @@ -38,7 +39,7 @@ public void Execute(GitVersionVariables variables, OutputContext context) var retryOperation = new RetryAction(); retryOperation.Execute(() => { - if (context.OutputFile != null) this.fileSystem.WriteAllText(context.OutputFile, json); + if (context.OutputFile != null) this.fileSystem.File.WriteAllText(context.OutputFile, json); }); } diff --git a/src/GitVersion.Output/Serializer/VersionVariableSerializer.cs b/src/GitVersion.Output/Serializer/VersionVariableSerializer.cs index b6243ea2aa..7941b971c2 100644 --- a/src/GitVersion.Output/Serializer/VersionVariableSerializer.cs +++ b/src/GitVersion.Output/Serializer/VersionVariableSerializer.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using System.Text.Encodings.Web; using GitVersion.Extensions; using GitVersion.Helpers; @@ -83,14 +84,14 @@ private static GitVersionVariables FromDictionary(IEnumerable new() { WriteIndented = true, Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping, Converters = { new VersionVariablesJsonStringConverter() } }; diff --git a/src/GitVersion.Output/WixUpdater/WixVersionFileUpdater.cs b/src/GitVersion.Output/WixUpdater/WixVersionFileUpdater.cs index 4f76e347ac..a6d1b708fc 100644 --- a/src/GitVersion.Output/WixUpdater/WixVersionFileUpdater.cs +++ b/src/GitVersion.Output/WixUpdater/WixVersionFileUpdater.cs @@ -1,3 +1,4 @@ +using System.IO.Abstractions; using GitVersion.Extensions; using GitVersion.Helpers; using GitVersion.Logging; @@ -25,16 +26,16 @@ public void Execute(GitVersionVariables variables, WixVersionContext context) var root = doc.DocumentElement; doc.InsertBefore(xmlDecl, root); - if (this.fileSystem.Exists(this.wixVersionFile)) + if (this.fileSystem.File.Exists(this.wixVersionFile)) { - this.fileSystem.Delete(this.wixVersionFile); + this.fileSystem.File.Delete(this.wixVersionFile); } - if (!this.fileSystem.DirectoryExists(context.WorkingDirectory)) + if (!this.fileSystem.Directory.Exists(context.WorkingDirectory)) { - this.fileSystem.CreateDirectory(context.WorkingDirectory); + this.fileSystem.Directory.CreateDirectory(context.WorkingDirectory); } - using var fs = this.fileSystem.OpenWrite(this.wixVersionFile); + using var fs = this.fileSystem.File.OpenWrite(this.wixVersionFile); doc.Save(fs); } From 0ddfbf45b5d102b62aeb99c389c28060eddb001d Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Thu, 6 Mar 2025 00:51:58 +0100 Subject: [PATCH 079/107] fix nuget warnings --- src/Directory.Packages.props | 2 ++ src/GitVersion.App.Tests/GitVersion.App.Tests.csproj | 1 + src/GitVersion.MsBuild/GitVersion.MsBuild.csproj | 1 + src/GitVersion.Testing/GitVersion.Testing.csproj | 1 + 4 files changed, 5 insertions(+) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 11d3a28cbd..eea058c3a0 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -36,8 +36,10 @@ + + diff --git a/src/GitVersion.App.Tests/GitVersion.App.Tests.csproj b/src/GitVersion.App.Tests/GitVersion.App.Tests.csproj index fbddfbedb5..b5afc842c8 100644 --- a/src/GitVersion.App.Tests/GitVersion.App.Tests.csproj +++ b/src/GitVersion.App.Tests/GitVersion.App.Tests.csproj @@ -2,6 +2,7 @@ + diff --git a/src/GitVersion.MsBuild/GitVersion.MsBuild.csproj b/src/GitVersion.MsBuild/GitVersion.MsBuild.csproj index 033f10f2b4..a2d4f5176a 100644 --- a/src/GitVersion.MsBuild/GitVersion.MsBuild.csproj +++ b/src/GitVersion.MsBuild/GitVersion.MsBuild.csproj @@ -19,6 +19,7 @@ + diff --git a/src/GitVersion.Testing/GitVersion.Testing.csproj b/src/GitVersion.Testing/GitVersion.Testing.csproj index c17ce24c9c..f79daa6f8a 100644 --- a/src/GitVersion.Testing/GitVersion.Testing.csproj +++ b/src/GitVersion.Testing/GitVersion.Testing.csproj @@ -4,6 +4,7 @@ + From 5ab63363ef1d18f5eb82fd76e0d7a137d9ec4461 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Thu, 6 Mar 2025 01:13:22 +0100 Subject: [PATCH 080/107] cleanup --- .../GitVersionTaskExecutor.cs | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/src/GitVersion.MsBuild/GitVersionTaskExecutor.cs b/src/GitVersion.MsBuild/GitVersionTaskExecutor.cs index 3686d25e56..b70c843847 100644 --- a/src/GitVersion.MsBuild/GitVersionTaskExecutor.cs +++ b/src/GitVersion.MsBuild/GitVersionTaskExecutor.cs @@ -108,30 +108,5 @@ public void WriteVersionInfoToBuildLog(WriteVersionInfoToBuildLog task) gitVersionOutputTool.OutputVariables(versionVariables, configuration.UpdateBuildNumber); } - private void DeleteTempFiles() - { - var tempPath = AssemblyInfoFileHelper.TempPath; - if (!this.fileSystem.Directory.Exists(tempPath)) - { - return; - } - - foreach (var file in this.fileSystem.Directory.GetFiles(tempPath)) - { - if (this.fileSystem.GetLastDirectoryWrite(file) >= DateTime.Now.AddDays(-1).Ticks) - { - continue; - } - try - { - this.fileSystem.File.Delete(file); - } - catch (UnauthorizedAccessException) - { - //ignore contention - } - } - } - private GitVersionVariables GitVersionVariables(GitVersionTaskBase task) => serializer.FromFile(task.VersionFile); } From 79f13a3420b8749b1fa7f33762d2da9fbbc765cc Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Thu, 6 Mar 2025 09:13:17 +0100 Subject: [PATCH 081/107] replace Path.* usage with PathHelper.* --- .../ArgumentParserTests.cs | 18 +++++++++--------- src/GitVersion.App/ArgumentParser.cs | 10 +++++----- src/GitVersion.App/ArgumentParserExtensions.cs | 2 +- src/GitVersion.App/FileAppender.cs | 2 +- src/GitVersion.App/GitVersionExecutor.cs | 2 +- .../Agents/BitBucketPipelinesTests.cs | 2 +- .../Agents/CodeBuildTests.cs | 2 +- .../Agents/GitHubActionsTests.cs | 2 +- .../Agents/GitLabCiTests.cs | 2 +- .../Agents/JenkinsTests.cs | 2 +- .../ConfigurationFileLocator.cs | 2 +- .../Core/GitVersionToolDirectoryTests.cs | 2 +- .../IntegrationTests/OtherScenarios.cs | 4 ++-- .../Extensions/ConfigurationExtensions.cs | 14 +++++++------- src/GitVersion.Core/Helpers/DirectoryHelper.cs | 2 +- src/GitVersion.Core/Helpers/PathHelper.cs | 17 +++++++++++++++-- .../Caching/GitVersionCacheKeyFactory.cs | 2 +- .../Git/GitRepositoryInfo.cs | 2 +- .../Tasks/GenerateGitVersionInformationTest.cs | 12 ++++++------ .../Tasks/UpdateAssemblyInfoTaskTest.cs | 8 ++++---- .../GitVersionTaskExecutor.cs | 2 +- .../Helpers/AssemblyInfoFileHelper.cs | 8 ++++---- .../AssemblyInfo/AssemblyInfoFileUpdater.cs | 2 +- .../GitVersionInfo/GitVersionInfoGenerator.cs | 6 ++++-- src/GitVersion.Output/TemplateManager.cs | 12 +++++++++--- .../Fixtures/RepositoryFixtureBase.cs | 2 +- 26 files changed, 81 insertions(+), 60 deletions(-) diff --git a/src/GitVersion.App.Tests/ArgumentParserTests.cs b/src/GitVersion.App.Tests/ArgumentParserTests.cs index a42b4e2c22..9120204927 100644 --- a/src/GitVersion.App.Tests/ArgumentParserTests.cs +++ b/src/GitVersion.App.Tests/ArgumentParserTests.cs @@ -289,7 +289,7 @@ public void UpdateAssemblyInfoWithFilename() var arguments = this.argumentParser.ParseArguments($"-targetpath {repo.RepositoryPath} -updateAssemblyInfo CommonAssemblyInfo.cs"); arguments.UpdateAssemblyInfo.ShouldBe(true); arguments.UpdateAssemblyInfoFileName.Count.ShouldBe(1); - arguments.UpdateAssemblyInfoFileName.ShouldContain(x => Path.GetFileName(x).Equals("CommonAssemblyInfo.cs")); + arguments.UpdateAssemblyInfoFileName.ShouldContain(x => PathHelper.GetFileName(x).Equals("CommonAssemblyInfo.cs")); } [Test] @@ -306,8 +306,8 @@ public void UpdateAssemblyInfoWithMultipleFilenames() var arguments = this.argumentParser.ParseArguments($"-targetpath {repo.RepositoryPath} -updateAssemblyInfo CommonAssemblyInfo.cs VersionAssemblyInfo.cs"); arguments.UpdateAssemblyInfo.ShouldBe(true); arguments.UpdateAssemblyInfoFileName.Count.ShouldBe(2); - arguments.UpdateAssemblyInfoFileName.ShouldContain(x => Path.GetFileName(x).Equals("CommonAssemblyInfo.cs")); - arguments.UpdateAssemblyInfoFileName.ShouldContain(x => Path.GetFileName(x).Equals("VersionAssemblyInfo.cs")); + arguments.UpdateAssemblyInfoFileName.ShouldContain(x => PathHelper.GetFileName(x).Equals("CommonAssemblyInfo.cs")); + arguments.UpdateAssemblyInfoFileName.ShouldContain(x => PathHelper.GetFileName(x).Equals("VersionAssemblyInfo.cs")); } [Test] @@ -324,8 +324,8 @@ public void UpdateProjectFilesWithMultipleFilenames() var arguments = this.argumentParser.ParseArguments($"-targetpath {repo.RepositoryPath} -updateProjectFiles CommonAssemblyInfo.csproj VersionAssemblyInfo.csproj"); arguments.UpdateProjectFiles.ShouldBe(true); arguments.UpdateAssemblyInfoFileName.Count.ShouldBe(2); - arguments.UpdateAssemblyInfoFileName.ShouldContain(x => Path.GetFileName(x).Equals("CommonAssemblyInfo.csproj")); - arguments.UpdateAssemblyInfoFileName.ShouldContain(x => Path.GetFileName(x).Equals("VersionAssemblyInfo.csproj")); + arguments.UpdateAssemblyInfoFileName.ShouldContain(x => PathHelper.GetFileName(x).Equals("CommonAssemblyInfo.csproj")); + arguments.UpdateAssemblyInfoFileName.ShouldContain(x => PathHelper.GetFileName(x).Equals("VersionAssemblyInfo.csproj")); } [Test] @@ -348,9 +348,9 @@ public void UpdateAssemblyInfoWithMultipleFilenamesMatchingGlobbing() var arguments = this.argumentParser.ParseArguments($"-targetpath {repo.RepositoryPath} -updateAssemblyInfo **/*AssemblyInfo.cs"); arguments.UpdateAssemblyInfo.ShouldBe(true); arguments.UpdateAssemblyInfoFileName.Count.ShouldBe(3); - arguments.UpdateAssemblyInfoFileName.ShouldContain(x => Path.GetFileName(x).Equals("CommonAssemblyInfo.cs")); - arguments.UpdateAssemblyInfoFileName.ShouldContain(x => Path.GetFileName(x).Equals("VersionAssemblyInfo.cs")); - arguments.UpdateAssemblyInfoFileName.ShouldContain(x => Path.GetFileName(x).Equals("LocalAssemblyInfo.cs")); + arguments.UpdateAssemblyInfoFileName.ShouldContain(x => PathHelper.GetFileName(x).Equals("CommonAssemblyInfo.cs")); + arguments.UpdateAssemblyInfoFileName.ShouldContain(x => PathHelper.GetFileName(x).Equals("VersionAssemblyInfo.cs")); + arguments.UpdateAssemblyInfoFileName.ShouldContain(x => PathHelper.GetFileName(x).Equals("LocalAssemblyInfo.cs")); } [Test] @@ -367,7 +367,7 @@ public void UpdateAssemblyInfoWithRelativeFilename() var arguments = this.argumentParser.ParseArguments($"-targetpath {targetPath} -updateAssemblyInfo ..\\..\\CommonAssemblyInfo.cs"); arguments.UpdateAssemblyInfo.ShouldBe(true); arguments.UpdateAssemblyInfoFileName.Count.ShouldBe(1); - arguments.UpdateAssemblyInfoFileName.ShouldContain(x => Path.GetFileName(x).Equals("CommonAssemblyInfo.cs")); + arguments.UpdateAssemblyInfoFileName.ShouldContain(x => PathHelper.GetFileName(x).Equals("CommonAssemblyInfo.cs")); } [Test] diff --git a/src/GitVersion.App/ArgumentParser.cs b/src/GitVersion.App/ArgumentParser.cs index 26fb7af233..7686b77231 100644 --- a/src/GitVersion.App/ArgumentParser.cs +++ b/src/GitVersion.App/ArgumentParser.cs @@ -107,14 +107,14 @@ private void ValidateConfigurationFile(Arguments arguments) { if (arguments.ConfigurationFile.IsNullOrWhiteSpace()) return; - if (Path.IsPathRooted(arguments.ConfigurationFile)) + if (PathHelper.IsPathRooted(arguments.ConfigurationFile)) { if (!this.fileSystem.File.Exists(arguments.ConfigurationFile)) throw new WarningException($"Could not find config file at '{arguments.ConfigurationFile}'"); - arguments.ConfigurationFile = Path.GetFullPath(arguments.ConfigurationFile); + arguments.ConfigurationFile = PathHelper.GetFullPath(arguments.ConfigurationFile); } else { - var configFilePath = Path.GetFullPath(PathHelper.Combine(arguments.TargetPath, arguments.ConfigurationFile)); + var configFilePath = PathHelper.GetFullPath(PathHelper.Combine(arguments.TargetPath, arguments.ConfigurationFile)); if (!this.fileSystem.File.Exists(configFilePath)) throw new WarningException($"Could not find config file at '{configFilePath}'"); arguments.ConfigurationFile = configFilePath; } @@ -156,7 +156,7 @@ private IEnumerable ResolveFiles(string workingDirectory, ISet? foreach (var path in paths) { - yield return Path.GetFullPath(PathHelper.Combine(workingDirectory, path)); + yield return PathHelper.GetFullPath(PathHelper.Combine(workingDirectory, path)); } } } @@ -182,7 +182,7 @@ private void ParseTargetPath(Arguments arguments, string? name, IReadOnlyList(); this.workDirectory = PathHelper.Combine(PathHelper.GetTempPath(), Guid.NewGuid().ToString()); - this.gitDirectory = Repository.Init(this.workDirectory).TrimEnd(Path.DirectorySeparatorChar); + this.gitDirectory = Repository.Init(this.workDirectory).TrimEnd(PathHelper.DirectorySeparatorChar); Assert.That(this.gitDirectory, Is.Not.Null); } diff --git a/src/GitVersion.Core.Tests/IntegrationTests/OtherScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/OtherScenarios.cs index d47a10b7cd..17d9946478 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/OtherScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/OtherScenarios.cs @@ -111,8 +111,8 @@ public void HasDirtyFlagWhenUncommittedChangesAreInRepository(bool stageFile, in for (int i = 0; i < numberOfFiles; i++) { - var tempFile = Path.GetTempFileName(); - var repoFile = PathHelper.Combine(fixture.RepositoryPath, Path.GetFileNameWithoutExtension(tempFile) + ".txt"); + var tempFile = PathHelper.GetTempFileName(); + var repoFile = PathHelper.Combine(fixture.RepositoryPath, PathHelper.GetFileNameWithoutExtension(tempFile) + ".txt"); fileSystem.File.Move(tempFile, repoFile); fileSystem.File.WriteAllText(repoFile, $"Hello world / testfile {i}"); diff --git a/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs b/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs index 82c7b8a47f..65b6d0cb67 100644 --- a/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs +++ b/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs @@ -100,7 +100,7 @@ public static bool IsReleaseBranch(this IGitVersionConfiguration configuration, foreach (var groupName in regex.GetGroupNames()) { var groupValue = match.Groups[groupName].Value; - Lazy escapedGroupValueLazy = new(() => EscapeInvalidCharaters(groupValue)); + Lazy escapedGroupValueLazy = new(() => EscapeInvalidCharacters(groupValue)); var placeholder = $"{{{groupName}}}"; int index, startIndex = 0; while ((index = label.IndexOf(placeholder, startIndex, StringComparison.InvariantCulture)) >= 0) @@ -115,9 +115,9 @@ public static bool IsReleaseBranch(this IGitVersionConfiguration configuration, return label; } - private static string EscapeInvalidCharaters(string groupValue) => groupValue.RegexReplace(@"[^a-zA-Z0-9-]", "-"); + private static string EscapeInvalidCharacters(string groupValue) => groupValue.RegexReplace("[^a-zA-Z0-9-]", "-"); - public static (string GitDirectory, string WorkingTreeDirectory)? FindGitDir(this IFileSystem fileSystem, string path) + public static (string GitDirectory, string WorkingTreeDirectory)? FindGitDir(this IFileSystem fileSystem, string? path) { string? startingDir = path; while (startingDir is not null) @@ -125,7 +125,7 @@ public static (string GitDirectory, string WorkingTreeDirectory)? FindGitDir(thi var dirOrFilePath = PathHelper.Combine(startingDir, ".git"); if (fileSystem.Directory.Exists(dirOrFilePath)) { - return (dirOrFilePath, Path.GetDirectoryName(dirOrFilePath)!); + return (dirOrFilePath, PathHelper.GetDirectoryName(dirOrFilePath)); } if (fileSystem.File.Exists(dirOrFilePath)) @@ -133,15 +133,15 @@ public static (string GitDirectory, string WorkingTreeDirectory)? FindGitDir(thi string? relativeGitDirPath = ReadGitDirFromFile(dirOrFilePath); if (!string.IsNullOrWhiteSpace(relativeGitDirPath)) { - var fullGitDirPath = Path.GetFullPath(PathHelper.Combine(startingDir, relativeGitDirPath)); + var fullGitDirPath = PathHelper.GetFullPath(PathHelper.Combine(startingDir, relativeGitDirPath)); if (fileSystem.Directory.Exists(fullGitDirPath)) { - return (fullGitDirPath, Path.GetDirectoryName(dirOrFilePath)!); + return (fullGitDirPath, PathHelper.GetDirectoryName(dirOrFilePath)); } } } - startingDir = Path.GetDirectoryName(startingDir); + startingDir = PathHelper.GetDirectoryName(startingDir); } return null; diff --git a/src/GitVersion.Core/Helpers/DirectoryHelper.cs b/src/GitVersion.Core/Helpers/DirectoryHelper.cs index 5acff873bf..357815c5e1 100644 --- a/src/GitVersion.Core/Helpers/DirectoryHelper.cs +++ b/src/GitVersion.Core/Helpers/DirectoryHelper.cs @@ -40,7 +40,7 @@ public static void DeleteDirectory(string directoryPath) "{0}Known and common causes include:" + "{0}- Windows Search Indexer (go to the Indexing Options, in the Windows Control Panel, and exclude the bin folder of LibGit2Sharp.Tests)" + "{0}- Antivirus (exclude the bin folder of LibGit2Sharp.Tests from the paths scanned by your real-time antivirus){0}", - PathHelper.NewLine, Path.GetFullPath(directoryPath))); + PathHelper.NewLine, PathHelper.GetFullPath(directoryPath))); } } } diff --git a/src/GitVersion.Core/Helpers/PathHelper.cs b/src/GitVersion.Core/Helpers/PathHelper.cs index 3c9d853a1d..42c69c0f41 100644 --- a/src/GitVersion.Core/Helpers/PathHelper.cs +++ b/src/GitVersion.Core/Helpers/PathHelper.cs @@ -5,6 +5,7 @@ namespace GitVersion.Helpers; internal static class PathHelper { public static string NewLine => SysEnv.NewLine; + public static char DirectorySeparatorChar => Path.DirectorySeparatorChar; private static readonly StringComparison OsDependentComparison = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) @@ -33,13 +34,19 @@ public static string GetDirectoryName(string? path) return Path.GetDirectoryName(path)!; } - public static string GetFullPath(string? path) + public static string GetFileName(string? path) { ArgumentNullException.ThrowIfNull(path, nameof(path)); - return Path.GetFullPath(path); + return Path.GetFileName(path); } + public static string? GetFileNameWithoutExtension(string? path) => Path.GetFileNameWithoutExtension(path); + + public static string? GetExtension(string? path) => Path.GetExtension(path); + + public static string GetFullPath(string? path) => Path.GetFullPath(path!); + public static string Combine(string? path1, string? path2) { ArgumentException.ThrowIfNullOrWhiteSpace(path1); @@ -79,4 +86,10 @@ public static bool Equal(string? path, string? otherPath) => GetFullPath(path).TrimEnd('\\').TrimEnd('/'), GetFullPath(otherPath).TrimEnd('\\').TrimEnd('/'), OsDependentComparison); + + public static string GetRandomFileName() => Path.GetRandomFileName(); + + public static string GetTempFileName() => Path.GetTempFileName(); + + public static bool IsPathRooted(string? path) => Path.IsPathRooted(path); } diff --git a/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheKeyFactory.cs b/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheKeyFactory.cs index 908f1a8124..b024a27a22 100644 --- a/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheKeyFactory.cs +++ b/src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheKeyFactory.cs @@ -118,7 +118,7 @@ private List CalculateDirectoryContents(string root) try { if (!this.fileSystem.File.Exists(file)) continue; - result.Add(Path.GetFileName(file)); + result.Add(PathHelper.GetFileName(file)); result.Add(this.fileSystem.File.ReadAllText(file)); } catch (IOException e) diff --git a/src/GitVersion.LibGit2Sharp/Git/GitRepositoryInfo.cs b/src/GitVersion.LibGit2Sharp/Git/GitRepositoryInfo.cs index 9cbf267f9d..d5df195240 100644 --- a/src/GitVersion.LibGit2Sharp/Git/GitRepositoryInfo.cs +++ b/src/GitVersion.LibGit2Sharp/Git/GitRepositoryInfo.cs @@ -40,7 +40,7 @@ public GitRepositoryInfo(IFileSystem fileSystem, IOptions opt var targetUrl = repositoryInfo.TargetUrl; var clonePath = repositoryInfo.ClonePath; - var userTemp = clonePath ?? Path.GetTempPath(); + var userTemp = clonePath ?? PathHelper.GetTempPath(); var repositoryName = targetUrl.Split('/', '\\').Last().Replace(".git", string.Empty); var possiblePath = PathHelper.Combine(userTemp, repositoryName); diff --git a/src/GitVersion.MsBuild.Tests/Tasks/GenerateGitVersionInformationTest.cs b/src/GitVersion.MsBuild.Tests/Tasks/GenerateGitVersionInformationTest.cs index ec0fb010bd..9a2892572b 100644 --- a/src/GitVersion.MsBuild.Tests/Tasks/GenerateGitVersionInformationTest.cs +++ b/src/GitVersion.MsBuild.Tests/Tasks/GenerateGitVersionInformationTest.cs @@ -76,7 +76,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuild( result.MsBuild.ShouldAllBe(x => x.Succeeded); result.Output.ShouldNotBeNullOrWhiteSpace(); - var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), $"GitVersionInformation.g.{extension}"); + var generatedFilePath = PathHelper.Combine(PathHelper.GetDirectoryName(result.ProjectPath), $"GitVersionInformation.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); @@ -103,7 +103,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildI result.MsBuild.ShouldAllBe(x => x.Succeeded); result.Output.ShouldNotBeNullOrWhiteSpace(); - var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), $"GitVersionInformation.g.{extension}"); + var generatedFilePath = PathHelper.Combine(PathHelper.GetDirectoryName(result.ProjectPath), $"GitVersionInformation.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); @@ -178,7 +178,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildA result.MsBuild.ShouldAllBe(x => x.Succeeded); result.Output.ShouldNotBeNullOrWhiteSpace(); - var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), randDir, $"GitVersionInformation.g.{extension}"); + var generatedFilePath = PathHelper.Combine(PathHelper.GetDirectoryName(result.ProjectPath), randDir, $"GitVersionInformation.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); @@ -209,7 +209,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildA result.MsBuild.ShouldAllBe(x => x.Succeeded); result.Output.ShouldNotBeNullOrWhiteSpace(); - var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), randDir, $"GitVersionInformation.g.{extension}"); + var generatedFilePath = PathHelper.Combine(PathHelper.GetDirectoryName(result.ProjectPath), randDir, $"GitVersionInformation.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); @@ -240,7 +240,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildA result.MsBuild.ShouldAllBe(x => x.Succeeded); result.Output.ShouldNotBeNullOrWhiteSpace(); - var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), randDir, $"GitVersionInformation.g.{extension}"); + var generatedFilePath = PathHelper.Combine(PathHelper.GetDirectoryName(result.ProjectPath), randDir, $"GitVersionInformation.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); @@ -273,7 +273,7 @@ public void GenerateGitVersionInformationTaskShouldCreateFileWhenRunWithMsBuildA result.MsBuild.ShouldAllBe(x => x.Succeeded); result.Output.ShouldNotBeNullOrWhiteSpace(); - var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), randDir, $"GitVersionInformation.g.{extension}"); + var generatedFilePath = PathHelper.Combine(PathHelper.GetDirectoryName(result.ProjectPath), randDir, $"GitVersionInformation.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); diff --git a/src/GitVersion.MsBuild.Tests/Tasks/UpdateAssemblyInfoTaskTest.cs b/src/GitVersion.MsBuild.Tests/Tasks/UpdateAssemblyInfoTaskTest.cs index 17c7072665..71cf8d8b7a 100644 --- a/src/GitVersion.MsBuild.Tests/Tasks/UpdateAssemblyInfoTaskTest.cs +++ b/src/GitVersion.MsBuild.Tests/Tasks/UpdateAssemblyInfoTaskTest.cs @@ -66,7 +66,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFileWhenRunWithMsBuild(string lang result.MsBuild.ShouldAllBe(x => x.Succeeded); result.Output.ShouldNotBeNullOrWhiteSpace(); - var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), $"AssemblyInfo.g.{extension}"); + var generatedFilePath = PathHelper.Combine(PathHelper.GetDirectoryName(result.ProjectPath), $"AssemblyInfo.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); @@ -89,7 +89,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFileWhenRunWithMsBuildInBuildServe result.MsBuild.ShouldAllBe(x => x.Succeeded); result.Output.ShouldNotBeNullOrWhiteSpace(); - var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), $"AssemblyInfo.g.{extension}"); + var generatedFilePath = PathHelper.Combine(PathHelper.GetDirectoryName(result.ProjectPath), $"AssemblyInfo.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); @@ -152,7 +152,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFileWhenRunWithMsBuildAndIntermedi result.MsBuild.ShouldAllBe(x => x.Succeeded); result.Output.ShouldNotBeNullOrWhiteSpace(); - var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), randDir, $"AssemblyInfo.g.{extension}"); + var generatedFilePath = PathHelper.Combine(PathHelper.GetDirectoryName(result.ProjectPath), randDir, $"AssemblyInfo.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); @@ -179,7 +179,7 @@ public void UpdateAssemblyInfoTaskShouldCreateFileWhenRunWithMsBuildAndIntermedi result.MsBuild.ShouldAllBe(x => x.Succeeded); result.Output.ShouldNotBeNullOrWhiteSpace(); - var generatedFilePath = PathHelper.Combine(Path.GetDirectoryName(result.ProjectPath), randDir, $"AssemblyInfo.g.{extension}"); + var generatedFilePath = PathHelper.Combine(PathHelper.GetDirectoryName(result.ProjectPath), randDir, $"AssemblyInfo.g.{extension}"); result.Output.ShouldContain($"{outputProperty}: {generatedFilePath}"); var fileContent = this.FileSystem.File.ReadAllText(generatedFilePath); diff --git a/src/GitVersion.MsBuild/GitVersionTaskExecutor.cs b/src/GitVersion.MsBuild/GitVersionTaskExecutor.cs index b70c843847..a5c7ed5e25 100644 --- a/src/GitVersion.MsBuild/GitVersionTaskExecutor.cs +++ b/src/GitVersion.MsBuild/GitVersionTaskExecutor.cs @@ -90,7 +90,7 @@ public void GenerateGitVersionInformation(GenerateGitVersionInformation task) targetNamespace = task.RootNamespace; if (string.IsNullOrWhiteSpace(targetNamespace)) { - targetNamespace = Path.GetFileNameWithoutExtension(task.ProjectFile); + targetNamespace = PathHelper.GetFileNameWithoutExtension(task.ProjectFile); } } diff --git a/src/GitVersion.MsBuild/Helpers/AssemblyInfoFileHelper.cs b/src/GitVersion.MsBuild/Helpers/AssemblyInfoFileHelper.cs index 2bbbb2fb37..ae730660e5 100644 --- a/src/GitVersion.MsBuild/Helpers/AssemblyInfoFileHelper.cs +++ b/src/GitVersion.MsBuild/Helpers/AssemblyInfoFileHelper.cs @@ -11,7 +11,7 @@ internal static class AssemblyInfoFileHelper { public static readonly string TempPath = MakeAndGetTempPath(); - private static string MakeAndGetTempPath() => PathHelper.Combine(Path.GetTempPath(), "GitVersionTask"); + private static string MakeAndGetTempPath() => PathHelper.Combine(PathHelper.GetTempPath(), "GitVersionTask"); public static string GetFileExtension(string language) => language switch { @@ -40,7 +40,7 @@ public static void CheckForInvalidFiles(IFileSystem fileSystem, IEnumerable extension switch + string getTargetNamespace(string? extension) => extension switch { ".vb" => context.TargetNamespace ?? "Global", ".cs" => context.TargetNamespace != null ? $"{PathHelper.NewLine}namespace {context.TargetNamespace}" : "", diff --git a/src/GitVersion.Output/TemplateManager.cs b/src/GitVersion.Output/TemplateManager.cs index 7eb60d3d54..da90e205aa 100644 --- a/src/GitVersion.Output/TemplateManager.cs +++ b/src/GitVersion.Output/TemplateManager.cs @@ -1,4 +1,5 @@ using GitVersion.Extensions; +using GitVersion.Helpers; namespace GitVersion.Output; @@ -13,7 +14,7 @@ internal class TemplateManager(TemplateType templateType) private readonly Dictionary templates = GetEmbeddedTemplates(templateType, "Templates").ToDictionary(tuple => tuple.ext, tuple => tuple.name, StringComparer.OrdinalIgnoreCase); private readonly Dictionary addFormats = GetEmbeddedTemplates(templateType, "AddFormats").ToDictionary(tuple => tuple.ext, tuple => tuple.name, StringComparer.OrdinalIgnoreCase); - public string? GetTemplateFor(string fileExtension) + public string? GetTemplateFor(string? fileExtension) { ArgumentNullException.ThrowIfNull(fileExtension); @@ -27,7 +28,7 @@ internal class TemplateManager(TemplateType templateType) return result; } - public string? GetAddFormatFor(string fileExtension) + public string? GetAddFormatFor(string? fileExtension) { ArgumentNullException.ThrowIfNull(fileExtension); @@ -56,7 +57,12 @@ public bool IsSupported(string fileExtension) { if (name.Contains(templateType.ToString()) && name.Contains(templateCategory)) { - yield return (ext: Path.GetExtension(name), name); + var extension = PathHelper.GetExtension(name); + if (string.IsNullOrWhiteSpace(extension)) + { + continue; + } + yield return (ext: extension, name); } } } diff --git a/src/GitVersion.Testing/Fixtures/RepositoryFixtureBase.cs b/src/GitVersion.Testing/Fixtures/RepositoryFixtureBase.cs index aed81489f4..4817162321 100644 --- a/src/GitVersion.Testing/Fixtures/RepositoryFixtureBase.cs +++ b/src/GitVersion.Testing/Fixtures/RepositoryFixtureBase.cs @@ -45,7 +45,7 @@ protected virtual void Dispose(bool disposing) } Repository.Dispose(); - var directoryPath = Path.GetFileName(RepositoryPath); + var directoryPath = PathHelper.GetFileName(RepositoryPath); try { From 66658c12fce8448c82a1413ceb1f4dbce303203a Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Thu, 6 Mar 2025 14:42:05 +0100 Subject: [PATCH 082/107] fix new-cli solution --- .gitignore | 2 ++ new-cli/.idea/.idea.GitVersion/.idea/icon.svg | 1 + new-cli/.idea/.idea.GitVersion/.idea/indexLayout.xml | 10 ++++++++++ new-cli/docs/calculate.rsp | 2 +- new-cli/docs/output-project.rsp | 2 +- new-cli/docs/output-wix.rsp | 2 +- 6 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 new-cli/.idea/.idea.GitVersion/.idea/icon.svg create mode 100644 new-cli/.idea/.idea.GitVersion/.idea/indexLayout.xml diff --git a/.gitignore b/.gitignore index e5775f626a..6625c880d9 100644 --- a/.gitignore +++ b/.gitignore @@ -136,3 +136,5 @@ node_modules dogfood/ new-cli/log.txt + +new-cli/logs/ diff --git a/new-cli/.idea/.idea.GitVersion/.idea/icon.svg b/new-cli/.idea/.idea.GitVersion/.idea/icon.svg new file mode 100644 index 0000000000..f8bfb01f26 --- /dev/null +++ b/new-cli/.idea/.idea.GitVersion/.idea/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/new-cli/.idea/.idea.GitVersion/.idea/indexLayout.xml b/new-cli/.idea/.idea.GitVersion/.idea/indexLayout.xml new file mode 100644 index 0000000000..db942041e6 --- /dev/null +++ b/new-cli/.idea/.idea.GitVersion/.idea/indexLayout.xml @@ -0,0 +1,10 @@ + + + + + docs + + + + + \ No newline at end of file diff --git a/new-cli/docs/calculate.rsp b/new-cli/docs/calculate.rsp index 7e0362931d..a8a006be0c 100644 --- a/new-cli/docs/calculate.rsp +++ b/new-cli/docs/calculate.rsp @@ -1 +1 @@ -calculate -l c:\logs\log.txt --work-dir C:\Projects\OSS\GitTools\GitVersion --verbosity verbose +calculate -l ./logs/log.txt --work-dir . --verbosity verbose diff --git a/new-cli/docs/output-project.rsp b/new-cli/docs/output-project.rsp index 8619d5df10..734d7e3736 100644 --- a/new-cli/docs/output-project.rsp +++ b/new-cli/docs/output-project.rsp @@ -1 +1 @@ -output --output-dir C:\Projects\OSS\GitTools\GitVersion --input-file version.json project --project-file project.csproj +output --output-dir ./output --input-file version.json project --project-file project.csproj diff --git a/new-cli/docs/output-wix.rsp b/new-cli/docs/output-wix.rsp index 25f543d648..91992af5b6 100644 --- a/new-cli/docs/output-wix.rsp +++ b/new-cli/docs/output-wix.rsp @@ -1 +1 @@ -output --output-dir C:\Projects\OSS\GitTools\GitVersion --input-file version.json wix --wix-file project.wix +output --output-dir ./output --input-file version.json wix --wix-file project.wix From 0988072ad086a524ebb07cd213b008aa70a829f2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Mar 2025 15:42:56 +0000 Subject: [PATCH 083/107] (deps): Bump Microsoft.CSharp and Scriban in /new-cli Bumps Microsoft.CSharp and [Scriban](https://github.com/scriban/scriban). These dependencies needed to be updated together. Updates `Microsoft.CSharp` from 4.7.0 to 4.5.0 Updates `Scriban` from 5.12.0 to 6.0.0 - [Release notes](https://github.com/scriban/scriban/releases) - [Changelog](https://github.com/scriban/scriban/blob/master/changelog.md) - [Commits](https://github.com/scriban/scriban/compare/5.12.0...6.0.0) --- updated-dependencies: - dependency-name: Microsoft.CSharp dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: Scriban dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index 5a744aa636..b7b8ff709a 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -15,7 +15,7 @@ - + From 8d772a7ec76098338e6aba30f0688fc034b988d4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Mar 2025 16:22:49 +0000 Subject: [PATCH 084/107] (deps): Bump gitreleasemanager.tool from 0.18.0 to 0.19.0 in /build Bumps [gitreleasemanager.tool](https://github.com/GitTools/GitReleaseManager) from 0.18.0 to 0.19.0. - [Release notes](https://github.com/GitTools/GitReleaseManager/releases) - [Changelog](https://github.com/GitTools/GitReleaseManager/blob/develop/GitReleaseManager.yaml) - [Commits](https://github.com/GitTools/GitReleaseManager/compare/0.18.0...0.19.0) --- updated-dependencies: - dependency-name: gitreleasemanager.tool dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 50a3e3e038..d9737dcf19 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "gitreleasemanager.tool": { - "version": "0.18.0", + "version": "0.19.0", "commands": [ "dotnet-gitreleasemanager" ] From 70f554ef6ad7bf7e3c867cb918ae5dcdfe2740ea Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 19:38:49 +0000 Subject: [PATCH 085/107] (deps): Bump dotnet-sdk from 9.0.200 to 9.0.201 Bumps [dotnet-sdk](https://github.com/dotnet/sdk) from 9.0.200 to 9.0.201. - [Release notes](https://github.com/dotnet/sdk/releases) - [Commits](https://github.com/dotnet/sdk/compare/v9.0.200...v9.0.201) --- updated-dependencies: - dependency-name: dotnet-sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index d5acb9d0bc..de8635bb7c 100644 --- a/global.json +++ b/global.json @@ -5,6 +5,6 @@ "src" ], "sdk": { - "version": "9.0.200" + "version": "9.0.201" } } From bafb3a6a57dde10279f24df865416114bc84cde5 Mon Sep 17 00:00:00 2001 From: Bi0T1N Date: Sat, 8 Feb 2025 14:18:06 +0100 Subject: [PATCH 086/107] Support for dotenv output format closes #4174 --- docs/input/docs/usage/cli/arguments.md | 2 +- docs/input/docs/usage/cli/output.md | 7 + new-cli/command.md | 12 ++ .../ArgumentParserTests.cs | 2 +- src/GitVersion.App/ArgumentParser.cs | 2 +- src/GitVersion.Core/Options/OutputType.cs | 3 +- src/GitVersion.Core/PublicAPI.Shipped.txt | 1 + .../Output/FormatArgumentTests.cs | 127 ++++++++++++++++++ .../OutputGenerator/OutputGenerator.cs | 23 ++++ 9 files changed, 175 insertions(+), 4 deletions(-) diff --git a/docs/input/docs/usage/cli/arguments.md b/docs/input/docs/usage/cli/arguments.md index 01d773c752..8b1b8ea5ea 100644 --- a/docs/input/docs/usage/cli/arguments.md +++ b/docs/input/docs/usage/cli/arguments.md @@ -30,7 +30,7 @@ GitVersion [path] /targetpath Same as 'path', but not positional /output Determines the output to the console. Can be either 'json', - 'file' or 'buildserver', will default to 'json'. + 'file', 'buildserver' or 'dotenv', will default to 'json'. /outputfile Path to output file. It is used in combination with /output 'file'. /showvariable Used in conjunction with /output json, will output just a diff --git a/docs/input/docs/usage/cli/output.md b/docs/input/docs/usage/cli/output.md index 52a03daba1..d26bf5a84d 100644 --- a/docs/input/docs/usage/cli/output.md +++ b/docs/input/docs/usage/cli/output.md @@ -14,3 +14,10 @@ out the variables to whatever build server it is running in. You can then use those variables in your build scripts or run different tools to create versioned NuGet packages or whatever you would like to do. See [build servers](/docs/reference/build-servers) for more information about this. + +You can even store the [variables](/docs/reference/variables) in a Dotenv file +and load it to have the variables available in your environment. +For that you have to run `GitVersion.exe /output dotenv` and store the output +into e.g. a `gitversion.env` file. These files can also be passed around in CI environments +like [GitHub](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#passing-values-between-steps-and-jobs-in-a-workflow) +or [GitLab](https://docs.gitlab.com/ee/ci/variables/#pass-an-environment-variable-to-another-job). diff --git a/new-cli/command.md b/new-cli/command.md index c137381b07..7e6d2aec3b 100644 --- a/new-cli/command.md +++ b/new-cli/command.md @@ -53,6 +53,18 @@ cat gitversion.json | gitversion output buildserver # Read version variables from stdin and write to Jenkins. cat gitversion.json | gitversion output buildserver --buildserver Jenkins +# Output version variables in Dotenv format +gitversion /output dotenv + +# Show only a subset of the version variables in Dotenv format (Unix syntax) +gitversion /output dotenv | grep -i "prerelease" + +# Show only a subset of the version variables that match the regex in Dotenv format (Unix syntax) +gitversion /output dotenv | grep -iE "major|sha=|_prerelease" + +# Write version variables in Dotenv format into a file +gitversion /output dotenv > gitversion.env + # Read version variables from stdin and write to globbed .wxi files. cat gitversion.json | gitversion output wix --path ./**/*.wxi diff --git a/src/GitVersion.App.Tests/ArgumentParserTests.cs b/src/GitVersion.App.Tests/ArgumentParserTests.cs index 9120204927..abdcd6c2a5 100644 --- a/src/GitVersion.App.Tests/ArgumentParserTests.cs +++ b/src/GitVersion.App.Tests/ArgumentParserTests.cs @@ -103,7 +103,7 @@ public void UnknownOutputShouldThrow() { var exception = Assert.Throws(() => this.argumentParser.ParseArguments("targetDirectoryPath -output invalid_value")); exception.ShouldNotBeNull(); - exception.Message.ShouldBe("Value 'invalid_value' cannot be parsed as output type, please use 'json', 'file' or 'buildserver'"); + exception.Message.ShouldBe("Value 'invalid_value' cannot be parsed as output type, please use 'json', 'file', 'buildserver' or 'dotenv'"); } [Test] diff --git a/src/GitVersion.App/ArgumentParser.cs b/src/GitVersion.App/ArgumentParser.cs index 7686b77231..bccbc96d36 100644 --- a/src/GitVersion.App/ArgumentParser.cs +++ b/src/GitVersion.App/ArgumentParser.cs @@ -432,7 +432,7 @@ private static void ParseOutput(Arguments arguments, IEnumerable? values { if (!Enum.TryParse(v, true, out OutputType outputType)) { - throw new WarningException($"Value '{v}' cannot be parsed as output type, please use 'json', 'file' or 'buildserver'"); + throw new WarningException($"Value '{v}' cannot be parsed as output type, please use 'json', 'file', 'buildserver' or 'dotenv'"); } arguments.Output.Add(outputType); diff --git a/src/GitVersion.Core/Options/OutputType.cs b/src/GitVersion.Core/Options/OutputType.cs index bb72800fc7..3ad1b04d94 100644 --- a/src/GitVersion.Core/Options/OutputType.cs +++ b/src/GitVersion.Core/Options/OutputType.cs @@ -4,5 +4,6 @@ public enum OutputType { BuildServer, Json, - File + File, + DotEnv } diff --git a/src/GitVersion.Core/PublicAPI.Shipped.txt b/src/GitVersion.Core/PublicAPI.Shipped.txt index 646e2c5952..8feb99e5cc 100644 --- a/src/GitVersion.Core/PublicAPI.Shipped.txt +++ b/src/GitVersion.Core/PublicAPI.Shipped.txt @@ -417,6 +417,7 @@ GitVersion.OutputType GitVersion.OutputType.BuildServer = 0 -> GitVersion.OutputType GitVersion.OutputType.File = 2 -> GitVersion.OutputType GitVersion.OutputType.Json = 1 -> GitVersion.OutputType +GitVersion.OutputType.DotEnv = 3 -> GitVersion.OutputType GitVersion.OutputVariables.GitVersionVariables GitVersion.OutputVariables.GitVersionVariables.AssemblySemFileVer.get -> string? GitVersion.OutputVariables.GitVersionVariables.AssemblySemFileVer.init -> void diff --git a/src/GitVersion.Output.Tests/Output/FormatArgumentTests.cs b/src/GitVersion.Output.Tests/Output/FormatArgumentTests.cs index d116855c6f..f85ac29366 100644 --- a/src/GitVersion.Output.Tests/Output/FormatArgumentTests.cs +++ b/src/GitVersion.Output.Tests/Output/FormatArgumentTests.cs @@ -68,6 +68,126 @@ public void ShouldOutputFormatWithEnvironmentVariablesTests(string format, strin output.ShouldBeEquivalentTo(expectedValue); } + [TestCase("Major", "1")] + [TestCase("MajorMinorPatch", "1.1.0")] + [TestCase("SemVer", "1.1.0-foo.1")] + [TestCase("PreReleaseTagWithDash", "-foo.1")] + [TestCase("AssemblySemFileVer", "1.1.0.0")] + [TestCase("BranchName", "feature/foo")] + [TestCase("FullSemVer", "1.1.0-foo.1+1")] + public void ShouldOutputDotEnvEntries(string variableName, string expectedValue) + { + var fixture = CreateTestRepository(); + + var consoleBuilder = new StringBuilder(); + IConsole consoleAdapter = new TestConsoleAdapter(consoleBuilder); + + var sp = ConfigureServices(services => + { + var options = Options.Create(new GitVersionOptions { WorkingDirectory = fixture.RepositoryPath, RepositoryInfo = { TargetBranch = fixture.Repository.Head.CanonicalName }, Output = { OutputType.DotEnv } }); + var repository = fixture.Repository.ToGitRepository(); + + services.AddSingleton(options); + services.AddSingleton(repository); + services.AddSingleton(consoleAdapter); + }); + + var versionVariables = sp.GetRequiredService().CalculateVersionVariables(); + var outputGenerator = sp.GetRequiredService(); + + outputGenerator.Execute(versionVariables, new()); + var output = consoleBuilder.ToString(); + output.ShouldContain("GitVersion_" + variableName + "=" + expectedValue + "\n"); + } + + [TestCase] + public void ShouldOutputAllCalculatedVariablesAsDotEnvEntries() + { + var fixture = CreateTestRepository(); + + var consoleBuilder = new StringBuilder(); + IConsole consoleAdapter = new TestConsoleAdapter(consoleBuilder); + + var sp = ConfigureServices(services => + { + var options = Options.Create(new GitVersionOptions { WorkingDirectory = fixture.RepositoryPath, RepositoryInfo = { TargetBranch = fixture.Repository.Head.CanonicalName }, Output = { OutputType.DotEnv } }); + var repository = fixture.Repository.ToGitRepository(); + + services.AddSingleton(options); + services.AddSingleton(repository); + services.AddSingleton(consoleAdapter); + }); + + var versionVariables = sp.GetRequiredService().CalculateVersionVariables(); + var outputGenerator = sp.GetRequiredService(); + + outputGenerator.Execute(versionVariables, new()); + var output = consoleBuilder.ToString(); + var totalOutputLines = output.Split("\n").Length - 1; // ignore last item that also ends with \n + Assert.That(totalOutputLines, Is.EqualTo(versionVariables.Count())); + } + + [TestCase("Major", "0")] + [TestCase("MajorMinorPatch", "0.0.1")] + [TestCase("SemVer", "0.0.1-1")] + [TestCase("BuildMetaData", "''")] + [TestCase("AssemblySemVer", "0.0.1.0")] + [TestCase("PreReleaseTagWithDash", "-1")] + [TestCase("BranchName", "main")] + [TestCase("PreReleaseLabel", "''")] + [TestCase("PreReleaseLabelWithDash", "''")] + public void ShouldOutputAllDotEnvEntriesEvenForMinimalRepositories(string variableName, string expectedValue) + { + var fixture = CreateMinimalTestRepository(); + + var consoleBuilder = new StringBuilder(); + IConsole consoleAdapter = new TestConsoleAdapter(consoleBuilder); + + var sp = ConfigureServices(services => + { + var options = Options.Create(new GitVersionOptions { WorkingDirectory = fixture.RepositoryPath, RepositoryInfo = { TargetBranch = fixture.Repository.Head.CanonicalName }, Output = { OutputType.DotEnv } }); + var repository = fixture.Repository.ToGitRepository(); + + services.AddSingleton(options); + services.AddSingleton(repository); + services.AddSingleton(consoleAdapter); + }); + + var versionVariables = sp.GetRequiredService().CalculateVersionVariables(); + var outputGenerator = sp.GetRequiredService(); + + outputGenerator.Execute(versionVariables, new()); + var output = consoleBuilder.ToString(); + output.ShouldContain("GitVersion_" + variableName + "=" + expectedValue + "\n"); + } + + [TestCase] + public void ShouldOutputAllCalculatedVariablesAsDotEnvEntriesEvenForMinimalRepositories() + { + var fixture = CreateMinimalTestRepository(); + + var consoleBuilder = new StringBuilder(); + IConsole consoleAdapter = new TestConsoleAdapter(consoleBuilder); + + var sp = ConfigureServices(services => + { + var options = Options.Create(new GitVersionOptions { WorkingDirectory = fixture.RepositoryPath, RepositoryInfo = { TargetBranch = fixture.Repository.Head.CanonicalName }, Output = { OutputType.DotEnv } }); + var repository = fixture.Repository.ToGitRepository(); + + services.AddSingleton(options); + services.AddSingleton(repository); + services.AddSingleton(consoleAdapter); + }); + + var versionVariables = sp.GetRequiredService().CalculateVersionVariables(); + var outputGenerator = sp.GetRequiredService(); + + outputGenerator.Execute(versionVariables, new()); + var output = consoleBuilder.ToString(); + var totalOutputLines = output.Split("\n").Length - 1; // ignore last item that also ends with \n + Assert.That(totalOutputLines, Is.EqualTo(versionVariables.Count())); + } + private static EmptyRepositoryFixture CreateTestRepository() { var fixture = new EmptyRepositoryFixture(); @@ -80,4 +200,11 @@ private static EmptyRepositoryFixture CreateTestRepository() _ = fixture.Repository.MakeACommit(); return fixture; } + + private static EmptyRepositoryFixture CreateMinimalTestRepository() + { + var fixture = new EmptyRepositoryFixture(); + _ = fixture.Repository.MakeACommit(); + return fixture; + } } diff --git a/src/GitVersion.Output/OutputGenerator/OutputGenerator.cs b/src/GitVersion.Output/OutputGenerator/OutputGenerator.cs index 1da7fe356e..71eeedcbd0 100644 --- a/src/GitVersion.Output/OutputGenerator/OutputGenerator.cs +++ b/src/GitVersion.Output/OutputGenerator/OutputGenerator.cs @@ -28,11 +28,34 @@ internal sealed class OutputGenerator( public void Execute(GitVersionVariables variables, OutputContext context) { var gitVersionOptions = this.options.Value; + if (gitVersionOptions.Output.Contains(OutputType.BuildServer)) { this.buildAgent.WriteIntegration(this.console.WriteLine, variables, context.UpdateBuildNumber ?? true); } + if (gitVersionOptions.Output.Contains(OutputType.DotEnv)) + { + List dotEnvEntries = []; + foreach (var (key, value) in variables.OrderBy(x => x.Key)) + { + string prefixedKey = "GitVersion_" + key; + string environmentValue = "''"; + if (!value.IsNullOrEmpty()) + { + environmentValue = value; + } + dotEnvEntries.Add(prefixedKey + "=" + environmentValue); + } + + foreach(var dotEnvEntry in dotEnvEntries) + { + this.console.WriteLine(dotEnvEntry); + } + + return; + } + var json = this.serializer.ToJson(variables); if (gitVersionOptions.Output.Contains(OutputType.File)) { From 482a8bcd7e801932d685c8ecdbf2db3de5dd2c5c Mon Sep 17 00:00:00 2001 From: Bi0T1N Date: Wed, 12 Feb 2025 16:47:55 +0100 Subject: [PATCH 087/107] Move usage examples into docs section --- docs/input/docs/usage/cli/output.md | 14 ++++++++++++++ new-cli/command.md | 12 ------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/docs/input/docs/usage/cli/output.md b/docs/input/docs/usage/cli/output.md index d26bf5a84d..e8cdaf051d 100644 --- a/docs/input/docs/usage/cli/output.md +++ b/docs/input/docs/usage/cli/output.md @@ -21,3 +21,17 @@ For that you have to run `GitVersion.exe /output dotenv` and store the output into e.g. a `gitversion.env` file. These files can also be passed around in CI environments like [GitHub](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#passing-values-between-steps-and-jobs-in-a-workflow) or [GitLab](https://docs.gitlab.com/ee/ci/variables/#pass-an-environment-variable-to-another-job). +Below are some examples of using the Dotenv format in the Unix command line: +```bash +# Output version variables in Dotenv format +gitversion /output dotenv + +# Show only a subset of the version variables in Dotenv format +gitversion /output dotenv | grep -i "prerelease" + +# Show only a subset of the version variables that match the regex in Dotenv format +gitversion /output dotenv | grep -iE "major|sha=|_prerelease" + +# Write version variables in Dotenv format into a file +gitversion /output dotenv > gitversion.env +``` diff --git a/new-cli/command.md b/new-cli/command.md index 7e6d2aec3b..c137381b07 100644 --- a/new-cli/command.md +++ b/new-cli/command.md @@ -53,18 +53,6 @@ cat gitversion.json | gitversion output buildserver # Read version variables from stdin and write to Jenkins. cat gitversion.json | gitversion output buildserver --buildserver Jenkins -# Output version variables in Dotenv format -gitversion /output dotenv - -# Show only a subset of the version variables in Dotenv format (Unix syntax) -gitversion /output dotenv | grep -i "prerelease" - -# Show only a subset of the version variables that match the regex in Dotenv format (Unix syntax) -gitversion /output dotenv | grep -iE "major|sha=|_prerelease" - -# Write version variables in Dotenv format into a file -gitversion /output dotenv > gitversion.env - # Read version variables from stdin and write to globbed .wxi files. cat gitversion.json | gitversion output wix --path ./**/*.wxi From 7d301093fb4aad4e27cd3965b027b19a2c0fdc75 Mon Sep 17 00:00:00 2001 From: Bi0T1N Date: Thu, 13 Feb 2025 17:09:04 +0100 Subject: [PATCH 088/107] Make tests cross-platform compatible --- src/GitVersion.Output.Tests/Output/FormatArgumentTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GitVersion.Output.Tests/Output/FormatArgumentTests.cs b/src/GitVersion.Output.Tests/Output/FormatArgumentTests.cs index f85ac29366..b034ff8e1e 100644 --- a/src/GitVersion.Output.Tests/Output/FormatArgumentTests.cs +++ b/src/GitVersion.Output.Tests/Output/FormatArgumentTests.cs @@ -97,7 +97,7 @@ public void ShouldOutputDotEnvEntries(string variableName, string expectedValue) outputGenerator.Execute(versionVariables, new()); var output = consoleBuilder.ToString(); - output.ShouldContain("GitVersion_" + variableName + "=" + expectedValue + "\n"); + output.ShouldContain($"GitVersion_{variableName}={expectedValue}{SysEnv.NewLine}"); } [TestCase] @@ -123,7 +123,7 @@ public void ShouldOutputAllCalculatedVariablesAsDotEnvEntries() outputGenerator.Execute(versionVariables, new()); var output = consoleBuilder.ToString(); - var totalOutputLines = output.Split("\n").Length - 1; // ignore last item that also ends with \n + var totalOutputLines = output.Split(SysEnv.NewLine).Length - 1; // ignore last item that also ends with the newline string Assert.That(totalOutputLines, Is.EqualTo(versionVariables.Count())); } @@ -158,7 +158,7 @@ public void ShouldOutputAllDotEnvEntriesEvenForMinimalRepositories(string variab outputGenerator.Execute(versionVariables, new()); var output = consoleBuilder.ToString(); - output.ShouldContain("GitVersion_" + variableName + "=" + expectedValue + "\n"); + output.ShouldContain($"GitVersion_{variableName}={expectedValue}{SysEnv.NewLine}"); } [TestCase] @@ -184,7 +184,7 @@ public void ShouldOutputAllCalculatedVariablesAsDotEnvEntriesEvenForMinimalRepos outputGenerator.Execute(versionVariables, new()); var output = consoleBuilder.ToString(); - var totalOutputLines = output.Split("\n").Length - 1; // ignore last item that also ends with \n + var totalOutputLines = output.Split(SysEnv.NewLine).Length - 1; // ignore last item that also ends with the newline string Assert.That(totalOutputLines, Is.EqualTo(versionVariables.Count())); } From 7eabdfd199f12dec29006c0f2f0ae1f16ca237a5 Mon Sep 17 00:00:00 2001 From: Bi0T1N Date: Wed, 26 Feb 2025 22:13:28 +0100 Subject: [PATCH 089/107] Add missing whitespace after foreach --- src/GitVersion.Output/OutputGenerator/OutputGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitVersion.Output/OutputGenerator/OutputGenerator.cs b/src/GitVersion.Output/OutputGenerator/OutputGenerator.cs index 71eeedcbd0..ea9a1b06fe 100644 --- a/src/GitVersion.Output/OutputGenerator/OutputGenerator.cs +++ b/src/GitVersion.Output/OutputGenerator/OutputGenerator.cs @@ -48,7 +48,7 @@ public void Execute(GitVersionVariables variables, OutputContext context) dotEnvEntries.Add(prefixedKey + "=" + environmentValue); } - foreach(var dotEnvEntry in dotEnvEntries) + foreach (var dotEnvEntry in dotEnvEntries) { this.console.WriteLine(dotEnvEntry); } From 2602d51f55cd5b7e627b3a3723d88cd69c5e1fed Mon Sep 17 00:00:00 2001 From: Bi0T1N Date: Fri, 7 Mar 2025 20:30:57 +0100 Subject: [PATCH 090/107] Encapsulate all values into single quotes will be more future proof as it might not break on values that contain whitespaces etc --- .../Output/FormatArgumentTests.cs | 26 +++++++++---------- .../OutputGenerator/OutputGenerator.cs | 4 +-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/GitVersion.Output.Tests/Output/FormatArgumentTests.cs b/src/GitVersion.Output.Tests/Output/FormatArgumentTests.cs index b034ff8e1e..3bcec4b95c 100644 --- a/src/GitVersion.Output.Tests/Output/FormatArgumentTests.cs +++ b/src/GitVersion.Output.Tests/Output/FormatArgumentTests.cs @@ -68,13 +68,13 @@ public void ShouldOutputFormatWithEnvironmentVariablesTests(string format, strin output.ShouldBeEquivalentTo(expectedValue); } - [TestCase("Major", "1")] - [TestCase("MajorMinorPatch", "1.1.0")] - [TestCase("SemVer", "1.1.0-foo.1")] - [TestCase("PreReleaseTagWithDash", "-foo.1")] - [TestCase("AssemblySemFileVer", "1.1.0.0")] - [TestCase("BranchName", "feature/foo")] - [TestCase("FullSemVer", "1.1.0-foo.1+1")] + [TestCase("Major", "'1'")] + [TestCase("MajorMinorPatch", "'1.1.0'")] + [TestCase("SemVer", "'1.1.0-foo.1'")] + [TestCase("PreReleaseTagWithDash", "'-foo.1'")] + [TestCase("AssemblySemFileVer", "'1.1.0.0'")] + [TestCase("BranchName", "'feature/foo'")] + [TestCase("FullSemVer", "'1.1.0-foo.1+1'")] public void ShouldOutputDotEnvEntries(string variableName, string expectedValue) { var fixture = CreateTestRepository(); @@ -127,13 +127,13 @@ public void ShouldOutputAllCalculatedVariablesAsDotEnvEntries() Assert.That(totalOutputLines, Is.EqualTo(versionVariables.Count())); } - [TestCase("Major", "0")] - [TestCase("MajorMinorPatch", "0.0.1")] - [TestCase("SemVer", "0.0.1-1")] + [TestCase("Major", "'0'")] + [TestCase("MajorMinorPatch", "'0.0.1'")] + [TestCase("SemVer", "'0.0.1-1'")] [TestCase("BuildMetaData", "''")] - [TestCase("AssemblySemVer", "0.0.1.0")] - [TestCase("PreReleaseTagWithDash", "-1")] - [TestCase("BranchName", "main")] + [TestCase("AssemblySemVer", "'0.0.1.0'")] + [TestCase("PreReleaseTagWithDash", "'-1'")] + [TestCase("BranchName", "'main'")] [TestCase("PreReleaseLabel", "''")] [TestCase("PreReleaseLabelWithDash", "''")] public void ShouldOutputAllDotEnvEntriesEvenForMinimalRepositories(string variableName, string expectedValue) diff --git a/src/GitVersion.Output/OutputGenerator/OutputGenerator.cs b/src/GitVersion.Output/OutputGenerator/OutputGenerator.cs index ea9a1b06fe..8e53f306f8 100644 --- a/src/GitVersion.Output/OutputGenerator/OutputGenerator.cs +++ b/src/GitVersion.Output/OutputGenerator/OutputGenerator.cs @@ -40,12 +40,12 @@ public void Execute(GitVersionVariables variables, OutputContext context) foreach (var (key, value) in variables.OrderBy(x => x.Key)) { string prefixedKey = "GitVersion_" + key; - string environmentValue = "''"; + string environmentValue = ""; if (!value.IsNullOrEmpty()) { environmentValue = value; } - dotEnvEntries.Add(prefixedKey + "=" + environmentValue); + dotEnvEntries.Add($"{prefixedKey}='{environmentValue}'"); } foreach (var dotEnvEntry in dotEnvEntries) From 74c9868a13345556748c317dd039ffd8a2e56ede Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Tue, 11 Mar 2025 07:18:02 +0100 Subject: [PATCH 091/107] include contributors in release notes --- GitReleaseManager.yml | 1 + src/GitVersion.sln | 1 + 2 files changed, 2 insertions(+) diff --git a/GitReleaseManager.yml b/GitReleaseManager.yml index 5a85f67383..8e0b3fb546 100644 --- a/GitReleaseManager.yml +++ b/GitReleaseManager.yml @@ -31,6 +31,7 @@ create: sha-section-heading: "SHA256 Hashes of the release artifacts" sha-section-line-format: "- `{1}\t- {0}`" allow-update-to-published: true + include-contributors: true close: use-issue-comments: true issue-comment: |- diff --git a/src/GitVersion.sln b/src/GitVersion.sln index cf4704cb70..64df2b6e40 100644 --- a/src/GitVersion.sln +++ b/src/GitVersion.sln @@ -56,6 +56,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{7D3A83B4-9 ..\.gitignore = ..\.gitignore ..\GitVersion.yml = ..\GitVersion.yml ..\global.json = ..\global.json + ..\GitReleaseManager.yml = ..\GitReleaseManager.yml EndProjectSection EndProject Global From 3886a51ff5bf2d9c96c42f47c4770186b845cd88 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Wed, 12 Mar 2025 07:09:00 +0100 Subject: [PATCH 092/107] fix configuration file name casing un linux --- .../ConfigurationFileLocatorTests.cs | 16 ++++++ .../ConfigurationFileLocator.cs | 56 +++++++++++-------- 2 files changed, 49 insertions(+), 23 deletions(-) diff --git a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationFileLocatorTests.cs b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationFileLocatorTests.cs index 3d83a38e23..1074bc07d7 100644 --- a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationFileLocatorTests.cs +++ b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationFileLocatorTests.cs @@ -153,6 +153,22 @@ public void DoNotThrowWhenWorkingAndRepoPathsAreSame_WithDifferentCasing() Should.NotThrow(() => this.configFileLocator.Verify(this.workingPath, this.repoPath)); } + [Test] + public void DoNotThrowWhenFileNameAreSame_WithDifferentCasing() + { + this.workingPath = this.repoPath; + + this.gitVersionOptions = new() { ConfigurationInfo = { ConfigurationFile = "MyConfig.yaml" } }; + var sp = GetServiceProvider(this.gitVersionOptions); + this.configFileLocator = sp.GetRequiredService(); + this.fileSystem = sp.GetRequiredService(); + + using var _ = this.fileSystem.SetupConfigFile(path: this.workingPath, fileName: ConfigFile.ToLower()); + + var config = Should.NotThrow(() => this.configFileLocator.GetConfigurationFile(this.workingPath)); + config.ShouldNotBe(null); + } + [Test] public void DoNotThrowWhenConfigFileIsInSubDirectoryOfRepoPath() { diff --git a/src/GitVersion.Configuration/ConfigurationFileLocator.cs b/src/GitVersion.Configuration/ConfigurationFileLocator.cs index 752a7b6af7..c2a3ecbafa 100644 --- a/src/GitVersion.Configuration/ConfigurationFileLocator.cs +++ b/src/GitVersion.Configuration/ConfigurationFileLocator.cs @@ -16,7 +16,14 @@ internal class ConfigurationFileLocator( public const string DefaultAlternativeFileName = "GitVersion.yaml"; public const string DefaultFileNameDotted = $".{DefaultFileName}"; public const string DefaultAlternativeFileNameDotted = $".{DefaultAlternativeFileName}"; - public List SupportedConfigFileNames = [DefaultFileName, DefaultAlternativeFileName, DefaultFileNameDotted, DefaultAlternativeFileNameDotted]; + + private readonly string[] SupportedConfigFileNames = + [ + DefaultFileName, + DefaultAlternativeFileName, + DefaultFileNameDotted, + DefaultAlternativeFileNameDotted + ]; private readonly IFileSystem fileSystem = fileSystem.NotNull(); private readonly ILog log = log.NotNull(); @@ -35,21 +42,28 @@ public void Verify(string? workingDirectory, string? projectRootDirectory) { if (directory is null) return null; - string?[] candidates = [this.ConfigurationFile, .. SupportedConfigFileNames]; - var candidatePaths = - from candidate in candidates - where !candidate.IsNullOrWhiteSpace() - select PathHelper.Combine(directory, candidate); + string[] candidates = !string.IsNullOrWhiteSpace(this.ConfigurationFile) + ? [this.ConfigurationFile, .. this.SupportedConfigFileNames] + : this.SupportedConfigFileNames; - foreach (var candidatePath in candidatePaths) + foreach (var fileName in candidates) { - this.log.Debug($"Trying to find configuration file at '{candidatePath}'"); - if (fileSystem.File.Exists(candidatePath)) + this.log.Debug($"Trying to find configuration file {fileName} at '{directory}'"); + if (directory != null && fileSystem.Directory.Exists(directory)) { - this.log.Info($"Found configuration file at '{candidatePath}'"); - return candidatePath; + var files = fileSystem.Directory.GetFiles(directory); + + var matchingFile = files.FirstOrDefault(file => + string.Equals(fileSystem.Path.GetFileName(file), fileName, StringComparison.OrdinalIgnoreCase)); + + if (matchingFile != null) + { + this.log.Info($"Found configuration file at '{matchingFile}'"); + return matchingFile; + } } - this.log.Debug($"Configuration file not found at '{candidatePath}'"); + + this.log.Debug($"Configuration file {fileName} not found at '{directory}'"); } return null; @@ -60,22 +74,18 @@ private void WarnAboutAmbiguousConfigFileSelection(string? workingDirectory, str var workingConfigFile = GetConfigurationFile(workingDirectory); var projectRootConfigFile = GetConfigurationFile(projectRootDirectory); - var hasConfigInWorkingDirectory = workingConfigFile != null; - var hasConfigInProjectRootDirectory = projectRootConfigFile != null; + var hasConfigInWorkingDirectory = workingConfigFile is not null; + var hasConfigInProjectRootDirectory = projectRootConfigFile is not null; if (hasConfigInProjectRootDirectory && hasConfigInWorkingDirectory) { throw new WarningException($"Ambiguous configuration file selection from '{workingConfigFile}' and '{projectRootConfigFile}'"); } - if (!hasConfigInProjectRootDirectory && !hasConfigInWorkingDirectory) - { - if (!SupportedConfigFileNames.Any(entry => entry.Equals(this.ConfigurationFile, StringComparison.OrdinalIgnoreCase))) - { - workingConfigFile = PathHelper.Combine(workingDirectory, this.ConfigurationFile); - projectRootConfigFile = PathHelper.Combine(projectRootDirectory, this.ConfigurationFile); - throw new WarningException($"The configuration file was not found at '{workingConfigFile}' or '{projectRootConfigFile}'"); - } - } + if (hasConfigInProjectRootDirectory || hasConfigInWorkingDirectory || this.SupportedConfigFileNames.Any(entry => entry.Equals(this.ConfigurationFile, StringComparison.OrdinalIgnoreCase))) return; + + workingConfigFile = PathHelper.Combine(workingDirectory, this.ConfigurationFile); + projectRootConfigFile = PathHelper.Combine(projectRootDirectory, this.ConfigurationFile); + throw new WarningException($"The configuration file was not found at '{workingConfigFile}' or '{projectRootConfigFile}'"); } } From 0388b70c84d3b2eabf72988ecee5fc9450c73b7f Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Wed, 12 Mar 2025 08:54:16 +0100 Subject: [PATCH 093/107] fix UTF8 files with BOM --- .editorconfig | 2 +- build/.run/Build.run.xml | 2 +- build/.run/Clean.run.xml | 2 +- build/.run/Package.run.xml | 2 +- build/.run/PublishCoverage.run.xml | 2 +- build/.run/Test.run.xml | 2 +- build/CI.sln | 2 +- build/CI.sln.DotSettings | 2 +- build/Directory.Build.props | 2 +- build/build/Build.csproj.DotSettings | 2 +- new-cli/.run/Tester.run.xml | 2 +- new-cli/GitVersion.Calculation/GitVersion.Calculation.csproj | 2 +- new-cli/GitVersion.sln | 2 +- new-cli/GitVersion.sln.DotSettings | 2 +- new-cli/nuget.config | 2 +- src/.run/schema.run.xml | 2 +- src/GitVersion.App.Tests/TestBuildFile.proj | 2 +- ...rTests.ShouldProperlyOutputNamespaceDeclaration.approved.txt | 2 +- ...rTests.ShouldProperlyOutputNamespaceDeclaration.approved.txt | 2 +- .../AssemblyInfo/AddFormats/VersionAssemblyInfo.fs | 2 +- .../AssemblyInfo/Templates/VersionAssemblyInfo.cs | 2 +- .../AssemblyInfo/Templates/VersionAssemblyInfo.fs | 2 +- .../AssemblyInfo/Templates/VersionAssemblyInfo.vb | 2 +- src/GitVersion.sln.DotSettings | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.editorconfig b/.editorconfig index cd66ed516f..317101a73a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,12 +2,12 @@ # top-most EditorConfig file root = true +charset = utf-8 [*] indent_style = space indent_size = 4 end_of_line = lf -charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true diff --git a/build/.run/Build.run.xml b/build/.run/Build.run.xml index 00d2bc0df3..e178484aae 100644 --- a/build/.run/Build.run.xml +++ b/build/.run/Build.run.xml @@ -1,4 +1,4 @@ - + From 8985ccd7e4743fd3d001f0aeafff159612fc7c5d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 14 Mar 2025 15:53:25 +0000 Subject: [PATCH 095/107] (deps): Bump the microsoft group across 2 directories with 1 update Bumps the microsoft group with 1 update in the /new-cli directory: [System.IO.Abstractions](https://github.com/TestableIO/System.IO.Abstractions). Bumps the microsoft group with 1 update in the /src directory: [System.IO.Abstractions](https://github.com/TestableIO/System.IO.Abstractions). Updates `System.IO.Abstractions` from 22.0.11 to 22.0.12 - [Release notes](https://github.com/TestableIO/System.IO.Abstractions/releases) - [Commits](https://github.com/TestableIO/System.IO.Abstractions/compare/v22.0.11...v22.0.12) Updates `System.IO.Abstractions` from 22.0.11 to 22.0.12 - [Release notes](https://github.com/TestableIO/System.IO.Abstractions/releases) - [Commits](https://github.com/TestableIO/System.IO.Abstractions/compare/v22.0.11...v22.0.12) --- updated-dependencies: - dependency-name: System.IO.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft - dependency-name: System.IO.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 2 +- src/Directory.Packages.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index d6293e8afc..d7b98fe599 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 6f3a3e8b36..fce833a52d 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -38,7 +38,7 @@ - + From 08e8550abdceec97d11fefd0d743ee50970ea5ef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 08:44:21 +0000 Subject: [PATCH 096/107] (deps): Bump System.CommandLine Bumps the microsoft group with 1 update in the /new-cli directory: [System.CommandLine](https://github.com/dotnet/command-line-api). Updates `System.CommandLine` from 2.0.0-beta4.25153.1 to 2.0.0-beta4.25167.1 - [Release notes](https://github.com/dotnet/command-line-api/releases) - [Changelog](https://github.com/dotnet/command-line-api/blob/main/docs/History.md) - [Commits](https://github.com/dotnet/command-line-api/commits) --- updated-dependencies: - dependency-name: System.CommandLine dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index d7b98fe599..a4334032ec 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -20,7 +20,7 @@ - + From 6daf779cddae5d008d055ed7d59d0bf512f1981d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 09:16:04 +0000 Subject: [PATCH 097/107] (deps): Bump JunitXml.TestLogger from 6.0.0 to 6.1.0 in /src Bumps [JunitXml.TestLogger](https://github.com/spekt/testlogger) from 6.0.0 to 6.1.0. - [Release notes](https://github.com/spekt/testlogger/releases) - [Changelog](https://github.com/spekt/testlogger/blob/master/CHANGELOG.md) - [Commits](https://github.com/spekt/testlogger/compare/v6.0.0...v6.1.0) --- updated-dependencies: - dependency-name: JunitXml.TestLogger dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index fce833a52d..929249a14b 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -20,7 +20,7 @@ - + From 57ccd84cd82e3e8d81b6bded8929edb0e272181a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Mar 2025 15:42:25 +0000 Subject: [PATCH 098/107] (deps): Bump System.CommandLine Bumps the microsoft group with 1 update in the /new-cli directory: [System.CommandLine](https://github.com/dotnet/command-line-api). Updates `System.CommandLine` from 2.0.0-beta4.25167.1 to 2.0.0-beta4.25168.1 - [Release notes](https://github.com/dotnet/command-line-api/releases) - [Changelog](https://github.com/dotnet/command-line-api/blob/main/docs/History.md) - [Commits](https://github.com/dotnet/command-line-api/commits) --- updated-dependencies: - dependency-name: System.CommandLine dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index a4334032ec..c7b3f26f27 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -20,7 +20,7 @@ - + From ea67ff80743c651d39c3b0e1ef8f6cbdaf074072 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Mar 2025 16:32:50 +0000 Subject: [PATCH 099/107] (deps): Bump dotnet-sdk from 9.0.201 to 9.0.202 Bumps [dotnet-sdk](https://github.com/dotnet/sdk) from 9.0.201 to 9.0.202. - [Release notes](https://github.com/dotnet/sdk/releases) - [Commits](https://github.com/dotnet/sdk/compare/v9.0.201...v9.0.202) --- updated-dependencies: - dependency-name: dotnet-sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index de8635bb7c..983865216b 100644 --- a/global.json +++ b/global.json @@ -5,6 +5,6 @@ "src" ], "sdk": { - "version": "9.0.201" + "version": "9.0.202" } } From e63923ba25c42f8cdf9e9938eb57b8dd77878446 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Mar 2025 15:26:02 +0000 Subject: [PATCH 100/107] (deps): Bump System.CommandLine Bumps the microsoft group with 1 update in the /new-cli directory: [System.CommandLine](https://github.com/dotnet/command-line-api). Updates `System.CommandLine` from 2.0.0-beta4.25168.1 to 2.0.0-beta5.25170.1 - [Release notes](https://github.com/dotnet/command-line-api/releases) - [Changelog](https://github.com/dotnet/command-line-api/blob/main/docs/History.md) - [Commits](https://github.com/dotnet/command-line-api/commits) --- updated-dependencies: - dependency-name: System.CommandLine dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index c7b3f26f27..f60736cd7a 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -20,7 +20,7 @@ - + From 122bdd1ad857a8389f239a44f64c8ff75037ed2d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Mar 2025 16:59:04 +0000 Subject: [PATCH 101/107] (deps): Bump the serilog group across 1 directory with 2 updates Bumps the serilog group with 2 updates in the /new-cli directory: [Microsoft.Extensions.DependencyInjection.Abstractions](https://github.com/dotnet/runtime) and [Serilog.Extensions.Logging](https://github.com/serilog/serilog-extensions-logging). Updates `Microsoft.Extensions.DependencyInjection.Abstractions` from 9.0.3 to 9.0.0 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.3...v9.0.0) Updates `Serilog.Extensions.Logging` from 9.0.0 to 9.0.1 - [Release notes](https://github.com/serilog/serilog-extensions-logging/releases) - [Commits](https://github.com/serilog/serilog-extensions-logging/compare/v9.0.0...v9.0.1) --- updated-dependencies: - dependency-name: Microsoft.Extensions.DependencyInjection.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: serilog - dependency-name: Serilog.Extensions.Logging dependency-type: direct:production update-type: version-update:semver-patch dependency-group: serilog ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index f60736cd7a..97eddeaa42 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -16,7 +16,7 @@ - + From 70eff5cfafb74cc2fe14f8fdcb14590e14e8b650 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Mar 2025 17:28:53 +0000 Subject: [PATCH 102/107] (deps): Bump System.CommandLine Bumps the microsoft group with 1 update in the /new-cli directory: [System.CommandLine](https://github.com/dotnet/command-line-api). Updates `System.CommandLine` from 2.0.0-beta5.25170.1 to 2.0.0-beta5.25174.1 - [Release notes](https://github.com/dotnet/command-line-api/releases) - [Changelog](https://github.com/dotnet/command-line-api/blob/main/docs/History.md) - [Commits](https://github.com/dotnet/command-line-api/commits) --- updated-dependencies: - dependency-name: System.CommandLine dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoft ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index 97eddeaa42..f652cba978 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -20,7 +20,7 @@ - + From 67b3bfe982ce89631607804bc714724cf42b1b0b Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Tue, 1 Apr 2025 07:53:17 +0200 Subject: [PATCH 103/107] Renamed build agent methods for consistency Renamed `GenerateSetVersionMessage` to `SetBuildNumber` and `GenerateSetParameterMessage` to `SetOutputVariables` across all build agents. Updated tests and integrations to reflect these changes for clearer method purpose alignment. --- .../Agents/AzurePipelinesTests.cs | 14 +++++++------- .../Agents/BitBucketPipelinesTests.cs | 6 +++--- .../Agents/BuildKiteTests.cs | 8 ++++---- .../Agents/BuildServerBaseTests.cs | 6 +++--- .../Agents/ContinuaCiTests.cs | 4 ++-- .../Agents/EnvRunTests.cs | 8 ++++---- .../Agents/GitHubActionsTests.cs | 16 ++++++++-------- .../Agents/GitLabCiTests.cs | 12 ++++++------ .../Agents/JenkinsTests.cs | 12 ++++++------ .../Agents/MyGetTests.cs | 17 +++++------------ .../Agents/SpaceAutomationTests.cs | 4 ++-- .../Agents/TeamCityTests.cs | 8 ++++---- src/GitVersion.BuildAgents/Agents/AppVeyor.cs | 4 ++-- .../Agents/AzurePipelines.cs | 4 ++-- .../Agents/BitBucketPipelines.cs | 4 ++-- .../Agents/BuildKite.cs | 4 ++-- .../Agents/CodeBuild.cs | 6 +++--- .../Agents/ContinuaCi.cs | 4 ++-- src/GitVersion.BuildAgents/Agents/Drone.cs | 4 ++-- src/GitVersion.BuildAgents/Agents/EnvRun.cs | 4 ++-- .../Agents/GitHubActions.cs | 4 ++-- src/GitVersion.BuildAgents/Agents/GitLabCi.cs | 6 +++--- src/GitVersion.BuildAgents/Agents/Jenkins.cs | 6 +++--- src/GitVersion.BuildAgents/Agents/MyGet.cs | 10 +++------- .../Agents/SpaceAutomation.cs | 4 ++-- src/GitVersion.BuildAgents/Agents/TeamCity.cs | 4 ++-- src/GitVersion.BuildAgents/Agents/TravisCI.cs | 4 ++-- src/GitVersion.Core/Agents/BuildAgentBase.cs | 19 ++++++++++--------- src/GitVersion.Core/Agents/LocalBuild.cs | 4 ++-- 29 files changed, 100 insertions(+), 110 deletions(-) diff --git a/src/GitVersion.BuildAgents.Tests/Agents/AzurePipelinesTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/AzurePipelinesTests.cs index 025cbb5c5f..e647086ad3 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/AzurePipelinesTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/AzurePipelinesTests.cs @@ -26,18 +26,18 @@ public void SetEnvironmentVariableForTest() public void ClearEnvironmentVariableForTest() => this.environment.SetEnvironmentVariable(key, null); [Test] - public void DevelopBranch() + public void ShouldSetBuildNumber() { var vars = new TestableGitVersionVariables { FullSemVer = "0.0.0-Unstable4" }; - var vsVersion = this.buildServer.GenerateSetVersionMessage(vars); + var vsVersion = this.buildServer.SetBuildNumber(vars); vsVersion.ShouldBe("##vso[build.updatebuildnumber]Some Build_Value 0.0.0-Unstable4 20151310.3 $(UnknownVar) Release"); } [Test] - public void EscapeValues() + public void ShouldSetOutputVariables() { - var vsVersion = this.buildServer.GenerateSetParameterMessage("Foo", "0.8.0-unstable568 Branch:'develop' Sha:'ee69bff1087ebc95c6b43aa2124bd58f5722e0cb'"); + var vsVersion = this.buildServer.SetOutputVariables("Foo", "0.8.0-unstable568 Branch:'develop' Sha:'ee69bff1087ebc95c6b43aa2124bd58f5722e0cb'"); vsVersion.ShouldContain("##vso[task.setvariable variable=GitVersion.Foo]0.8.0-unstable568 Branch:'develop' Sha:'ee69bff1087ebc95c6b43aa2124bd58f5722e0cb'"); vsVersion.ShouldContain("##vso[task.setvariable variable=GitVersion.Foo;isOutput=true]0.8.0-unstable568 Branch:'develop' Sha:'ee69bff1087ebc95c6b43aa2124bd58f5722e0cb'"); @@ -50,7 +50,7 @@ public void MissingEnvShouldNotBlowUp() const string semver = "0.0.0-Unstable4"; var vars = new TestableGitVersionVariables { FullSemVer = semver }; - var vsVersion = this.buildServer.GenerateSetVersionMessage(vars); + var vsVersion = this.buildServer.SetBuildNumber(vars); vsVersion.ShouldBe(semver); } @@ -62,7 +62,7 @@ public void AzurePipelinesBuildNumberWithFullSemVer(string buildNumberFormat, st { this.environment.SetEnvironmentVariable(key, buildNumberFormat); var vars = new TestableGitVersionVariables { FullSemVer = myFullSemVer }; - var logMessage = this.buildServer.GenerateSetVersionMessage(vars); + var logMessage = this.buildServer.SetBuildNumber(vars); logMessage.ShouldBe(logPrefix + expectedBuildNumber); } @@ -74,7 +74,7 @@ public void AzurePipelinesBuildNumberWithSemVer(string buildNumberFormat, string { this.environment.SetEnvironmentVariable(key, buildNumberFormat); var vars = new TestableGitVersionVariables { SemVer = mySemVer }; - var logMessage = this.buildServer.GenerateSetVersionMessage(vars); + var logMessage = this.buildServer.SetBuildNumber(vars); logMessage.ShouldBe(logPrefix + expectedBuildNumber); } } diff --git a/src/GitVersion.BuildAgents.Tests/Agents/BitBucketPipelinesTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/BitBucketPipelinesTests.cs index dbaef24ea1..a8a39cbca0 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/BitBucketPipelinesTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/BitBucketPipelinesTests.cs @@ -46,7 +46,7 @@ public void CalculateVersionOnMainBranch() this.environment.SetEnvironmentVariable(BitBucketPipelines.BranchEnvironmentVariableName, "refs/heads/main"); var vars = new TestableGitVersionVariables { FullSemVer = "1.2.3" }; - var vsVersion = this.buildServer.GenerateSetVersionMessage(vars); + var vsVersion = this.buildServer.SetBuildNumber(vars); vsVersion.ShouldBe("1.2.3"); } @@ -58,7 +58,7 @@ public void CalculateVersionOnDevelopBranch() this.environment.SetEnvironmentVariable(BitBucketPipelines.BranchEnvironmentVariableName, "refs/heads/develop"); var vars = new TestableGitVersionVariables { FullSemVer = "1.2.3-unstable.4" }; - var vsVersion = this.buildServer.GenerateSetVersionMessage(vars); + var vsVersion = this.buildServer.SetBuildNumber(vars); vsVersion.ShouldBe("1.2.3-unstable.4"); } @@ -70,7 +70,7 @@ public void CalculateVersionOnFeatureBranch() this.environment.SetEnvironmentVariable(BitBucketPipelines.BranchEnvironmentVariableName, "refs/heads/feature/my-work"); var vars = new TestableGitVersionVariables { FullSemVer = "1.2.3-beta.4" }; - var vsVersion = this.buildServer.GenerateSetVersionMessage(vars); + var vsVersion = this.buildServer.SetBuildNumber(vars); vsVersion.ShouldBe("1.2.3-beta.4"); } diff --git a/src/GitVersion.BuildAgents.Tests/Agents/BuildKiteTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/BuildKiteTests.cs index 3cb40d44ec..516bf2da94 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/BuildKiteTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/BuildKiteTests.cs @@ -73,23 +73,23 @@ public void GetCurrentBranchShouldHandlePullRequests() } [Test] - public void GetSetParameterMessageShouldReturnEmptyArray() + public void ShouldSetOutputVariables() { // Act - var result = this.buildServer.GenerateSetParameterMessage("Foo", "Bar"); + var result = this.buildServer.SetOutputVariables("Foo", "Bar"); // Assert result.ShouldBeEmpty(); } [Test] - public void GetEmptyGenerateSetVersionMessage() + public void ShouldSetBuildNumber() { // Arrange var vars = new TestableGitVersionVariables { FullSemVer = "1.0.0" }; // Act - var message = this.buildServer.GenerateSetVersionMessage(vars); + var message = this.buildServer.SetBuildNumber(vars); // Assert message.ShouldBeEmpty(); diff --git a/src/GitVersion.BuildAgents.Tests/Agents/BuildServerBaseTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/BuildServerBaseTests.cs index 0042b69743..44200014a9 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/BuildServerBaseTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/BuildServerBaseTests.cs @@ -46,7 +46,7 @@ public void BuildNumberIsFullSemVer() writes = []; buildAgent.WriteIntegration(writes.Add, variables, false); - writes.ShouldNotContain(x => x != null && x.StartsWith("Executing GenerateSetVersionMessage for ")); + writes.ShouldNotContain(x => x != null && x.StartsWith("Set Build Number for ")); } private class BuildAgent(IEnvironment environment, ILog log, IFileSystem fileSystem) : BuildAgentBase(environment, log, fileSystem) @@ -55,8 +55,8 @@ private class BuildAgent(IEnvironment environment, ILog log, IFileSystem fileSys public override bool CanApplyToCurrentContext() => throw new NotImplementedException(); - public override string GenerateSetVersionMessage(GitVersionVariables variables) => variables.FullSemVer; + public override string SetBuildNumber(GitVersionVariables variables) => variables.FullSemVer; - public override string[] GenerateSetParameterMessage(string name, string? value) => []; + public override string[] SetOutputVariables(string name, string? value) => []; } } diff --git a/src/GitVersion.BuildAgents.Tests/Agents/ContinuaCiTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/ContinuaCiTests.cs index 45f4882ea6..6ed2ff100e 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/ContinuaCiTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/ContinuaCiTests.cs @@ -12,11 +12,11 @@ public class ContinuaCiTests : TestBase public void SetUp() => this.sp = ConfigureServices(services => services.AddSingleton()); [Test] - public void GenerateBuildVersion() + public void ShouldSetBuildNumber() { var buildServer = this.sp.GetRequiredService(); var vars = new TestableGitVersionVariables { FullSemVer = "0.0.0-Beta4.7" }; - var continuaCiVersion = buildServer.GenerateSetVersionMessage(vars); + var continuaCiVersion = buildServer.SetBuildNumber(vars); Assert.That(continuaCiVersion, Is.EqualTo("@@continua[setBuildVersion value='0.0.0-Beta4.7']")); } } diff --git a/src/GitVersion.BuildAgents.Tests/Agents/EnvRunTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/EnvRunTests.cs index f7df7ae10d..bff6125322 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/EnvRunTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/EnvRunTests.cs @@ -52,18 +52,18 @@ public void CanApplyToCurrentContextEnvironmentVariableNotSet() [TestCase("1.2.3")] [TestCase("1.2.3-rc4")] - public void GenerateSetVersionMessage(string fullSemVer) + public void ShouldSetBuildNumber(string fullSemVer) { var vars = new TestableGitVersionVariables { FullSemVer = fullSemVer }; - var version = this.buildServer.GenerateSetVersionMessage(vars); + var version = this.buildServer.SetBuildNumber(vars); version.ShouldBe(fullSemVer); } [TestCase("Version", "1.2.3", "@@envrun[set name='GitVersion_Version' value='1.2.3']")] [TestCase("Version", "1.2.3-rc4", "@@envrun[set name='GitVersion_Version' value='1.2.3-rc4']")] - public void GenerateSetParameterMessage(string name, string? value, string expected) + public void ShouldSetOutputVariables(string name, string? value, string expected) { - var output = this.buildServer.GenerateSetParameterMessage(name, value); + var output = this.buildServer.SetOutputVariables(name, value); output.ShouldHaveSingleItem(); output[0].ShouldBe(expected); } diff --git a/src/GitVersion.BuildAgents.Tests/Agents/GitHubActionsTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/GitHubActionsTests.cs index 83c40c5d0f..34f7c43140 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/GitHubActionsTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/GitHubActionsTests.cs @@ -103,23 +103,23 @@ public void GetCurrentBranchShouldHandlePullRequests() } [Test] - public void GetSetParameterMessage() + public void ShouldSetOutputVariables() { // Assert this.environment.GetEnvironmentVariable("GitVersion_Something").ShouldBeNullOrWhiteSpace(); // Act - var result = this.buildServer.GenerateSetParameterMessage("GitVersion_Something", "1.0.0"); + var result = this.buildServer.SetOutputVariables("GitVersion_Something", "1.0.0"); // Assert result.ShouldContain(_ => true, 0); } [Test] - public void SkipEmptySetParameterMessage() + public void SkipEmptyOutputVariables() { // Act - var result = this.buildServer.GenerateSetParameterMessage("Hello", string.Empty); + var result = this.buildServer.SetOutputVariables("Hello", string.Empty); // Assert result.ShouldBeEquivalentTo(Array.Empty()); @@ -140,7 +140,7 @@ public void ShouldWriteIntegration() this.buildServer.WriteIntegration(s => list.Add(s), vars); // Assert - var expected = new List { "Executing GenerateSetVersionMessage for 'GitHubActions'.", "", "Executing GenerateBuildLogOutput for 'GitHubActions'.", "Writing version variables to $GITHUB_ENV file for 'GitHubActions'." }; + var expected = new List { "Set Build Number for 'GitHubActions'.", "", "Set Output Variables for 'GitHubActions'.", "Writing version variables to $GITHUB_ENV file for 'GitHubActions'." }; string.Join(PathHelper.NewLine, list) .ShouldBe(string.Join(PathHelper.NewLine, expected)); @@ -167,17 +167,17 @@ public void ShouldNotWriteIntegration() // Act this.buildServer.WriteIntegration(s => list.Add(s), vars, false); - list.ShouldNotContain(x => x != null && x.StartsWith("Executing GenerateSetVersionMessage for ")); + list.ShouldNotContain(x => x != null && x.StartsWith("Set Build Number for ")); } [Test] - public void GetEmptyGenerateSetVersionMessage() + public void ShouldSetBuildNumber() { // Arrange var vars = new TestableGitVersionVariables { FullSemVer = "1.0.0" }; // Act - var message = this.buildServer.GenerateSetVersionMessage(vars); + var message = this.buildServer.SetBuildNumber(vars); // Assert message.ShouldBeEmpty(); diff --git a/src/GitVersion.BuildAgents.Tests/Agents/GitLabCiTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/GitLabCiTests.cs index 06f05ac711..9f78e800a7 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/GitLabCiTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/GitLabCiTests.cs @@ -29,18 +29,18 @@ public void SetUp() public void TearDown() => this.environment.SetEnvironmentVariable(GitLabCi.EnvironmentVariableName, null); [Test] - public void GenerateSetVersionMessageReturnsVersionAsIsAlthoughThisIsNotUsedByJenkins() + public void ShouldSetBuildNumber() { var vars = new TestableGitVersionVariables { FullSemVer = "0.0.0-Beta4.7" }; - this.buildServer.GenerateSetVersionMessage(vars).ShouldBe("0.0.0-Beta4.7"); + this.buildServer.SetBuildNumber(vars).ShouldBe("0.0.0-Beta4.7"); } [Test] - public void GenerateMessageTest() + public void ShouldSetOutputVariables() { - var generatedParameterMessages = this.buildServer.GenerateSetParameterMessage("name", "value"); - generatedParameterMessages.Length.ShouldBe(1); - generatedParameterMessages[0].ShouldBe("GitVersion_name=value"); + var result = this.buildServer.SetOutputVariables("name", "value"); + result.Length.ShouldBe(1); + result[0].ShouldBe("GitVersion_name=value"); } [TestCase("main", "main")] diff --git a/src/GitVersion.BuildAgents.Tests/Agents/JenkinsTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/JenkinsTests.cs index 451a1b4dd9..0899cd8c31 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/JenkinsTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/JenkinsTests.cs @@ -94,18 +94,18 @@ public void JenkinsTakesBranchNameInPipelineAsCode() } [Test] - public void GenerateSetVersionMessageReturnsVersionAsIsAlthoughThisIsNotUsedByJenkins() + public void ShouldSetBuildNumber() { var vars = new TestableGitVersionVariables { FullSemVer = "0.0.0-Beta4.7" }; - this.buildServer.GenerateSetVersionMessage(vars).ShouldBe("0.0.0-Beta4.7"); + this.buildServer.SetBuildNumber(vars).ShouldBe("0.0.0-Beta4.7"); } [Test] - public void GenerateMessageTest() + public void ShouldSetOutputVariables() { - var generatedParameterMessages = this.buildServer.GenerateSetParameterMessage("name", "value"); - generatedParameterMessages.Length.ShouldBe(1); - generatedParameterMessages[0].ShouldBe("GitVersion_name=value"); + var result = this.buildServer.SetOutputVariables("name", "value"); + result.Length.ShouldBe(1); + result[0].ShouldBe("GitVersion_name=value"); } [Test] diff --git a/src/GitVersion.BuildAgents.Tests/Agents/MyGetTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/MyGetTests.cs index 73eb8fb787..9894f777ef 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/MyGetTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/MyGetTests.cs @@ -16,24 +16,17 @@ public void SetUp() } [Test] - public void DevelopBranch() + public void ShouldSetBuildNumber() { var vars = new TestableGitVersionVariables { FullSemVer = "0.0.0-Unstable4" }; - var message = this.buildServer.GenerateSetVersionMessage(vars); - Assert.That(message, Is.EqualTo(null)); + var message = this.buildServer.SetBuildNumber(vars); + Assert.That(message, Is.EqualTo("##myget[buildNumber '0.0.0-Unstable4']")); } [Test] - public void EscapeValues() + public void ShouldSetOutputVariables() { - var message = this.buildServer.GenerateSetParameterMessage("Foo", "0.8.0-unstable568 Branch:'develop' Sha:'ee69bff1087ebc95c6b43aa2124bd58f5722e0cb'"); + var message = this.buildServer.SetOutputVariables("Foo", "0.8.0-unstable568 Branch:'develop' Sha:'ee69bff1087ebc95c6b43aa2124bd58f5722e0cb'"); Assert.That(message[0], Is.EqualTo("##myget[setParameter name='GitVersion.Foo' value='0.8.0-unstable568 Branch:|'develop|' Sha:|'ee69bff1087ebc95c6b43aa2124bd58f5722e0cb|'']")); } - - [Test] - public void BuildNumber() - { - var message = this.buildServer.GenerateSetParameterMessage("SemVer", "0.8.0-unstable568"); - Assert.That(message[1], Is.EqualTo("##myget[buildNumber '0.8.0-unstable568']")); - } } diff --git a/src/GitVersion.BuildAgents.Tests/Agents/SpaceAutomationTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/SpaceAutomationTests.cs index 9afdb28362..c330ab2ea7 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/SpaceAutomationTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/SpaceAutomationTests.cs @@ -84,13 +84,13 @@ public void GetCurrentBranchShouldHandlePullRequests() } [Test] - public void GetEmptyGenerateSetVersionMessage() + public void ShouldSetBuildNumber() { // Arrange var vars = new TestableGitVersionVariables { FullSemVer = "1.0.0" }; // Act - var message = this.buildServer.GenerateSetVersionMessage(vars); + var message = this.buildServer.SetBuildNumber(vars); // Assert message.ShouldBeEmpty(); diff --git a/src/GitVersion.BuildAgents.Tests/Agents/TeamCityTests.cs b/src/GitVersion.BuildAgents.Tests/Agents/TeamCityTests.cs index f2364e3aaf..d3cbca95cf 100644 --- a/src/GitVersion.BuildAgents.Tests/Agents/TeamCityTests.cs +++ b/src/GitVersion.BuildAgents.Tests/Agents/TeamCityTests.cs @@ -16,17 +16,17 @@ public void SetUp() } [Test] - public void DevelopBranch() + public void ShouldSetBuildNumber() { var vars = new TestableGitVersionVariables { FullSemVer = "0.0.0-Unstable4" }; - var tcVersion = this.buildServer.GenerateSetVersionMessage(vars); + var tcVersion = this.buildServer.SetBuildNumber(vars); Assert.That(tcVersion, Is.EqualTo("##teamcity[buildNumber '0.0.0-Unstable4']")); } [Test] - public void EscapeValues() + public void ShouldSetOutputVariables() { - var tcVersion = this.buildServer.GenerateSetParameterMessage("Foo", "0.8.0-unstable568 Branch:'develop' Sha:'ee69bff1087ebc95c6b43aa2124bd58f5722e0cb'"); + var tcVersion = this.buildServer.SetOutputVariables("Foo", "0.8.0-unstable568 Branch:'develop' Sha:'ee69bff1087ebc95c6b43aa2124bd58f5722e0cb'"); Assert.Multiple(() => { Assert.That(tcVersion[0], Is.EqualTo("##teamcity[setParameter name='GitVersion.Foo' value='0.8.0-unstable568 Branch:|'develop|' Sha:|'ee69bff1087ebc95c6b43aa2124bd58f5722e0cb|'']")); diff --git a/src/GitVersion.BuildAgents/Agents/AppVeyor.cs b/src/GitVersion.BuildAgents/Agents/AppVeyor.cs index c3b73be7f9..49c8bf4e6c 100644 --- a/src/GitVersion.BuildAgents/Agents/AppVeyor.cs +++ b/src/GitVersion.BuildAgents/Agents/AppVeyor.cs @@ -11,7 +11,7 @@ internal class AppVeyor(IEnvironment environment, ILog log, IFileSystem fileSyst protected override string EnvironmentVariable => EnvironmentVariableName; - public override string GenerateSetVersionMessage(GitVersionVariables variables) + public override string SetBuildNumber(GitVersionVariables variables) { var buildNumber = Environment.GetEnvironmentVariable("APPVEYOR_BUILD_NUMBER"); var apiUrl = Environment.GetEnvironmentVariable("APPVEYOR_API_URL") ?? throw new Exception("APPVEYOR_API_URL environment variable not set"); @@ -38,7 +38,7 @@ public override string GenerateSetVersionMessage(GitVersionVariables variables) return $"Set AppVeyor build number to '{variables.FullSemVer}'."; } - public override string[] GenerateSetParameterMessage(string name, string? value) + public override string[] SetOutputVariables(string name, string? value) { var apiUrl = Environment.GetEnvironmentVariable("APPVEYOR_API_URL") ?? throw new Exception("APPVEYOR_API_URL environment variable not set"); var httpClient = GetHttpClient(apiUrl); diff --git a/src/GitVersion.BuildAgents/Agents/AzurePipelines.cs b/src/GitVersion.BuildAgents/Agents/AzurePipelines.cs index b6fca6b9ac..c8fef2b6e6 100644 --- a/src/GitVersion.BuildAgents/Agents/AzurePipelines.cs +++ b/src/GitVersion.BuildAgents/Agents/AzurePipelines.cs @@ -11,7 +11,7 @@ internal class AzurePipelines(IEnvironment environment, ILog log, IFileSystem fi protected override string EnvironmentVariable => EnvironmentVariableName; - public override string[] GenerateSetParameterMessage(string name, string? value) => + public override string[] SetOutputVariables(string name, string? value) => [ $"##vso[task.setvariable variable=GitVersion.{name}]{value}", $"##vso[task.setvariable variable=GitVersion.{name};isOutput=true]{value}" @@ -22,7 +22,7 @@ public override string[] GenerateSetParameterMessage(string name, string? value) public override bool PreventFetch() => true; - public override string GenerateSetVersionMessage(GitVersionVariables variables) + public override string SetBuildNumber(GitVersionVariables variables) { // For AzurePipelines, we'll get the Build Number and insert GitVersion variables where // specified diff --git a/src/GitVersion.BuildAgents/Agents/BitBucketPipelines.cs b/src/GitVersion.BuildAgents/Agents/BitBucketPipelines.cs index b2954465f5..836101e09f 100644 --- a/src/GitVersion.BuildAgents/Agents/BitBucketPipelines.cs +++ b/src/GitVersion.BuildAgents/Agents/BitBucketPipelines.cs @@ -21,13 +21,13 @@ public BitBucketPipelines(IEnvironment environment, ILog log, IFileSystem fileSy protected override string EnvironmentVariable => EnvironmentVariableName; - public override string GenerateSetVersionMessage(GitVersionVariables variables) => variables.FullSemVer; + public override string SetBuildNumber(GitVersionVariables variables) => variables.FullSemVer; public void WithPropertyFile(string propertiesFileName) => this.propertyFile = propertiesFileName; public void WithPowershellFile(string powershellFileName) => this.ps1File = powershellFileName; - public override string[] GenerateSetParameterMessage(string name, string? value) => [$"GITVERSION_{name.ToUpperInvariant()}={value}"]; + public override string[] SetOutputVariables(string name, string? value) => [$"GITVERSION_{name.ToUpperInvariant()}={value}"]; public override void WriteIntegration(Action writer, GitVersionVariables variables, bool updateBuildNumber = true) { diff --git a/src/GitVersion.BuildAgents/Agents/BuildKite.cs b/src/GitVersion.BuildAgents/Agents/BuildKite.cs index dbd0d58d2a..bdf325460a 100644 --- a/src/GitVersion.BuildAgents/Agents/BuildKite.cs +++ b/src/GitVersion.BuildAgents/Agents/BuildKite.cs @@ -12,10 +12,10 @@ internal class BuildKite(IEnvironment environment, ILog log, IFileSystem fileSys public override bool CanApplyToCurrentContext() => "true".Equals(Environment.GetEnvironmentVariable(EnvironmentVariable), StringComparison.OrdinalIgnoreCase); - public override string GenerateSetVersionMessage(GitVersionVariables variables) => + public override string SetBuildNumber(GitVersionVariables variables) => string.Empty; // There is no equivalent function in BuildKite. - public override string[] GenerateSetParameterMessage(string name, string? value) => + public override string[] SetOutputVariables(string name, string? value) => []; // There is no equivalent function in BuildKite. public override string? GetCurrentBranch(bool usingDynamicRepos) diff --git a/src/GitVersion.BuildAgents/Agents/CodeBuild.cs b/src/GitVersion.BuildAgents/Agents/CodeBuild.cs index 791ac37e85..30b710d8c4 100644 --- a/src/GitVersion.BuildAgents/Agents/CodeBuild.cs +++ b/src/GitVersion.BuildAgents/Agents/CodeBuild.cs @@ -17,9 +17,9 @@ internal sealed class CodeBuild : BuildAgentBase protected override string EnvironmentVariable => WebHookEnvironmentVariableName; - public override string GenerateSetVersionMessage(GitVersionVariables variables) => variables.FullSemVer; + public override string SetBuildNumber(GitVersionVariables variables) => variables.FullSemVer; - public override string[] GenerateSetParameterMessage(string name, string? value) => + public override string[] SetOutputVariables(string name, string? value) => [ $"GitVersion_{name}={value}" ]; @@ -38,7 +38,7 @@ public override void WriteIntegration(Action writer, GitVersionVariable base.WriteIntegration(writer, variables, updateBuildNumber); writer($"Outputting variables to '{this.file}' ... "); - this.FileSystem.File.WriteAllLines(this.file, GenerateBuildLogOutput(variables)); + this.FileSystem.File.WriteAllLines(this.file, SetOutputVariables(variables)); } public override bool PreventFetch() => true; diff --git a/src/GitVersion.BuildAgents/Agents/ContinuaCi.cs b/src/GitVersion.BuildAgents/Agents/ContinuaCi.cs index 08b90a6e5a..ecdf5a0bc8 100644 --- a/src/GitVersion.BuildAgents/Agents/ContinuaCi.cs +++ b/src/GitVersion.BuildAgents/Agents/ContinuaCi.cs @@ -10,12 +10,12 @@ internal class ContinuaCi(IEnvironment environment, ILog log, IFileSystem fileSy protected override string EnvironmentVariable => EnvironmentVariableName; - public override string[] GenerateSetParameterMessage(string name, string? value) => + public override string[] SetOutputVariables(string name, string? value) => [ $"@@continua[setVariable name='GitVersion_{name}' value='{value}' skipIfNotDefined='true']" ]; - public override string GenerateSetVersionMessage(GitVersionVariables variables) => $"@@continua[setBuildVersion value='{variables.FullSemVer}']"; + public override string SetBuildNumber(GitVersionVariables variables) => $"@@continua[setBuildVersion value='{variables.FullSemVer}']"; public override bool PreventFetch() => false; } diff --git a/src/GitVersion.BuildAgents/Agents/Drone.cs b/src/GitVersion.BuildAgents/Agents/Drone.cs index 503815e33a..d5c46697d5 100644 --- a/src/GitVersion.BuildAgents/Agents/Drone.cs +++ b/src/GitVersion.BuildAgents/Agents/Drone.cs @@ -11,9 +11,9 @@ internal class Drone(IEnvironment environment, ILog log, IFileSystem fileSystem) protected override string EnvironmentVariable => EnvironmentVariableName; public override bool CanApplyToCurrentContext() => "true".Equals(Environment.GetEnvironmentVariable(EnvironmentVariable), StringComparison.OrdinalIgnoreCase); - public override string GenerateSetVersionMessage(GitVersionVariables variables) => variables.FullSemVer; + public override string SetBuildNumber(GitVersionVariables variables) => variables.FullSemVer; - public override string[] GenerateSetParameterMessage(string name, string? value) => + public override string[] SetOutputVariables(string name, string? value) => [ $"GitVersion_{name}={value}" ]; diff --git a/src/GitVersion.BuildAgents/Agents/EnvRun.cs b/src/GitVersion.BuildAgents/Agents/EnvRun.cs index 171b945dfd..45b9e3e075 100644 --- a/src/GitVersion.BuildAgents/Agents/EnvRun.cs +++ b/src/GitVersion.BuildAgents/Agents/EnvRun.cs @@ -26,9 +26,9 @@ public override bool CanApplyToCurrentContext() return false; } - public override string GenerateSetVersionMessage(GitVersionVariables variables) => variables.FullSemVer; + public override string SetBuildNumber(GitVersionVariables variables) => variables.FullSemVer; - public override string[] GenerateSetParameterMessage(string name, string? value) => + public override string[] SetOutputVariables(string name, string? value) => [ $"@@envrun[set name='GitVersion_{name}' value='{value}']" ]; diff --git a/src/GitVersion.BuildAgents/Agents/GitHubActions.cs b/src/GitVersion.BuildAgents/Agents/GitHubActions.cs index ff4a16d653..7bd1515e11 100644 --- a/src/GitVersion.BuildAgents/Agents/GitHubActions.cs +++ b/src/GitVersion.BuildAgents/Agents/GitHubActions.cs @@ -14,10 +14,10 @@ internal class GitHubActions(IEnvironment environment, ILog log, IFileSystem fil protected override string EnvironmentVariable => EnvironmentVariableName; - public override string GenerateSetVersionMessage(GitVersionVariables variables) => + public override string SetBuildNumber(GitVersionVariables variables) => string.Empty; // There is no equivalent function in GitHub Actions. - public override string[] GenerateSetParameterMessage(string name, string? value) => + public override string[] SetOutputVariables(string name, string? value) => []; // There is no equivalent function in GitHub Actions. public override void WriteIntegration(Action writer, GitVersionVariables variables, bool updateBuildNumber = true) diff --git a/src/GitVersion.BuildAgents/Agents/GitLabCi.cs b/src/GitVersion.BuildAgents/Agents/GitLabCi.cs index 350b75d849..572590de54 100644 --- a/src/GitVersion.BuildAgents/Agents/GitLabCi.cs +++ b/src/GitVersion.BuildAgents/Agents/GitLabCi.cs @@ -15,9 +15,9 @@ internal class GitLabCi : BuildAgentBase protected override string EnvironmentVariable => EnvironmentVariableName; - public override string GenerateSetVersionMessage(GitVersionVariables variables) => variables.FullSemVer; + public override string SetBuildNumber(GitVersionVariables variables) => variables.FullSemVer; - public override string[] GenerateSetParameterMessage(string name, string? value) => + public override string[] SetOutputVariables(string name, string? value) => [ $"GitVersion_{name}={value}" ]; @@ -45,6 +45,6 @@ public override void WriteIntegration(Action writer, GitVersionVariable base.WriteIntegration(writer, variables, updateBuildNumber); writer($"Outputting variables to '{this.file}' ... "); - this.FileSystem.File.WriteAllLines(this.file, GenerateBuildLogOutput(variables)); + this.FileSystem.File.WriteAllLines(this.file, SetOutputVariables(variables)); } } diff --git a/src/GitVersion.BuildAgents/Agents/Jenkins.cs b/src/GitVersion.BuildAgents/Agents/Jenkins.cs index e23a8be632..57c78aede1 100644 --- a/src/GitVersion.BuildAgents/Agents/Jenkins.cs +++ b/src/GitVersion.BuildAgents/Agents/Jenkins.cs @@ -15,9 +15,9 @@ internal class Jenkins : BuildAgentBase public void WithPropertyFile(string propertiesFileName) => this.file = propertiesFileName; - public override string GenerateSetVersionMessage(GitVersionVariables variables) => variables.FullSemVer; + public override string SetBuildNumber(GitVersionVariables variables) => variables.FullSemVer; - public override string[] GenerateSetParameterMessage(string name, string? value) => + public override string[] SetOutputVariables(string name, string? value) => [ $"GitVersion_{name}={value}" ]; @@ -44,6 +44,6 @@ public override void WriteIntegration(Action writer, GitVersionVariable base.WriteIntegration(writer, variables, updateBuildNumber); writer($"Outputting variables to '{this.file}' ... "); - this.FileSystem.File.WriteAllLines(this.file, GenerateBuildLogOutput(variables)); + this.FileSystem.File.WriteAllLines(this.file, SetOutputVariables(variables)); } } diff --git a/src/GitVersion.BuildAgents/Agents/MyGet.cs b/src/GitVersion.BuildAgents/Agents/MyGet.cs index ea82a27056..a8eb3fd32e 100644 --- a/src/GitVersion.BuildAgents/Agents/MyGet.cs +++ b/src/GitVersion.BuildAgents/Agents/MyGet.cs @@ -18,22 +18,18 @@ public override bool CanApplyToCurrentContext() && buildRunner.Equals("MyGet", StringComparison.InvariantCultureIgnoreCase); } - public override string[] GenerateSetParameterMessage(string name, string? value) + public override string[] SetOutputVariables(string name, string? value) { var messages = new List { $"##myget[setParameter name='GitVersion.{name}' value='{ServiceMessageEscapeHelper.EscapeValue(value)}']" }; - if (string.Equals(name, "SemVer", StringComparison.InvariantCultureIgnoreCase)) - { - messages.Add($"##myget[buildNumber '{ServiceMessageEscapeHelper.EscapeValue(value)}']"); - } - return [.. messages]; } - public override string? GenerateSetVersionMessage(GitVersionVariables variables) => null; + public override string? SetBuildNumber(GitVersionVariables variables) => + $"##myget[buildNumber '{ServiceMessageEscapeHelper.EscapeValue(variables.FullSemVer)}']"; public override bool PreventFetch() => false; } diff --git a/src/GitVersion.BuildAgents/Agents/SpaceAutomation.cs b/src/GitVersion.BuildAgents/Agents/SpaceAutomation.cs index 1518eea9a9..2814896e04 100644 --- a/src/GitVersion.BuildAgents/Agents/SpaceAutomation.cs +++ b/src/GitVersion.BuildAgents/Agents/SpaceAutomation.cs @@ -12,7 +12,7 @@ internal class SpaceAutomation(IEnvironment environment, ILog log, IFileSystem f public override string? GetCurrentBranch(bool usingDynamicRepos) => Environment.GetEnvironmentVariable("JB_SPACE_GIT_BRANCH"); - public override string[] GenerateSetParameterMessage(string name, string? value) => []; + public override string[] SetOutputVariables(string name, string? value) => []; - public override string GenerateSetVersionMessage(GitVersionVariables variables) => string.Empty; + public override string SetBuildNumber(GitVersionVariables variables) => string.Empty; } diff --git a/src/GitVersion.BuildAgents/Agents/TeamCity.cs b/src/GitVersion.BuildAgents/Agents/TeamCity.cs index 30bce327d3..6cb5aa92fb 100644 --- a/src/GitVersion.BuildAgents/Agents/TeamCity.cs +++ b/src/GitVersion.BuildAgents/Agents/TeamCity.cs @@ -36,11 +36,11 @@ private void WriteBranchEnvVariableWarning() => this.Log.Warning(@"TeamCity does public override bool PreventFetch() => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("Git_Branch")); - public override string[] GenerateSetParameterMessage(string name, string? value) => + public override string[] SetOutputVariables(string name, string? value) => [ $"##teamcity[setParameter name='GitVersion.{name}' value='{ServiceMessageEscapeHelper.EscapeValue(value)}']", $"##teamcity[setParameter name='system.GitVersion.{name}' value='{ServiceMessageEscapeHelper.EscapeValue(value)}']" ]; - public override string GenerateSetVersionMessage(GitVersionVariables variables) => $"##teamcity[buildNumber '{ServiceMessageEscapeHelper.EscapeValue(variables.FullSemVer)}']"; + public override string SetBuildNumber(GitVersionVariables variables) => $"##teamcity[buildNumber '{ServiceMessageEscapeHelper.EscapeValue(variables.FullSemVer)}']"; } diff --git a/src/GitVersion.BuildAgents/Agents/TravisCI.cs b/src/GitVersion.BuildAgents/Agents/TravisCI.cs index ca4e0764a1..43eb4638c8 100644 --- a/src/GitVersion.BuildAgents/Agents/TravisCI.cs +++ b/src/GitVersion.BuildAgents/Agents/TravisCI.cs @@ -11,9 +11,9 @@ internal class TravisCi(IEnvironment environment, ILog log, IFileSystem fileSyst public override bool CanApplyToCurrentContext() => "true".Equals(Environment.GetEnvironmentVariable(EnvironmentVariable)) && "true".Equals(Environment.GetEnvironmentVariable("CI")); - public override string GenerateSetVersionMessage(GitVersionVariables variables) => variables.FullSemVer; + public override string SetBuildNumber(GitVersionVariables variables) => variables.FullSemVer; - public override string[] GenerateSetParameterMessage(string name, string? value) => + public override string[] SetOutputVariables(string name, string? value) => [ $"GitVersion_{name}={value}" ]; diff --git a/src/GitVersion.Core/Agents/BuildAgentBase.cs b/src/GitVersion.Core/Agents/BuildAgentBase.cs index c30dd82949..776e1f4efc 100644 --- a/src/GitVersion.Core/Agents/BuildAgentBase.cs +++ b/src/GitVersion.Core/Agents/BuildAgentBase.cs @@ -12,15 +12,15 @@ internal abstract class BuildAgentBase(IEnvironment environment, ILog log, IFile protected readonly IFileSystem FileSystem = fileSystem.NotNull(); protected abstract string EnvironmentVariable { get; } - public virtual bool IsDefault => false; - public abstract string? GenerateSetVersionMessage(GitVersionVariables variables); - public abstract string[] GenerateSetParameterMessage(string name, string? value); + public abstract string? SetBuildNumber(GitVersionVariables variables); + public abstract string[] SetOutputVariables(string name, string? value); public virtual bool CanApplyToCurrentContext() => !Environment.GetEnvironmentVariable(EnvironmentVariable).IsNullOrEmpty(); public virtual string? GetCurrentBranch(bool usingDynamicRepos) => null; + public virtual bool IsDefault => false; public virtual bool PreventFetch() => true; public virtual bool ShouldCleanUpRemotes() => false; @@ -28,23 +28,24 @@ public virtual void WriteIntegration(Action writer, GitVersionVariables { if (updateBuildNumber) { - writer($"Executing GenerateSetVersionMessage for '{GetType().Name}'."); - writer(GenerateSetVersionMessage(variables)); + writer($"Set Build Number for '{GetType().Name}'."); + writer(SetBuildNumber(variables)); } - writer($"Executing GenerateBuildLogOutput for '{GetType().Name}'."); - foreach (var buildParameter in GenerateBuildLogOutput(variables)) + + writer($"Set Output Variables for '{GetType().Name}'."); + foreach (var buildParameter in SetOutputVariables(variables)) { writer(buildParameter); } } - protected IEnumerable GenerateBuildLogOutput(GitVersionVariables variables) + protected IEnumerable SetOutputVariables(GitVersionVariables variables) { var output = new List(); foreach (var (key, value) in variables) { - output.AddRange(GenerateSetParameterMessage(key, value)); + output.AddRange(SetOutputVariables(key, value)); } return output; diff --git a/src/GitVersion.Core/Agents/LocalBuild.cs b/src/GitVersion.Core/Agents/LocalBuild.cs index bb14a6d815..be7a1e1c5f 100644 --- a/src/GitVersion.Core/Agents/LocalBuild.cs +++ b/src/GitVersion.Core/Agents/LocalBuild.cs @@ -10,6 +10,6 @@ internal class LocalBuild(IEnvironment environment, ILog log, IFileSystem fileSy protected override string EnvironmentVariable => string.Empty; public override bool CanApplyToCurrentContext() => true; - public override string? GenerateSetVersionMessage(GitVersionVariables variables) => null; - public override string[] GenerateSetParameterMessage(string name, string? value) => []; + public override string? SetBuildNumber(GitVersionVariables variables) => null; + public override string[] SetOutputVariables(string name, string? value) => []; } From 336bd63318f58db8053d469b4805c9320a243935 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Mon, 31 Mar 2025 23:21:07 +0200 Subject: [PATCH 104/107] Refactor semantic version handling with dedicated tuple type Replaced `KeyValuePair` with a more descriptive `CommitSemanticVersion` tuple across semantic versioning logic to simplify and standardize code. Adjusted related method implementations and ordering logic accordingly for improved readability and maintainability. Removed redundant code paths and streamlined syntax in mainline version strategy. --- .../Core/TaggedSemanticVersionService.cs | 34 ++++++++++--------- .../MainlineVersionStrategy.cs | 17 ++++------ 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/src/GitVersion.Core/Core/TaggedSemanticVersionService.cs b/src/GitVersion.Core/Core/TaggedSemanticVersionService.cs index 19efb54071..bb81377012 100644 --- a/src/GitVersion.Core/Core/TaggedSemanticVersionService.cs +++ b/src/GitVersion.Core/Core/TaggedSemanticVersionService.cs @@ -2,6 +2,8 @@ using GitVersion.Extensions; using GitVersion.Git; +using CommitSemanticVersion = (GitVersion.Git.ICommit Commit, GitVersion.SemanticVersionWithTag SemanticVersion); + namespace GitVersion.Core; internal sealed class TaggedSemanticVersionService( @@ -19,7 +21,7 @@ public ILookup GetTaggedSemanticVersions( DateTimeOffset? notOlderThan, TaggedSemanticVersions taggedSemanticVersion) { - IEnumerable>> GetElements() + IEnumerable> GetElements() { if (taggedSemanticVersion.HasFlag(TaggedSemanticVersions.OfBranch)) { @@ -67,8 +69,8 @@ IEnumerable>> GetEleme } return GetElements().SelectMany(elements => elements).Distinct() - .OrderByDescending(element => element.Key.When) - .ToLookup(element => element.Key, element => element.Value); + .OrderByDescending(element => element.Commit.When) + .ToLookup(element => element.Commit, element => element.SemanticVersion); } public ILookup GetTaggedSemanticVersionsOfBranch( @@ -87,11 +89,11 @@ public ILookup GetTaggedSemanticVersionsOfBranc label: label, notOlderThan: notOlderThan); - return result.Distinct().OrderByDescending(element => element.Key.When) - .ToLookup(element => element.Key, element => element.Value); + return result.Distinct().OrderByDescending(element => element.Commit.When) + .ToLookup(element => element.Commit, element => element.SemanticVersion); } - private IEnumerable> GetTaggedSemanticVersionsOfBranchInternal( + private IEnumerable GetTaggedSemanticVersionsOfBranchInternal( IBranch branch, string? tagPrefix, SemanticVersionFormat format, @@ -110,7 +112,7 @@ private IEnumerable> GetTaggedSema { if (semanticVersion.Value.IsMatchForBranchSpecificLabel(label)) { - yield return new(grouping.Key, semanticVersion); + yield return (grouping.Key, semanticVersion); } } } @@ -133,11 +135,11 @@ public ILookup GetTaggedSemanticVersionsOfMerge notOlderThan: notOlderThan); return result.Distinct() - .OrderByDescending(element => element.Key.When) - .ToLookup(element => element.Key, element => element.Value); + .OrderByDescending(element => element.Commit.When) + .ToLookup(element => element.Commit, element => element.SemanticVersion); } - private IEnumerable> GetTaggedSemanticVersionsOfMergeTargetInternal( + private IEnumerable GetTaggedSemanticVersionsOfMergeTargetInternal( IBranch branch, string? tagPrefix, SemanticVersionFormat format, @@ -178,11 +180,11 @@ public ILookup GetTaggedSemanticVersionsOfMainB excludeBranches: excludeBranches); return result.Distinct() - .OrderByDescending(element => element.Key.When) - .ToLookup(element => element.Key, element => element.Value); + .OrderByDescending(element => element.Commit.When) + .ToLookup(element => element.Commit, element => element.SemanticVersion); } - private IEnumerable> GetTaggedSemanticVersionsOfMainBranchesInternal( + private IEnumerable GetTaggedSemanticVersionsOfMainBranchesInternal( IGitVersionConfiguration configuration, DateTimeOffset? notOlderThan, string? label, @@ -218,11 +220,11 @@ public ILookup GetTaggedSemanticVersionsOfRelea excludeBranches: excludeBranches); return result.Distinct() - .OrderByDescending(element => element.Key.When) - .ToLookup(element => element.Key, element => element.Value); + .OrderByDescending(element => element.Commit.When) + .ToLookup(element => element.Commit, element => element.SemanticVersion); } - private IEnumerable> GetTaggedSemanticVersionsOfReleaseBranchesInternal( + private IEnumerable GetTaggedSemanticVersionsOfReleaseBranchesInternal( IGitVersionConfiguration configuration, DateTimeOffset? notOlderThan, string? label, diff --git a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/MainlineVersionStrategy.cs b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/MainlineVersionStrategy.cs index 1e0dd74209..6a100f37be 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/MainlineVersionStrategy.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/MainlineVersionStrategy.cs @@ -211,10 +211,8 @@ private bool IterateOverCommitsRecursive( { return true; } - else - { - returnTrueWhenTheIncrementIsKnown = true; - } + + returnTrueWhenTheIncrementIsKnown = true; } } @@ -242,7 +240,7 @@ private bool IterateOverCommitsRecursive( if (configuration.IsMainBranch == true) throw new NotImplementedException(); mergedCommitsInReverseOrderLazy = new( - () => incrementStrategyFinder.GetMergedCommits(item, 0, Context.Configuration.Ignore).Reverse().ToList() + () => [.. incrementStrategyFinder.GetMergedCommits(item, 0, Context.Configuration.Ignore).Reverse()] ); childConfiguration = configuration; childBranchName = iteration.BranchName; @@ -260,9 +258,8 @@ private bool IterateOverCommitsRecursive( iteration: childIteration, targetBranch: targetBranch, targetLabel: targetLabel, - traversedCommits: traversedCommits, - taggedSemanticVersions: taggedSemanticVersions - ); + taggedSemanticVersions: taggedSemanticVersions, + traversedCommits: traversedCommits); commit.AddChildIteration(childIteration); if (done) return true; @@ -316,9 +313,7 @@ private bool IterateOverCommitsRecursive( // If a main branch existing we need to ensure that it will be present at the first position in the list. foreach (var item in result) { - result[item.Key] = item.Value - .OrderByDescending(element => (element.Configuration.IsMainBranch ?? Context.Configuration.IsMainBranch) == true) - .ToList(); + result[item.Key] = [.. item.Value.OrderByDescending(element => (element.Configuration.IsMainBranch ?? Context.Configuration.IsMainBranch) == true)]; } return result; } From a16753fd1ab5d26dd738005a687f373cd2bc0dab Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 16:15:58 +0000 Subject: [PATCH 105/107] (deps): Bump Microsoft.CSharp and Scriban in /new-cli Bumps Microsoft.CSharp and [Scriban](https://github.com/scriban/scriban). These dependencies needed to be updated together. Updates `Microsoft.CSharp` from 4.7.0 to 4.5.0 Updates `Scriban` from 6.0.0 to 6.1.0 - [Release notes](https://github.com/scriban/scriban/releases) - [Changelog](https://github.com/scriban/scriban/blob/master/changelog.md) - [Commits](https://github.com/scriban/scriban/compare/6.0.0...6.1.0) --- updated-dependencies: - dependency-name: Microsoft.CSharp dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: Scriban dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index f652cba978..e2bba2fc2e 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -15,7 +15,7 @@ - + From 8ba10bdf7b1b7df8cc26a4cce8c2f5a0c69946ea Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Tue, 1 Apr 2025 17:05:30 +0200 Subject: [PATCH 106/107] +semver minor update PublicAPI.Shipped --- src/GitVersion.Core/PublicAPI.Shipped.txt | 4 +++- src/GitVersion.Core/PublicAPI.Unshipped.txt | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GitVersion.Core/PublicAPI.Shipped.txt b/src/GitVersion.Core/PublicAPI.Shipped.txt index 8feb99e5cc..a2138c8c06 100644 --- a/src/GitVersion.Core/PublicAPI.Shipped.txt +++ b/src/GitVersion.Core/PublicAPI.Shipped.txt @@ -157,6 +157,7 @@ GitVersion.Extensions.AssemblyVersionsGeneratorExtensions GitVersion.Extensions.CommonExtensions GitVersion.Extensions.DictionaryExtensions GitVersion.Extensions.EnumerableExtensions +GitVersion.Extensions.FileSystemExtensions GitVersion.Extensions.GitExtensions GitVersion.Extensions.IncrementStrategyExtensions GitVersion.Extensions.ReadEmbeddedResourceExtensions @@ -415,9 +416,9 @@ GitVersion.MergeMessage.TargetBranch.get -> string? GitVersion.MergeMessage.Version.get -> GitVersion.SemanticVersion? GitVersion.OutputType GitVersion.OutputType.BuildServer = 0 -> GitVersion.OutputType +GitVersion.OutputType.DotEnv = 3 -> GitVersion.OutputType GitVersion.OutputType.File = 2 -> GitVersion.OutputType GitVersion.OutputType.Json = 1 -> GitVersion.OutputType -GitVersion.OutputType.DotEnv = 3 -> GitVersion.OutputType GitVersion.OutputVariables.GitVersionVariables GitVersion.OutputVariables.GitVersionVariables.AssemblySemFileVer.get -> string? GitVersion.OutputVariables.GitVersionVariables.AssemblySemFileVer.init -> void @@ -738,6 +739,7 @@ static GitVersion.Extensions.DictionaryExtensions.GetOrAdd(this Sy static GitVersion.Extensions.EnumerableExtensions.AddRange(this System.Collections.Generic.ICollection! source, System.Collections.Generic.IEnumerable! items) -> void static GitVersion.Extensions.EnumerableExtensions.OnlyOrDefault(this System.Collections.Generic.IEnumerable! source) -> T? static GitVersion.Extensions.EnumerableExtensions.SingleOfType(this System.Collections.IEnumerable! source) -> T +static GitVersion.Extensions.FileSystemExtensions.GetLastDirectoryWrite(this System.IO.Abstractions.IFileSystem! fileSystem, string! path) -> long static GitVersion.Extensions.GitExtensions.CreateGitLogArgs(int? maxCommits) -> string! static GitVersion.Extensions.GitExtensions.DumpGraphLog(System.Action? writer = null, int? maxCommits = null) -> void static GitVersion.Extensions.IncrementStrategyExtensions.ToVersionField(this GitVersion.IncrementStrategy strategy) -> GitVersion.VersionField diff --git a/src/GitVersion.Core/PublicAPI.Unshipped.txt b/src/GitVersion.Core/PublicAPI.Unshipped.txt index 57bf801923..7dc5c58110 100644 --- a/src/GitVersion.Core/PublicAPI.Unshipped.txt +++ b/src/GitVersion.Core/PublicAPI.Unshipped.txt @@ -1,3 +1 @@ #nullable enable -GitVersion.Extensions.FileSystemExtensions -static GitVersion.Extensions.FileSystemExtensions.GetLastDirectoryWrite(this System.IO.Abstractions.IFileSystem! fileSystem, string! path) -> long From c2bc09f9ee048c6bdce6ec494fa48cb74420f608 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Tue, 1 Apr 2025 17:36:07 +0200 Subject: [PATCH 107/107] update schemas --- schemas/6.2/GitVersion.configuration.json | 426 ++++++++++++++++++++++ schemas/6.2/GitVersion.json | 184 ++++++++++ 2 files changed, 610 insertions(+) create mode 100644 schemas/6.2/GitVersion.configuration.json create mode 100644 schemas/6.2/GitVersion.json diff --git a/schemas/6.2/GitVersion.configuration.json b/schemas/6.2/GitVersion.configuration.json new file mode 100644 index 0000000000..66011f9140 --- /dev/null +++ b/schemas/6.2/GitVersion.configuration.json @@ -0,0 +1,426 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://gitversion.net/schemas/6.2/GitVersion.configuration.json", + "title": "GitVersion Configuration (6.2)", + "description": "GitVersion configuration schema (6.2)", + "type": "object", + "properties": { + "assembly-file-versioning-format": { + "description": "Specifies the format of AssemblyFileVersion and overwrites the value of assembly-file-versioning-scheme.", + "type": [ + "string", + "null" + ] + }, + "assembly-file-versioning-scheme": { + "description": "The scheme to use when setting AssemblyFileVersion attribute. Can be 'MajorMinorPatchTag', 'MajorMinorPatch', 'MajorMinor', 'Major', 'None'. Defaults to 'MajorMinorPatch'.", + "default": "MajorMinorPatch", + "enum": [ + "MajorMinorPatchTag", + "MajorMinorPatch", + "MajorMinor", + "Major", + "None", + null + ] + }, + "assembly-informational-format": { + "description": "Specifies the format of AssemblyInformationalVersion. Defaults to '{InformationalVersion}'.", + "default": "'{InformationalVersion}'", + "type": [ + "string", + "null" + ] + }, + "assembly-versioning-format": { + "description": "Specifies the format of AssemblyVersion and overwrites the value of assembly-versioning-scheme.", + "type": [ + "string", + "null" + ] + }, + "assembly-versioning-scheme": { + "description": "The scheme to use when setting AssemblyVersion attribute. Can be 'MajorMinorPatchTag', 'MajorMinorPatch', 'MajorMinor', 'Major', 'None'. Defaults to 'MajorMinorPatch'.", + "default": "MajorMinorPatch", + "enum": [ + "MajorMinorPatchTag", + "MajorMinorPatch", + "MajorMinor", + "Major", + "None", + null + ] + }, + "branches": { + "description": "The header for all the individual branch configuration.", + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "commit-message-incrementing": { + "description": "Sets whether it should be possible to increment the version with special syntax in the commit message. Can be 'Disabled', 'Enabled' or 'MergeMessageOnly'.", + "enum": [ + "Enabled", + "Disabled", + "MergeMessageOnly", + null + ] + }, + "mode": { + "description": "The deployment mode for this branch. Can be 'ManualDeployment', 'ContinuousDelivery', 'ContinuousDeployment'.", + "enum": [ + "ManualDeployment", + "ContinuousDelivery", + "ContinuousDeployment", + null + ] + }, + "increment": { + "description": "The increment strategy for this branch. Can be 'Inherit', 'Patch', 'Minor', 'Major', 'None'.", + "$ref": "#/$defs/incrementStrategy" + }, + "is-main-branch": { + "description": "When using Mainline mode, this indicates that this branch is a mainline. By default main and support/* are mainlines.", + "type": [ + "boolean", + "null" + ] + }, + "is-release-branch": { + "description": "Indicates this branch configuration represents a release branch in GitFlow.", + "type": [ + "boolean", + "null" + ] + }, + "is-source-branch-for": { + "description": "The branches that this branch is a source branch.", + "$ref": "#/$defs/hashSetOfString" + }, + "label": { + "description": "The label to use for this branch. Use the value {BranchName} or similar as a placeholder to insert a named capture group from RegularExpression (fx. the branch name).", + "type": [ + "string", + "null" + ] + }, + "pre-release-weight": { + "description": "Provides a way to translate the PreReleaseLabel to a number.", + "type": [ + "integer", + "null" + ] + }, + "prevent-increment": { + "description": "The prevent increment configuration section.", + "$ref": "#/$defs/preventIncrementConfiguration" + }, + "regex": { + "format": "regex", + "description": "The regular expression pattern to use to match this branch.", + "type": [ + "string", + "null" + ] + }, + "source-branches": { + "description": "The source branches for this branch.", + "$ref": "#/$defs/hashSetOfString" + }, + "track-merge-message": { + "description": "This property is a branch related property and gives the user the possibility to control the behavior of whether the merge commit message will be interpreted as a next version or not.", + "type": [ + "boolean", + "null" + ] + }, + "track-merge-target": { + "description": "Strategy which will look for tagged merge commits directly off the current branch.", + "type": [ + "boolean", + "null" + ] + }, + "tracks-release-branches": { + "description": "Indicates this branch configuration represents develop in GitFlow.", + "type": [ + "boolean", + "null" + ] + } + } + } + }, + "commit-date-format": { + "description": "The format to use when calculating the commit date. Defaults to 'yyyy-MM-dd'. See [Standard Date and Time Format Strings](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) and [Custom Date and Time Format Strings](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings).", + "default": "yyyy-MM-dd", + "type": [ + "string", + "null" + ] + }, + "commit-message-incrementing": { + "description": "Sets whether it should be possible to increment the version with special syntax in the commit message. Can be 'Disabled', 'Enabled' or 'MergeMessageOnly'.", + "enum": [ + "Enabled", + "Disabled", + "MergeMessageOnly", + null + ] + }, + "mode": { + "description": "The deployment mode for this branch. Can be 'ManualDeployment', 'ContinuousDelivery', 'ContinuousDeployment'.", + "enum": [ + "ManualDeployment", + "ContinuousDelivery", + "ContinuousDeployment", + null + ] + }, + "ignore": { + "description": "The header property for the ignore configuration.", + "type": "object", + "properties": { + "commits-before": { + "format": "date-time", + "description": "Commits before this date will be ignored. Format: yyyy-MM-ddTHH:mm:ss.", + "type": [ + "string", + "null" + ] + }, + "sha": { + "description": "A sequence of SHAs to be excluded from the version calculations.", + "$ref": "#/$defs/hashSetOfString" + } + } + }, + "increment": { + "description": "The increment strategy for this branch. Can be 'Inherit', 'Patch', 'Minor', 'Major', 'None'.", + "$ref": "#/$defs/incrementStrategy" + }, + "is-main-branch": { + "description": "When using Mainline mode, this indicates that this branch is a mainline. By default main and support/* are mainlines.", + "type": [ + "boolean", + "null" + ] + }, + "is-release-branch": { + "description": "Indicates this branch configuration represents a release branch in GitFlow.", + "type": [ + "boolean", + "null" + ] + }, + "is-source-branch-for": { + "description": "The branches that this branch is a source branch.", + "$ref": "#/$defs/hashSetOfString" + }, + "label": { + "description": "The label to use for this branch. Use the value {BranchName} or similar as a placeholder to insert a named capture group from RegularExpression (fx. the branch name).", + "type": [ + "string", + "null" + ] + }, + "major-version-bump-message": { + "format": "regex", + "description": "The regular expression to match commit messages with to perform a major version increment. Defaults to '\\+semver:\\s?(breaking|major)'", + "default": "\\+semver:\\s?(breaking|major)", + "type": [ + "string", + "null" + ] + }, + "merge-message-formats": { + "description": "Custom merge message formats to enable identification of merge messages that do not follow the built-in conventions.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "minor-version-bump-message": { + "format": "regex", + "description": "The regular expression to match commit messages with to perform a minor version increment. Defaults to '\\+semver:\\s?(feature|minor)'", + "default": "\\+semver:\\s?(feature|minor)", + "type": [ + "string", + "null" + ] + }, + "next-version": { + "description": "Allows you to bump the next version explicitly. Useful for bumping main or a feature branch with breaking changes", + "type": [ + "string", + "null" + ] + }, + "no-bump-message": { + "format": "regex", + "description": "Used to tell GitVersion not to increment when in Mainline development mode. Defaults to '\\+semver:\\s?(none|skip)'", + "default": "\\+semver:\\s?(none|skip)", + "type": [ + "string", + "null" + ] + }, + "patch-version-bump-message": { + "format": "regex", + "description": "The regular expression to match commit messages with to perform a patch version increment. Defaults to '\\+semver:\\s?(fix|patch)'", + "default": "\\+semver:\\s?(fix|patch)", + "type": [ + "string", + "null" + ] + }, + "pre-release-weight": { + "description": "Provides a way to translate the PreReleaseLabel to a number.", + "type": [ + "integer", + "null" + ] + }, + "prevent-increment": { + "description": "The prevent increment configuration section.", + "$ref": "#/$defs/preventIncrementConfiguration" + }, + "regex": { + "format": "regex", + "description": "The regular expression pattern to use to match this branch.", + "type": [ + "string", + "null" + ] + }, + "semantic-version-format": { + "description": "Specifies the semantic version format that is used when parsing the string. Can be 'Strict' or 'Loose'. Defaults to 'Strict'.", + "default": "Strict", + "enum": [ + "Strict", + "Loose" + ] + }, + "source-branches": { + "description": "The source branches for this branch.", + "$ref": "#/$defs/hashSetOfString" + }, + "tag-prefix": { + "format": "regex", + "description": "A regular expression which is used to trim Git tags before processing. Defaults to '[vV]?'", + "default": "[vV]?", + "type": [ + "string", + "null" + ] + }, + "tag-pre-release-weight": { + "description": "The pre-release weight in case of tagged commits. Defaults to 60000.", + "type": [ + "integer", + "null" + ] + }, + "track-merge-message": { + "description": "This property is a branch related property and gives the user the possibility to control the behavior of whether the merge commit message will be interpreted as a next version or not.", + "type": [ + "boolean", + "null" + ] + }, + "track-merge-target": { + "description": "Strategy which will look for tagged merge commits directly off the current branch.", + "type": [ + "boolean", + "null" + ] + }, + "tracks-release-branches": { + "description": "Indicates this branch configuration represents develop in GitFlow.", + "type": [ + "boolean", + "null" + ] + }, + "update-build-number": { + "description": "Whether to update the build number in the project file. Defaults to true.", + "default": "true", + "type": "boolean" + }, + "version-in-branch-pattern": { + "format": "regex", + "description": "A regular expression which is used to determine the version number in the branch name or commit message (e.g., v1.0.0-LTS). Defaults to '(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*'.", + "default": "(?[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*", + "type": [ + "string", + "null" + ] + }, + "strategies": { + "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 'Mainline'.", + "type": "array", + "items": { + "enum": [ + "None", + "Fallback", + "ConfiguredNextVersion", + "MergeMessage", + "TaggedCommit", + "TrackReleaseBranches", + "VersionInBranchName", + "Mainline" + ] + } + }, + "workflow": { + "description": "The base template of the configuration to use. Possible values are: 'GitFlow/v1' or 'GitHubFlow/v1'", + "type": [ + "string", + "null" + ] + } + }, + "$defs": { + "incrementStrategy": { + "enum": [ + "None", + "Major", + "Minor", + "Patch", + "Inherit" + ] + }, + "hashSetOfString": { + "type": "array", + "items": { + "type": "string" + } + }, + "preventIncrementConfiguration": { + "type": "object", + "properties": { + "of-merged-branch": { + "description": "Prevent increment when branch merged.", + "type": [ + "boolean", + "null" + ] + }, + "when-branch-merged": { + "description": "Prevent increment when branch merged.", + "type": [ + "boolean", + "null" + ] + }, + "when-current-commit-tagged": { + "description": "This branch related property controls the behavior whether to use the tagged (value set to true) or the incremented (value set to false) semantic version. Defaults to true.", + "type": [ + "boolean", + "null" + ] + } + } + } + } +} \ No newline at end of file diff --git a/schemas/6.2/GitVersion.json b/schemas/6.2/GitVersion.json new file mode 100644 index 0000000000..1a1fb8c5ce --- /dev/null +++ b/schemas/6.2/GitVersion.json @@ -0,0 +1,184 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://gitversion.net/schemas/6.2/GitVersion.json", + "title": "GitVersion version variables output", + "description": "GitVersion output schema", + "type": "object", + "properties": { + "AssemblySemFileVer": { + "description": "Suitable for .NET AssemblyFileVersion. Defaults to Major.Minor.Patch.0.", + "type": [ + "string", + "null" + ] + }, + "AssemblySemVer": { + "description": "Suitable for .NET AssemblyVersion. Defaults to Major.Minor.0.0", + "type": [ + "string", + "null" + ] + }, + "BranchName": { + "description": "The name of the checked out Git branch.", + "type": [ + "string", + "null" + ] + }, + "BuildMetaData": { + "description": "The build metadata, usually representing number of commits since the VersionSourceSha.", + "type": [ + "integer", + "null" + ] + }, + "CommitDate": { + "description": "The ISO-8601 formatted date of the commit identified by Sha.", + "type": [ + "string", + "null" + ] + }, + "CommitsSinceVersionSource": { + "description": "The number of commits since the version source.", + "type": [ + "integer", + "null" + ] + }, + "EscapedBranchName": { + "description": "Equal to BranchName, but with / replaced with -.", + "type": [ + "string", + "null" + ] + }, + "FullBuildMetaData": { + "description": "The BuildMetaData suffixed with BranchName and Sha.", + "type": [ + "string", + "null" + ] + }, + "FullSemVer": { + "description": "The full, SemVer 2.0 compliant version number.", + "type": [ + "string", + "null" + ] + }, + "InformationalVersion": { + "description": "Suitable for .NET AssemblyInformationalVersion. Defaults to FullSemVer suffixed by FullBuildMetaData.", + "type": [ + "string", + "null" + ] + }, + "Major": { + "description": "The major version. Should be incremented on breaking changes.", + "type": [ + "integer", + "null" + ] + }, + "MajorMinorPatch": { + "description": "Major, Minor and Patch joined together, separated by '.'.", + "type": [ + "string", + "null" + ] + }, + "Minor": { + "description": "The minor version. Should be incremented on new features.", + "type": [ + "integer", + "null" + ] + }, + "Patch": { + "description": "The patch version. Should be incremented on bug fixes.", + "type": [ + "integer", + "null" + ] + }, + "PreReleaseLabel": { + "description": "The pre-release label is the name of the pre-release.", + "type": [ + "string", + "null" + ] + }, + "PreReleaseLabelWithDash": { + "description": "The pre-release label prefixed with a dash.", + "type": [ + "string", + "null" + ] + }, + "PreReleaseNumber": { + "description": "The pre-release number is the number of commits since the last version bump.", + "type": [ + "integer", + "null" + ] + }, + "PreReleaseTag": { + "description": "The pre-release tag is the pre-release label suffixed by the PreReleaseNumber.", + "type": [ + "string", + "null" + ] + }, + "PreReleaseTagWithDash": { + "description": "The pre-release tag prefixed with a dash.", + "type": [ + "string", + "null" + ] + }, + "SemVer": { + "description": "The semantic version number, including PreReleaseTagWithDash for pre-release version numbers.", + "type": [ + "string", + "null" + ] + }, + "Sha": { + "description": "The SHA of the Git commit.", + "type": [ + "string", + "null" + ] + }, + "ShortSha": { + "description": "The Sha limited to 7 characters.", + "type": [ + "string", + "null" + ] + }, + "UncommittedChanges": { + "description": "The number of uncommitted changes present in the repository.", + "type": [ + "integer", + "null" + ] + }, + "VersionSourceSha": { + "description": "The SHA of the commit used as version source.", + "type": [ + "string", + "null" + ] + }, + "WeightedPreReleaseNumber": { + "description": "A summation of branch specific pre-release-weight and the PreReleaseNumber. Can be used to obtain a monotonically increasing version number across the branches.", + "type": [ + "integer", + "null" + ] + } + } +} \ No newline at end of file