Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e6a14f2
Add reference assembly for System.Private.CoreLib.dll
akoeplinger Jul 13, 2022
7aa87e4
PR feedback
akoeplinger Jul 14, 2022
089738f
Disable compiling against SPC ref assembly for NativeAOT System.Priva…
akoeplinger Jul 14, 2022
b3bc03a
Revert changes that turned out to not be necessary
akoeplinger Jul 14, 2022
a15219f
Apply suggestions from code review
akoeplinger Jul 14, 2022
a435769
PR feedback
akoeplinger Jul 14, 2022
2c543f7
Fix build of System.Diagnostics.Debug.Tests.csproj
akoeplinger Jul 14, 2022
e48f215
Don't binplace System.Private.CoreLib ref assembly
akoeplinger Jul 14, 2022
686c578
Move contract .cs files back into the contract's ref\ directory
akoeplinger Jul 14, 2022
4c11ede
Add ApiCompat run for System.Private.CoreLib ref<->impl
akoeplinger Jul 14, 2022
9fb1ec2
Fix ApiCompat differences
akoeplinger Jul 14, 2022
928ef61
Better fix for wasm threading ApiCompat errors
akoeplinger Jul 15, 2022
76c7308
Revert unnecessary changes
akoeplinger Jul 15, 2022
9674d4c
Add comment
akoeplinger Jul 15, 2022
0e8122b
Disable binplacing with existing property
akoeplinger Jul 15, 2022
cd09cf2
Move CoreLib apicompat run to src projects
akoeplinger Jul 15, 2022
ecbde50
Fix ApiCompat issues by adding baseline files
akoeplinger Jul 15, 2022
1d28a85
PR feedback
akoeplinger Jul 15, 2022
d137fa3
Updates based on latest GenAPI changes
akoeplinger Jul 29, 2022
4ebf355
Merge remote-tracking branch 'upstream/main' into corelib-ref-assembly
akoeplinger Jul 29, 2022
5b7e29e
Update MatchingRefApiCompatBaseline.txt with recent changes
akoeplinger Jul 29, 2022
15398a9
Update MatchingRefApiCompatBaseline.txt with recent changes
akoeplinger Jul 29, 2022
bca5a1b
Fix MatchingRefApiCompatBaseline.txt validation failing on Windows
akoeplinger Jul 29, 2022
913329c
Update GenAPI
akoeplinger Aug 1, 2022
3600348
Remove MatchingRefApiCompatBaseline.Unix.txt
akoeplinger Aug 1, 2022
e947b5f
Merge remote-tracking branch 'upstream/main' into corelib-ref-assembly
akoeplinger Aug 2, 2022
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
3 changes: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,12 @@

<PropertyGroup>
<CoreLibSharedDir>$([MSBuild]::NormalizeDirectory('$(LibrariesProjectRoot)', 'System.Private.CoreLib', 'src'))</CoreLibSharedDir>
<CoreLibRefDir>$([MSBuild]::NormalizeDirectory('$(LibrariesProjectRoot)', 'System.Private.CoreLib', 'ref'))</CoreLibRefDir>
<CoreLibRefContractsDir>$([MSBuild]::NormalizeDirectory('$(CoreLibRefDir)', 'contracts'))</CoreLibRefContractsDir>
<CoreLibProject Condition="'$(RuntimeFlavor)' == 'CoreCLR'">$([MSBuild]::NormalizePath('$(CoreClrProjectRoot)', 'System.Private.CoreLib', 'System.Private.CoreLib.csproj'))</CoreLibProject>
<CoreLibProject Condition="'$(RuntimeFlavor)' == 'Mono'">$([MSBuild]::NormalizePath('$(MonoProjectRoot)', 'System.Private.CoreLib', 'System.Private.CoreLib.csproj'))</CoreLibProject>
<CoreLibProject Condition="'$(UseNativeAotCoreLib)' == 'true'">$([MSBuild]::NormalizePath('$(CoreClrProjectRoot)', 'nativeaot', 'System.Private.CoreLib', 'src', 'System.Private.CoreLib.csproj'))</CoreLibProject>
<UriProject>$([MSBuild]::NormalizePath('$(LibrariesProjectRoot)', 'System.Private.Uri', 'src', 'System.Private.Uri.csproj'))</UriProject>
Comment thread
akoeplinger marked this conversation as resolved.

