summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2012-01-26 10:39:14 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2012-01-29 10:38:50 -0800
commitcca405de64ca11dc4cf3f3d088f1373ac587da4b (patch)
tree9a492cff9bcce5d09b7c7a58f56fea57f8f0c29d /tools
parent188fb4ade43d91c504f2c54e7acbfd53d0c50e94 (diff)
downloadDotNetOpenAuth-cca405de64ca11dc4cf3f3d088f1373ac587da4b.zip
DotNetOpenAuth-cca405de64ca11dc4cf3f3d088f1373ac587da4b.tar.gz
DotNetOpenAuth-cca405de64ca11dc4cf3f3d088f1373ac587da4b.tar.bz2
Fixed up versioning to use SemVer 2.0.
Diffstat (limited to 'tools')
-rw-r--r--tools/DotNetOpenAuth.Versioning.targets19
1 files changed, 16 insertions, 3 deletions
diff --git a/tools/DotNetOpenAuth.Versioning.targets b/tools/DotNetOpenAuth.Versioning.targets
index cbcb76d..7ea18b1 100644
--- a/tools/DotNetOpenAuth.Versioning.targets
+++ b/tools/DotNetOpenAuth.Versioning.targets
@@ -6,6 +6,9 @@
<PropertyGroup>
<VersionCsFile>$(IntermediatePath)\$(AssemblyName).Version.cs</VersionCsFile>
<NoWarn>$(NoWarn);1607</NoWarn>
+
+ <!-- PrereleaseVersion can be any alphanumeric identifier with a preceding hyphen, or blank. -->
+ <PrereleaseVersion>-beta</PrereleaseVersion>
</PropertyGroup>
<UsingTask AssemblyFile="$(ProjectRoot)lib\MSBuild.Community.Tasks.dll" TaskName="AssemblyInfo"/>
@@ -16,15 +19,25 @@
GitRepoRoot="$(ProjectRoot)">
<Output TaskParameter="Version" PropertyName="BuildVersion" />
<Output TaskParameter="SimpleVersion" PropertyName="BuildVersionSimple" />
- <Output TaskParameter="GitCommitId" PropertyName="AssemblyInformationalVersion" />
+ <Output TaskParameter="GitCommitId" PropertyName="GitCommitId" />
+ <Output TaskParameter="BuildNumber" PropertyName="BuildNumber" />
</GetBuildVersion>
<PropertyGroup>
<!-- In TeamCity, the build agent doesn't get the .git directory, but the commit id is available by other means. -->
- <AssemblyInformationalVersion Condition=" '$(AssemblyInformationalVersion)' == '' ">$(BUILD_VCS_NUMBER)</AssemblyInformationalVersion>
+ <GitCommitId Condition=" '$(GitCommitId)' == '' ">$(BUILD_VCS_NUMBER)</GitCommitId>
+
+ <SemVerBuildSuffix>+build.$(BuildNumber).$(GitCommitId.Substring(0,10))</SemVerBuildSuffix>
+ <AssemblyInformationalVersion>$(BuildVersionSimple)$(PrereleaseVersion)$(SemVerBuildSuffix)</AssemblyInformationalVersion>
+
+ <!-- When NuGet supports SemVer 2.0, we can set NuGetPackageVersion to be the same as $(AssemblyInformationalVersion) -->
+ <NuGetPackageVersion Condition=" '$(PrereleaseVersion)' == '' ">$(BuildVersion)</NuGetPackageVersion>
+ <NuGetPackageVersion Condition=" '$(PrereleaseVersion)' != '' ">$(BuildVersionSimple)$(PrereleaseVersion)</NuGetPackageVersion>
</PropertyGroup>
<Warning Condition=" '$(AssemblyInformationalVersion)' == '' " Text="Unable to determine the git HEAD commit ID to use for informational version number." />
- <Message Condition=" '$(AssemblyInformationalVersion)' != '' " Text="Building version $(BuildVersion) from commit $(AssemblyInformationalVersion)"/>
+ <Message Condition=" '$(AssemblyInformationalVersion)' != '' " Text="Building version $(BuildVersion) from commit $(GitCommitId)"/>
<Message Condition=" '$(AssemblyInformationalVersion)' == '' " Text="Building version $(BuildVersion)"/>
+ <Message Importance="low" Text="AssemblyInformationalVersion: $(AssemblyInformationalVersion)" />
+ <Message Importance="low" Text="NuGetPackageVersion: $(NuGetPackageVersion)" />
</Target>
<Target Name="BeforeBuild" DependsOnTargets="GetBuildVersion">