未验证 提交 2575ce5f 编写于 作者: V Viktor Hofer 提交者: GitHub

Use ApiCompatTask in ApiCompat.proj (#66073)

* Use ApiCompatTask in ApiCompat.proj

As ApiCompat now has a task that allows to run in-proc, use that instead
of shelving out. Also use items instead of properties to define
the attribute exclusion list.

* Update ApiCompat version
上级 3e2d4831
......@@ -58,9 +58,9 @@
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>81001b45bd54f9223905bf55f6ed0125273580fa</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.ApiCompat" Version="7.0.0-beta.22157.6">
<Dependency Name="Microsoft.DotNet.ApiCompat" Version="7.0.0-beta.22159.9">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>81001b45bd54f9223905bf55f6ed0125273580fa</Sha>
<Sha>3d988e17f3317c888c82e21b4b3dd5196dfc4d78</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.GenAPI" Version="7.0.0-beta.22157.6">
<Uri>https://github.com/dotnet/arcade</Uri>
......
......@@ -46,7 +46,7 @@
<!-- SDK dependencies -->
<MicrosoftDotNetCompatibilityVersion>2.0.0-alpha.1.21525.11</MicrosoftDotNetCompatibilityVersion>
<!-- Arcade dependencies -->
<MicrosoftDotNetApiCompatVersion>7.0.0-beta.22157.6</MicrosoftDotNetApiCompatVersion>
<MicrosoftDotNetApiCompatVersion>7.0.0-beta.22159.9</MicrosoftDotNetApiCompatVersion>
<MicrosoftDotNetBuildTasksFeedVersion>7.0.0-beta.22157.6</MicrosoftDotNetBuildTasksFeedVersion>
<MicrosoftDotNetCodeAnalysisVersion>7.0.0-beta.22157.6</MicrosoftDotNetCodeAnalysisVersion>
<MicrosoftDotNetGenAPIVersion>7.0.0-beta.22157.6</MicrosoftDotNetGenAPIVersion>
......
......@@ -57,13 +57,18 @@
<AssemblyVersion />
</PropertyGroup>
<!-- ApiCompat setting -->
<PropertyGroup>
<RunApiCompatForSrc>$([MSBuild]::ValueOrDefault('$(IsSourceProject)', 'false'))</RunApiCompatForSrc>
<RunMatchingRefApiCompat>$([MSBuild]::ValueOrDefault('$(IsSourceProject)', 'false'))</RunMatchingRefApiCompat>
<ApiCompatEnforceOptionalRules>true</ApiCompatEnforceOptionalRules>
<ApiCompatExcludeAttributeList>$(RepositoryEngineeringDir)DefaultGenApiDocIds.txt,$(RepositoryEngineeringDir)ApiCompatExcludeAttributes.txt</ApiCompatExcludeAttributeList>
</PropertyGroup>
<ItemGroup>
<ApiCompatExcludeAttributesFile Include="$(RepositoryEngineeringDir)DefaultGenApiDocIds.txt" />
<ApiCompatExcludeAttributesFile Include="$(RepositoryEngineeringDir)ApiCompatExcludeAttributes.txt" />
</ItemGroup>
<ItemGroup>
<!-- Projects which are manually built. -->
<ProjectExclusions Include="$(CommonTestPath)System\Net\Prerequisites\**\*.csproj" />
......
......@@ -8,14 +8,14 @@
<CompileUsingReferenceAssemblies>true</CompileUsingReferenceAssemblies>
<TrimOutPrivateAssembliesFromReferencePath>true</TrimOutPrivateAssembliesFromReferencePath>
<ApiCompatNSBaselineFile>$(MSBuildThisFileDirectory)ApiCompatBaseline.netcoreapp.netstandard.txt</ApiCompatNSBaselineFile>
<ApiCompatNSOnlyBaselineFile>$(MSBuildThisFileDirectory)ApiCompatBaseline.netcoreapp.netstandardOnly.txt</ApiCompatNSOnlyBaselineFile>
<PreviousNetCoreAppBaselineFile>$(MSBuildThisFileDirectory)ApiCompatBaseline.PreviousNetCoreApp.txt</PreviousNetCoreAppBaselineFile>
<ApiCompatNetStandard20BaselineFile>$(MSBuildThisFileDirectory)ApiCompatBaseline.netstandard2.0.txt</ApiCompatNetStandard20BaselineFile>
<ApiCompatNetStandard21BaselineFile>$(MSBuildThisFileDirectory)ApiCompatBaseline.netstandard2.1.txt</ApiCompatNetStandard21BaselineFile>
<ApiCompatNetCoreAppLatestStableBaselineFile>$(MSBuildThisFileDirectory)ApiCompatBaseline.NetCoreAppLatestStable.txt</ApiCompatNetCoreAppLatestStableBaselineFile>
</PropertyGroup>
<ItemGroup>
<ApiCompatExcludeAttributeFile Include="$(ApiCompatExcludeAttributeList.Split(','))" />
<ApiCompatExcludeAttributeFile Include="ApiCompatBaselineExcludedAttributes.txt" />
<!-- The globally defined DefaultGenApiDocIds.txt and the ApiCompatExcludeAttributes.txt exclude attribute files apply as well. -->
<ApiCompatExcludeAttributesFile Include="ApiCompatBaselineExcludedAttributes.txt" />
</ItemGroup>
<!-- For API comparision, ApiCompat needs both the inbox and the out-of-band assemblies plus the shims to be built. -->
......@@ -35,60 +35,59 @@
<Target Name="RunApiCompat"
DependsOnTargets="FindReferenceAssembliesForReferences"
AfterTargets="Build"
Inputs="@(ReferencePathWithRefAssemblies);$(ApiCompatNSBaselineFile);$(ApiCompatNSOnlyBaselineFile);$(PreviousNetCoreAppBaselineFile);@(ApiCompatExcludeAttributeFile)"
Inputs="@(ReferencePathWithRefAssemblies);$(ApiCompatNetStandard20BaselineFile);$(ApiCompatNetStandard21BaselineFile);$(ApiCompatNetCoreAppLatestStableBaselineFile);@(ApiCompatExcludeAttributesFile)"
Outputs="$(IntermediateOutputPath)$(TargetArchitecture)-marker.txt">
<PropertyGroup>
<ApiCompatResponseFile>$(IntermediateOutputPath)apicompat.rsp</ApiCompatResponseFile>
<ApiCompatExitCode>0</ApiCompatExitCode>
<!-- TODO: Replace with ReferencePathWithRefAssemblies when ApiCompat supports passing in a list of assemblies: https://github.com/dotnet/arcade/issues/8394. -->
<ApiCompatArgs>--impl-dirs "$(LibrariesAllRefArtifactsPath.TrimEnd('\/'))"</ApiCompatArgs>
<ApiCompatArgs Condition="'@(ApiCompatExcludeAttributeFile)' != ''">$(ApiCompatArgs) --exclude-attributes "@(ApiCompatExcludeAttributeFile->Metadata('FullPath'), ',')"</ApiCompatArgs>
</PropertyGroup>
<WriteLinesToFile File="$(ApiCompatResponseFile)"
Lines="$(ApiCompatArgs)"
Overwrite="true" />
<Message Text="ApiCompat -> Comparing $(NetCoreAppCurrent) reference assemblies against .NETStandard2.x and .NETCoreApp$(NetCoreAppLatestStableVersion)..." Importance="high" />
<!-- In order to update the .NETStandard baseline, you can just start the build with /p:UpdateNETStandardBaseline=true -->
<PropertyGroup>
<NetStandardLibrary20RefPath>$([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', 'netstandard.library', '$(NetStandardLibraryVersion)', 'build', 'netstandard2.0', 'ref'))</NetStandardLibrary20RefPath>
<NetStandard21OnlyRef>$(NETStandard21RefPath)netstandard.dll</NetStandard21OnlyRef>
<NetStandard21BaselineModifer>--baseline</NetStandard21BaselineModifer>
<NetStandard21BaselineModifer Condition="'$(UpdateNETStandardBaseline)' == 'true'">&gt;</NetStandard21BaselineModifer>
<PropertyGroup Condition="'$(UpdateBaselineFiles)' == 'true'">
<ApiCompatNetStandard21OutputFile>$(ApiCompatNetStandard21BaselineFile)</ApiCompatNetStandard21OutputFile>
<ApiCompatNetStandard20OutputFile>$(ApiCompatNetStandard20BaselineFile)</ApiCompatNetStandard20OutputFile>
<ApiCompatNetCoreAppLatestStableOutputFile>$(ApiCompatNetCoreAppLatestStableBaselineFile)</ApiCompatNetCoreAppLatestStableOutputFile>
<ApiCompatNetStandard21BaselineFile />
<ApiCompatNetStandard20BaselineFile />
<ApiCompatNetCoreAppLatestStableBaselineFile />
</PropertyGroup>
<Delete Files="$(ApiCompatNetStandard21OutputFile);$(ApiCompatNetStandard20OutputFile);$(ApiCompatNetCoreAppLatestStableOutputFile)"
Condition="'$(UpdateBaselineFiles)' == 'true'" />
<Message Importance="high" Text="ApiCompat -> Comparing $(NetCoreAppCurrent) reference assemblies against .NETStandard2.x and .NETCoreApp$(NetCoreAppLatestStableVersion)..." />
<Exec Command="$(_ApiCompatCommand) &quot;$(NetStandard21OnlyRef)&quot; @&quot;$(ApiCompatResponseFile)&quot; $(NetStandard21BaselineModifer) &quot;$(ApiCompatNSOnlyBaselineFile)&quot;"
CustomErrorRegularExpression="^[a-zA-Z]+ :"
StandardOutputImportance="Low"
IgnoreExitCode="true">
<!-- ApiCompat: NetCoreAppCurrent <-> netstandard2.1 -->
<ApiCompatTask Contracts="$(NETStandard21RefPath)netstandard.dll"
ExcludeAttributes="@(ApiCompatExcludeAttributesFile)"
ImplementationDirectories="$(LibrariesAllRefArtifactsPath)"
BaselineFiles="$(ApiCompatNetStandard21BaselineFile)"
ValidateBaseline="true"
OutFilePath="$(ApiCompatNetStandard21OutputFile)"
DisableAssemblyResolveTraceListener="true"
IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="ApiCompatExitCode" />
</Exec>
<Error Condition="'$(ApiCompatExitCode)' != '0'" Text="ApiCompat failed comparing netstandard.dll to $(NetCoreAppCurrent)" />
</ApiCompatTask>
<Error Condition="'$(ApiCompatExitCode)' != '0'" Text="ApiCompat failed comparing netstandard.dll to $(NetCoreAppCurrent). If this breaking change is intentional, the ApiCompat baseline files can be updated by running 'dotnet build $(MSBuildThisFileFullPath) --no-incremental /p:UpdateBaselineFiles=true'." />
<Exec Command="$(_ApiCompatCommand) &quot;$(NetStandardLibrary20RefPath.TrimEnd('\/'))&quot; --baseline &quot;$(ApiCompatNSBaselineFile)&quot; @&quot;$(ApiCompatResponseFile)&quot;"
CustomErrorRegularExpression="^[a-zA-Z]+ :"
StandardOutputImportance="Low"
IgnoreExitCode="true">
<!-- ApiCompat: NetCoreAppCurrent <-> netstandard2.0 -->
<ApiCompatTask Contracts="$([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', 'netstandard.library', '$(NetStandardLibraryVersion)', 'build', 'netstandard2.0', 'ref'))"
ExcludeAttributes="@(ApiCompatExcludeAttributesFile)"
ImplementationDirectories="$(LibrariesAllRefArtifactsPath)"
BaselineFiles="$(ApiCompatNetStandard20BaselineFile)"
ValidateBaseline="true"
OutFilePath="$(ApiCompatNetStandard20OutputFile)"
DisableAssemblyResolveTraceListener="true"
IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="ApiCompatExitCode" />
</Exec>
<Error Condition="'$(ApiCompatExitCode)' != '0'" Text="ApiCompat failed comparing netstandard to $(NetCoreAppCurrent)" />
<!-- In order to update the previous .NETCoreApp baseline, you can just start the build with /p:UpdatePreviousNetCoreAppBaseline=true -->
<PropertyGroup>
<PreviousNetCoreAppRefPath>$([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', 'microsoft.netcore.app.ref', '$(NetCoreAppLatestStablePackageBaselineVersion)', 'ref', '$(NetCoreAppLatestStable)'))</PreviousNetCoreAppRefPath>
<PreviousNetCoreAppBaselineParam>--baseline</PreviousNetCoreAppBaselineParam>
<PreviousNetCoreAppBaselineParam Condition="'$(UpdatePreviousNetCoreAppBaseline)' == 'true'">&gt;</PreviousNetCoreAppBaselineParam>
</PropertyGroup>
</ApiCompatTask>
<Error Condition="'$(ApiCompatExitCode)' != '0'" Text="ApiCompat failed comparing netstandard to $(NetCoreAppCurrent). If this breaking change is intentional, the ApiCompat baseline files can be updated by running 'dotnet build $(MSBuildThisFileFullPath) --no-incremental /p:UpdateBaselineFiles=true'." />
<Exec Command="$(_ApiCompatCommand) &quot;$(PreviousNetCoreAppRefPath.TrimEnd('\/'))&quot; @&quot;$(ApiCompatResponseFile)&quot; $(PreviousNetCoreAppBaselineParam) &quot;$(PreviousNetCoreAppBaselineFile)&quot;"
CustomErrorRegularExpression="^[a-zA-Z]+ :"
StandardOutputImportance="Low"
IgnoreExitCode="true">
<!-- ApiCompat: NetCoreAppCurrent <-> NetCoreAppLatestStable -->
<ApiCompatTask Contracts="$([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', 'microsoft.netcore.app.ref', '$(NetCoreAppLatestStablePackageBaselineVersion)', 'ref', '$(NetCoreAppLatestStable)'))"
ExcludeAttributes="@(ApiCompatExcludeAttributesFile)"
ImplementationDirectories="$(LibrariesAllRefArtifactsPath)"
BaselineFiles="$(ApiCompatNetCoreAppLatestStableBaselineFile)"
ValidateBaseline="true"
OutFilePath="$(ApiCompatNetCoreAppLatestStableOutputFile)"
DisableAssemblyResolveTraceListener="true"
IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="ApiCompatExitCode" />
</Exec>
<Error Condition="'$(ApiCompatExitCode)' != '0'" Text="ApiCompat failed comparing $(NetCoreAppLatestStable) to $(NetCoreAppCurrent). If this breaking change is intentional, the ApiCompat baseline can be updated by running 'dotnet build $(MSBuildThisFileFullPath) /p:UpdatePreviousNetCoreAppBaseline=true'" />
</ApiCompatTask>
<Error Condition="'$(ApiCompatExitCode)' != '0'" Text="ApiCompat failed comparing $(NetCoreAppLatestStable) to $(NetCoreAppCurrent). If this breaking change is intentional, the ApiCompat baseline files can be updated by running 'dotnet build $(MSBuildThisFileFullPath) --no-incremental /p:UpdateBaselineFiles=true'." />
<!-- Create a marker file which serves as the target's output to enable incremental builds. -->
<Touch Files="$(IntermediateOutputPath)$(TargetArchitecture)-marker.txt"
......
Compat issues with assembly netstandard:
CannotRemoveAttribute : Attribute 'System.ComponentModel.DefaultEventAttribute' exists on 'System.ComponentModel.BackgroundWorker' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.ComponentModel.DefaultEventAttribute' exists on 'System.Diagnostics.Process' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.ComponentModel.DefaultPropertyAttribute' exists on 'System.Diagnostics.Process' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.ComponentModel.DefaultEventAttribute' exists on 'System.IO.FileSystemWatcher' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector<T>.CopyTo(T[])' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector<T>.CopyTo(T[], System.Int32)' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector<T>.Equals(System.Numerics.Vector<T>)' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector<T>.Equals(System.Object)' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector<T>.GetHashCode()' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector<T>.Item.get(System.Int32)' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector<T>.ToString()' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector<T>.ToString(System.String)' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.IsReadOnlyAttribute' exists on 'System.Numerics.Vector<T>.ToString(System.String, System.IFormatProvider)' in the contract but not the implementation.
CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'System.Runtime.CompilerServices.AsyncMethodBuilderAttribute' changed from '[AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Struct, Inherited=false, AllowMultiple=false)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Method | AttributeTargets.Struct, Inherited=false, AllowMultiple=false)]' in the implementation.
CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'System.Runtime.InteropServices.ManagedToNativeComInteropStubAttribute' changed from '[AttributeUsageAttribute(AttributeTargets.Method, Inherited=false)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Method, Inherited=false, AllowMultiple=false)]' in the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptionsAttribute' exists on 'System.Security.SecureString.AppendChar(System.Char)' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptionsAttribute' exists on 'System.Security.SecureString.InsertAt(System.Int32, System.Char)' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptionsAttribute' exists on 'System.Security.SecureString.RemoveAt(System.Int32)' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptionsAttribute' exists on 'System.Security.SecureString.SetAt(System.Int32, System.Char)' in the contract but not the implementation.
CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'System.Xml.Serialization.XmlAnyAttributeAttribute' changed from '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, AllowMultiple=false)]' in the implementation.
CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'System.Xml.Serialization.XmlNamespaceDeclarationsAttribute' changed from '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, AllowMultiple=false)]' in the implementation.
Total Issues: 21
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册