Skip to content

Commit 8d88cfd

Browse files
committed
GitTools#2325 - remove legacy variables
1 parent 1f37d07 commit 8d88cfd

File tree

55 files changed

+51
-650
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+51
-650
lines changed

build/build/Tasks/Package/PackageChocolatey.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public override void Run(BuildContext context)
3030
var chocolateySettings = new ChocolateyPackSettings
3131
{
3232
LimitOutput = true,
33-
Version = context.Version?.SemVersion,
33+
Version = context.Version?.ChocolateyVersion,
3434
OutputDirectory = Paths.Nuget,
3535
Files = context.GetFiles(artifactPath + "/**/*.*")
3636
.Select(file => new ChocolateyNuSpecContent { Source = file.FullPath, Target = file.FullPath.Replace(artifactPath, "") })

build/common/Addins/GitVersion/GitVersion.cs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ public sealed class GitVersion
4545
/// </summary>
4646
public string? BuildMetaData { get; set; }
4747

48-
/// <summary>
49-
/// Gets or sets the build metadata padded.
50-
/// </summary>
51-
public string? BuildMetaDataPadded { get; set; }
52-
5348
/// <summary>
5449
/// Gets or sets the major version.
5550
/// </summary>
@@ -65,16 +60,6 @@ public sealed class GitVersion
6560
/// </summary>
6661
public string? SemVer { get; set; }
6762

68-
/// <summary>
69-
/// Gets or sets the legacy Semantic Version.
70-
/// </summary>
71-
public string? LegacySemVer { get; set; }
72-
73-
/// <summary>
74-
/// Gets or sets the padded legacy Semantic Version.
75-
/// </summary>
76-
public string? LegacySemVerPadded { get; set; }
77-
7863
/// <summary>
7964
/// Gets or sets the assembly Semantic Version.
8065
/// </summary>
@@ -105,26 +90,11 @@ public sealed class GitVersion
10590
/// </summary>
10691
public string? Sha { get; set; }
10792

108-
/// <summary>
109-
/// Gets or sets the NuGet version for v2.
110-
/// </summary>
111-
public string? NuGetVersionV2 { get; set; }
112-
113-
/// <summary>
114-
/// Gets or sets the NuGet version.
115-
/// </summary>
116-
public string? NuGetVersion { get; set; }
117-
11893
/// <summary>
11994
/// Gets or sets the commits since version source.
12095
/// </summary>
12196
public int? CommitsSinceVersionSource { get; set; }
12297

123-
/// <summary>
124-
/// Gets or sets the commits since version source padded.
125-
/// </summary>
126-
public string? CommitsSinceVersionSourcePadded { get; set; }
127-
12898
/// <summary>
12999
/// Gets or sets the commit date.
130100
/// </summary>

build/common/Utilities/Models.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,24 @@ public record NugetCredentials(string ApiKey);
1212

1313
public record ChocolateyCredentials(string ApiKey);
1414

15-
public record BuildVersion(GitVersion GitVersion, string? Version, string? Milestone, string? SemVersion, string? NugetVersion)
15+
public record BuildVersion(GitVersion GitVersion, string? Version, string? Milestone, string? SemVersion, string? NugetVersion, string? ChocolateyVersion)
1616
{
1717
public static BuildVersion Calculate(GitVersion gitVersion)
1818
{
1919
var version = gitVersion.MajorMinorPatch;
20-
var semVersion = gitVersion.LegacySemVer;
21-
var nugetVersion = gitVersion.LegacySemVer;
20+
var semVersion = gitVersion.SemVer;
21+
var nugetVersion = gitVersion.SemVer;
22+
var chocolateyVersion = gitVersion.MajorMinorPatch;
23+
24+
if (!string.IsNullOrWhiteSpace(gitVersion.PreReleaseTag))
25+
{
26+
chocolateyVersion += $"-{gitVersion.PreReleaseTag?.Replace(".", "-")}";
27+
}
2228

2329
if (!string.IsNullOrWhiteSpace(gitVersion.BuildMetaData))
2430
{
2531
semVersion += $"-{gitVersion.BuildMetaData}";
32+
chocolateyVersion += $"-{gitVersion.BuildMetaData}";
2633
nugetVersion += $".{gitVersion.BuildMetaData}";
2734
}
2835

@@ -31,7 +38,8 @@ public static BuildVersion Calculate(GitVersion gitVersion)
3138
Version: version,
3239
Milestone: version,
3340
SemVersion: semVersion,
34-
NugetVersion: nugetVersion?.ToLowerInvariant()
41+
NugetVersion: nugetVersion?.ToLowerInvariant(),
42+
ChocolateyVersion: chocolateyVersion?.ToLowerInvariant()
3543
);
3644
}
3745
}

