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
Show file tree
Hide file tree
Changes from 3 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
5 changes: 3 additions & 2 deletions src/libraries/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,11 @@
<Import Project="$(RepositoryEngineeringDir)targetingpacks.targets" />

<PropertyGroup>
<!-- Libraries non test projects shouldn't reference compat shims. -->
<!-- Libraries ref and source projects which don't bring in dependencies from outside the repository shouldn't reference compat shims. -->
<SkipTargetingPackShimReferences Condition="'$(UseLocalTargetingRuntimePack)' == 'true' and
'$(IsTestProject)' != 'true' and
'$(IsTestSupportProject)' != 'true'">true</SkipTargetingPackShimReferences>
'$(IsTestSupportProject)' != 'true' and
'$(IsGeneratorProject)' != 'true'">true</SkipTargetingPackShimReferences>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)codeOptimization.targets" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum)</TargetFrameworks>
<SkipValidateReferenceAssemblyProjectReferences>true</SkipValidateReferenceAssemblyProjectReferences>
</PropertyGroup>

<ItemGroup>
Expand All @@ -9,7 +11,8 @@
</ItemGroup>

<ItemGroup>
<!-- Avoid a PackageReference to System.Drawing.Common this reference is only needed for TypeForwards -->
<PackageReference Include="System.Drawing.Common" Version="$(SystemDrawingCommonVersion)" PrivateAssets="All" />
<!-- Avoid a product dependency to System.Drawing.Common, this reference is only needed for TypeForwards -->
<ProjectReference Include="$(LibrariesProjectRoot)shims\fakes\System.Drawing.Common.csproj" PrivateAssets="all" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);$(NetCoreAppPrevious)-windows;$(NetCoreAppPrevious);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum)</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down Expand Up @@ -93,7 +94,8 @@ System.Security.Cryptography.X509Certificates.X509SelectionFlag</PackageDescript
</ItemGroup>

<ItemGroup>
<!-- Avoid a PackageReference to System.Drawing.Common this reference is only needed for TypeForwards -->
<PackageReference Include="System.Drawing.Common" Version="$(SystemDrawingCommonVersion)" PrivateAssets="All" />
<!-- Avoid a product dependency to System.Drawing.Common, this reference is only needed for TypeForwards -->
<ProjectReference Include="$(LibrariesProjectRoot)shims\fakes\System.Drawing.Common.csproj" PrivateAssets="all" />
</ItemGroup>

</Project>
1 change: 0 additions & 1 deletion src/libraries/apicompat/ApiCompat.proj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
<!-- For API comparison, ApiCompat needs the inbox assemblies (including shims) and to resolve type forwards, the out-of-band assemblies. -->
<ItemGroup>
<ProjectReference Include="..\sfx-src.proj" OutputItemType="SharedFrameworkAssembly" />
<ProjectReference Include="..\shims.proj" OutputItemType="SharedFrameworkAssembly" />
<ProjectReference Include="..\oob-src.proj" OutputItemType="OOBAssembly" />
</ItemGroup>

Expand Down
44 changes: 0 additions & 44 deletions src/libraries/frameworklist.targets

This file was deleted.

6 changes: 0 additions & 6 deletions src/libraries/oob.proj
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
</PropertyGroup>

<ItemGroup Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildTargetFramework)' == ''">
<ProjectReference Include="sfx-gen.proj" OutputItemType="SharedFrameworkAnalyzerAssembly" />
<ProjectReference Include="sfx-src.proj" OutputItemType="SharedFrameworkAssembly" />
<ProjectReference Include="oob-src.proj" OutputItemType="OOBAssembly" />
<ProjectReference Include="shims.proj" OutputItemType="SharedFrameworkAssembly" />

<ProjectReference Include="apicompat\ApiCompat.proj"
Condition="'$(DotNetBuildFromSource)' != 'true' and '$(ApiCompatValidateAssemblies)' != 'false'" />
Expand All @@ -23,15 +21,11 @@
<!-- Support building reference projects only. -->
<ItemGroup Condition="'$(RefOnly)' == 'true'">
<ProjectReference Remove="@(ProjectReference)" />
<ProjectReference Include="sfx-gen.proj" OutputItemType="SharedFrameworkAnalyzerAssembly" />
<ProjectReference Include="sfx-ref.proj" OutputItemType="SharedFrameworkAssembly" />
<ProjectReference Include="oob-ref.proj" />
<ProjectReference Include="shims.proj" OutputItemType="SharedFrameworkAssembly" />
</ItemGroup>

