Skip to content

Commit

Permalink
Remove unnecessary ref source projects from Microsoft.Bcl packages (#…
Browse files Browse the repository at this point in the history
…105312)

* Remove unused reference assembly projects from Bcl folders

Contributes to #58163

- Remove unused reference assembly projects and move the
  forwards.cs files into the src folder.
- Don't rely on IsPartialFacadeAssembly switch anymore
  which makes it possible to use the compiler generated xml
  file and removes the dependency on the reference source project.
- Enable package baseline validation for Microsoft.Bcl.Numerics

This improves restore and build perf in total as well as per leaf
project on the CLI and inside VS.

* Update project references

- Update projects that now need to reference the src project as
  the ref project got deleted.
- Remove target that validates that ref projects only reference ref
  project. That target doesn't make sense anymore with our direction
  towards removing reference assembly projects.
  • Loading branch information
ViktorHofer committed Jul 23, 2024
1 parent 53d1a6d commit 3028ee9
Show file tree
Hide file tree
Showing 32 changed files with 114 additions and 581 deletions.
12 changes: 2 additions & 10 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,10 @@
<Error Text="The passed-in TargetOS property value '$(TargetOS)' must be lowercase." />
</Target>

<ItemDefinitionGroup>
<TargetPathWithTargetPlatformMoniker>
<IsReferenceAssemblyProject>$(IsReferenceAssemblyProject)</IsReferenceAssemblyProject>
</TargetPathWithTargetPlatformMoniker>
</ItemDefinitionGroup>

<Target Name="ValidateReferenceAssemblyProjectReferencesAndTargetFramework"
AfterTargets="ResolveReferences"
<Target Name="ValidateReferenceAssemblyProjectTargetFramework"
BeforeTargets="CoreCompile"
Condition="'$(IsReferenceAssemblyProject)' == 'true' and
'$(SkipValidateReferenceAssemblyProjectReferences)' != 'true'">
<Error Text="Reference assemblies must only reference other reference assemblies and '%(ReferencePath.ProjectReferenceOriginalItemSpec)' is not a reference assembly project and does not set 'ProduceReferenceAssembly'."
Condition="'%(ReferencePath.ReferenceSourceTarget)' == 'ProjectReference' and '%(ReferencePath.IsReferenceAssemblyProject)' != 'true' and '%(ReferencePath.ReferenceAssembly)' == ''" />
<Error Text="Reference assemblies must be TargetPlatform agnostic. $(MSBuildProjectName) incorrectly targets $(TargetFramework), platform: $(TargetPlatformIdentifier)."
Condition="'$(TargetPlatformIdentifier)' != ''" />
</Target>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,37 @@

<PropertyGroup>
<TargetFrameworks>netstandard2.0;$(NetFrameworkMinimum);netstandard2.1</TargetFrameworks>
<UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>
<IsPackable>true</IsPackable>
<!-- This assembly should never be placed inbox as it is only for downlevel compatibility. -->
<PackageDescription>Provides the IAsyncEnumerable&lt;T&gt; and IAsyncDisposable interfaces and helper types for .NET Standard 2.0. This package is not required starting with .NET Standard 2.1 and .NET Core 3.0.

Commonly Used Types:
System.IAsyncDisposable
System.Collections.Generic.IAsyncEnumerable
System.Collections.Generic.IAsyncEnumerator</PackageDescription>
<PackageDescription>Provides the IAsyncEnumerable&lt;T&gt; and IAsyncDisposable interfaces and helper types for .NET Standard 2.0. This package is not required starting with .NET Standard 2.1 and .NET Core 3.0.</PackageDescription>
</PropertyGroup>

<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup>
<IsPartialFacadeAssembly Condition="'$(TargetFramework)' == 'netstandard2.1'">true</IsPartialFacadeAssembly>
</PropertyGroup>
<Choose>
<When Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netstandard2.1'))">
<ItemGroup>
<Compile Include="Microsoft.Bcl.AsyncInterfaces.Forwards.cs" />
</ItemGroup>
</When>