<!-- this property is used by the SDK to pull in mono-based runtime packs -->
<UseMonoRuntime Condition="'$(UseMonoRuntime)' == '' and '$(RuntimeFlavor)' == 'Mono'">true</UseMonoRuntime>
Expand Down
21 changes: 11 additions & 10 deletions eng/references.targets
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,12 @@
<SetConfiguration Condition="'$(RuntimeFlavor)' == 'Mono' and
'$(Configuration)' != '$(MonoConfiguration)'">Configuration=$(MonoConfiguration)</SetConfiguration>
</ProjectReference>
<!-- If a CoreLib ProjectReference is present, make all P2P assets non transitive. -->
<!-- If a CoreLib src/ref ProjectReference is present, make all P2P assets non transitive. -->
Comment thread
akoeplinger marked this conversation as resolved.
Outdated
<ProjectReference Update="@(ProjectReference->WithMetadataValue('PrivateAssets', ''))"
PrivateAssets="all"
Condition="'$(IsSourceProject)' == 'true' and '@(_coreLibProjectReference)' != ''" />
</ItemGroup>

<!-- Disable TargetArchitectureMismatch warning when we reference CoreLib as it is platform specific. -->
<Target Name="DisableProjectReferenceArchitectureMismatchWarningForCoreLib"
Condition="'@(_coreLibProjectReference)' != ''"
BeforeTargets="ResolveAssemblyReferences">
<PropertyGroup>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
</Target>

<!-- Filter out transitive P2Ps which should be excluded. -->
<Target Name="FilterTransitiveProjectReferences"
AfterTargets="IncludeTransitiveProjectReferences"
Expand Down Expand Up @@ -94,6 +85,16 @@
</ItemGroup>
</Target>

<Target Name="ReplaceCoreLibSrcWithRefAssemblyForCompilation"
AfterTargets="FindReferenceAssembliesForReferences"
Condition="'@(_coreLibProjectReference)' != ''">
Comment thread
akoeplinger marked this conversation as resolved.
Outdated
<ItemGroup>
<_resolvedCoreLibProjectReference Include="@(_ResolvedProjectReferencePaths->WithMetadataValue('MSBuildSourceProjectFile','$(CoreLibProject)'))" />
<ReferencePathWithRefAssemblies Remove="@(_resolvedCoreLibProjectReference)" />
<ReferencePathWithRefAssemblies Include="@(_resolvedCoreLibProjectReference->Metadata('ReferenceAssembly'))" />
</ItemGroup>
</Target>

<!-- For experimental ref assemblies (which typically have the same name as a regular ref
assembly), bump their minor file version by 100 to make it distinguishable from the regular
ref assembly. -->
Expand Down
30 changes: 28 additions & 2 deletions eng/resolveContract.targets
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<GenAPIHeaderFile>$(RepositoryEngineeringDir)LicenseHeader.txt</GenAPIHeaderFile>
<GenAPITargetPath>$([MSBuild]::NormalizePath('$(MSBuildProjectDirectory)', '..', 'ref', '$(AssemblyName).cs'))</GenAPITargetPath>
<GenAPILangVersion Condition="'$(LangVersion)' != ''">$(LangVersion)</GenAPILangVersion>
<ProjectForGenAPIDocIdGeneration Condition="'$(IsSourceProject)' == 'true' and '$(ProjectForGenAPIDocIdGeneration)' == ''">$(CoreLibProject)</ProjectForGenAPIDocIdGeneration>
</PropertyGroup>

<PropertyGroup Condition="'$(IsSourceProject)' == 'true'">
Expand Down Expand Up @@ -60,11 +61,36 @@
ReferenceAssembly="" />
</ItemGroup>
</Target>


<Target Name="GenerateDocIdsForCoreLibOrUriProject"
Comment thread
akoeplinger marked this conversation as resolved.
Outdated
Condition="'@(ProjectReference->WithMetadataValue('Identity', '$(ProjectForGenAPIDocIdGeneration)'))' != '' and ('$(ContractTypesPartiallyMovedToCoreLib)' == 'true' or '$(ContractTypesPartiallyMovedToUri)' == 'true')">
Comment thread
akoeplinger marked this conversation as resolved.
Outdated
<PropertyGroup>
<!-- generate conditional compilation symbols to hide types implemented in contracts so we can include the .cs in the System.Private.CoreLib ref -->
<GenAPIConditionalTypeList>$(IntermediateOutputPath)GenAPIConditionalTypeList.txt</GenAPIConditionalTypeList>
Comment thread
ViktorHofer marked this conversation as resolved.
Outdated
<GenAPIConditionalTypeListSymbol Condition="'$(GenAPIConditionalTypeListSymbol)' == ''">!HIDE_CONTRACT_TYPES</GenAPIConditionalTypeListSymbol>
Comment thread
ericstj marked this conversation as resolved.
Outdated
<GenAPIConditionalTypeListWrapOtherTypes Condition="'$(GenAPIConditionalTypeListWrapOtherTypes)' == ''">true</GenAPIConditionalTypeListWrapOtherTypes>
</PropertyGroup>
<ItemGroup>
Comment thread
akoeplinger marked this conversation as resolved.
<_genAPIResolvedCoreLibProjectReferenceDir Include="@(_ResolvedProjectReferencePaths->WithMetadataValue('MSBuildSourceProjectFile','$(CoreLibProject)')->'%(RootDir)%(Directory)')" />
Comment thread
akoeplinger marked this conversation as resolved.
Outdated
<_genAPIResolvedProjectForGenAPIDocIdGeneration Include="@(_ResolvedProjectReferencePaths->WithMetadataValue('MSBuildSourceProjectFile','$(ProjectForGenAPIDocIdGeneration)'))" />
</ItemGroup>

<Microsoft.DotNet.GenAPI.GenAPITask
Assembly="@(_genAPIResolvedProjectForGenAPIDocIdGeneration)"
LibPath="@(_genAPIResolvedCoreLibProjectReferenceDir)"
WriterType="DocIds"
DocIdKinds="Namespace, Type"
OutputPath="$(GenAPIConditionalTypeList)" />
</Target>

<Target Name="SetGenAPIProperties"
DependsOnTargets="GenerateDocIdsForCoreLibOrUriProject"
BeforeTargets="GenerateReferenceAssemblySource">
<PropertyGroup>
<GenAPIFollowTypeForwards Condition="'%(ProjectReference.Identity)' == '$(CoreLibProject)'">true</GenAPIFollowTypeForwards>
<GenAPIFollowTypeForwards Condition="'%(ProjectReference.Identity)' == '$(CoreLibProject)' or '%(ProjectReference.Identity)' == '$(UriProject)'">true</GenAPIFollowTypeForwards>
Comment thread
ViktorHofer marked this conversation as resolved.

<!-- for contracts where all types were moved to CoreLib we generate the ref .cs in the CoreLib directory for easier maintenance -->
<GenAPITargetPath Condition="'%(ProjectReference.Identity)' == '$(CoreLibProject)' and '$(ContractTypesPartiallyMovedToCoreLib)' != 'true'">$([MSBuild]::NormalizePath('$(CoreLibRefContractsDir)', '$(AssemblyName).cs'))</GenAPITargetPath>
</PropertyGroup>
</Target>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,4 +345,10 @@
<FileWrites Include="@(EventingSourceFile)" />
</ItemGroup>
</Target>

<!-- Import refererence assembly logic -->
<PropertyGroup>
<IsSourceProject>true</IsSourceProject>
</PropertyGroup>
<Import Project="$(RepositoryEngineeringDir)resolveContract.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -613,4 +613,10 @@
<!-- This is the T4 template service and is added by VS anytime you modify a T4 template. Required for .tt files. -->
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
</ItemGroup>

<!-- Import refererence assembly logic -->
<PropertyGroup>
<IsSourceProject>true</IsSourceProject>
</PropertyGroup>
<Import Project="$(RepositoryEngineeringDir)resolveContract.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Microsoft.Win32.Primitives.cs" />
<Compile Include="$(CoreLibRefContractsDir)Microsoft.Win32.Primitives.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Changes to this file must follow the https://aka.ms/api-review process.
// ------------------------------------------------------------------------------

#if !HIDE_CONTRACT_TYPES
namespace System.Collections.Concurrent
{
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
Expand Down Expand Up @@ -126,26 +127,6 @@ void System.Collections.IDictionary.Remove(object key) { }
public bool TryRemove(TKey key, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TValue value) { throw null; }
public bool TryUpdate(TKey key, TValue newValue, TValue comparisonValue) { throw null; }
}
public partial class ConcurrentQueue<T> : System.Collections.Concurrent.IProducerConsumerCollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.ICollection, System.Collections.IEnumerable
{
public ConcurrentQueue() { }
public ConcurrentQueue(System.Collections.Generic.IEnumerable<T> collection) { }
public int Count { get { throw null; } }
public bool IsEmpty { get { throw null; } }
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
object System.Collections.ICollection.SyncRoot { get { throw null; } }
public void Clear() { }
public void CopyTo(T[] array, int index) { }
public void Enqueue(T item) { }
public System.Collections.Generic.IEnumerator<T> GetEnumerator() { throw null; }
bool System.Collections.Concurrent.IProducerConsumerCollection<T>.TryAdd(T item) { throw null; }
bool System.Collections.Concurrent.IProducerConsumerCollection<T>.TryTake([System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out T item) { throw null; }
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
public T[] ToArray() { throw null; }
public bool TryDequeue([System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out T result) { throw null; }
public bool TryPeek([System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out T result) { throw null; }
}
public partial class ConcurrentStack<T> : System.Collections.Concurrent.IProducerConsumerCollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.ICollection, System.Collections.IEnumerable
{
public ConcurrentStack() { }
Expand Down Expand Up @@ -176,13 +157,6 @@ public enum EnumerablePartitionerOptions
None = 0,
NoBuffering = 1,
}
public partial interface IProducerConsumerCollection<T> : System.Collections.Generic.IEnumerable<T>, System.Collections.ICollection, System.Collections.IEnumerable
{
void CopyTo(T[] array, int index);
T[] ToArray();
bool TryAdd(T item);
bool TryTake([System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out T item);
}
public abstract partial class OrderablePartitioner<TSource> : System.Collections.Concurrent.Partitioner<TSource>
{
protected OrderablePartitioner(bool keysOrderedInEachPartition, bool keysOrderedAcrossPartitions, bool keysNormalized) { }
Expand Down Expand Up @@ -213,3 +187,34 @@ protected Partitioner() { }
public abstract System.Collections.Generic.IList<System.Collections.Generic.IEnumerator<TSource>> GetPartitions(int partitionCount);
}
}
#endif // !HIDE_CONTRACT_TYPES
namespace System.Collections.Concurrent
{
public partial class ConcurrentQueue<T> : System.Collections.Concurrent.IProducerConsumerCollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.ICollection, System.Collections.IEnumerable
{
public ConcurrentQueue() { }
public ConcurrentQueue(System.Collections.Generic.IEnumerable<T> collection) { }
public int Count { get { throw null; } }
public bool IsEmpty { get { throw null; } }
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
object System.Collections.ICollection.SyncRoot { get { throw null; } }
public void Clear() { }
public void CopyTo(T[] array, int index) { }
public void Enqueue(T item) { }
public System.Collections.Generic.IEnumerator<T> GetEnumerator() { throw null; }
bool System.Collections.Concurrent.IProducerConsumerCollection<T>.TryAdd(T item) { throw null; }
bool System.Collections.Concurrent.IProducerConsumerCollection<T>.TryTake([System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out T item) { throw null; }
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
public T[] ToArray() { throw null; }
public bool TryDequeue([System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out T result) { throw null; }
public bool TryPeek([System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out T result) { throw null; }
}
public partial interface IProducerConsumerCollection<T> : System.Collections.Generic.IEnumerable<T>, System.Collections.ICollection, System.Collections.IEnumerable
{
void CopyTo(T[] array, int index);
T[] ToArray();
bool TryAdd(T item);
bool TryTake([System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out T item);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<ContractTypesPartiallyMovedToCoreLib>true</ContractTypesPartiallyMovedToCoreLib>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
</PropertyGroup>
<ItemGroup>
Expand Down
Loading