Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "wiki"]
path = wiki
url = https://github.com/AArnott/Nerdbank.GitVersioning.wiki.git
11 changes: 11 additions & 0 deletions doc/cake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Cake Build
Add `#addin Cake.GitVersioning` to the top of your Cake Build script. See [here](Cake/GitVersioning/GitVersioningAliases.md) for usage. See [here](Nerdbank/GitVersioning/VersionOracle.md) for the VersionOracle usage.

## Example
~~~~csharp
Task("GetVersion")
.Does(() =>
{
Information(GetVersioningGetVersion().SemVer2)
});
~~~~
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ You can install Nerdbank.GitVersioning into your projects via NuGet or NPM.
* Use the [nbgv .NET Core CLI tool](doc/nbgv-cli.md) (recommended)
* [NuGet installation instructions](doc/nuget-acquisition.md)
* [NPM installation instructions](doc/npm-acquisition.md)
* [Cake Build installation instructions](doc/cake.md)

You must also create [a version.json file](doc/versionJson.md) in your repo. See [migration notes](doc/migrating.md) if your repo already has a version.txt or version.json file from using another system.

Expand All @@ -49,6 +50,7 @@ for these build systems:
* [gulp](doc/gulp.md)
* [DNX](doc/dotnet-cli.md)
* [dotnet CLI](doc/dotnet-cli.md)
* [Cake Build](doc/cake.md)

Also some special [cloud build considerations](doc/cloudbuild.md).

Expand Down
59 changes: 59 additions & 0 deletions src/Cake.GitVersioning/Cake.GitVersioning.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Chris Crutchfield, Andrew Arnott</Authors>
<Company>andarno</Company>
<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>
<Copyright>Copyright © Andrew Arnott</Copyright>
<PackageTags>git commit versioning version assemblyinfo</PackageTags>
<PackageProjectUrl>http://github.com/aarnott/Nerdbank.GitVersioning</PackageProjectUrl>
<SignAssembly>false</SignAssembly>
<!-- We include the whole OutputPath in this tools package. -->
<IncludeBuildOutput>false</IncludeBuildOutput>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackBuildOutputs</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>C:\git\Nerdbank.GitVersioning\src\..\bin\Cake.GitVersioning\Debug\net461\Cake.GitVersioning.xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>C:\git\Nerdbank.GitVersioning\src\..\bin\Cake.GitVersioning\Release\net461\Cake.GitVersioning.xml</DocumentationFile>
</PropertyGroup>

<!-- This is a tools package and should express no dependencies. -->
<ItemDefinitionGroup>
<ProjectReference>
<PrivateAssets>all</PrivateAssets>
</ProjectReference>
<PackageReference>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemDefinitionGroup>

<ItemGroup>
<PackageReference Include="Cake.Core" Version="0.26.0" />
<PackageReference Include="DotNetMDDocs" Version="0.111.0" Condition=" '$(GenerateMarkdownApiDocs)' == 'true' " />
<PackageReference Include="Nerdbank.GitVersioning.LKG" Version="1.6.20-beta-gfea83a8c9e" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\NerdBank.GitVersioning\NerdBank.GitVersioning.csproj" />
</ItemGroup>

<Target Name="PackBuildOutputs" DependsOnTargets="SatelliteDllsProjectOutputGroup;DebugSymbolsProjectOutputGroup">
<ItemGroup>
<TfmSpecificPackageFile Include="$(OutputPath)\**\*" Exclude="$(OutputPath)\**\*.xml;$(OutputPath)\**\*.pdb;$(OutputPath)\**\Cake.Core.dll">
<PackagePath>lib\$(TargetFramework)\</PackagePath>
</TfmSpecificPackageFile>
</ItemGroup>
</Target>