<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true'">
<Compile Include="System\Threading\Tasks\Sources\ManualResetValueTaskSourceCore.cs" />
<Compile Include="System\Runtime\CompilerServices\AsyncIteratorMethodBuilder.cs" />
<Compile Include="$(CoreLibSharedDir)\System\Collections\Generic\IAsyncEnumerable.cs">
<Link>System.Private.CoreLib\System\Collections\Generic\IAsyncEnumerable.cs</Link>
</Compile>
<Compile Include="$(CoreLibSharedDir)\System\Collections\Generic\IAsyncEnumerator.cs">
<Link>System.Private.CoreLib\System\Collections\Generic\IAsyncEnumerator.cs</Link>
</Compile>
<Compile Include="$(CoreLibSharedDir)\System\IAsyncDisposable.cs">
<Link>System.Private.CoreLib\System\IAsyncDisposable.cs</Link>
</Compile>
<Compile Include="$(CoreLibSharedDir)\System\Runtime\CompilerServices\AsyncIteratorStateMachineAttribute.cs">
<Link>System.Private.CoreLib\System\Runtime\CompilerServices\AsyncIteratorStateMachineAttribute.cs</Link>
</Compile>
<Compile Include="$(CoreLibSharedDir)\System\Runtime\CompilerServices\ConfiguredAsyncDisposable.cs">
<Link>System.Private.CoreLib\System\Runtime\CompilerServices\ConfiguredAsyncDisposable.cs</Link>
</Compile>
<Compile Include="$(CoreLibSharedDir)\System\Runtime\CompilerServices\ConfiguredCancelableAsyncEnumerable.cs">
<Link>System.Private.CoreLib\System\Runtime\CompilerServices\ConfiguredCancelableAsyncEnumerable.cs</Link>
</Compile>
<Compile Include="$(CoreLibSharedDir)\System\Threading\Tasks\TaskAsyncEnumerableExtensions.cs">
<Link>System.Private.CoreLib\System\Threading\Tasks\TaskAsyncEnumerableExtensions.cs</Link>
</Compile>
<Compile Include="$(CoreLibSharedDir)\System\Runtime\CompilerServices\EnumeratorCancellationAttribute.cs">
<Link>System.Private.CoreLib\System\Runtime\CompilerServices\EnumeratorCancellationAttribute.cs</Link>
</Compile>
<Otherwise>
<ItemGroup>
<Compile Include="System\Threading\Tasks\Sources\ManualResetValueTaskSourceCore.cs" />
<Compile Include="System\Runtime\CompilerServices\AsyncIteratorMethodBuilder.cs" />

</ItemGroup>
<Compile Include="$(CoreLibSharedDir)System\Collections\Generic\IAsyncEnumerable.cs" Link="System.Private.CoreLib\System\Collections\Generic\IAsyncEnumerable.cs" />
<Compile Include="$(CoreLibSharedDir)System\Collections\Generic\IAsyncEnumerator.cs" Link="System.Private.CoreLib\System\Collections\Generic\IAsyncEnumerator.cs" />
<Compile Include="$(CoreLibSharedDir)System\IAsyncDisposable.cs" Link="System.Private.CoreLib\System\IAsyncDisposable.cs" />
<Compile Include="$(CoreLibSharedDir)System\Runtime\CompilerServices\AsyncIteratorStateMachineAttribute.cs" Link="System.Private.CoreLib\System\Runtime\CompilerServices\AsyncIteratorStateMachineAttribute.cs" />
<Compile Include="$(CoreLibSharedDir)System\Runtime\CompilerServices\ConfiguredAsyncDisposable.cs" Link="System.Private.CoreLib\System\Runtime\CompilerServices\ConfiguredAsyncDisposable.cs" />
<Compile Include="$(CoreLibSharedDir)System\Runtime\CompilerServices\ConfiguredCancelableAsyncEnumerable.cs" Link="System.Private.CoreLib\System\Runtime\CompilerServices\ConfiguredCancelableAsyncEnumerable.cs" />
<Compile Include="$(CoreLibSharedDir)System\Threading\Tasks\TaskAsyncEnumerableExtensions.cs" Link="System.Private.CoreLib\System\Threading\Tasks\TaskAsyncEnumerableExtensions.cs" />
<Compile Include="$(CoreLibSharedDir)System\Runtime\CompilerServices\EnumeratorCancellationAttribute.cs" Link="System.Private.CoreLib\System\Runtime\CompilerServices\EnumeratorCancellationAttribute.cs" />
</ItemGroup>

<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true'">
<PackageReference Include="System.Threading.Tasks.Extensions" Version="$(SystemThreadingTasksExtensionsVersion)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Threading.Tasks.Extensions" Version="$(SystemThreadingTasksExtensionsVersion)" />
</ItemGroup>
</Otherwise>
</Choose>

</Project>
Loading

0 comments on commit 3028ee9

Please sign in to comment.