Skip to content

Commit

Permalink
Include PrivateReleaseGitRef to output of GetBuildVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
aok-foss committed Apr 28, 2020
1 parent 2819578 commit 60bf406
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/NerdBank.GitVersioning/VersionOracle.cs
Expand Up @@ -272,7 +272,10 @@ public IEnumerable<string> BuildMetadataWithCommitId
/// </summary>
public int VersionHeightOffset { get; }

private string BuildingRef { get; }
/// <summary>
/// Gets the ref (branch or tag) being built.
/// </summary>
public string BuildingRef { get; }

/// <summary>
/// Gets the version for this project, with up to 4 components.
Expand Down
8 changes: 8 additions & 0 deletions src/Nerdbank.GitVersioning.Tasks/GetBuildVersion.cs
Expand Up @@ -78,6 +78,13 @@ public GetBuildVersion()
[Output]
public bool PublicRelease { get; private set; }

/// <summary>
/// Gets the ref (branch or tag) being built.
/// Only specified when this is not a public release.
/// </summary>
[Output]
public string PrivateReleaseGitRef { get; set; }

/// <summary>
/// Gets the version string to use in the compiled assemblies.
/// </summary>
Expand Down Expand Up @@ -218,6 +225,7 @@ protected override bool ExecuteInner()
}

this.PublicRelease = oracle.PublicRelease;
this.PrivateReleaseGitRef = this.PublicRelease ? null : oracle.BuildingRef;
this.Version = oracle.Version.ToString();
this.AssemblyVersion = oracle.AssemblyVersion.ToString();
this.AssemblyFileVersion = oracle.AssemblyFileVersion.ToString();
Expand Down
Expand Up @@ -92,6 +92,7 @@
<Output TaskParameter="BuildNumber" PropertyName="BuildNumber" />
<Output TaskParameter="BuildNumber" PropertyName="BuildVersionNumberComponent" />
<Output TaskParameter="PublicRelease" PropertyName="PublicRelease" />
<Output TaskParameter="PrivateReleaseGitRef" PropertyName="PrivateReleaseGitRef" />
<Output TaskParameter="CloudBuildNumber" PropertyName="CloudBuildNumber" Condition=" '$(CloudBuildNumber)' == '' "/>
<Output TaskParameter="BuildMetadataFragment" PropertyName="SemVerBuildSuffix" />
<Output TaskParameter="NuGetPackageVersion" PropertyName="NuGetPackageVersion" />
Expand Down

0 comments on commit 60bf406

Please sign in to comment.