Skip to content

Commit 9623cc4

Browse files
committed
dogfood GitVersion to handle breaking changes
1 parent 3ec073d commit 9623cc4

File tree

4 files changed

+55
-34
lines changed

4 files changed

+55
-34
lines changed

GitVersion.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
assembly-versioning-scheme: MajorMinorPatch
22
branches:
33
main:
4-
tag: beta
4+
label: beta
55
support:
6-
tag: beta
6+
label: beta

build/build/Tasks/ValidateVersion.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using Build.Utilities;
21
using Common.Utilities;
32

43
namespace Build.Tasks;

build/common/Lifetime/BuildLifetimeBase.cs

+31-3
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,17 @@ public override void Setup(T context, ISetupContext info)
2424
context.IsOnLinux = context.IsRunningOnLinux();
2525
context.IsOnMacOS = context.IsRunningOnMacOs();
2626

27-
var gitVersion = context.GitVersion(new GitVersionSettings
27+
BuildSolution(context);
28+
29+
var gitversionTool = context.GetGitVersionToolLocation();
30+
var gitVersionSettings = new GitVersionSettings
2831
{
29-
OutputTypes = new HashSet<GitVersionOutput> { GitVersionOutput.Json, GitVersionOutput.BuildServer }
30-
});
32+
OutputTypes = new HashSet<GitVersionOutput> { GitVersionOutput.Json, GitVersionOutput.BuildServer },
33+
ToolPath = context.Tools.Resolve(new[] { "dotnet.exe", "dotnet" }),
34+
ArgumentCustomization = args => args.Prepend(gitversionTool!.FullPath)
35+
};
36+
37+
var gitVersion = context.GitVersion(gitVersionSettings);
3138

3239
context.Version = BuildVersion.Calculate(gitVersion);
3340
}
@@ -69,4 +76,25 @@ protected void LogBuildInformation(T context)
6976
context.Information("Support Branch: {0}", context.IsSupportBranch);
7077
context.Information("Tagged: {0}", context.IsTagged);
7178
}
79+
private static void BuildSolution(T context)
80+
{
81+
context.Information("Builds solution...");
82+
83+
const string sln = "./src/GitVersion.sln";
84+
85+
context.DotNetRestore(sln,
86+
new()
87+
{
88+
Verbosity = DotNetVerbosity.Minimal,
89+
Sources = new[] { "https://api.nuget.org/v3/index.json" },
90+
});
91+
92+
context.DotNetBuild(sln,
93+
new()
94+
{
95+
Verbosity = DotNetVerbosity.Minimal,
96+
Configuration = Constants.DefaultConfiguration,
97+
NoRestore = true,
98+
});
99+
}
72100
}

dotnet-tools.json

+22-28
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
11
{
2-
"version": 1,
3-
"isRoot": true,
4-
"tools": {
5-
"codecov.tool": {
6-
"version": "1.13.0",
7-
"commands": [
8-
"codecov"
9-
]
10-
},
11-
"gitversion.tool": {
12-
"version": "5.11.1",
13-
"commands": [
14-
"dotnet-gitversion"
15-
]
16-
},
17-
"gitreleasemanager.tool": {
18-
"version": "0.13.0",
19-
"commands": [
20-
"dotnet-gitreleasemanager"
21-
]
22-
},
23-
"Wyam2": {
24-
"version": "3.0.0",
25-
"commands": [
26-
"wyam2"
27-
]
28-
}
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"codecov.tool": {
6+
"version": "1.13.0",
7+
"commands": [
8+
"codecov"
9+
]
10+
},
11+
"gitreleasemanager.tool": {
12+
"version": "0.13.0",
13+
"commands": [
14+
"dotnet-gitreleasemanager"
15+
]
16+
},
17+
"wyam2": {
18+
"version": "3.0.0",
19+
"commands": [
20+
"wyam2"
21+
]
2922
}
30-
}
23+
}
24+
}

0 commit comments

Comments
 (0)