Skip to content

Commit f5a5b9a

Browse files
author
Chris Crutchfield
committed
Cake.GitVersioning wrapper
1 parent 39ac768 commit f5a5b9a

File tree

3 files changed

+106
-1
lines changed

3 files changed

+106
-1
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net461</TargetFramework>
5+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
6+
<Authors>Chris Crutchfield, Andrew Arnott</Authors>
7+
<Company>andarno</Company>
8+
<Description>Cake wrapper for Nerdbank.GitVersioning. Stamps your assemblies with semver 2.0 compliant git commit specific version information and provides NuGet versioning information as well.</Description>
9+
<Copyright>Copyright © Andrew Arnott</Copyright>
10+
<PackageTags>git commit versioning version assemblyinfo</PackageTags>
11+
<PackageLicenseUrl>https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/39ac76891c/LICENSE.txt</PackageLicenseUrl>
12+
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
13+
<PackageProjectUrl>http://github.com/aarnott/Nerdbank.GitVersioning</PackageProjectUrl>
14+
<SignAssembly>false</SignAssembly>
15+
</PropertyGroup>
16+
17+
<ItemGroup>
18+
<PackageReference Include="Cake.Core" Version="0.26.0" />
19+
<PackageReference Include="Nerdbank.GitVersioning.LKG" Version="1.6.20-beta-gfea83a8c9e" />
20+
</ItemGroup>
21+
22+
<ItemGroup>
23+
<ProjectReference Include="..\NerdBank.GitVersioning\NerdBank.GitVersioning.csproj" PrivateAssets="true" />
24+
</ItemGroup>
25+
26+
<ItemGroup>
27+
<Content Include="$(OutputPath)\NerdBank.GitVersioning.dll">
28+
<PackagePath>lib\$(TargetFramework)\</PackagePath>
29+
<Pack>true</Pack>
30+
</Content>
31+
32+
<Content Include="$(OutputPath)\LibGit2Sharp.dll">
33+
<PackagePath>lib\$(TargetFramework)</PackagePath>
34+
<Pack>true</Pack>
35+
</Content>
36+
<Content Include="$(OutputPath)\lib\**\*">
37+
<PackagePath>lib\$(TargetFramework)\lib</PackagePath>
38+
<Pack>true</Pack>
39+
</Content>
40+
41+
<Content Include="$(OutputPath)\Newtonsoft.Json.dll">
42+
<PackagePath>lib\$(TargetFramework)</PackagePath>
43+
<Pack>true</Pack>
44+
</Content>
45+
46+
<Content Include="$(OutputPath)\Validation.dll">
47+
<PackagePath>lib\$(TargetFramework)</PackagePath>
48+
<Pack>true</Pack>
49+
</Content>
50+
</ItemGroup>
51+
52+
</Project>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.IO;
2+
using System.Reflection;
3+
using Cake.Core;
4+
using Cake.Core.Annotations;
5+
using Nerdbank.GitVersioning;
6+
7+
namespace Cake.GitVersioning
8+
{
9+
/// <summary>
10+
/// Contains functionality for using Nerdbank.GitVersioning.
11+
/// </summary>
12+
[CakeAliasCategory("Git Versioning")]
13+
public static class GitVersioningAliases
14+
{
15+
/// <summary>
16+
/// Gets the Git Versioning version from the current repo.
17+
/// </summary>
18+
/// <example>
19+
/// Task("GetVersion")
20+
/// .Does(() =>
21+
/// {
22+
/// Information(GetVersioningGetVersion().SemVer2)
23+
/// });
24+
/// </example>
25+
/// <param name="context">The context.</param>
26+
/// <param name="projectDirectory">Directory to start the search for version.json.</param>
27+
/// <returns>The version information from Git Versioning.</returns>
28+
[CakeMethodAlias]
29+
public static VersionOracle GitVersioningGetVersion(this ICakeContext context, string projectDirectory = ".")
30+
{
31+
GitExtensions.HelpFindLibGit2NativeBinaries(Path.GetDirectoryName(Assembly.GetAssembly(typeof(GitVersioningAliases)).Location));
32+
33+
return VersionOracle.Create(projectDirectory, null, CloudBuild.Active);
34+
}
35+
}
36+
}

