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

Build the shim assemblies as part of libs.sfx #89005

Merged
merged 15 commits into from
Jul 18, 2023
Merged
40 changes: 36 additions & 4 deletions src/libraries/apicompat/ApiCompat.proj
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,36 @@
<PackageDownload Include="NETStandard.Library.Ref" Version="[$(NETStandardLibraryRefVersion)]" />
<PackageDownload Include="NETStandard.Library" Version="[$(NetStandardLibraryVersion)]" />
<PackageReference Include="Microsoft.DotNet.ApiCompat.Task" Version="$(MicrosoftDotNetApiCompatTaskVersion)" IsImplicitlyDefined="true" />

<!-- Restore and reference assemblies not built in runtime anymore, required for resolving type forward on both comparison sides. -->
<ApiCompatTypeForwardDestinationPackage Include="System.Data.SqlClient" PackageVersion="$(SystemDataSqlClientVersion)" TargetFramework="netcoreapp2.1" />
<ApiCompatTypeForwardDestinationPackage Include="System.Drawing.Common" PackageVersion="$(SystemDrawingCommonVersion)" TargetFramework="net7.0" />

<!-- Restore and reference assemblies required for resolving type forwards on the baseline (left) side. -->
<ApiCompatLeftTypeForwardDestinationPackage Include="@(ApiCompatTypeForwardDestinationPackage)" />
<ApiCompatLeftTypeForwardDestinationPackage
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you got this all fixed up now, but one thing you might consider is using a project to do an actual restore of the old Microsoft.Windows.Compatibility package and all assets for a particular target framework. That might avoid juggling all the PackageDownload items.

Include="
Microsoft.Win32.SystemEvents;
System.CodeDom;
System.Configuration.ConfigurationManager;
System.Data.Odbc;
System.Data.OleDb;
System.Diagnostics.EventLog;
System.Diagnostics.PerformanceCounter;
System.IO.Packaging;
System.IO.Ports;
System.Runtime.Serialization.Schema;
System.Security.Cryptography.Pkcs;
System.Security.Cryptography.ProtectedData;
System.Security.Cryptography.Xml;
System.Security.Permissions;
System.ServiceModel.Syndication;
System.ServiceProcess.ServiceController;
System.Threading.AccessControl;
System.Windows.Extensions"
PackageVersion="$(ApiCompatNetCoreAppBaselineVersion)"
TargetFramework="$(ApiCompatNetCoreAppBaselineTFM)" />
<PackageDownload Include="@(ApiCompatLeftTypeForwardDestinationPackage)" Version="[%(PackageVersion)]" />
</ItemGroup>

<Target Name="RunApiCompat"
Expand All @@ -52,7 +82,8 @@

<ItemGroup>
<ApiCompatRightAssembly Include="@(ReferencePathWithRefAssemblies->WithMetadataValue('IsPrivateAssembly', 'false')->WithMetadataValue('OutputItemType', 'SharedFrameworkAssembly'))" />
<ApiCompatRightAssemblyReference Include="@(ReferencePathWithRefAssemblies->WithMetadataValue('IsPrivateAssembly', 'false')->WithMetadataValue('OutputItemType', 'OOBAssembly'), ',')" />
<ApiCompatRightAssemblyReference Include="@(ReferencePathWithRefAssemblies->WithMetadataValue('IsPrivateAssembly', 'false')->WithMetadataValue('OutputItemType', 'OOBAssembly'))" />
<ApiCompatRightAssemblyReference Include="@(ApiCompatTypeForwardDestinationPackage->'$(NuGetPackageRoot)%(Identity)\%(PackageVersion)\lib\%(TargetFramework)\%(Identity).dll')" />
</ItemGroup>

<!-- ApiCompat: NetCoreAppCurrent <-> .NETCoreApp ApiCompatNetCoreAppBaselineVersion -->
Expand All @@ -67,7 +98,8 @@
ExcludeAttributesFiles="@(ApiCompatExcludeAttributesFile)"
LeftAssembliesTransformationPattern="@(ApiCompatNetCoreAppLatestStableLeftAssembliesTransformationPattern)"
RightAssembliesTransformationPattern="@(ApiCompatNetCoreAppCurrentRightAssembliesTransformationPattern)"
RightAssembliesReferences="@(ApiCompatRightAssemblyReference)" />
LeftAssembliesReferences="@(ApiCompatLeftTypeForwardDestinationPackage->'$(NuGetPackageRoot)%(Identity)\%(PackageVersion)\lib\%(TargetFramework)\%(Identity).dll', ',')"
RightAssembliesReferences="@(ApiCompatRightAssemblyReference, ',')" />

<!-- ApiCompat: NetCoreAppCurrent <-> netstandard2.1 -->
<Microsoft.DotNet.ApiCompat.Task.ValidateAssembliesTask
Expand All @@ -80,7 +112,7 @@
ExcludeAttributesFiles="@(ApiCompatExcludeAttributesFile)"
LeftAssembliesTransformationPattern="@(ApiCompatNetStandard21LeftAssembliesTransformationPattern)"
RightAssembliesTransformationPattern="@(ApiCompatNetCoreAppCurrentRightAssembliesTransformationPattern)"
RightAssembliesReferences="@(ApiCompatRightAssemblyReference)" />
RightAssembliesReferences="@(ApiCompatRightAssemblyReference, ',')" />

<!-- ApiCompat: NetCoreAppCurrent <-> netstandard2.0 -->
<Microsoft.DotNet.ApiCompat.Task.ValidateAssembliesTask
Expand All @@ -93,7 +125,7 @@
ExcludeAttributesFiles="@(ApiCompatExcludeAttributesFile)"
LeftAssembliesTransformationPattern="@(ApiCompatNetStandard20LeftAssembliesTransformationPattern)"
RightAssembliesTransformationPattern="@(ApiCompatNetCoreAppCurrentRightAssembliesTransformationPattern)"
RightAssembliesReferences="@(ApiCompatRightAssemblyReference)" />
RightAssembliesReferences="@(ApiCompatRightAssemblyReference, ',')" />

<!-- Create a marker file which serves as the target's output to enable incremental builds. -->
<Touch Files="$(IntermediateOutputPath)$(TargetArchitecture)-marker.txt"
Expand Down