Skip to content

Commit 66ab294

Browse files
Support for queuing a stable package build
* Porting dotnet/corefx#27582 to wcf. (cherry picked from commit 5e2a966)
1 parent bf71c08 commit 66ab294

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

Packaging.props

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
<PropertyGroup>
3-
<PreReleaseLabel>rtm</PreReleaseLabel>
3+
<StabilizePackageVersion Condition="'$(StabilizePackageVersion)' == ''">false</StabilizePackageVersion>
4+
<PreReleaseLabel Condition="'$(PackageVersionStamp)' != ''">$(PackageVersionStamp)</PreReleaseLabel>
5+
<PreReleaseLabel Condition="'$(PreReleaseLabel)' == ''">rtm</PreReleaseLabel>
6+
<IncludePreReleaseLabelInPackageVersion Condition="'$(StabilizePackageVersion)' != 'true' or '$(PackageVersionStamp)' != ''">true</IncludePreReleaseLabelInPackageVersion>
7+
<IncludeBuildNumberInPackageVersion Condition="'$(StabilizePackageVersion)' == 'true'">false</IncludeBuildNumberInPackageVersion>
8+
<IncludeBuildNumberInPackageVersion Condition="'$(StabilizePackageVersion)' != 'true'">true</IncludeBuildNumberInPackageVersion>
9+
410
<PackageDescriptionFile>$(ProjectDir)pkg/descriptions.json</PackageDescriptionFile>
511
<PackageLicenseFile>$(ProjectDir)LICENSE.TXT</PackageLicenseFile>
612
<PackageThirdPartyNoticesFile>$(ProjectDir)THIRD-PARTY-NOTICES.TXT</PackageThirdPartyNoticesFile>

pkg/baseline/baseline.props

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,25 @@
1919
<Error Condition="!Exists('$(CoreFxBaseLinePackageProps)')"
2020
Text="Error '$(CoreFxBaseLinePackageProps)' does not exist, ensure you have restored packages before building this project" />
2121
</Target>
22+
23+
<!--
24+
Below targets should moved to packaging.targets in BuildTools but keeping in corefx for convenience right now - (ported from CoreFx to WCF)
25+
-->
26+
27+
<Target Name="BlockStable" Condition="'$(BlockStable)' == 'true'" AfterTargets="CalculatePackageVersion">
28+
<!-- DO NOT ship this packages as stable -->
29+
<Error Condition="!$(PackageVersion.Contains('-'))" Text="Package $(Id) should not be built stable" />
30+
</Target>
31+
32+
<!-- Get the package version if it isn't marked as block stable -->
33+
<Target Name="GetPackageIdentityIfStable"
34+
Returns="@(_StablePackageIdentity)">
35+
<Message Importance="high" Text="GetPackageIdentityIfStable Id is: '$(Id)' and Package Version is: '$(PackageVersion)'" />
36+
37+
<ItemGroup Condition="'$(BlockStable)' != 'true'">
38+
<_StablePackageIdentity Include="$(Id)">
39+
<Version>$(PackageVersion)</Version>
40+
</_StablePackageIdentity>
41+
</ItemGroup>
42+
</Target>
2243
</Project>

src/packages.builds

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,41 @@
1515
</Project>
1616
</ItemGroup>
1717

18+
<!-- Need the PackageIndexFile file property from baseline.props -->
19+
<Import Project="../pkg/baseline/baseline.props" />
20+
21+
<UsingTask TaskName="UpdatePackageIndex" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
22+
23+
<!--
24+
Updates the package index to mark all packages we are building that can go stable as stable.
25+
this will allow for a kicked off build to control package stability at queue time. This does edit
26+
the package index in-place but that shouldn't cause any problems for official builds are the only
27+
ones that might do this. After we ship a stable set of packages this target should be run and the
28+
changes to the package index should be commited to the repo.
29+
-->
30+
<Target Name="UpdatePackageIndexWithStableVersions"
31+
BeforeTargets="BuildAllProjects"
32+
Condition="'$(IncludePreReleaseLabelInPackageVersion)' != 'true'">
33+
<ItemGroup>
34+
<PkgProjects Include="$(MSBuildThisFileDirectory)..\pkg\*\*.pkgproj" />
35+
<PkgProjects Include="*\pkg\**\*.pkgproj" />
36+
</ItemGroup>
37+
38+
<MSBuild Targets="GetPackageIdentityIfStable"
39+
BuildInParallel="$(BuildInParallel)"
40+
Projects="@(PkgProjects)">
41+
<Output TaskParameter="TargetOutputs"
42+
ItemName="_StablePackages" />
43+
</MSBuild>
44+
45+
<Message Importance="high" Text="Marking package '%(_StablePackages.Identity)' stable with version '%(_StablePackages.Version)'" />
46+
47+
<UpdatePackageIndex
48+
PackageIndexFile="$(PackageIndexFile)"
49+
StablePackages="@(_StablePackages)" />
50+
51+
</Target>
52+
1853
<UsingTask TaskName="GenerateNetStandardSupportTable" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll" />
1954
<Target Name="GenerateNETStandardDocs">
2055
<Error Condition="'$(WcfPackageReportDir)' == ''"

0 commit comments

Comments
 (0)