src/Nerdbank.GitVersioning.sln

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
4-
VisualStudioVersion = 15.0.26228.9
4+
VisualStudioVersion = 15.0.27130.2010
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{5DD5E4FA-CB73-4610-85AB-557B54E96AA9}") = "Nerdbank.GitVersioning.NuGet", "Nerdbank.GitVersioning.NuGet\Nerdbank.GitVersioning.NuGet.nuproj", "{B7DE4122-9E90-43DE-BE44-454315CFAE99}"
77
EndProject
@@ -27,6 +27,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nerdbank.GitVersioning.Task
2727
EndProject
2828
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MSBuildExtensionTask", "MSBuildExtensionTask\MSBuildExtensionTask.csproj", "{568CD02D-49C4-49DB-A34D-2DE9D7A0FE85}"
2929
EndProject
30+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cake.GitVersioning", "Cake.GitVersioning\Cake.GitVersioning.csproj", "{1F267A97-DFE3-4166-83B1-9D236B7A09BD}"
31+
EndProject
3032
Global
3133
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3234
Debug|Any CPU = Debug|Any CPU
@@ -99,8 +101,23 @@ Global
99101
{568CD02D-49C4-49DB-A34D-2DE9D7A0FE85}.Release|x64.Build.0 = Release|Any CPU
100102
{568CD02D-49C4-49DB-A34D-2DE9D7A0FE85}.Release|x86.ActiveCfg = Release|Any CPU
101103
{568CD02D-49C4-49DB-A34D-2DE9D7A0FE85}.Release|x86.Build.0 = Release|Any CPU
104+
{1F267A97-DFE3-4166-83B1-9D236B7A09BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
105+
{1F267A97-DFE3-4166-83B1-9D236B7A09BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
106+
{1F267A97-DFE3-4166-83B1-9D236B7A09BD}.Debug|x64.ActiveCfg = Debug|Any CPU
107+
{1F267A97-DFE3-4166-83B1-9D236B7A09BD}.Debug|x64.Build.0 = Debug|Any CPU
108+
{1F267A97-DFE3-4166-83B1-9D236B7A09BD}.Debug|x86.ActiveCfg = Debug|Any CPU
109+
{1F267A97-DFE3-4166-83B1-9D236B7A09BD}.Debug|x86.Build.0 = Debug|Any CPU
110+
{1F267A97-DFE3-4166-83B1-9D236B7A09BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
111+
{1F267A97-DFE3-4166-83B1-9D236B7A09BD}.Release|Any CPU.Build.0 = Release|Any CPU
112+
{1F267A97-DFE3-4166-83B1-9D236B7A09BD}.Release|x64.ActiveCfg = Release|Any CPU
113+
{1F267A97-DFE3-4166-83B1-9D236B7A09BD}.Release|x64.Build.0 = Release|Any CPU
114+
{1F267A97-DFE3-4166-83B1-9D236B7A09BD}.Release|x86.ActiveCfg = Release|Any CPU
115+
{1F267A97-DFE3-4166-83B1-9D236B7A09BD}.Release|x86.Build.0 = Release|Any CPU
102116
EndGlobalSection
103117
GlobalSection(SolutionProperties) = preSolution
104118
HideSolutionNode = FALSE
105119
EndGlobalSection
120+
GlobalSection(ExtensibilityGlobals) = postSolution
121+
SolutionGuid = {03CE16EE-A939-43FB-B846-92EB3A797ECF}
122+
EndGlobalSection
106123
EndGlobal

0 commit comments

Comments
 (0)