docs/input/docs/reference/configuration.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ major-version-bump-message: '\+semver:\s?(breaking|major)'
5252
minor-version-bump-message: '\+semver:\s?(feature|minor)'
5353
patch-version-bump-message: '\+semver:\s?(fix|patch)'
5454
no-bump-message: '\+semver:\s?(none|skip)'
55-
legacy-semver-padding: 4
56-
build-metadata-padding: 4
57-
commits-since-version-source-padding: 4
5855
tag-pre-release-weight: 60000
5956
commit-message-incrementing: Enabled
6057
ignore:
@@ -194,24 +191,6 @@ Used to tell GitVersion not to increment when in Mainline development mode.
194191
Default `\+semver:\s?(none|skip)`, which will match occurrences of `+semver:
195192
none` and `+semver: skip`
196193

197-
### legacy-semver-padding
198-
199-
The number of characters to pad `LegacySemVer` to in the `LegacySemVerPadded`
200-
[variable][variables]. Default is `4`, which will pad the `LegacySemVer` value
201-
of `3.0.0-beta1` to `3.0.0-beta0001`.
202-
203-
### build-metadata-padding
204-
205-
The number of characters to pad `BuildMetaData` to in the `BuildMetaDataPadded`
206-
[variable][variables]. Default is `4`, which will pad the `BuildMetaData` value
207-
of `1` to `0001`.
208-
209-
### commits-since-version-source-padding
210-
211-
The number of characters to pad `CommitsSinceVersionSource` to in the
212-
`CommitsSinceVersionSourcePadded` [variable][variables]. Default is `4`, which
213-
will pad the `CommitsSinceVersionSource` value of `1` to `0001`.
214-
215194
### tag-pre-release-weight
216195

217196
The pre-release weight in case of tagged commits. If the value is not set in the

docs/input/docs/reference/variables.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@ what is available. For the `release/3.0.0` branch of GitVersion it shows:
2121
"PreReleaseNumber": 99,
2222
"WeightedPreReleaseNumber": 1099,
2323
"BuildMetaData": 88,
24-
"BuildMetaDataPadded": "0088",
2524
"FullBuildMetaData": "99.Branch.release/3.22.11.Sha.28c853159a46b5a87e6cc9c4f6e940c59d6bc68a",
2625
"MajorMinorPatch": "3.22.11",
2726
"SemVer": "3.22.11-beta.99",
28-
"LegacySemVer": "3.22.11-beta99",
29-
"LegacySemVerPadded": "3.22.11-beta0099",
3027
"AssemblySemVer": "3.22.11.0",
3128
"AssemblySemFileVer": "3.22.11.0",
3229
"InformationalVersion": "3.22.11-beta.99+88.Branch.release/3.022.011.Sha.28c853159a46b5a87e6cc9c4f6e940c59d6bc68a",
@@ -35,13 +32,8 @@ what is available. For the `release/3.0.0` branch of GitVersion it shows:
3532
"EscapedBranchName": "release-3.022.011",
3633
"Sha": "28c853159a46b5a87e6cc9c4f6e940c59d6bc68a",
3734
"ShortSha": "28c8531",
38-
"NuGetVersionV2": "3.22.11-beta0099",
39-
"NuGetVersion": "3.22.11-beta0099",
40-
"NuGetPreReleaseTagV2": "beta0099",
41-
"NuGetPreReleaseTag": "beta0099",
4235
"VersionSourceSha": "28c853159a46b5a87e6cc9c4f6e940c59d6bc68a",
4336
"CommitsSinceVersionSource": 7,
44-
"CommitsSinceVersionSourcePadded": "0007",
4537
"CommitDate": "2021-12-31",
4638
"UncommittedChanges": 0
4739
}
@@ -61,12 +53,9 @@ Each property of the above JSON document is described in the below table.
6153
| `PreReleaseNumber` | The pre-release number. |
6254
| `WeightedPreReleaseNumber` | A summation of branch specific `pre-release-weight` and the `PreReleaseNumber`. Can be used to obtain a monotonically increasing version number across the branches. |
6355
| `BuildMetaData` | The build metadata, usually representing number of commits since the `VersionSourceSha`. Despite its name, will not increment for every build. |
64-
| `BuildMetaDataPadded` | The `BuildMetaData` padded with `0` up to 4 digits. |
6556
| `FullBuildMetaData` | The `BuildMetaData` suffixed with `BranchName` and `Sha`. |
6657
| `MajorMinorPatch` | `Major`, `Minor` and `Patch` joined together, separated by `.`. |
6758
| `SemVer` | The semantical version number, including `PreReleaseTagWithDash` for pre-release version numbers. |
68-
| `LegacySemVer` | Equal to `SemVer`, but without a `.` separating `PreReleaseLabel` and `PreReleaseNumber`. |
69-
| `LegacySemVerPadded` | Equal to `LegacySemVer`, but with `PreReleaseNumber` padded with `0` up to 4 digits. |
7059
| `AssemblySemVer` | Suitable for .NET `AssemblyVersion`. Defaults to `Major.Minor.0.0` to allow the assembly to be hotfixed without breaking existing applications that may be referencing it. |
7160
| `AssemblySemFileVer` | Suitable for .NET `AssemblyFileVersion`. Defaults to `Major.Minor.Patch.0`. |
7261
| `InformationalVersion` | Suitable for .NET `AssemblyInformationalVersion`. Defaults to `FullSemVer` suffixed by `FullBuildMetaData`. |
@@ -75,13 +64,8 @@ Each property of the above JSON document is described in the below table.
7564
| `EscapedBranchName` | Equal to `BranchName`, but with `/` replaced with `-`. |
7665
| `Sha` | The SHA of the Git commit. |
7766
| `ShortSha` | The `Sha` limited to 7 characters. |
78-
| `NuGetVersionV2` | A NuGet 2.0 compatible version number. |
79-
| `NuGetVersion` | A NuGet 1.0 compatible version number. |
80-
| `NuGetPreReleaseTagV2` | A NuGet 2.0 compatible `PreReleaseTag`. |
81-
| `NuGetPreReleaseTag` | A NuGet 1.0 compatible `PreReleaseTag`. |
8267
| `VersionSourceSha` | The SHA of the commit used as version source. |
8368
| `CommitsSinceVersionSource` | The number of commits since the version source. |
84-
| `CommitsSinceVersionSourcePadded` | The `CommitsSinceVersionSource` padded with `0` up to 4 digits. |
8569
| `CommitDate` | The ISO-8601 formatted date of the commit identified by `Sha`. |
8670
| `UncommittedChanges` | The number of uncommitted changes present in the repository. |
8771

docs/input/docs/usage/cli/arguments.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,10 @@ Following options are supported:
115115
3. `assembly-informational-format`
116116
4. `assembly-versioning-format`
117117
5. `assembly-versioning-scheme`
118-
6. `build-metadata-padding`
119118
7. `commit-date-format`
120119
8. `commit-message-incrementing`
121-
9. `commits-since-version-source-padding`
122120
10. `continuous-delivery-fallback-tag`
123121
11. `increment`
124-
12. `legacy-semver-padding`
125122
13. `major-version-bump-message`
126123
14. `minor-version-bump-message`
127124
15. `mode`

