Skip to content

Commit

Permalink
Use ProjectReference to build against System.Private.CoreLib (dotnet#…
Browse files Browse the repository at this point in the history
…38196)

* Use ProjectReference to build against CoreLib
  • Loading branch information
ViktorHofer authored Jun 22, 2020
1 parent 3495f1a commit dd41a4a
Show file tree
Hide file tree
Showing 44 changed files with 52 additions and 52 deletions.
4 changes: 4 additions & 0 deletions src/libraries/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@
<NetStandard21RefPath>$([MSBuild]::NormalizeDirectory('$(RefRootPath)', 'netstandard2.1'))</NetStandard21RefPath>
<NetFxRefPath>$([MSBuild]::NormalizeDirectory('$(RefRootPath)', '$(NetFrameworkCurrent)'))</NetFxRefPath>

<!-- System.Private.CoreLib -->
<CoreLibProject Condition="'$(RuntimeFlavor)' == 'CoreCLR'">$([MSBuild]::NormalizePath('$(CoreClrProjectRoot)', 'src', 'System.Private.CoreLib', 'System.Private.CoreLib.csproj'))</CoreLibProject>
<CoreLibProject Condition="'$(RuntimeFlavor)' == 'Mono'">$([MSBuild]::NormalizePath('$(MonoProjectRoot)', 'netcore', 'System.Private.CoreLib', 'System.Private.CoreLib.csproj'))</CoreLibProject>

<!-- Helix properties -->
<OSPlatformConfig>$(TargetOS).$(Platform).$(Configuration)</OSPlatformConfig>
<AnyOSPlatformConfig>AnyOS.AnyCPU.$(Configuration)</AnyOSPlatformConfig>
Expand Down
6 changes: 4 additions & 2 deletions src/libraries/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project InitialTargets="AddSkipGetTargetFrameworkToProjectReferences">
<Project InitialTargets="UpdateProjectReferencesWithAttributes">
<PropertyGroup>
<RefPath>$([MSBuild]::NormalizeDirectory('$(RefRootPath)', '$(TargetFramework)'))</RefPath>
</PropertyGroup>
Expand Down Expand Up @@ -184,10 +184,12 @@
<!-- Define this target to override the workaround in arcade as we don't need it for our pkgprojs -->
<Target Name="InitializeStandardNuspecProperties" />

<Target Name="AddSkipGetTargetFrameworkToProjectReferences" Condition="'@(ProjectReference)' != ''">
<Target Name="UpdateProjectReferencesWithAttributes" Condition="'@(ProjectReference)' != ''">
<ItemGroup>
<ProjectReference>
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
<AdditionalProperties Condition="'%(Filename)' == 'System.Private.CoreLib' and '$(RuntimeFlavor)' == 'CoreCLR'">Configuration=$(CoreCLRConfiguration);TargetFramework=$(NetCoreAppCurrent)</AdditionalProperties>
<AdditionalProperties Condition="'%(Filename)' == 'System.Private.CoreLib' and '$(RuntimeFlavor)' == 'Mono'">Configuration=$(MonoConfiguration);TargetFramework=$(NetCoreAppCurrent)</AdditionalProperties>
</ProjectReference>
</ItemGroup>
</Target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/libraries/System.Buffers/src/System.Buffers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Link="System\Collections\Concurrent\IProducerConsumerCollectionDebugView.cs" />
</ItemGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
<ProjectReference Include="..\..\System.Collections\src\System.Collections.csproj" />
<ProjectReference Include="..\..\System.Diagnostics.Tracing\src\System.Diagnostics.Tracing.csproj" />
<ProjectReference Include="..\..\System.Threading\src\System.Threading.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
Link="Common\System\Collections\Generic\EnumerableHelpers.cs" />
</ItemGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ItemGroup>
<DefaultReferenceExclusions Include="System.Diagnostics.Debug" />
<DefaultReferenceExclusions Include="System.Runtime.Extensions" />
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" Private="false" />
<ReferenceFromRuntime Include="System.Runtime" />
<ReferenceFromRuntime Include="System.Threading" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
<ProjectReference Include="..\..\System.Collections.Immutable\src\System.Collections.Immutable.csproj" />
</ItemGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@
<ProjectReference Include="..\..\System.Threading\src\System.Threading.csproj" />
</ItemGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/libraries/System.Memory/src/System.Memory.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
Link="Common\System\Buffers\ArrayBufferWriter.cs" />
</ItemGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
<Compile Include="System\Uri.Unix.cs" />
</ItemGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
<Compile Include="System\Reflection\TypeExtensions.cs" />
</ItemGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
<ProjectReference Include="..\..\System.Runtime\src\System.Runtime.csproj" />
</ItemGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@
<Compile Include="System\Security\SecureStringMarshal.cs" />
</ItemGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
Link="Common\System\Collections\HashHelpers.cs" />
</ItemGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
<ProjectReference Include="..\..\System.Runtime.CompilerServices.Unsafe\src\System.Runtime.CompilerServices.Unsafe.ilproj" />
<ProjectReference Include="..\..\System.Runtime\src\System.Runtime.csproj" />
<ProjectReference Include="..\..\System.Collections\src\System.Collections.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/System.Runtime/src/System.Runtime.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
<ProjectReference Include="..\..\System.Private.Uri\src\System.Private.Uri.csproj" />
</ItemGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/libraries/System.Threading/src/System.Threading.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
Link="Common\System\HResults.cs" />
</ItemGroup>
<ItemGroup>
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
<Reference Include="System.Security.Cryptography.Algorithms" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == '$(NetCoreAppCurrent)'">
<ReferenceFromRuntime Include="System.Private.CoreLib" />
<ProjectReference Include="$(CoreLibProject)" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Primitives" />
<ProjectReference Include="..\..\System.Runtime\src\System.Runtime.csproj" />
Expand Down
12 changes: 3 additions & 9 deletions src/libraries/shims/manual/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@
</PropertyGroup>

<ItemGroup>
<ReferencePath
Include="$(RuntimePath)System.*.dll;$(RuntimePath)Microsoft.Win32.*.dll;$(RuntimePath)netstandard.dll"
Exclude="$(RuntimePath)$(MSBuildProjectName).dll" />
<ReferencePath Include="$(RuntimePath)System.*.dll;$(RuntimePath)Microsoft.Win32.*.dll;$(RuntimePath)netstandard.dll"
Exclude="$(RuntimePath)$(MSBuildProjectName).dll" />
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>

<Target Name="AddSystemPrivateCoreLibReferencePath" DependsOnTargets="GetFilesFromRuntime" BeforeTargets="ResolveReferences">
<ItemGroup>
<ReferencePath Include="@(RuntimeFiles)" Condition="'%(FileName)%(Extension)' == 'System.Private.CoreLib.dll'" />
</ItemGroup>
</Target>
</Project>

0 comments on commit dd41a4a

Please sign in to comment.