<Target Name="SetNuSpecProperties" BeforeTargets="GenerateNuspec" DependsOnTargets="GetBuildVersion">
<PropertyGroup>
<PackageLicenseUrl>https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/$(GitCommitIdShort)/LICENSE.txt</PackageLicenseUrl>
</PropertyGroup>
</Target>
</Project>
38 changes: 38 additions & 0 deletions src/Cake.GitVersioning/GitVersioningAliases.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System.IO;
using System.Reflection;
using Cake.Core;
using Cake.Core.Annotations;
using Nerdbank.GitVersioning;

namespace Cake.GitVersioning
{
/// <summary>
/// Contains functionality for using Nerdbank.GitVersioning.
/// </summary>
[CakeAliasCategory("Git Versioning")]
public static class GitVersioningAliases
{
/// <summary>
/// Gets the Git Versioning version from the current repo.
/// </summary>
/// <example>
/// Task("GetVersion")
/// .Does(() =>
/// {
/// Information(GetVersioningGetVersion().SemVer2)
/// });
/// </example>
/// <param name="context">The context.</param>
/// <param name="projectDirectory">Directory to start the search for version.json.</param>
/// <returns>The version information from Git Versioning.</returns>
[CakeMethodAlias]
public static VersionOracle GitVersioningGetVersion(this ICakeContext context, string projectDirectory = ".")
{
var fullProjectDirectory = (new DirectoryInfo(projectDirectory)).FullName;

GitExtensions.HelpFindLibGit2NativeBinaries(Path.GetDirectoryName(Assembly.GetAssembly(typeof(GitVersioningAliases)).Location));

return VersionOracle.Create(fullProjectDirectory, null, CloudBuild.Active);
}
}
}
2 changes: 2 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<BaseIntermediateOutputPath>$(MSBuildThisFileDirectory)..\obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
<OutputPath>$(MSBuildThisFileDirectory)..\bin\$(MSBuildProjectName)\$(Configuration)\</OutputPath>
<DocumentationRootFolder>$(MSBuildThisFileDirectory)..\wiki\api</DocumentationRootFolder>

<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)strongname.snk</AssemblyOriginatorKeyFile>

Expand Down
3 changes: 2 additions & 1 deletion src/NerdBank.GitVersioning/NerdBank.GitVersioning.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
<PackageId>Nerdbank.GitVersioning.Core</PackageId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DotNetMDDocs" Version="0.111.0" PrivateAssets="all" Condition=" '$(GenerateMarkdownApiDocs)' == 'true' " />
<PackageReference Include="LibGit2Sharp" Version="0.24.7-g9fca61fdda" PrivateAssets="None" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="System.Diagnostics.Process" Version="4.3.0" Condition=" '$(TargetFramework)' == 'netstandard1.3' " />
<PackageReference Include="Validation" Version="2.3.7" />
<PackageReference Include="Nerdbank.GitVersioning.LKG" Version="1.6.20-beta-gfea83a8c9e" />
Expand Down
8 changes: 7 additions & 1 deletion src/Nerdbank.GitVersioning.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.9
VisualStudioVersion = 15.0.27130.2010
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4BD1A7CD-6F52-4F5A-825B-50E4D8C3ECFF}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -28,6 +28,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MSBuildExtensionTask", "MSB
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nbgv", "nbgv\nbgv.csproj", "{EF4DAF23-6CE9-48C5-84C5-80AC80D3D07D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cake.GitVersioning", "Cake.GitVersioning\Cake.GitVersioning.csproj", "{1F267A97-DFE3-4166-83B1-9D236B7A09BD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -56,6 +58,10 @@ Global
{EF4DAF23-6CE9-48C5-84C5-80AC80D3D07D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF4DAF23-6CE9-48C5-84C5-80AC80D3D07D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF4DAF23-6CE9-48C5-84C5-80AC80D3D07D}.Release|Any CPU.Build.0 = Release|Any CPU
{1F267A97-DFE3-4166-83B1-9D236B7A09BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F267A97-DFE3-4166-83B1-9D236B7A09BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F267A97-DFE3-4166-83B1-9D236B7A09BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F267A97-DFE3-4166-83B1-9D236B7A09BD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 1 addition & 0 deletions wiki
Submodule wiki added at 45e494