<ImportGroup Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildTargetFramework)' == ''">
<!-- Re-generate the targeting pack's framework list to include shims. -->
<Import Project="frameworklist.targets" />
<!-- Import the illink file which contains some of the logic required to illink the out-of-band assemblies. -->
<Import Project="$(RepositoryEngineeringDir)illink.targets" />
</ImportGroup>
Expand Down
8 changes: 8 additions & 0 deletions src/libraries/sfx-ref.proj
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,12 @@
System.Private.CoreLib\ref\System.Private.CoreLib.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(RefOnly)' == 'true'">
<ProjectReference Include="shims\*\src\*.csproj" />
<ReferenceShimProject Include="shims\*\ref\*.csproj" />
<ProjectReference Include="@(ReferenceShimProject)" />
<!-- Omit projects which depend on source projects to be built. -->
<ProjectReference Remove="@(ReferenceShimProject->'shims\%(Filename)\src\%(Filename)%(Extension)')" />
</ItemGroup>

</Project>
3 changes: 2 additions & 1 deletion src/libraries/sfx-src.proj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
Exclude="@(NetCoreAppLibrary->'%(Identity)\src\%(Identity).csproj');
Microsoft.VisualBasic.Core\src\Microsoft.VisualBasic.Core.vbproj" />
<ProjectReference Include="@(AnyProject);
$(CoreLibProject)"
$(CoreLibProject);
shims\*\src\*.csproj"
Exclude="@(NonNetCoreAppProject)" />
</ItemGroup>

Expand Down
45 changes: 40 additions & 5 deletions src/libraries/sfx.proj
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<Project Sdk="Microsoft.Build.NoTargets">

<Sdk Name="Microsoft.DotNet.SharedFramework.Sdk" />

<PropertyGroup>
<TargetFramework>$(NetCoreAppCurrent)-$(TargetOS)</TargetFramework>
<BuildInParallel>false</BuildInParallel>
<IsPackable>false</IsPackable>
<FrameworkListOutputPath>$(MicrosoftNetCoreAppRefPackDataDir)FrameworkList.xml</FrameworkListOutputPath>
</PropertyGroup>

<ItemGroup>
Expand All @@ -11,16 +15,47 @@
<ProjectReference Include="sfx-ref.proj">
<OutputItemType Condition="'$(RefOnly)' == 'true'">SharedFrameworkAssembly</OutputItemType>
</ProjectReference>
<!-- The RefOnly condition exists to support building the reference source projects only. -->
<ProjectReference Include="sfx-src.proj" OutputItemType="SharedFrameworkAssembly" Condition="'$(RefOnly)' != 'true'" />
<ProjectReference Include="sfx-gen.proj" OutputItemType="SharedFrameworkAnalyzerAssembly" />
</ItemGroup>

<!-- Support building only the reference assemblies. -->
<ItemGroup Condition="'$(RefOnly)' != 'true'">
<ProjectReference Include="sfx-src.proj" OutputItemType="SharedFrameworkAssembly" />
</ItemGroup>
<Target Name="GetGenerateFrameworkListFileInputs">
<Error Text="Shared framework assemblies must be built before the framework list can be generated."
Condition="'@(SharedFrameworkAssembly)' == '' or '@(SharedFrameworkAnalyzerAssembly)' == ''" />

<ItemGroup>
<SharedFrameworkAssemblyWithReferenceAssembly Include="@(SharedFrameworkAssembly->WithMetadataValue('IsPrivateAssembly', 'false')->HasMetadata('ReferenceAssembly'))" />
<SharedFrameworkAssemblyWithoutReferenceAssembly Include="@(SharedFrameworkAssembly->WithMetadataValue('IsPrivateAssembly', 'false'))"
Exclude="@(SharedFrameworkAssemblyWithReferenceAssembly)" />

<FrameworkListInputFile Include="@(SharedFrameworkAssemblyWithReferenceAssembly->Metadata('ReferenceAssembly'));
@(SharedFrameworkAssemblyWithoutReferenceAssembly)"
TargetPath="ref/$(NetCoreAppCurrent)" />
<FrameworkListInputFile Include="@(SharedFrameworkAnalyzerAssembly)"
TargetPath="%(SharedFrameworkAnalyzerAssembly.GeneratorProjectBaseTargetPath)" />
</ItemGroup>
</Target>

<!-- Generate the targeting pack's framework list so that out-of-band projects can leverage it. -->
<Import Project="frameworklist.targets" />
<UsingTask TaskName="CreateFrameworkListFile" AssemblyFile="$(DotNetSharedFrameworkTaskFile)"/>
<Target Name="GenerateFrameworkListFile"
DependsOnTargets="GetGenerateFrameworkListFileInputs"
AfterTargets="Build"
Inputs="@(FrameworkListInputFile)"
Outputs="$(FrameworkListOutputPath)">
<ItemGroup>
<FrameworkListRootAttribute Include="Name" Value="$(NetCoreAppCurrentBrandName)" />
<FrameworkListRootAttribute Include="TargetFrameworkIdentifier" Value="$(NetCoreAppCurrentIdentifier)" />
<FrameworkListRootAttribute Include="TargetFrameworkVersion" Value="$(NetCoreAppCurrentVersion)" />
<FrameworkListRootAttribute Include="FrameworkName" Value="$(MicrosoftNetCoreAppFrameworkName)" />
</ItemGroup>

<CreateFrameworkListFile Files="@(FrameworkListInputFile)"
TargetFile="$(FrameworkListOutputPath)"
TargetFilePrefixes="ref/;runtimes/;analyzers/"
RootAttributes="@(FrameworkListRootAttribute)" />
</Target>

<!-- Copy the intellisense file to the targeting pack directory. -->
<Target Name="CopyDocumentationFiles"
Expand Down
19 changes: 0 additions & 19 deletions src/libraries/shims.proj

This file was deleted.

5 changes: 0 additions & 5 deletions src/libraries/shims/Directory.Build.targets

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)System.Configuration.ConfigurationManager\src\System.Configuration.ConfigurationManager.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Runtime\src\System.Runtime.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Permissions\src\System.Security.Permissions.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)shims\fakes\System.Configuration.ConfigurationManager.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)shims\fakes\System.Security.Permissions.csproj" />
</ItemGroup>

</Project>
9 changes: 4 additions & 5 deletions src/libraries/shims/System.Core/src/System.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@

<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)System.Collections\src\System.Collections.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Diagnostics.PerformanceCounter\src\System.Diagnostics.PerformanceCounter.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.IO.MemoryMappedFiles\src\System.IO.MemoryMappedFiles.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.IO.Pipes\src\System.IO.Pipes.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.IO.Pipes.AccessControl\src\System.IO.Pipes.AccessControl.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Linq\src\System.Linq.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.IO.Pipes\src\System.IO.Pipes.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Linq.Expressions\src\System.Linq.Expressions.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Linq.Parallel\src\System.Linq.Parallel.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Linq.Queryable\src\System.Linq.Queryable.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Runtime\src\System.Runtime.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Linq\src\System.Linq.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Runtime.InteropServices\src\System.Runtime.InteropServices.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Runtime\src\System.Runtime.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Cryptography\src\System.Security.Cryptography.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Permissions\src\System.Security.Permissions.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Threading\src\System.Threading.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)shims\fakes\System.Diagnostics.PerformanceCounter.csproj" />
</ItemGroup>

</Project>
10 changes: 0 additions & 10 deletions src/libraries/shims/System.Data/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<StrongNameKeyId>ECMA</StrongNameKeyId>
<SystemDataSqlClientTFM>netcoreapp2.1</SystemDataSqlClientTFM>
<!-- Keep in sync with TFM exposed in source-build-reference-packages/src/referencePackages/src/system.data.sqlclient/4.8.5 -->
<SystemDataSqlClientTFM Condition="'$(ArcadeBuildFromSource)' == 'true'">net6.0</SystemDataSqlClientTFM>
</PropertyGroup>

<ItemGroup>
<!-- System.Data.SqlClient is not live built anymore, reference it manually to avoid tfm nuget selection fallback errors
when the TargetOS i.e. is MacCatalyst. Set Private false so that it doesn't flow down to consuming projects. -->
<PackageDownload Include="System.Data.SqlClient" Version="[$(SystemDataSqlClientVersion)]" />
<Reference Include="$([MSBuild]::NormalizePath('$(NuGetPackageRoot)', 'system.data.sqlclient', '$(SystemDataSqlClientVersion)', 'ref', '$(SystemDataSqlClientTFM)', 'System.Data.SqlClient.dll'))" Private="false" />
</ItemGroup>

</Project>
7 changes: 4 additions & 3 deletions src/libraries/shims/System.Data/ref/System.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)System.Data.Common\ref\System.Data.Common.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Data.Odbc\ref\System.Data.Odbc.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Data.OleDb\ref\System.Data.OleDb.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Runtime\ref\System.Runtime.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Permissions\ref\System.Security.Permissions.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)shims\fakes\System.Data.Odbc.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)shims\fakes\System.Data.OleDb.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)shims\fakes\System.Data.SqlClient.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)shims\fakes\System.Security.Permissions.csproj" />
</ItemGroup>

</Project>
7 changes: 4 additions & 3 deletions src/libraries/shims/System.Data/src/System.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
<ItemGroup>
<ProjectReference Include="$(CoreLibProject)" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Data.Common\src\System.Data.Common.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Data.Odbc\src\System.Data.Odbc.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Data.OleDb\src\System.Data.OleDb.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Runtime\src\System.Runtime.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Permissions\src\System.Security.Permissions.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)shims\fakes\System.Data.Odbc.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)shims\fakes\System.Data.OleDb.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)shims\fakes\System.Data.SqlClient.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)shims\fakes\System.Security.Permissions.csproj" />
</ItemGroup>

</Project>
Loading