Skip to content

Commit 47a5319

Browse files
committed
Updated Build
1 parent 1fc39ec commit 47a5319

File tree

8 files changed

+50
-31
lines changed

8 files changed

+50
-31
lines changed

.build/Build.GitRepository.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
using Nuke.Common.Git;
2-
using Nuke.Common.Tools.GitVersion;
32

43
partial class Build
54
{
65
[GitRepository] readonly GitRepository GitRepository;
7-
[GitVersion(Framework = Net60)] readonly GitVersion GitVersion;
86
}
97

.build/Build.Publish.cs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ partial class Build
3434
.Executes(() =>
3535
{
3636
var projFile = File.ReadAllText(StarWarsProj);
37-
File.WriteAllText(StarWarsProj, projFile.Replace("11.1.0", GitVersion.SemVer));
37+
File.WriteAllText(StarWarsProj, projFile.Replace("11.1.0", SemVersion));
3838

3939
projFile = File.ReadAllText(EmptyServerProj);
40-
File.WriteAllText(EmptyServerProj, projFile.Replace("11.1.0", GitVersion.SemVer));
40+
File.WriteAllText(EmptyServerProj, projFile.Replace("11.1.0", SemVersion));
4141

4242
projFile = File.ReadAllText(EmptyServer12Proj);
43-
File.WriteAllText(EmptyServer12Proj, projFile.Replace("11.1.0", GitVersion.SemVer));
43+
File.WriteAllText(EmptyServer12Proj, projFile.Replace("11.1.0", SemVersion));
4444

4545
projFile = File.ReadAllText(EmptyAzf12Proj);
46-
File.WriteAllText(EmptyAzf12Proj, projFile.Replace("11.1.0", GitVersion.SemVer));
46+
File.WriteAllText(EmptyAzf12Proj, projFile.Replace("11.1.0", SemVersion));
4747
})
4848
.Executes(() =>
4949
{
@@ -56,21 +56,21 @@ partial class Build
5656
DotNetBuild(c => c
5757
.SetProjectFile(PackSolutionFile)
5858
.SetConfiguration(Configuration)
59-
.SetAssemblyVersion(GitVersion.AssemblySemVer)
60-
.SetFileVersion(GitVersion.AssemblySemFileVer)
61-
.SetInformationalVersion(GitVersion.InformationalVersion)
62-
.SetVersion(GitVersion.SemVer));
59+
.SetInformationalVersion(SemVersion)
60+
.SetFileVersion(Version)
61+
.SetAssemblyVersion(Version)
62+
.SetVersion(SemVersion));
6363

6464
DotNetPack(c => c
6565
.SetProject(PackSolutionFile)
6666
.SetConfiguration(Configuration)
6767
.SetOutputDirectory(PackageDirectory)
6868
.SetNoRestore(true)
6969
.SetNoBuild(true)
70-
.SetVersion(GitVersion.SemVer));
70+
.SetVersion(SemVersion));
7171

7272
NuGetPack(c => c
73-
.SetVersion(GitVersion.SemVer)
73+
.SetVersion(SemVersion)
7474
.SetOutputDirectory(PackageDirectory)
7575
.SetConfiguration(Configuration)
7676
.CombineWith(
@@ -89,23 +89,23 @@ partial class Build
8989
t.ItemType == "PackageReference" &&
9090
t.IsImported == false &&
9191
t.EvaluatedInclude == "StrawberryShake.CodeGeneration.CSharp");
92-
packageReference.SetMetadataValue("Version", GitVersion.SemVer);
92+
packageReference.SetMetadataValue("Version", SemVersion);
9393
parsedProject.Save();
9494

9595
DotNetBuild(c => c
9696
.SetProjectFile(analyzerProject)
9797
.SetConfiguration(Configuration)
98-
.SetAssemblyVersion(GitVersion.AssemblySemVer)
99-
.SetFileVersion(GitVersion.AssemblySemFileVer)
100-
.SetInformationalVersion(GitVersion.InformationalVersion)
101-
.SetVersion(GitVersion.SemVer));
98+
.SetInformationalVersion(SemVersion)
99+
.SetFileVersion(Version)
100+
.SetAssemblyVersion(Version)
101+
.SetVersion(SemVersion));
102102

103103
DotNetPack(c => c
104104
.SetProject(analyzerProject)
105105
.SetNoBuild(InvokedTargets.Contains(Compile))
106106
.SetConfiguration(Configuration)
107107
.SetOutputDirectory(PackageDirectory)
108-
.SetVersion(GitVersion.SemVer));
108+
.SetVersion(SemVersion));
109109

