summaryrefslogtreecommitdiff
path: root/src/.nuget/builds.targets
blob: d58f010d3939b85e7f2574aa1ca31b3f789ad9a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?xml version="1.0" encoding="utf-8"?>
<Project>
  <PropertyGroup Condition="'$(BuildIdentityPackage)' == ''">
    <BuildIdentityPackage>true</BuildIdentityPackage>

    <!-- Used to determine if we should build some packages only once across multiple official build legs.
         For offline builds we still set OfficialBuildId but we need to build all the packages for a single
         leg only, so we also take DotNetBuildFromSource into account. -->
    <BuildingAnOfficialBuildLeg Condition="'$(OfficialBuildId)' != '' AND '$(DotNetBuildFromSource)' != 'true'">true</BuildingAnOfficialBuildLeg>

    <!-- During an official build, only build identity packages on windows x64 legs -->
    <BuildIdentityPackage Condition="'$(BuildingAnOfficialBuildLeg)' == 'true' AND ('$(OS)' != 'Windows_NT' OR '$(BuildArch)' != 'x64')">false</BuildIdentityPackage>
  </PropertyGroup>

  <Target Name="FilterProjects" BeforeTargets="Build">
    <Error Condition="'$(PackageRID)' == ''" Text="'PackageRID' property must be specified."/>

    <!-- Only build packages for current RID or non-RID-specific -->
    <ItemGroup>
      <_projectsToBuild Include="@(Project)" Condition="'%(Project.PackageTargetRuntime)' == '$(PackageRID)'" />
    </ItemGroup>

    <ItemGroup Condition="'$(BuildIdentityPackage)' == 'true'">
      <_projectsToBuild Include="@(Project)" Condition="'%(Project.PackageTargetRuntime)' == ''" />
    </ItemGroup>

    <ItemGroup>
      <ProjectReference Include="@(_projectsToBuild)" />
    </ItemGroup>
  </Target>
</Project>