Skip to content

Commit

Permalink
Move build number logic out of Internal.AspNetCore.Sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate McMaster committed Jan 18, 2017
1 parent 95f5bec commit 9816474
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
17 changes: 17 additions & 0 deletions build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,21 @@
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
</PropertyGroup>

<!-- workaround https://github.com/NuGet/Home/issues/3953 -->
<!-- version options -->
<PropertyGroup>
<!--
Create second-based build number for local builds.
635556672000000000 is Jan 1, 2015.
-->
<_SecondBasedTimeStamp>$([System.DateTime]::UtcNow.Subtract($([System.DateTime]::FromBinary(635556672000000000))).TotalSeconds.ToString("F0"))</_SecondBasedTimeStamp>
<_SecondBasedTimeStamp>t$([System.Int64]::Parse($(_SecondBasedTimeStamp)).ToString("x9"))</_SecondBasedTimeStamp>

<!-- fallback build number if not set by KoreBuild-->
<BuildNumber Condition="'$(BuildNumber)'==''">$(_SecondBasedTimeStamp)</BuildNumber>
<VersionSuffix Condition="'$(VersionSuffix)'!='' AND '$(BuildNumber)' != ''">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
<VersionSuffix Condition="'$(VersionSuffix)'==''">$(BuildNumber)</VersionSuffix>
</PropertyGroup>
<!-- end workaround -->

</Project>
14 changes: 1 addition & 13 deletions src/Internal.AspNetCore.Sdk/targets/BuildNumber.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,7 @@ For single-tfm projects, this will be imported from build/Internal.AspNetCore.Sd
-->
<Project ToolsVersion="15.0">
<!-- version options -->
<PropertyGroup>
<!--
Create second-based build number for local builds.
635556672000000000 is Jan 1, 2015.
-->
<_SecondBasedTimeStamp>$([System.DateTime]::UtcNow.Subtract($([System.DateTime]::FromBinary(635556672000000000))).TotalSeconds.ToString("F0"))</_SecondBasedTimeStamp>
<_SecondBasedTimeStamp>t$([System.Int64]::Parse($(_SecondBasedTimeStamp)).ToString("x9"))</_SecondBasedTimeStamp>

<!-- fallback build number if not set by KoreBuild-->
<BuildNumber Condition="'$(BuildNumber)'==''">$(_SecondBasedTimeStamp)</BuildNumber>
<VersionSuffix Condition="'$(VersionSuffix)'!='' AND '$(BuildNumber)' != ''">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
<VersionSuffix Condition="'$(VersionSuffix)'==''">$(BuildNumber)</VersionSuffix>
</PropertyGroup>
<!-- TODO determine build number here instead of inside individual repos when https://github.com/NuGet/Home/issues/3953 is resolved-->

<Target Name="ShowBuildVersion" BeforeTargets="PrepareForBuild">
<Message Text="Build version: $(AssemblyName)/$(TargetFramework)/$(Version)" Importance="normal" />
Expand Down

0 comments on commit 9816474

Please sign in to comment.