Skip to content

APICompat for ref-pack servicing #42961

@ericstj

Description

@ericstj

We now permit servicing of our ref-packs. We should make sure that any change made to the ref-packs in servicing is API compatible with an un-serviced ref-pack.

This ensures that a library compiled against the serviced ref-pack will work with a GA runtime, or another un-serviced consuming compile (eg: in case of nuget packages).

The purpose of this would be to block API additions in servicing.

I think we can accomplish this in a similar way we do API compat with past release, restoring the GA-refpack.

<PropertyGroup>
<PreviousNetCoreAppRefPath>$([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', '$(PreviousNetCoreAppPackageId)', '$(PreviousNetCoreAppPackageVersion)', 'ref', '$(PreviousNetCoreApp)'))</PreviousNetCoreAppRefPath>
<_previousNetCoreAppBaselineFile>$(MSBuildThisFileDirectory)ApiCompatBaseline.PreviousNetCoreApp.txt</_previousNetCoreAppBaselineFile>
<_previousNetCoreAppBaselineParam>--baseline &quot;$(_previousNetCoreAppBaselineFile)&quot;</_previousNetCoreAppBaselineParam>
<_previousNetCoreAppBaselineParam Condition="'$(UpdatePreviousNetCoreAppBaseline)' == 'true'">&gt; &quot;$(_previousNetCoreAppBaselineFile)&quot;</_previousNetCoreAppBaselineParam>
</PropertyGroup>
<Error Condition="'$(NetCoreAppCurrent)' != 'net5.0'" Text="Update value of PreviousNetCoreApp" />
<Error Condition="!Exists($(PreviousNetCoreAppRefPath))" Text="Missing reference assemblies for '$(PreviousNetCoreApp)'" />
<Exec Command="$(_ApiCompatCommand) &quot;$(PreviousNetCoreAppRefPath.TrimEnd('\/'))&quot; @&quot;$(ApiCompatResponseFile)&quot; $(_previousNetCoreAppBaselineParam)"
CustomErrorRegularExpression="^[a-zA-Z]+ :"
StandardOutputImportance="Low"
IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="ApiCompatExitCode" />
</Exec>

We should treat current ref-pack as "contract" and GA ref-pack as implementation. That will catch any case where a current reference couldn't be satisfied by GA ref-pack.

CC @dougbu since this sort of check would be interesting for AspNET as well.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions