diff --git a/MinVer.Lib/Version.cs b/MinVer.Lib/Version.cs index dc26de48..a2fe7ffa 100644 --- a/MinVer.Lib/Version.cs +++ b/MinVer.Lib/Version.cs @@ -7,18 +7,19 @@ namespace MinVer.Lib; -public class Version : SemanticVersion +public class Version : NuGetVersion { private readonly List preReleaseIdentifiers; private readonly int height; - public Version(IEnumerable defaultPreReleaseIdentifiers) : this(0, 0, 0, defaultPreReleaseIdentifiers.ToList(), 0, "") { } + public Version(IEnumerable defaultPreReleaseIdentifiers) : this(0, 0, 0, 0, defaultPreReleaseIdentifiers.ToList(), 0, "") { } - private Version(int major, int minor, int patch, List preReleaseIdentifiers, int height, string? buildMetadata) : + private Version(int major, int minor, int patch, int revision, List preReleaseIdentifiers, int height, string? buildMetadata) : base( major, minor, patch, + revision, height > 0 ? preReleaseIdentifiers.Append(height.ToString(CultureInfo.InvariantCulture)) : preReleaseIdentifiers, @@ -29,7 +30,7 @@ private Version(int major, int minor, int patch, List preReleaseIdentifi } public override string ToString(string? format, IFormatProvider? formatProvider) => - $"{this.Major}.{this.Minor}.{this.Patch}{(string.IsNullOrEmpty(this.Release) ? "" : $"-{this.Release}")}{(string.IsNullOrEmpty(this.Metadata) ? "" : $"+{this.Metadata}")}"; + $"{this.Major}.{this.Minor}.{this.Patch}.{this.Revision}{(string.IsNullOrEmpty(this.Release) ? "" : $"-{this.Release}")}{(string.IsNullOrEmpty(this.Metadata) ? "" : $"+{this.Metadata}")}"; public Version Satisfying(MajorMinor minMajorMinor, IEnumerable defaultPreReleaseIdentifiers) { @@ -37,24 +38,25 @@ public Version Satisfying(MajorMinor minMajorMinor, IEnumerable defaultP return minMajorMinor.Major < this.Major || (minMajorMinor.Major == this.Major && minMajorMinor.Minor <= this.Minor) ? this - : new Version(minMajorMinor.Major, minMajorMinor.Minor, 0, defaultPreReleaseIdentifiers.ToList(), this.height, this.Metadata); + : new Version(minMajorMinor.Major, minMajorMinor.Minor, 0, 0, defaultPreReleaseIdentifiers.ToList(), this.height, this.Metadata); } public Version WithHeight(int newHeight, VersionPart autoIncrement, IEnumerable defaultPreReleaseIdentifiers) => this.preReleaseIdentifiers.Count == 0 && newHeight > 0 ? autoIncrement switch { - VersionPart.Major => new Version(this.Major + 1, 0, 0, defaultPreReleaseIdentifiers.ToList(), newHeight, ""), - VersionPart.Minor => new Version(this.Major, this.Minor + 1, 0, defaultPreReleaseIdentifiers.ToList(), newHeight, ""), - VersionPart.Patch => new Version(this.Major, this.Minor, this.Patch + 1, defaultPreReleaseIdentifiers.ToList(), newHeight, ""), + VersionPart.Major => new Version(this.Major + 1, 0, 0, 0, defaultPreReleaseIdentifiers.ToList(), newHeight, ""), + VersionPart.Minor => new Version(this.Major, this.Minor + 1, 0, 0, defaultPreReleaseIdentifiers.ToList(), newHeight, ""), + VersionPart.Patch => new Version(this.Major, this.Minor, this.Patch + 1, 0, defaultPreReleaseIdentifiers.ToList(), newHeight, ""), + VersionPart.Revision => new Version(this.Major, this.Minor, this.Patch, this.Revision + 1, defaultPreReleaseIdentifiers.ToList(), newHeight, ""), _ => throw new ArgumentOutOfRangeException(nameof(autoIncrement)), } - : new Version(this.Major, this.Minor, this.Patch, this.preReleaseIdentifiers, newHeight, newHeight == 0 ? this.Metadata : ""); + : new Version(this.Major, this.Minor, this.Patch, this.Revision, this.preReleaseIdentifiers, newHeight, newHeight == 0 ? this.Metadata : ""); public Version AddBuildMetadata(string newBuildMetadata) { var separator = !string.IsNullOrEmpty(this.Metadata) && !string.IsNullOrEmpty(newBuildMetadata) ? "." : ""; - return new Version(this.Major, this.Minor, this.Patch, this.preReleaseIdentifiers, this.height, $"{this.Metadata}{separator}{newBuildMetadata}"); + return new Version(this.Major, this.Minor, this.Patch, this.Revision, this.preReleaseIdentifiers, this.height, $"{this.Metadata}{separator}{newBuildMetadata}"); } public static bool TryParse(string text, [NotNullWhen(returnValue: true)] out Version? version, string prefix = "") @@ -69,12 +71,12 @@ public static bool TryParse(string text, [NotNullWhen(returnValue: true)] out Ve return false; } - if (!SemanticVersion.TryParse(text[prefix.Length..], out var semanticVersion)) + if (!NuGetVersion.TryParse(text[prefix.Length..], out var nugetVersion)) { return false; } - version = new Version(semanticVersion.Major, semanticVersion.Minor, semanticVersion.Patch, semanticVersion.ReleaseLabels.ToList(), 0, semanticVersion.Metadata); + version = new Version(nugetVersion.Major, nugetVersion.Minor, nugetVersion.Patch, nugetVersion.Revision, nugetVersion.ReleaseLabels.ToList(), 0, nugetVersion.Metadata); return true; } } diff --git a/MinVer.Lib/VersionPart.cs b/MinVer.Lib/VersionPart.cs index a75fd0d0..1ed5526d 100644 --- a/MinVer.Lib/VersionPart.cs +++ b/MinVer.Lib/VersionPart.cs @@ -2,12 +2,13 @@ namespace MinVer.Lib; public enum VersionPart { - Patch = 0, - Minor = 1, - Major = 2, + Revision = 0, + Patch = 1, + Minor = 2, + Major = 3, } public static class VersionPartExtensions { - public static string ValidValues => "major, minor, or patch (default)"; + public static string ValidValues => "major, minor, patch or revision (default)"; } diff --git a/MinVer/build/MinVer.targets b/MinVer/build/MinVer.targets index cdc8b87b..fbd7993d 100644 --- a/MinVer/build/MinVer.targets +++ b/MinVer/build/MinVer.targets @@ -56,15 +56,16 @@ @(MinVerOutputVersion) $(MinVerVersion.Split(`.`)[0]) $(MinVerVersion.Split(`.`)[1]) - $(MinVerVersion.Split(`.`)[2].Split(`-`)[0].Split(`+`)[0]) + $(MinVerVersion.Split(`.`)[2]) + $(MinVerVersion.Split(`.`)[3].Split(`-`)[0].Split(`+`)[0]) $(MinVerVersion.Split(`+`)[0].Split(`-`, 2)[1]) $(MinVerVersion.Split(`+`, 2)[1]) $(MinVerMajor).0.0.0 - $(MinVerMajor).$(MinVerMinor).$(MinVerPatch).0 + $(MinVerMajor).$(MinVerMinor).$(MinVerPatch).$(MinVerRevision) $(MinVerVersion) - $(MinVerMajor).$(MinVerMinor).$(MinVerPatch) + $(MinVerMajor).$(MinVerMinor).$(MinVerPatch).$(MinVerRevision) $(PackageVersion)-$(MinVerPreRelease) $(PackageVersion) @@ -72,6 +73,7 @@ + diff --git a/MinVerTests.Infra/Package.cs b/MinVerTests.Infra/Package.cs index 15592d6a..4071f2b7 100644 --- a/MinVerTests.Infra/Package.cs +++ b/MinVerTests.Infra/Package.cs @@ -5,16 +5,16 @@ namespace MinVerTests.Infra; public record Package(string Version, AssemblyVersion AssemblyVersion, FileVersion FileVersion, string InformationalVersion) { - public static Package WithVersion(int major, int minor, int patch, IEnumerable? preReleaseIdentifiers = null, int height = 0, string buildMetadata = "", string? informationalVersionAdditionalBuildMetadata = "") + public static Package WithVersion(int major, int minor, int patch, int revision, IEnumerable? preReleaseIdentifiers = null, int height = 0, string buildMetadata = "", string? informationalVersionAdditionalBuildMetadata = "") { var preReleaseToken = preReleaseIdentifiers == null ? "" : GetPreReleaseToken(preReleaseIdentifiers.ToList()); var heightToken = height == 0 ? "" : $".{height}"; var buildMetadataToken = string.IsNullOrEmpty(buildMetadata) ? "" : $"+{buildMetadata}"; - var version = $"{major}.{minor}.{patch}{preReleaseToken}{heightToken}"; + var version = $"{major}.{minor}.{patch}.{revision}{preReleaseToken}{heightToken}"; var informationalVersion = $"{version}{buildMetadataToken}{informationalVersionAdditionalBuildMetadata}"; - return new Package(version, new AssemblyVersion(major, 0, 0, 0), new FileVersion(major, minor, patch, 0, informationalVersion), informationalVersion); + return new Package(version, new AssemblyVersion(major, 0, 0, 0), new FileVersion(major, minor, patch, revision, informationalVersion), informationalVersion); } private static string GetPreReleaseToken(IReadOnlyList preReleaseIdentifiers) => preReleaseIdentifiers.Any() ? $"-{string.Join(".", preReleaseIdentifiers)}" : ""; diff --git a/MinVerTests.Infra/Sdk.cs b/MinVerTests.Infra/Sdk.cs index c8c27429..d52ce2a5 100644 --- a/MinVerTests.Infra/Sdk.cs +++ b/MinVerTests.Infra/Sdk.cs @@ -141,7 +141,8 @@ private static void CreateGlobalJsonIfRequired(string path) environmentVariables, handleExitCode).ConfigureAwait(false); - var matcher = new Matcher().AddInclude("**/bin/Debug/*.nupkg"); + //very weird, it always put the file in bin/x64/Debug and not bin/Debug changed it for now + var matcher = new Matcher().AddInclude("**/Debug/*.nupkg"); var packageFileNames = matcher.GetResultsInFullPath(path).OrderBy(result => result); var getPackages = packageFileNames.Select(GetPackage); var packages = await Task.WhenAll(getPackages).ConfigureAwait(false); @@ -184,15 +185,39 @@ private static async Task GetPackage(string fileName) var nuspecFileName = Directory.EnumerateFiles(extractedDirectoryName, "*.nuspec").First(); var nuspec = await File.ReadAllTextAsync(nuspecFileName).ConfigureAwait(false); - var nuspecVersion = nuspec.Split("")[1].Split("")[0]; + + //adding Revision part to value got from nuget because of automatic truncation by nuget (i have a feeling this could be done better) + var nuspecVersionRaw = nuspec.Split("")[1].Split("")[0]; + var nuspecVersionParts = nuspecVersionRaw.Split('-', 2); + var containsRevision = nuspecVersionParts[0].Count(c => c == '.') > 2; + string nuspecVersion; + if (containsRevision) + { + nuspecVersion = nuspecVersionRaw; + } + else + { + nuspecVersion = $"{nuspecVersionParts[0]}.0"; + nuspecVersion += nuspecVersionParts.Length > 1 ? $"-{nuspecVersionParts[1]}" : string.Empty; + } var assemblyFileName = Directory.EnumerateFiles(extractedDirectoryName, "*.dll", new EnumerationOptions { RecurseSubdirectories = true, }).First(); var (systemAssemblyVersion, informationalVersion) = GetAssemblyVersions(assemblyFileName); + //also changing informational version because of automatic truncation + if (informationalVersion.Count(c => c == '.') < 3) + { + informationalVersion += ".0"; + } + var assemblyVersion = new AssemblyVersion(systemAssemblyVersion.Major, systemAssemblyVersion.Minor, systemAssemblyVersion.Build, systemAssemblyVersion.Revision); var fileVersionInfo = FileVersionInfo.GetVersionInfo(assemblyFileName); - var fileVersion = new FileVersion(fileVersionInfo.FileMajorPart, fileVersionInfo.FileMinorPart, fileVersionInfo.FileBuildPart, fileVersionInfo.FilePrivatePart, fileVersionInfo.ProductVersion ?? ""); + //also changing product version because of automatic truncation + var productVersion = fileVersionInfo.ProductVersion?.Count(c => c == '.') < 3 + ? $"{fileVersionInfo.ProductVersion}.0" + : fileVersionInfo.ProductVersion; + var fileVersion = new FileVersion(fileVersionInfo.FileMajorPart, fileVersionInfo.FileMinorPart, fileVersionInfo.FileBuildPart, fileVersionInfo.FilePrivatePart, productVersion ?? ""); return new Package(nuspecVersion, assemblyVersion, fileVersion, informationalVersion); } diff --git a/MinVerTests.Lib/AutoIncrement.cs b/MinVerTests.Lib/AutoIncrement.cs index dd1f2d37..36b7cf6d 100644 --- a/MinVerTests.Lib/AutoIncrement.cs +++ b/MinVerTests.Lib/AutoIncrement.cs @@ -11,9 +11,14 @@ namespace MinVerTests.Lib; public static class AutoIncrement { [Theory] - [InlineData("1.2.3", VersionPart.Major, "2.0.0-alpha.0.1")] - [InlineData("1.2.3", VersionPart.Minor, "1.3.0-alpha.0.1")] - [InlineData("1.2.3", VersionPart.Patch, "1.2.4-alpha.0.1")] + [InlineData("1.2.3.4", VersionPart.Major, "2.0.0.0-alpha.0.1")] + [InlineData("1.2.3.4", VersionPart.Minor, "1.3.0.0-alpha.0.1")] + [InlineData("1.2.3.4", VersionPart.Patch, "1.2.4.0-alpha.0.1")] + [InlineData("1.2.3.4", VersionPart.Revision, "1.2.3.5-alpha.0.1")] + [InlineData("1.2.3", VersionPart.Major, "2.0.0.0-alpha.0.1")] + [InlineData("1.2.3", VersionPart.Minor, "1.3.0.0-alpha.0.1")] + [InlineData("1.2.3", VersionPart.Patch, "1.2.4.0-alpha.0.1")] + [InlineData("1.2.3", VersionPart.Revision, "1.2.3.1-alpha.0.1")] public static async Task RtmVersionIncrement(string tag, VersionPart autoIncrement, string expectedVersion) { // arrange diff --git a/MinVerTests.Lib/BuildMetadata.cs b/MinVerTests.Lib/BuildMetadata.cs index c161efaf..e88f5486 100644 --- a/MinVerTests.Lib/BuildMetadata.cs +++ b/MinVerTests.Lib/BuildMetadata.cs @@ -11,8 +11,8 @@ namespace MinVerTests.Lib; public static class BuildMetadata { [Theory] - [InlineData("", "0.0.0-alpha.0")] - [InlineData("a", "0.0.0-alpha.0+a")] + [InlineData("", "0.0.0.0-alpha.0")] + [InlineData("a", "0.0.0.0-alpha.0+a")] public static async Task NoCommits(string buildMetadata, string expectedVersion) { // arrange @@ -27,8 +27,8 @@ public static async Task NoCommits(string buildMetadata, string expectedVersion) } [Theory] - [InlineData("", "0.0.0-alpha.0")] - [InlineData("a", "0.0.0-alpha.0+a")] + [InlineData("", "0.0.0.0-alpha.0")] + [InlineData("a", "0.0.0.0-alpha.0+a")] public static async Task NoTag(string buildMetadata, string expectedVersion) { // arrange @@ -43,12 +43,15 @@ public static async Task NoTag(string buildMetadata, string expectedVersion) } [Theory] - [InlineData("1.2.3+a", "", "1.2.3+a")] - [InlineData("1.2.3", "b", "1.2.3+b")] - [InlineData("1.2.3+a", "b", "1.2.3+a.b")] - [InlineData("1.2.3-pre+a", "", "1.2.3-pre+a")] - [InlineData("1.2.3-pre", "b", "1.2.3-pre+b")] - [InlineData("1.2.3-pre+a", "b", "1.2.3-pre+a.b")] + [InlineData("1.2.3.4+a", "", "1.2.3.4+a")] + [InlineData("1.2.3.4", "b", "1.2.3.4+b")] + [InlineData("1.2.3.4+a", "b", "1.2.3.4+a.b")] + [InlineData("1.2.3.4-pre+a", "", "1.2.3.4-pre+a")] + [InlineData("1.2.3.4-pre", "b", "1.2.3.4-pre+b")] + [InlineData("1.2.3.4-pre+a", "b", "1.2.3.4-pre+a.b")] + [InlineData("1.2.3-pre+a", "b", "1.2.3.0-pre+a.b")] + [InlineData("1.2.3+a", "b", "1.2.3.0+a.b")] + [InlineData("1.2.3", "b", "1.2.3.0+b")] public static async Task CurrentTag(string tag, string buildMetadata, string expectedVersion) { // arrange @@ -64,12 +67,14 @@ public static async Task CurrentTag(string tag, string buildMetadata, string exp } [Theory] - [InlineData("1.2.3+a", "", "1.2.4-alpha.0.1")] - [InlineData("1.2.3", "b", "1.2.4-alpha.0.1+b")] - [InlineData("1.2.3+a", "b", "1.2.4-alpha.0.1+b")] - [InlineData("1.2.3-pre+a", "", "1.2.3-pre.1")] - [InlineData("1.2.3-pre", "b", "1.2.3-pre.1+b")] - [InlineData("1.2.3-pre+a", "b", "1.2.3-pre.1+b")] + [InlineData("1.2.3.4+a", "", "1.2.3.5-alpha.0.1")] + [InlineData("1.2.3.4", "b", "1.2.3.5-alpha.0.1+b")] + [InlineData("1.2.3.4+a", "b", "1.2.3.5-alpha.0.1+b")] + [InlineData("1.2.3.4-pre+a", "", "1.2.3.4-pre.1")] + [InlineData("1.2.3.4-pre", "b", "1.2.3.4-pre.1+b")] + [InlineData("1.2.3.4-pre+a", "b", "1.2.3.4-pre.1+b")] + [InlineData("1.2.3-pre+a", "b", "1.2.3.0-pre.1+b")] + [InlineData("1.2.3", "b", "1.2.3.1-alpha.0.1+b")] public static async Task PreviousTag(string tag, string buildMetadata, string expectedVersion) { // arrange diff --git a/MinVerTests.Lib/DefaultPreReleaseIdentifiers.cs b/MinVerTests.Lib/DefaultPreReleaseIdentifiers.cs index 4d822021..0db0cb45 100644 --- a/MinVerTests.Lib/DefaultPreReleaseIdentifiers.cs +++ b/MinVerTests.Lib/DefaultPreReleaseIdentifiers.cs @@ -11,8 +11,8 @@ namespace MinVerTests.Lib; public static class DefaultPreReleaseIdentifiers { [Theory] - [InlineData("alpha.0", "0.0.0-alpha.0")] - [InlineData("preview.x", "0.0.0-preview.x")] + [InlineData("alpha.0", "0.0.0.0-alpha.0")] + [InlineData("preview.x", "0.0.0.0-preview.x")] public static async Task Various(string identifiers, string expectedVersion) { // arrange diff --git a/MinVerTests.Lib/MinMajorMinor.cs b/MinVerTests.Lib/MinMajorMinor.cs index 67ddc229..fe792b20 100644 --- a/MinVerTests.Lib/MinMajorMinor.cs +++ b/MinVerTests.Lib/MinMajorMinor.cs @@ -22,13 +22,16 @@ public static async Task NoCommits() var actualVersion = Versioner.GetVersion(path, "", new MajorMinor(1, 2), "", default, PreReleaseIdentifiers.Default, false, NullLogger.Instance); // assert - Assert.Equal("1.2.0-alpha.0", actualVersion.ToString()); + Assert.Equal("1.2.0.0-alpha.0", actualVersion.ToString()); } [Theory] - [InlineData("4.0.0", 3, 2, "4.0.0", true)] - [InlineData("4.3.0", 4, 3, "4.3.0", true)] - [InlineData("4.3.0", 5, 4, "5.4.0-alpha.0", false)] + [InlineData("4.0.0.0", 3, 2, "4.0.0.0", true)] + [InlineData("4.3.0.0", 4, 3, "4.3.0.0", true)] + [InlineData("4.3.0.0", 5, 4, "5.4.0.0-alpha.0", false)] + [InlineData("4.0.0", 3, 2, "4.0.0.0", true)] + [InlineData("4.3.0", 4, 3, "4.3.0.0", true)] + [InlineData("4.3.0", 5, 6, "5.6.0.0-alpha.0", false)] public static async Task Tagged(string tag, int major, int minor, string expectedVersion, bool isRedundant) { // arrange @@ -60,6 +63,6 @@ public static async Task NotTagged() var actualVersion = Versioner.GetVersion(path, "", new MajorMinor(1, 0), "", default, PreReleaseIdentifiers.Default, false, NullLogger.Instance); // assert - Assert.Equal("1.0.0-alpha.0", actualVersion.ToString()); + Assert.Equal("1.0.0.0-alpha.0", actualVersion.ToString()); } } diff --git a/MinVerTests.Lib/TagPrefixes.cs b/MinVerTests.Lib/TagPrefixes.cs index 2d564566..4894fe46 100644 --- a/MinVerTests.Lib/TagPrefixes.cs +++ b/MinVerTests.Lib/TagPrefixes.cs @@ -11,9 +11,12 @@ namespace MinVerTests.Lib; public static class TagPrefixes { [Theory] - [InlineData("2.3.4", "", "2.3.4")] - [InlineData("v3.4.5", "v", "3.4.5")] - [InlineData("version5.6.7", "version", "5.6.7")] + [InlineData("2.3.4.5", "", "2.3.4.5")] + [InlineData("v3.4.5.8", "v", "3.4.5.8")] + [InlineData("version5.6.7.15", "version", "5.6.7.15")] + [InlineData("2.3.4", "", "2.3.4.0")] + [InlineData("r3.4.5", "r", "3.4.5.0")] + [InlineData("revision5.6.7", "revision", "5.6.7.0")] public static async Task TagPrefix(string tag, string prefix, string expectedVersion) { // act diff --git a/MinVerTests.Lib/Versions.cs b/MinVerTests.Lib/Versions.cs index 07f8a14b..bde2a6f2 100644 --- a/MinVerTests.Lib/Versions.cs +++ b/MinVerTests.Lib/Versions.cs @@ -116,7 +116,7 @@ public static async Task EmptyRepo() var version = Versioner.GetVersion(path, "", MajorMinor.Default, "", default, PreReleaseIdentifiers.Default, false, NullLogger.Instance); // assert - Assert.Equal("0.0.0-alpha.0", version.ToString()); + Assert.Equal("0.0.0.0-alpha.0", version.ToString()); } [Fact] @@ -130,6 +130,6 @@ public static void NoRepo() var version = Versioner.GetVersion(path, "", MajorMinor.Default, "", default, PreReleaseIdentifiers.Default, false, NullLogger.Instance); // assert - Assert.Equal("0.0.0-alpha.0", version.ToString()); + Assert.Equal("0.0.0.0-alpha.0", version.ToString()); } } diff --git a/MinVerTests.Lib/log.0.0.txt b/MinVerTests.Lib/log.0.0.txt index 70f0ca9d..07c659fb 100644 --- a/MinVerTests.Lib/log.0.0.txt +++ b/MinVerTests.Lib/log.0.0.txt @@ -43,10 +43,10 @@ Trace: - 1 Trace: Checking parents of commit 2... Trace: Checking commit 0 (height 2)... Trace: Found no version tags on commit 0. -Trace: Found root commit { Commit: 0, Tag: '', Version: 0.0.0-alpha.0, Height: 2 }. +Trace: Found root commit { Commit: 0, Tag: '', Version: 0.0.0.0-alpha.0, Height: 2 }. Trace: Checking parents of commit 2... Trace: Checking commit 1 (height 2)... -Trace: Found version tag { Commit: 1, Tag: '1.0.0-foo.1', Version: 1.0.0-foo.1, Height: 2 }. +Trace: Found version tag { Commit: 1, Tag: '1.0.0-foo.1', Version: 1.0.0.0-foo.1, Height: 2 }. Trace: Checking parents of commit 5... Trace: Checking commit 3 (height 1)... Trace: Found no version tags on commit 3. @@ -64,7 +64,7 @@ Trace: Checking parents of commit 4... Trace: Checking commit 2 (height 2)... Trace: Commit 2 already checked. Abandoning path. Debug: 6 commits checked. -Debug: Ignoring { Commit: 0, Tag: '', Version: 0.0.0-alpha.0, Height: 2 }. -Info: Using { Commit: 1, Tag: '1.0.0-foo.1', Version: 1.0.0-foo.1, Height: 2 }. -Debug: The calculated version 1.0.0-foo.1.2 satisfies the minimum major minor 0.0. -Info: Calculated version 1.0.0-foo.1.2. +Debug: Ignoring { Commit: 0, Tag: '', Version: 0.0.0.0-alpha.0, Height: 2 }. +Info: Using { Commit: 1, Tag: '1.0.0-foo.1', Version: 1.0.0.0-foo.1, Height: 2 }. +Debug: The calculated version 1.0.0.0-foo.1.2 satisfies the minimum major minor 0.0. +Info: Calculated version 1.0.0.0-foo.1.2. diff --git a/MinVerTests.Lib/log.2.0.txt b/MinVerTests.Lib/log.2.0.txt index c259e339..494c703c 100644 --- a/MinVerTests.Lib/log.2.0.txt +++ b/MinVerTests.Lib/log.2.0.txt @@ -43,10 +43,10 @@ Trace: - 1 Trace: Checking parents of commit 2... Trace: Checking commit 0 (height 2)... Trace: Found no version tags on commit 0. -Trace: Found root commit { Commit: 0, Tag: '', Version: 0.0.0-alpha.0, Height: 2 }. +Trace: Found root commit { Commit: 0, Tag: '', Version: 0.0.0.0-alpha.0, Height: 2 }. Trace: Checking parents of commit 2... Trace: Checking commit 1 (height 2)... -Trace: Found version tag { Commit: 1, Tag: '1.0.0-foo.1', Version: 1.0.0-foo.1, Height: 2 }. +Trace: Found version tag { Commit: 1, Tag: '1.0.0-foo.1', Version: 1.0.0.0-foo.1, Height: 2 }. Trace: Checking parents of commit 5... Trace: Checking commit 3 (height 1)... Trace: Found no version tags on commit 3. @@ -64,7 +64,7 @@ Trace: Checking parents of commit 4... Trace: Checking commit 2 (height 2)... Trace: Commit 2 already checked. Abandoning path. Debug: 6 commits checked. -Debug: Ignoring { Commit: 0, Tag: '', Version: 0.0.0-alpha.0, Height: 2 }. -Info: Using { Commit: 1, Tag: '1.0.0-foo.1', Version: 1.0.0-foo.1, Height: 2 }. -Info: Bumping version to 2.0.0-alpha.0.2 to satisfy minimum major minor 2.0. -Info: Calculated version 2.0.0-alpha.0.2. +Debug: Ignoring { Commit: 0, Tag: '', Version: 0.0.0.0-alpha.0, Height: 2 }. +Info: Using { Commit: 1, Tag: '1.0.0-foo.1', Version: 1.0.0.0-foo.1, Height: 2 }. +Info: Bumping version to 2.0.0.0-alpha.0.2 to satisfy minimum major minor 2.0. +Info: Calculated version 2.0.0.0-alpha.0.2. diff --git a/MinVerTests.Lib/versions.txt b/MinVerTests.Lib/versions.txt index ed4b28af..c70b599f 100644 --- a/MinVerTests.Lib/versions.txt +++ b/MinVerTests.Lib/versions.txt @@ -1,30 +1,30 @@ -* ' (HEAD -> main, tag: v/1.1.0, tag: 1.1.0-rc.1, tag: 1.1.0)' -* ' (tag: v/1.1.0-beta.10.1)' -* ' (tag: v/1.1.0-beta.10, tag: 1.1.0-beta.2, tag: 1.1.0-beta.10)' -* ' (tag: v/1.1.0-alpha.1.2)' +* ' (HEAD -> main, tag: v/1.1.0.0, tag: 1.1.0-rc.1, tag: 1.1.0)' +* ' (tag: v/1.1.0.0-beta.10.1)' +* ' (tag: v/1.1.0.0-beta.10, tag: 1.1.0-beta.2, tag: 1.1.0-beta.10)' +* ' (tag: v/1.1.0.0-alpha.1.2)' |\ -| * ' (tag: v/1.0.2-alpha.0.1, foo)' -| * ' (tag: v/1.0.1, tag: 1.0.1)' -| * ' (tag: v/1.0.1-alpha.1.1)' -| * ' (tag: v/1.0.1-alpha.1, tag: 1.0.1-alpha.1)' -| * ' (tag: v(2)/1.0.1-alpha.0.2)' -| * ' (tag: v(2)/1.0.1-alpha.0.1)' -* | ' (tag: v/1.1.0-alpha.1.1)' -* | ' (tag: v/1.1.0-alpha.1, tag: 1.1.0-alpha.1)' -* | ' (tag: v/1.0.1-alpha.0.2)' -* | ' (tag: v/1.0.1-alpha.0.1)' +| * ' (tag: v/1.0.1.1-alpha.0.1, foo)' +| * ' (tag: v/1.0.1.0, tag: 1.0.1)' +| * ' (tag: v/1.0.1.0-alpha.1.1)' +| * ' (tag: v/1.0.1.0-alpha.1, tag: 1.0.1-alpha.1)' +| * ' (tag: v(2)/1.0.0.1-alpha.0.2)' +| * ' (tag: v(2)/1.0.0.1-alpha.0.1)' +* | ' (tag: v/1.1.0.0-alpha.1.1)' +* | ' (tag: v/1.1.0.0-alpha.1, tag: 1.1.0-alpha.1)' +* | ' (tag: v/1.0.0.1-alpha.0.2)' +* | ' (tag: v/1.0.0.1-alpha.0.1)' |/ -* ' (tag: v/1.0.0, tag: 1.0.0-rc.1, tag: 1.0.0)' -* ' (tag: v/1.0.0-alpha.1.1)' -* ' (tag: v/1.0.0-alpha.1, tag: 1.0.0-alpha.1)' -* ' (tag: v/0.1.1-alpha.0.1)' -* ' (tag: v/0.1.0, tag: 0.1.0)' -* ' (tag: v/0.1.0-beta.1.1)' -* ' (tag: v/0.1.0-beta.1, tag: 0.1.0-beta.1)' -* ' (tag: v/0.0.1-alpha.0.1)' -* ' (tag: v/0.0.0, tag: 0.0.0)' -* ' (tag: v/0.0.0-alpha.1.1)' -* ' (tag: v/0.0.0-alpha.1, tag: 0.0.0-alpha.1)' -* ' (tag: v/0.0.0-alpha.0.2)' -* ' (tag: v/0.0.0-alpha.0.1)' -* ' (tag: v/0.0.0-alpha.0)' +* ' (tag: v/1.0.0.0, tag: 1.0.0-rc.1, tag: 1.0.0)' +* ' (tag: v/1.0.0.0-alpha.1.1)' +* ' (tag: v/1.0.0.0-alpha.1, tag: 1.0.0-alpha.1)' +* ' (tag: v/0.1.0.1-alpha.0.1)' +* ' (tag: v/0.1.0.0, tag: 0.1.0)' +* ' (tag: v/0.1.0.0-beta.1.1)' +* ' (tag: v/0.1.0.0-beta.1, tag: 0.1.0-beta.1)' +* ' (tag: v/0.0.0.1-alpha.0.1)' +* ' (tag: v/0.0.0.0, tag: 0.0.0)' +* ' (tag: v/0.0.0.0-alpha.1.1)' +* ' (tag: v/0.0.0.0-alpha.1, tag: 0.0.0-alpha.1)' +* ' (tag: v/0.0.0.0-alpha.0.2)' +* ' (tag: v/0.0.0.0-alpha.0.1)' +* ' (tag: v/0.0.0.0-alpha.0)' diff --git a/MinVerTests.Packages/AnnotatedTag.cs b/MinVerTests.Packages/AnnotatedTag.cs index 3fa25e59..75b85dfe 100644 --- a/MinVerTests.Packages/AnnotatedTag.cs +++ b/MinVerTests.Packages/AnnotatedTag.cs @@ -16,9 +16,9 @@ public static async Task HasTagVersion() await Git.Init(path); await Git.Commit(path); - await Git.AnnotatedTag(path, "2.3.4-alpha.5+build.6", "foo"); + await Git.AnnotatedTag(path, "2.3.4.6-alpha.5+build.6", "foo"); - var expected = Package.WithVersion(2, 3, 4, ["alpha", "5",], 0, "build.6"); + var expected = Package.WithVersion(2, 3, 4, 6, ["alpha", "5",], 0, "build.6"); // act var (actual, _, _) = await Sdk.BuildProject(path); diff --git a/MinVerTests.Packages/BuildMetadata.cs b/MinVerTests.Packages/BuildMetadata.cs index 4733d716..f6a5a6de 100644 --- a/MinVerTests.Packages/BuildMetadata.cs +++ b/MinVerTests.Packages/BuildMetadata.cs @@ -14,7 +14,7 @@ public static async Task HasBuildMetadata() var path = MethodBase.GetCurrentMethod().GetTestDirectory(); await Sdk.CreateProject(path); var envVars = ("MinVerBuildMetadata", "build.123"); - var expected = Package.WithVersion(0, 0, 0, ["alpha", "0",], 0, "build.123"); + var expected = Package.WithVersion(0, 0, 0, 0, ["alpha", "0",], 0, "build.123"); // act var (actual, _, _) = await Sdk.BuildProject(path, envVars: envVars); diff --git a/MinVerTests.Packages/Cleaning.cs b/MinVerTests.Packages/Cleaning.cs index 79b0e062..62dee0af 100644 --- a/MinVerTests.Packages/Cleaning.cs +++ b/MinVerTests.Packages/Cleaning.cs @@ -25,7 +25,8 @@ public static async Task PackagesAreCleaned(bool multiTarget) _ = await Sdk.BuildProject(path); - var packages = new Matcher().AddInclude("**/bin/Debug/*.nupkg"); + //very weird, it always put the file in bin/x64/Debug and not bin/Debug changed it for now + var packages = new Matcher().AddInclude("**/Debug/*.nupkg"); Assert.NotEmpty(packages.GetResultsInFullPath(path)); // act diff --git a/MinVerTests.Packages/CommitAfterPreReleaseTag.cs b/MinVerTests.Packages/CommitAfterPreReleaseTag.cs index 64df5d0b..8298f5de 100644 --- a/MinVerTests.Packages/CommitAfterPreReleaseTag.cs +++ b/MinVerTests.Packages/CommitAfterPreReleaseTag.cs @@ -16,10 +16,10 @@ public static async Task HasHeightOne() await Git.Init(path); await Git.Commit(path); - await Git.Tag(path, "2.3.4-alpha.5"); + await Git.Tag(path, "2.3.4.6-alpha.5"); await Git.Commit(path); - var expected = Package.WithVersion(2, 3, 4, ["alpha", "5",], 1); + var expected = Package.WithVersion(2, 3, 4, 6, ["alpha", "5",], 1); // act var (actual, _, _) = await Sdk.BuildProject(path); diff --git a/MinVerTests.Packages/CommitAfterRtmTag.cs b/MinVerTests.Packages/CommitAfterRtmTag.cs index 98a22f5a..0bdeaabd 100644 --- a/MinVerTests.Packages/CommitAfterRtmTag.cs +++ b/MinVerTests.Packages/CommitAfterRtmTag.cs @@ -19,7 +19,7 @@ public static async Task HasNextPatchWithHeightOne() await Git.Tag(path, "2.3.4"); await Git.Commit(path); - var expected = Package.WithVersion(2, 3, 5, ["alpha", "0",], 1); + var expected = Package.WithVersion(2, 3, 4, 1, ["alpha", "0",], 1); // act var (actual, _, _) = await Sdk.BuildProject(path); diff --git a/MinVerTests.Packages/CommitAfterTagWithBuildMetadata.cs b/MinVerTests.Packages/CommitAfterTagWithBuildMetadata.cs index c6cf118c..9a8f4c0b 100644 --- a/MinVerTests.Packages/CommitAfterTagWithBuildMetadata.cs +++ b/MinVerTests.Packages/CommitAfterTagWithBuildMetadata.cs @@ -16,10 +16,10 @@ public static async Task DoesNotHaveBuildMetadata() await Git.Init(path); await Git.Commit(path); - await Git.Tag(path, "2.3.4+build.5"); + await Git.Tag(path, "2.3.4.6+build.5"); await Git.Commit(path); - var expected = Package.WithVersion(2, 3, 5, ["alpha", "0",], 1); + var expected = Package.WithVersion(2, 3, 4, 7, ["alpha", "0",], 1); // act var (actual, _, _) = await Sdk.BuildProject(path); diff --git a/MinVerTests.Packages/CustomAutoIncrement.cs b/MinVerTests.Packages/CustomAutoIncrement.cs index 3ad0d465..95d0df48 100644 --- a/MinVerTests.Packages/CustomAutoIncrement.cs +++ b/MinVerTests.Packages/CustomAutoIncrement.cs @@ -21,7 +21,7 @@ public static async Task HasCustomAutoIncrement() var envVars = ("MinVerAutoIncrement".ToAltCase(), "minor"); - var expected = Package.WithVersion(2, 4, 0, ["alpha", "0",], 1); + var expected = Package.WithVersion(2, 4, 0, 0, ["alpha", "0",], 1); // act var (actual, _, _) = await Sdk.BuildProject(path, envVars: envVars); diff --git a/MinVerTests.Packages/CustomDefaultPreReleaseIdentifiers.cs b/MinVerTests.Packages/CustomDefaultPreReleaseIdentifiers.cs index c9c32234..4d8774c3 100644 --- a/MinVerTests.Packages/CustomDefaultPreReleaseIdentifiers.cs +++ b/MinVerTests.Packages/CustomDefaultPreReleaseIdentifiers.cs @@ -22,7 +22,7 @@ public static async Task HasCustomDefaultPreReleaseIdentifiers() var envVars = ("MinVerDefaultPreReleaseIdentifiers".ToAltCase(), "preview.0"); - var expected = Package.WithVersion(2, 3, 5, ["preview", "0",], 1); + var expected = Package.WithVersion(2, 3, 4, 1, ["preview", "0",], 1); // act var (actual, _, _) = await Sdk.BuildProject(path, envVars: envVars); @@ -47,7 +47,7 @@ public static async Task HasCustomDefaultPreReleasePhase() var envVars = ("MinVerDefaultPreReleasePhase".ToAltCase(), "preview"); - var expected = Package.WithVersion(2, 3, 5, ["preview", "0",], 1); + var expected = Package.WithVersion(2, 3, 4, 1, ["preview", "0",], 1); // act var (actual, sdkStandardOutput, _) = await Sdk.BuildProject(path, envVars: envVars); @@ -79,7 +79,7 @@ public static async Task HasCustomDefaultPreReleaseIdentifiersAndCustomDefaultPr ("MinVerDefaultPreReleasePhase", "foo"), }; - var expected = Package.WithVersion(2, 3, 5, ["preview", "0",], 1); + var expected = Package.WithVersion(2, 3, 4, 1, ["preview", "0",], 1); // act var (actual, _, _) = await Sdk.BuildProject(path, envVars: envVars); diff --git a/MinVerTests.Packages/EmptyRepo.cs b/MinVerTests.Packages/EmptyRepo.cs index fcded5c6..f82267c7 100644 --- a/MinVerTests.Packages/EmptyRepo.cs +++ b/MinVerTests.Packages/EmptyRepo.cs @@ -15,7 +15,7 @@ public static async Task HasDefaultVersion() var path = MethodBase.GetCurrentMethod().GetTestDirectory(); await Sdk.CreateProject(path); await Git.Init(path); - var expected = Package.WithVersion(0, 0, 0, ["alpha", "0",]); + var expected = Package.WithVersion(0, 0, 0, 0, ["alpha", "0",]); // act var (actual, sdkStandardOutput, _) = await Sdk.BuildProject(path); diff --git a/MinVerTests.Packages/FirstCommit.cs b/MinVerTests.Packages/FirstCommit.cs index ead93377..b28395eb 100644 --- a/MinVerTests.Packages/FirstCommit.cs +++ b/MinVerTests.Packages/FirstCommit.cs @@ -17,7 +17,7 @@ public static async Task HasDefaultVersion() await Git.Init(path); await Git.Commit(path); - var expected = Package.WithVersion(0, 0, 0, ["alpha", "0",]); + var expected = Package.WithVersion(0, 0, 0, 0, ["alpha", "0",]); // act var (actual, _, _) = await Sdk.BuildProject(path); diff --git a/MinVerTests.Packages/IgnoringHeight.cs b/MinVerTests.Packages/IgnoringHeight.cs index 1469c604..3e8c1e31 100644 --- a/MinVerTests.Packages/IgnoringHeight.cs +++ b/MinVerTests.Packages/IgnoringHeight.cs @@ -16,12 +16,12 @@ public static async Task HeightIsIgnored() await Git.Init(path); await Git.Commit(path); - await Git.Tag(path, "2.3.4"); + await Git.Tag(path, "2.3.4.6"); await Git.Commit(path); var envVars = ("MinVerIgnoreHeight".ToAltCase(), "true".ToAltCase()); - var expected = Package.WithVersion(2, 3, 4); + var expected = Package.WithVersion(2, 3, 4, 6); // act var (actual, _, _) = await Sdk.BuildProject(path, envVars: envVars); diff --git a/MinVerTests.Packages/MinimumMajorMinorAfterTag.cs b/MinVerTests.Packages/MinimumMajorMinorAfterTag.cs index 3ab657d0..4081e200 100644 --- a/MinVerTests.Packages/MinimumMajorMinorAfterTag.cs +++ b/MinVerTests.Packages/MinimumMajorMinorAfterTag.cs @@ -21,7 +21,7 @@ public static async Task HasMinimumMajorMinorWithHeightOne() var envVars = ("MinVerMinimumMajorMinor".ToAltCase(), "3.0"); - var expected = Package.WithVersion(3, 0, 0, ["alpha", "0",], 1); + var expected = Package.WithVersion(3, 0, 0, 0, ["alpha", "0",], 1); // act var (actual, _, _) = await Sdk.BuildProject(path, envVars: envVars); diff --git a/MinVerTests.Packages/MinimumMajorMinorOnTag.cs b/MinVerTests.Packages/MinimumMajorMinorOnTag.cs index 212eb532..84c94c12 100644 --- a/MinVerTests.Packages/MinimumMajorMinorOnTag.cs +++ b/MinVerTests.Packages/MinimumMajorMinorOnTag.cs @@ -20,7 +20,7 @@ public static async Task HasMinimumMajorMinor() var envVars = ("MinVerMinimumMajorMinor".ToAltCase(), "3.0"); - var expected = Package.WithVersion(3, 0, 0, ["alpha", "0",]); + var expected = Package.WithVersion(3, 0, 0, 0, ["alpha", "0",]); // act var (actual, _, _) = await Sdk.BuildProject(path, envVars: envVars); diff --git a/MinVerTests.Packages/MultipleProjects.cs b/MinVerTests.Packages/MultipleProjects.cs index e53e78c1..cd92389e 100644 --- a/MinVerTests.Packages/MultipleProjects.cs +++ b/MinVerTests.Packages/MultipleProjects.cs @@ -35,12 +35,12 @@ public async Task MultipleTagPrefixes() await Git.Init(path); await Git.Commit(path); await Git.Tag(path, "2.3.4"); - await Git.Tag(path, "v5.6.7"); + await Git.Tag(path, "v5.6.7.8"); - var expected0 = Package.WithVersion(2, 3, 4); - var expected1 = Package.WithVersion(5, 6, 7); - var expected2 = Package.WithVersion(2, 3, 4); - var expected3 = Package.WithVersion(5, 6, 7); + var expected0 = Package.WithVersion(2, 3, 4, 0); + var expected1 = Package.WithVersion(5, 6, 7, 8); + var expected2 = Package.WithVersion(2, 3, 4, 0); + var expected3 = Package.WithVersion(5, 6, 7, 8); // act var (actual, standardOutput, _) = await Sdk.Build(path); @@ -55,10 +55,10 @@ public async Task MultipleTagPrefixes() Assert.Collection( versionCalculations, - message => Assert.Equal("MinVer: Calculated version 2.3.4.", message), - message => Assert.Equal("MinVer: Calculated version 5.6.7.", message), - message => Assert.Equal("MinVer: Calculated version 2.3.4.", message), - message => Assert.Equal("MinVer: Calculated version 5.6.7.", message)); + message => Assert.Equal("MinVer: Calculated version 2.3.4.0.", message), + message => Assert.Equal("MinVer: Calculated version 5.6.7.8.", message), + message => Assert.Equal("MinVer: Calculated version 2.3.4.0.", message), + message => Assert.Equal("MinVer: Calculated version 5.6.7.8.", message)); Assert.Collection( actual, diff --git a/MinVerTests.Packages/NoRepo.cs b/MinVerTests.Packages/NoRepo.cs index 39c137fc..a9208f31 100644 --- a/MinVerTests.Packages/NoRepo.cs +++ b/MinVerTests.Packages/NoRepo.cs @@ -14,7 +14,7 @@ public static async Task HasDefaultVersion() // arrange var path = MethodBase.GetCurrentMethod().GetTestDirectory(); await Sdk.CreateProject(path); - var expected = Package.WithVersion(0, 0, 0, ["alpha", "0",]); + var expected = Package.WithVersion(0, 0, 0, 0, ["alpha", "0",]); // act var (actual, sdkStandardOutput, _) = await Sdk.BuildProject(path); diff --git a/MinVerTests.Packages/NonVersionTag.cs b/MinVerTests.Packages/NonVersionTag.cs index 2274558a..25e1f316 100644 --- a/MinVerTests.Packages/NonVersionTag.cs +++ b/MinVerTests.Packages/NonVersionTag.cs @@ -18,7 +18,7 @@ public static async Task HasDefaultVersion() await Git.Commit(path); await Git.Tag(path, "foo"); - var expected = Package.WithVersion(0, 0, 0, ["alpha", "0",]); + var expected = Package.WithVersion(0, 0, 0, 0, ["alpha", "0",]); // act var (actual, _, _) = await Sdk.BuildProject(path); diff --git a/MinVerTests.Packages/OptionMasking.cs b/MinVerTests.Packages/OptionMasking.cs index d4f3a4c5..d903ea8d 100644 --- a/MinVerTests.Packages/OptionMasking.cs +++ b/MinVerTests.Packages/OptionMasking.cs @@ -24,7 +24,7 @@ public static async Task AutoIncrementBackToDefault(string value) var envVars = ("MinVerAutoIncrement".ToAltCase(), "minor"); var args = $"--auto-increment {value}"; - var expected = Package.WithVersion(2, 3, 5, ["alpha", "0",], 1); + var expected = Package.WithVersion(2, 3, 5, 0, ["alpha", "0",], 1); // act var (cliStandardOutput, _) = await MinVerCli.ReadAsync(path, args: args, envVars: envVars); @@ -45,7 +45,7 @@ public static async Task BuildMetadataBackToDefault(string value) var envVars = ("MinVerBuildMetadata", "build.123"); var args = $"--build-metadata {value}"; - var expected = Package.WithVersion(0, 0, 0, ["alpha", "0",]); + var expected = Package.WithVersion(0, 0, 0, 0, ["alpha", "0",]); // act var (cliStandardOutput, _) = await MinVerCli.ReadAsync(path, args: args, envVars: envVars); @@ -64,13 +64,13 @@ public static async Task DefaultPreReleaseIdentifiersBackToDefault(string value) await Git.Init(path); await Git.Commit(path); - await Git.Tag(path, "2.3.4"); + await Git.Tag(path, "2.3.5.4"); await Git.Commit(path); var envVars = ("MinVerDefaultPreReleaseIdentifiers".ToAltCase(), "preview.0"); var args = $"--default-pre-release-identifiers {value}"; - var expected = Package.WithVersion(2, 3, 5, ["alpha", "0",], 1); + var expected = Package.WithVersion(2, 3, 5, 5, ["alpha", "0",], 1); // act var (cliStandardOutput, _) = await MinVerCli.ReadAsync(path, args: args, envVars: envVars); @@ -89,13 +89,13 @@ public static async Task DefaultPreReleasePhaseBackToDefault(string value) await Git.Init(path); await Git.Commit(path); - await Git.Tag(path, "2.3.4"); + await Git.Tag(path, "2.3.4.15"); await Git.Commit(path); var envVars = ("MinVerDefaultPreReleasePhase".ToAltCase(), "preview"); var args = $"--default-pre-release-phase {value}"; - var expected = Package.WithVersion(2, 3, 5, ["alpha", "0",], 1); + var expected = Package.WithVersion(2, 3, 4, 16, ["alpha", "0",], 1); // act var (cliStandardOutput, _) = await MinVerCli.ReadAsync(path, args: args, envVars: envVars); @@ -119,7 +119,7 @@ public static async Task MinimumMajorMinorBackToDefault(string value) var envVars = ("MinVerMinimumMajorMinor".ToAltCase(), "3.0"); var args = $"--minimum-major-minor {value}"; - var expected = Package.WithVersion(2, 3, 4); + var expected = Package.WithVersion(2, 3, 4, 0); // act var (cliStandardOutput, _) = await MinVerCli.ReadAsync(path, args: args, envVars: envVars); @@ -143,7 +143,7 @@ public static async Task TagPrefixBackToDefault(string value) var envVars = ("MinVerTagPrefix", "v."); var args = $"--tag-prefix {value}"; - var expected = Package.WithVersion(2, 3, 4, ["alpha", "5",]); + var expected = Package.WithVersion(2, 3, 4, 0, ["alpha", "5",]); // act var (cliStandardOutput, _) = await MinVerCli.ReadAsync(path, args: args, envVars: envVars); diff --git a/MinVerTests.Packages/OutputVariables.cs b/MinVerTests.Packages/OutputVariables.cs index 4e3adb37..919e5bc9 100644 --- a/MinVerTests.Packages/OutputVariables.cs +++ b/MinVerTests.Packages/OutputVariables.cs @@ -14,22 +14,23 @@ public static async Task AreSet() // arrange var path = MethodBase.GetCurrentMethod().GetTestDirectory(); await Sdk.CreateProject(path); - var envVars = ("MinVerVersionOverride".ToAltCase(), "2.3.4-alpha-x.5+build.6"); + var envVars = ("MinVerVersionOverride".ToAltCase(), "2.3.4.5-alpha-x.5+build.6"); // act var (_, standardOutput, _) = await Sdk.BuildProject(path, envVars: envVars); // assert - Assert.Contains("MinVer: [output] MinVerVersion=2.3.4-alpha-x.5+build.6", standardOutput, StringComparison.Ordinal); + Assert.Contains("MinVer: [output] MinVerVersion=2.3.4.5-alpha-x.5+build.6", standardOutput, StringComparison.Ordinal); Assert.Contains("MinVer: [output] MinVerMajor=2", standardOutput, StringComparison.Ordinal); Assert.Contains("MinVer: [output] MinVerMinor=3", standardOutput, StringComparison.Ordinal); Assert.Contains("MinVer: [output] MinVerPatch=4", standardOutput, StringComparison.Ordinal); + Assert.Contains("MinVer: [output] MinVerRevision=5", standardOutput, StringComparison.Ordinal); Assert.Contains("MinVer: [output] MinVerPreRelease=alpha-x.5", standardOutput, StringComparison.Ordinal); Assert.Contains("MinVer: [output] MinVerBuildMetadata=build.6", standardOutput, StringComparison.Ordinal); Assert.Contains("MinVer: [output] AssemblyVersion=2.0.0.0", standardOutput, StringComparison.Ordinal); - Assert.Contains("MinVer: [output] FileVersion=2.3.4.0", standardOutput, StringComparison.Ordinal); - Assert.Contains("MinVer: [output] InformationalVersion=2.3.4-alpha-x.5+build.6", standardOutput, StringComparison.Ordinal); - Assert.Contains("MinVer: [output] PackageVersion=2.3.4-alpha-x.5", standardOutput, StringComparison.Ordinal); - Assert.Contains("MinVer: [output] Version=2.3.4-alpha-x.5", standardOutput, StringComparison.Ordinal); + Assert.Contains("MinVer: [output] FileVersion=2.3.4.5", standardOutput, StringComparison.Ordinal); + Assert.Contains("MinVer: [output] InformationalVersion=2.3.4.5-alpha-x.5+build.6", standardOutput, StringComparison.Ordinal); + Assert.Contains("MinVer: [output] PackageVersion=2.3.4.5-alpha-x.5", standardOutput, StringComparison.Ordinal); + Assert.Contains("MinVer: [output] Version=2.3.4.5-alpha-x.5", standardOutput, StringComparison.Ordinal); } } diff --git a/MinVerTests.Packages/PreReleaseTag.cs b/MinVerTests.Packages/PreReleaseTag.cs index 1c7fe527..5a12aa86 100644 --- a/MinVerTests.Packages/PreReleaseTag.cs +++ b/MinVerTests.Packages/PreReleaseTag.cs @@ -18,7 +18,7 @@ public static async Task HasTagVersion() await Git.Commit(path); await Git.Tag(path, "2.3.4-alpha.5"); - var expected = Package.WithVersion(2, 3, 4, ["alpha", "5",]); + var expected = Package.WithVersion(2, 3, 4, 0, ["alpha", "5",]); // act var (actual, _, _) = await Sdk.BuildProject(path); diff --git a/MinVerTests.Packages/RtmTag.cs b/MinVerTests.Packages/RtmTag.cs index fb0c8372..6fd72455 100644 --- a/MinVerTests.Packages/RtmTag.cs +++ b/MinVerTests.Packages/RtmTag.cs @@ -18,7 +18,7 @@ public static async Task HasTagVersion() await Git.Commit(path); await Git.Tag(path, "2.3.4"); - var expected = Package.WithVersion(2, 3, 4); + var expected = Package.WithVersion(2, 3, 4, 0); // act var (actual, _, _) = await Sdk.BuildProject(path); diff --git a/MinVerTests.Packages/Skip.cs b/MinVerTests.Packages/Skip.cs index 9967ed9f..b7729cbb 100644 --- a/MinVerTests.Packages/Skip.cs +++ b/MinVerTests.Packages/Skip.cs @@ -14,7 +14,7 @@ public static async Task HasDefaultSdkVersion() var path = MethodBase.GetCurrentMethod().GetTestDirectory(); await Sdk.CreateProject(path); var envVars = ("MinVerSkip".ToAltCase(), "true"); - var expected = Package.WithVersion(1, 0, 0); + var expected = Package.WithVersion(1, 0, 0, 0); // act var (actual, _, _) = await Sdk.BuildProject(path, envVars: envVars); diff --git a/MinVerTests.Packages/SourceLink.cs b/MinVerTests.Packages/SourceLink.cs index 8c231f7a..04a1f914 100644 --- a/MinVerTests.Packages/SourceLink.cs +++ b/MinVerTests.Packages/SourceLink.cs @@ -30,7 +30,7 @@ public static async Task HasCommitSha() var buildMetadata = "build.123"; var envVars = ("MinVerBuildMetadata", buildMetadata); - var expected = Package.WithVersion(0, 0, 0, ["alpha", "0",], 0, "build.123", $".{sha}"); + var expected = Package.WithVersion(0, 0, 0, 0, ["alpha", "0",], 0, "build.123", $".{sha}"); // act var (actual, _, _) = await Sdk.BuildProject(path, envVars: envVars); diff --git a/MinVerTests.Packages/TagWithBuildMetadata.cs b/MinVerTests.Packages/TagWithBuildMetadata.cs index c5157b09..5aa879f6 100644 --- a/MinVerTests.Packages/TagWithBuildMetadata.cs +++ b/MinVerTests.Packages/TagWithBuildMetadata.cs @@ -16,9 +16,9 @@ public static async Task HasTagVersion() await Git.Init(path); await Git.Commit(path); - await Git.Tag(path, "2.3.4-alpha.5+build.6"); + await Git.Tag(path, "2.3.4.5-alpha.5+build.6"); - var expected = Package.WithVersion(2, 3, 4, ["alpha", "5",], 0, "build.6"); + var expected = Package.WithVersion(2, 3, 4, 5, ["alpha", "5",], 0, "build.6"); // act var (actual, _, _) = await Sdk.BuildProject(path); diff --git a/MinVerTests.Packages/TagWithPrefix.cs b/MinVerTests.Packages/TagWithPrefix.cs index 3f280c4b..f84d8d2a 100644 --- a/MinVerTests.Packages/TagWithPrefix.cs +++ b/MinVerTests.Packages/TagWithPrefix.cs @@ -16,11 +16,11 @@ public static async Task HasTagVersion() await Git.Init(path); await Git.Commit(path); - await Git.Tag(path, "v.2.3.4-alpha.5"); + await Git.Tag(path, "v.2.3.4.5-alpha.5"); var envVars = ("MinVerTagPrefix", "v."); - var expected = Package.WithVersion(2, 3, 4, ["alpha", "5",]); + var expected = Package.WithVersion(2, 3, 4, 5, ["alpha", "5",]); // act var (actual, _, _) = await Sdk.BuildProject(path, envVars: envVars); diff --git a/MinVerTests.Packages/TwoCommitsAfterPreReleaseTag.cs b/MinVerTests.Packages/TwoCommitsAfterPreReleaseTag.cs index 0c1601ca..e1e16964 100644 --- a/MinVerTests.Packages/TwoCommitsAfterPreReleaseTag.cs +++ b/MinVerTests.Packages/TwoCommitsAfterPreReleaseTag.cs @@ -16,11 +16,11 @@ public static async Task HasHeightTwo() await Git.Init(path); await Git.Commit(path); - await Git.Tag(path, "2.3.4-alpha.5"); + await Git.Tag(path, "2.3.4.5-alpha.5"); await Git.Commit(path); await Git.Commit(path); - var expected = Package.WithVersion(2, 3, 4, ["alpha", "5",], 2); + var expected = Package.WithVersion(2, 3, 4, 5, ["alpha", "5",], 2); // act var (actual, _, _) = await Sdk.BuildProject(path); diff --git a/MinVerTests.Packages/TwoCommitsAfterRtmTag.cs b/MinVerTests.Packages/TwoCommitsAfterRtmTag.cs index e85e3ae0..102e4402 100644 --- a/MinVerTests.Packages/TwoCommitsAfterRtmTag.cs +++ b/MinVerTests.Packages/TwoCommitsAfterRtmTag.cs @@ -16,11 +16,11 @@ public static async Task HasNextPatchWithHeightTwo() await Git.Init(path); await Git.Commit(path); - await Git.Tag(path, "2.3.4"); + await Git.Tag(path, "2.3.4.5"); await Git.Commit(path); await Git.Commit(path); - var expected = Package.WithVersion(2, 3, 5, ["alpha", "0",], 2); + var expected = Package.WithVersion(2, 3, 4, 6, ["alpha", "0",], 2); // act var (actual, _, _) = await Sdk.BuildProject(path); diff --git a/MinVerTests.Packages/VersionOverride.cs b/MinVerTests.Packages/VersionOverride.cs index 490eac4c..39ff3a7c 100644 --- a/MinVerTests.Packages/VersionOverride.cs +++ b/MinVerTests.Packages/VersionOverride.cs @@ -16,11 +16,11 @@ public static async Task HasVersionOverride() await Git.Init(path); await Git.Commit(path); - await Git.Tag(path, "2.3.4"); + await Git.Tag(path, "2.3.4.5"); var envVars = ("MinVerVersionOverride".ToAltCase(), "3.4.5-alpha.6+build.7"); - var expected = Package.WithVersion(3, 4, 5, ["alpha", "6",], 0, "build.7"); + var expected = Package.WithVersion(3, 4, 5, 0, ["alpha", "6",], 0, "build.7"); // act var (actual, _, _) = await Sdk.BuildProject(path, envVars: envVars);