Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ProjectServicingConfiguration build skips in sharedfx tooling #4318

Merged
merged 1 commit into from
Nov 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@
</PropertyGroup>
</Target>

<Target Name="SkipBuildInstallerProperties"
DependsOnTargets="GetSkipBuildProps"
BeforeTargets="GetInstallerGenerationFlags">
<PropertyGroup Condition="'$(SkipBuild)' == 'true'">
<GenerateDeb>false</GenerateDeb>
<GenerateRpm>false</GenerateRpm>
<GeneratePkg>false</GeneratePkg>
<GenerateMSI>false</GenerateMSI>
</PropertyGroup>
</Target>

<!--
This targets file is imported for all pkgproj files, but some (like DotNetHostPolicy) don't need
installers and just use the normal packaging tooling.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,54 @@
</ItemGroup>
</Target>

<Target Name="GetSkipBuildProps">
<Target Name="GetCurrentProjectServicingConfiguration">
<ItemGroup>
<CurrentProjectServicingConfiguration
Include="@(ProjectServicingConfiguration)"
Condition="'%(Identity)' == '$(MSBuildProjectName)'" />
</ItemGroup>
</Target>

<!--
The Microsoft build's per-package servicing policy conflicts with the source-build restrictions.
Targeting packs, for example, are only built/published when there's a known change to release.
This is in contrast to runtime packs and the shared framework, which are always built and
published. This means it's common in the Microsoft build for downstream repos to depend on two
builds' outputs: the current build's runtime assets, and some old build's targeting pack.

The Microsoft build can simply download the old targeting pack from NuGet.org. Source-build
can't do this because the bits on NuGet.org are not built locally. Instead, source-build assumes
it's possible to use current sources to build a package with the old version. This target
applies the old build's patch version to make that happen.

This solution has pitfalls. More info at https://github.com/dotnet/core-setup/issues/8735. The
target supports SkipSetLastReleasedVersionForSourceBuild (unused as of writing) to allow
disabling this workaround if a better way forward is implemented.
-->
<Target Name="SetLastReleasedVersionForSourceBuild"
Condition="
'$(DotNetBuildFromSource)' == 'true' and
'$(SkipSetLastReleasedVersionForSourceBuild)' != 'true'"
BeforeTargets="GetProductVersions"
DependsOnTargets="GetCurrentProjectServicingConfiguration">
<PropertyGroup>
<MostRecentProducedServicingPatchVersion>%(CurrentProjectServicingConfiguration.PatchVersion)</MostRecentProducedServicingPatchVersion>
<PatchVersion Condition="'$(MostRecentProducedServicingPatchVersion)' != ''">$(MostRecentProducedServicingPatchVersion)</PatchVersion>
</PropertyGroup>
</Target>

<Target Name="GetSkipBuildProps"
DependsOnTargets="
GetCurrentProjectServicingConfiguration;
GetProductVersions">
<!--
Skip the build if there is an applicable servicing configuration, and the servicing
configuration indicates this project shouldn't build for this patch version.
-->
<PropertyGroup Condition="'@(CurrentProjectServicingConfiguration)' != ''">
<SkipBuild Condition="'%(CurrentProjectServicingConfiguration.PatchVersion)' != '$(PatchVersion)'">true</SkipBuild>
</PropertyGroup>

<PropertyGroup>
<!-- Avoid building a project when none of the possible BuildRIDs is the current RID. -->
<_packageRIDInBuildRIDList Condition="'%(BuildRID.Identity)' == '$(PackageRID)'">true</_packageRIDInBuildRIDList>
Expand Down