From 8afa47f02b0c3140811584424e4fbb123fb6150f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Fri, 17 Dec 2021 15:09:47 +0900 Subject: [PATCH] Allow building libs against NativeAOT CoreLib To make sure ApiCompat tooling runs at least in some legs, compile libs against NativeAOT corelib if we're building CLR, but not building the JIT flavor of the runtime. The baselining is necessary because the reflection stack of NativeAOT doesn't live in CoreLib. The CannotRemoveBaseTypeOrInteface baselining will go away once we fix https://github.com/dotnet/runtime/issues/62944. It's one of the "overall goodness" things we can take out of NativeAOT and put it into all runtimes. --- Directory.Build.props | 1 + eng/ApiCompatExcludeAttributes.txt | 2 ++ eng/Subsets.props | 5 ++++- .../src/MatchingRefApiCompatBaseline.txt | 5 ++++- .../src/MatchingRefApiCompatBaseline.txt | 11 ++++++++++- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index f149734c7c81f4..0983ba4ae36f89 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -245,6 +245,7 @@ $([MSBuild]::NormalizeDirectory('$(LibrariesProjectRoot)', 'System.Private.CoreLib', 'src')) $([MSBuild]::NormalizePath('$(CoreClrProjectRoot)', 'System.Private.CoreLib', 'System.Private.CoreLib.csproj')) $([MSBuild]::NormalizePath('$(MonoProjectRoot)', 'System.Private.CoreLib', 'System.Private.CoreLib.csproj')) + $([MSBuild]::NormalizePath('$(CoreClrProjectRoot)', 'nativeaot', 'System.Private.CoreLib', 'src', 'System.Private.CoreLib.csproj')) true diff --git a/eng/ApiCompatExcludeAttributes.txt b/eng/ApiCompatExcludeAttributes.txt index 19475f50297f8a..5ea702ad6f3d4a 100644 --- a/eng/ApiCompatExcludeAttributes.txt +++ b/eng/ApiCompatExcludeAttributes.txt @@ -1,3 +1,5 @@ T:System.CLSCompliantAttribute T:System.Diagnostics.CodeAnalysis.MemberNotNullAttribute T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute +T:System.Diagnostics.DebuggerGuidedStepThroughAttribute +T:System.Runtime.CompilerServices.EagerStaticClassConstructionAttribute diff --git a/eng/Subsets.props b/eng/Subsets.props index 22714ffc7d0a88..d8aa6d9fea0fea 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -49,9 +49,12 @@ $(PrimaryRuntimeFlavor) - + true + + + true diff --git a/src/libraries/System.Reflection/src/MatchingRefApiCompatBaseline.txt b/src/libraries/System.Reflection/src/MatchingRefApiCompatBaseline.txt index 47ffa8392dfb7b..93972536f0210c 100644 --- a/src/libraries/System.Reflection/src/MatchingRefApiCompatBaseline.txt +++ b/src/libraries/System.Reflection/src/MatchingRefApiCompatBaseline.txt @@ -1,3 +1,6 @@ Compat issues with assembly System.Reflection: MembersMustExist : Member 'protected System.ModuleHandle System.Reflection.Module.GetModuleHandleImpl()' does not exist in the reference but it does exist in the implementation. -Total Issues: 1 +MembersMustExist : Member 'public System.Reflection.ParameterInfo[] System.Reflection.MethodBase.GetParametersNoCopy()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Reflection.MethodBase System.Reflection.MethodBase.MetadataDefinitionMethod.get()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Int32 System.Reflection.MethodInfo.GenericParameterCount.get()' does not exist in the reference but it does exist in the implementation. +Total Issues: 4 diff --git a/src/libraries/System.Runtime/src/MatchingRefApiCompatBaseline.txt b/src/libraries/System.Runtime/src/MatchingRefApiCompatBaseline.txt index cbe8cabdbb2956..6c58cd1642bf78 100644 --- a/src/libraries/System.Runtime/src/MatchingRefApiCompatBaseline.txt +++ b/src/libraries/System.Runtime/src/MatchingRefApiCompatBaseline.txt @@ -24,4 +24,13 @@ CannotMakeMemberAbstract : Member 'public System.Boolean System.IO.FileSystemInf CannotMakeMemberAbstract : Member 'public System.String System.IO.FileSystemInfo.Name.get()' is abstract in the reference but is not abstract in the implementation. # C# generates backing fields for fixed buffers as public. TypesMustExist : Type 'System.IO.Enumeration.FileSystemEntry.<_fileNameBuffer>e__FixedBuffer' does not exist in the reference but it does exist in the implementation. - +MembersMustExist : Member 'public void System.ModuleHandle..ctor(System.Reflection.Module)' does not exist in the reference but it does exist in the implementation. +CannotRemoveBaseTypeOrInterface : Type 'System.RuntimeTypeHandle' does not implement interface 'System.IEquatable' in the reference but it does in the implementation. +MembersMustExist : Member 'public System.String System.String System.Type.DefaultTypeNameWhenMissingMetadata' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.String System.Type.FormatTypeNameForReflection()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.String System.Type.InternalGetNameIfAvailable(System.Type)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.String System.Type.InternalNameIfAvailable.get()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.TypedReference.IsNull.get()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Reflection.ParameterInfo[] System.Reflection.MethodBase.GetParametersNoCopy()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Reflection.MethodBase System.Reflection.MethodBase.MetadataDefinitionMethod.get()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Int32 System.Reflection.MethodInfo.GenericParameterCount.get()' does not exist in the reference but it does exist in the implementation.