Skip to content

Commit

Permalink
Only the library projects updates build numbers (#22554)
Browse files Browse the repository at this point in the history
* Only the library projects updates build numbers

* ok

* better logging

* '

* why tho

* that is why

* wow

* metadata

* PreReleaseVersionLabel

* this is a bit better
  • Loading branch information
mattleibow authored May 22, 2024
1 parent 51bb9a2 commit cfc5482
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions eng/Versions.targets
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
</SetVersionsDependsOn>
</PropertyGroup>

<Target Name="SetVersions" BeforeTargets="$(SetVersionsBefore)" DependsOnTargets="$(SetVersionsDependsOn)" Returns="$(Version)">
<Target Name="SetVersions"
BeforeTargets="$(SetVersionsBefore)"
DependsOnTargets="$(SetVersionsDependsOn)"
Returns="$(Version)">

<PropertyGroup>
<PreReleaseVersionLabel Condition="$(CI) and '$(BUILD_REASON)' == 'Schedule'">$(NightlyTag)</PreReleaseVersionLabel>
</PropertyGroup>
Expand All @@ -47,8 +51,20 @@
<VSComponentVersion Condition="'$(PreReleaseVersionLabel)' == ''">$(MajorVersion).$(MinorVersion).$(PatchVersion).0</VSComponentVersion>
</PropertyGroup>

<PropertyGroup>
<_SkipUpdateBuildNumber Condition="'$(SampleProject)' == 'true' or '$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe' or '$(AndroidApplication)' == 'true' or '$(IsTestProject)' == 'true' or '$(IsPackable)' == 'false'">true</_SkipUpdateBuildNumber>
<_UpdateBuildNumber Condition="$(CI) and '$(BUILD_BUILDNUMBER)' != '$(PackageVersion)' AND '$(_SkipUpdateBuildNumber)' != 'true'">$(PackageVersion)</_UpdateBuildNumber>
</PropertyGroup>

<Error Condition="'$(_UpdateBuildNumber)' == '1.0.0'" Text="Unexpected _UpdateBuildNumber: '$(_UpdateBuildNumber)'" />

<PropertyGroup Condition="'$(_UpdateBuildNumber)' != ''">
<_UpdateBuildNumber Condition="'@(VersionMetadata)' != ''">$(_UpdateBuildNumber)+@(VersionMetadata -> '%(Identity)', '.')</_UpdateBuildNumber>
</PropertyGroup>

<Message Condition="$(CI) and '$(BUILD_REASON)' == 'Schedule'" Importance="high" Text="##vso[build.addbuildtag]$(NightlyTag)"/>
<Message Condition="$(CI) and '$(BUILD_BUILDNUMBER)' != '$(PackageVersion)'" Importance="high" Text="##vso[build.updatebuildnumber]$(PackageVersion)"/>
<Message Condition="'$(_UpdateBuildNumber)' != ''" Importance="high" Text="##vso[build.updatebuildnumber]$(_UpdateBuildNumber)"/>

</Target>

</Project>

0 comments on commit cfc5482

Please sign in to comment.