src/GitVersion.App.Tests/ArgumentParserTests.cs

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -409,14 +409,14 @@ private static IEnumerable<TestCaseData> OverrideconfigWithInvalidOptionTestData
409409
};
410410
}
411411

412-
[TestCaseSource(nameof(OverrideconfigWithSingleOptionTestData))]
413-
public void OverrideconfigWithSingleOptions(string options, Config expected)
412+
[TestCaseSource(nameof(OverrideConfigWithSingleOptionTestData))]
413+
public void OverrideConfigWithSingleOptions(string options, Config expected)
414414
{
415415
var arguments = this.argumentParser.ParseArguments($"/overrideconfig {options}");
416416
arguments.OverrideConfig.ShouldBeEquivalentTo(expected);
417417
}
418418

419-
private static IEnumerable<TestCaseData> OverrideconfigWithSingleOptionTestData()
419+
private static IEnumerable<TestCaseData> OverrideConfigWithSingleOptionTestData()
420420
{
421421
yield return new TestCaseData(
422422
"assembly-versioning-scheme=MajorMinor",
@@ -509,27 +509,6 @@ private static IEnumerable<TestCaseData> OverrideconfigWithSingleOptionTestData(
509509
NoBumpMessage = "This is no bump message."
510510
}
511511
);
512-
yield return new TestCaseData(
513-
"legacy-semver-padding=99",
514-
new Config
515-
{
516-
LegacySemVerPadding = 99
517-
}
518-
);
519-
yield return new TestCaseData(
520-
"build-metadata-padding=30",
521-
new Config
522-
{
523-
BuildMetaDataPadding = 30
524-
}
525-
);
526-
yield return new TestCaseData(
527-
"commits-since-version-source-padding=5",
528-
new Config
529-
{
530-
CommitsSinceVersionSourcePadding = 5
531-
}
532-
);
533512
yield return new TestCaseData(
534513
"tag-pre-release-weight=2",
535514
new Config

src/GitVersion.App.Tests/PullRequestInBuildAgentTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ private static async Task VerifyPullRequestVersionIsCalculatedProperly(string pu
175175

176176
result.ExitCode.ShouldBe(0);
177177
result.OutputVariables.ShouldNotBeNull();
178-
result.OutputVariables.FullSemVer.ShouldBe("1.0.4-PullRequest0005.3");
178+
result.OutputVariables.FullSemVer.ShouldBe("1.0.4-PullRequest5.3");
179179

180180
// Cleanup repository files
181181
DirectoryHelper.DeleteDirectory(remoteRepositoryPath);

src/GitVersion.App.Tests/VersionWriterTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ public void WriteVersionShouldWriteFileVersionWithNoPrereleaseTag()
3232
[Test]
3333
public void WriteVersionShouldWriteFileVersionWithPrereleaseTag()
3434
{
35-
var asm = GenerateAssembly(new Version(1, 0, 0), "-beta0004");
35+
var asm = GenerateAssembly(new Version(1, 0, 0), "-beta4");
3636

3737
string? version = string.Empty;
3838
this.versionWriter.WriteTo(asm, v => version = v);
3939

4040
Assert.IsNotNull(asm);
41-
Assert.AreEqual("1.0.0-beta0004", version);
41+
Assert.AreEqual("1.0.0-beta4", version);
4242
}
4343

4444
private static Assembly GenerateAssembly(Version fileVersion, string prereleaseInfo)

src/GitVersion.Core.Tests/BuildAgents/MyGetTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void EscapeValues()
3535
[Test]
3636
public void BuildNumber()
3737
{
38-
var message = this.buildServer.GenerateSetParameterMessage("LegacySemVerPadded", "0.8.0-unstable568");
38+
var message = this.buildServer.GenerateSetParameterMessage("SemVer", "0.8.0-unstable568");
3939
Assert.AreEqual("##myget[buildNumber '0.8.0-unstable568']", message[1]);
4040
}
4141
}

0 commit comments

Comments
 (0)