Skip to content

Commit

Permalink
!fixup! Actually use %(LatestPackageReference.RTMVersion) metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
dougbu committed Jul 10, 2020
1 parent 75c18ca commit ecf8a2b
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions eng/targets/ResolveReferences.targets
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@
<UnusedBaselinePackageReference Remove="@(SuppressBaselineReference)" Condition="'$(IsServicingBuild)' != 'true'"/>
</ItemGroup>

<JoinItems Left="@(Reference)" Right="@(LatestPackageReference)" LeftMetadata="*" RightMetadata="Version"
<JoinItems Left="@(Reference)" Right="@(LatestPackageReference)" LeftMetadata="*" RightMetadata="Version;RTMVersion"
Condition=" '$(UseLatestPackageReferences)' == 'true' ">
<Output TaskParameter="JoinResult" ItemName="_LatestPackageReferenceWithVersion" />
</JoinItems>

<ItemGroup>
<!-- Remove reference items that have been resolved to a LatestPackageReference item. -->
<PackageReference Include="@(_LatestPackageReferenceWithVersion)" IsImplicitlyDefined="true" />
<!-- Remove reference items that have been resolved to a LatestPackageReference item. -->
<Reference Remove="@(_LatestPackageReferenceWithVersion)" />
</ItemGroup>

Expand All @@ -165,22 +165,22 @@
</JoinItems>

<ItemGroup>
<!-- Remove reference items that have been resolved to a BaselinePackageReference item. -->
<PackageReference Include="@(_BaselinePackageReferenceWithVersion)" IsImplicitlyDefined="true" />
<!-- Remove reference items that have been resolved to a BaselinePackageReference item. -->
<Reference Remove="@(_BaselinePackageReferenceWithVersion)" />
</ItemGroup>

<!-- For PrivateAssets=All references, like .Sources packages, fallback to LatestPackageReferences. -->
<JoinItems Left="@(Reference->WithMetadataValue('PrivateAssets', 'All'))"
Right="@(LatestPackageReference)"
LeftMetadata="*"
RightMetadata="Version">
RightMetadata="Version;RTMVersion">
<Output TaskParameter="JoinResult" ItemName="_PrivatePackageReferenceWithVersion" />
</JoinItems>

<ItemGroup>
<!-- Remove reference items that have been resolved to a LatestPackageReference item. -->
<PackageReference Include="@(_PrivatePackageReferenceWithVersion)" IsImplicitlyDefined="true" />
<!-- Remove reference items that have been resolved to a LatestPackageReference item. -->
<Reference Remove="@(_PrivatePackageReferenceWithVersion)" />

<!-- Free up memory for unnecessary items -->
Expand All @@ -190,6 +190,23 @@
<_ImplicitPackageReference Remove="@(_ImplicitPackageReference)" />
</ItemGroup>

<!--
Update project references to compile against RTM packages. %(RTMVersion) is set for about a dozen packages in all
servicing builds. But, these changes are only needed when that value differs from current %(Version) i.e. after
an incoming package has been serviced.
-->
<ItemGroup>
<PackageReference
Condition=" '%(PackageReference.RTMVersion)' != '' and '%(PackageReference.RTMVersion)' != '%(PackageReference.Version)' "
ExcludeAssets="Compile" />
<PackageReference Include="@(PackageReference->HasMetadata('RTMVersion'))"
Condition=" '%(PackageReference.RTMVersion)' != '%(PackageReference.Version)' "
IsImplicitlyDefined="true"
IncludeAssets="Compile"
PrivateAssets="All"
Version="%(PackageReference.RTMVersion)" />
</ItemGroup>

<Error
Condition="'$(DisablePackageReferenceRestrictions)' != 'true' AND @(_ExplicitPackageReference->Count()) != 0"
Text="PackageReference items are not allowed. Use &lt;Reference&gt; instead to replace the reference to @(_ExplicitPackageReference, ', '). See docs/ReferenceResolution.md for more details." />
Expand Down

0 comments on commit ecf8a2b

Please sign in to comment.