110110
var analyzerTestProject = ProjectModelTasks
111111
.ParseSolution(SgSolutionFile)
@@ -118,16 +118,16 @@ partial class Build
118118
t.ItemType == "PackageReference" &&
119119
t.IsImported == false &&
120120
t.EvaluatedInclude == "StrawberryShake.CodeGeneration.CSharp.Analyzers");
121-
packageReference.SetMetadataValue("Version", GitVersion.SemVer);
121+
packageReference.SetMetadataValue("Version", SemVersion);
122122
parsedProject.Save();
123123

124124
DotNetBuild(c => c
125125
.SetProjectFile(analyzerTestProject)
126126
.SetConfiguration(Configuration)
127-
.SetAssemblyVersion(GitVersion.AssemblySemVer)
128-
.SetFileVersion(GitVersion.AssemblySemFileVer)
129-
.SetInformationalVersion(GitVersion.InformationalVersion)
130-
.SetVersion(GitVersion.SemVer));
127+
.SetInformationalVersion(SemVersion)
128+
.SetFileVersion(Version)
129+
.SetAssemblyVersion(Version)
130+
.SetVersion(SemVersion));
131131
});
132132

133133
Target Publish => _ => _

.build/Build.Sonar.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ partial class Build
5656
.SetProjectFile(SonarSolutionFile)
5757
.SetProcessWorkingDirectory(RootDirectory));
5858

59-
Logger.Info("Creating Sonar analysis for version: {0} ...", GitVersion.SemVer);
59+
Logger.Info("Creating Sonar analysis for version: {0} ...", SemVersion);
6060

6161
SonarScannerBegin(SonarBeginFullSettings);
6262
DotNetBuild(SonarBuildAll);
@@ -85,7 +85,7 @@ SonarScannerBeginSettings SonarBeginPrSettings(SonarScannerBeginSettings setting
8585

8686
SonarScannerBeginSettings SonarBeginFullSettings(SonarScannerBeginSettings settings) =>
8787
SonarBeginBaseSettings(settings)
88-
.SetVersion(GitVersion.SemVer)
88+
.SetVersion(SemVersion)
8989
.SetFramework(Net50);
9090

9191
SonarScannerBeginSettings SonarBeginBaseSettings(SonarScannerBeginSettings settings) =>

.build/Build.Version.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using Nuke.Common;
3+
using Semver;
4+
5+
partial class Build
6+
{
7+
[Parameter] readonly string SemVersion = "14.0.0-preview.build.0";
8+
9+
[Parameter]
10+
string Version =>
11+
Semver.SemVersion
12+
.Parse(SemVersion, SemVersionStyles.Any)
13+
.WithoutPrereleaseOrMetadata()
14+
.ToString();
15+
}

.build/Build.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ partial class Build : NukeBuild
6666
.SetProjectFile(AllSolutionFile)
6767
.SetNoRestore(InvokedTargets.Contains(Restore))
6868
.SetConfiguration(Configuration)
69-
.SetAssemblyVersion(GitVersion.AssemblySemVer)
70-
.SetFileVersion(GitVersion.AssemblySemFileVer)
71-
.SetInformationalVersion(GitVersion.InformationalVersion)
72-
.SetVersion(GitVersion.SemVer));
69+
.SetInformationalVersion(SemVersion)
70+
.SetFileVersion(Version)
71+
.SetAssemblyVersion(Version)
72+
.SetVersion(SemVersion));
7373
});
7474

7575
Target Reset => _ => _

.build/Build.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
<ItemGroup>
1414
<PackageReference Include="Nuke.Common" Version="5.3.0" />
1515
<PackageReference Include="Colorful.Console" Version="1.2.15" />
16+
<PackageReference Include="Semver" Version="2.3.0" />
1617
</ItemGroup>
1718

1819
<ItemGroup>
19-
<PackageDownload Include="GitVersion.Tool" Version="[5.8.1]" />
2020
<PackageDownload Include="NuGet.CommandLine" Version="[6.0.0]" />
2121
<PackageDownload Include="dotnet-sonarscanner" Version="[5.4.0]" />
2222
<PackageDownload Include="OpenCover" Version="[4.7.1221]" />

.devops/azure-pipelines.release-hotchocolate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ stages:
5151
- task: CmdLine@2
5252
displayName: "Create Packages"
5353
inputs:
54-
script: "./build.cmd pack"
54+
script: "./build.cmd pack --SemVersion $(Build.SourceBranchName)"
5555
- task: PublishBuildArtifacts@1
5656
displayName: "Upload Packages"
5757
inputs:

.nuke/build.schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@
9393
"type": "string",
9494
"description": "Root directory during build execution"
9595
},
96+
"SemVersion": {
97+
"type": "string"
98+
},
9699
"Skip": {
97100
"type": "array",
98101
"description": "List of targets to be skipped. Empty list skips all dependencies",
@@ -166,6 +169,9 @@
166169
"Quiet",
167170
"Verbose"
168171
]
172+
},
173+
"Version": {
174+
"type": "string"
169175
}
170176
}
171177
}

0 commit comments

Comments
 (0)