Skip to content

Commit 4158756

Browse files
authored
[release/5.0] Update API baseline files (dotnet#27653)
* Move all PublicAPI.Unshipped.txt files to PublicAPI.Shipped.txt - we have now shipped this API surface * Add eng/PublicAPI.empty.txt file - make it easier to add new implementation projects * Add missing public API baseline files - dotnet#26784 part 1/2 - a few unexpected files turned up missing beyond the dotnet#26784 list… * Reference Microsoft.CodeAnalysis.PublicApiAnalyzers more often - dotnet#27484 part 2/2 - emit errors when API baseline files are missing - update categorization of some projects - specification tests are not implementation projects - but _were_ project reference providers (keep that) - correct `$(IsTestAssetProject)` setting for Razor shims et cetera - correct `$(IsSampleProject)` setting for casing of some Sample directories - Microsoft.AspNetCore.Analyzer.Testing should be treated as test asset - add `$(AddPublicApiAnalyzers)` property to support overrides - e.g. for `msbuild` task projects and tools nit: - remove useless `$(IsTestProject)` setting in a specification test project - wrap some long `Condition`s * Do not run public API analyzer in `RazorCoreCompile` target * Remove old `$(EnableApiCheck)` settings - property does nothing - also remove a dangling ApiCheck comment
1 parent 4d47720 commit 4158756

File tree

298 files changed

+19884
-19176
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

298 files changed

+19884
-19176
lines changed

Directory.Build.props

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,23 @@
1111
<PropertyGroup>
1212
<RepoRelativeProjectDir>$([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectDirectory)))</RepoRelativeProjectDir>
1313

14-
<IsBenchmarkProject Condition="$(MSBuildProjectName.EndsWith('.Performance')) OR $(RepoRelativeProjectDir.Contains('perf')) OR $(RepoRelativeProjectDir.Contains('benchmarkapps'))">true</IsBenchmarkProject>
14+
<IsBenchmarkProject Condition=" $(MSBuildProjectName.EndsWith('.Performance')) OR
15+
$(RepoRelativeProjectDir.Contains('perf')) OR
16+
$(RepoRelativeProjectDir.Contains('benchmarkapps')) ">true</IsBenchmarkProject>
1517
<IsSpecificationTestProject Condition="$(MSBuildProjectName.EndsWith('.Specification.Tests'))">true</IsSpecificationTestProject>
1618
<IsUnitTestProject Condition=" '$(IsUnitTestProject)' == '' ">false</IsUnitTestProject>
17-
<IsUnitTestProject Condition="'$(IsSpecificationTestProject)' != 'true' and ( $(MSBuildProjectName.EndsWith('Tests')) or $(MSBuildProjectName.EndsWith('.Test')) or $(MSBuildProjectName.EndsWith('.FunctionalTest')) )">true</IsUnitTestProject>
18-
<IsTestAssetProject Condition="$(RepoRelativeProjectDir.Contains('testassets'))">true</IsTestAssetProject>
19-
<IsSampleProject Condition="$(RepoRelativeProjectDir.Contains('sample'))">true</IsSampleProject>
19+
<IsUnitTestProject Condition=" '$(IsSpecificationTestProject)' != 'true' AND
20+
( $(MSBuildProjectName.EndsWith('Tests')) OR
21+
$(MSBuildProjectName.EndsWith('.Test')) OR
22+
$(MSBuildProjectName.EndsWith('.FunctionalTest')) ) ">true</IsUnitTestProject>
23+
<IsTestAssetProject Condition=" $(RepoRelativeProjectDir.Contains('testassets')) ">true</IsTestAssetProject>
24+
<IsSampleProject Condition=" $(RepoRelativeProjectDir.Contains('sample')) OR
25+
$(RepoRelativeProjectDir.Contains('Sample')) ">true</IsSampleProject>
2026
<IsAnalyzersProject Condition="$(MSBuildProjectName.EndsWith('.Analyzers'))">true</IsAnalyzersProject>
21-
<IsShipping Condition="'$(IsSampleProject)' == 'true' or '$(IsTestAssetProject)' == 'true' or '$(IsBenchmarkProject)' == 'true' or '$(IsUnitTestProject)' == 'true'">false</IsShipping>
27+
<IsShipping Condition=" '$(IsSampleProject)' == 'true' OR
28+
'$(IsTestAssetProject)' == 'true' OR
29+
'$(IsBenchmarkProject)' == 'true' OR
30+
'$(IsUnitTestProject)' == 'true'">false</IsShipping>
2231

2332
<!--
2433
Following logic mimics core-setup approach as well as

Directory.Build.targets

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,17 @@
9898

9999
<PropertyGroup>
100100
<!-- Implementation projects are the projects which produce nuget packages or shipping assemblies. -->
101-
<IsImplementationProject Condition=" '$(IsImplementationProject)' == '' AND '$(IsAnalyzersProject)' != 'true' AND '$(IsTestAssetProject)' != 'true' AND '$(IsTestProject)' != 'true' AND '$(IsBenchmarkProject)' != 'true' AND '$(IsSampleProject)' != 'true' ">true</IsImplementationProject>
101+
<IsImplementationProject Condition=" '$(IsImplementationProject)' == '' AND
102+
'$(IsAnalyzersProject)' != 'true' AND
103+
'$(IsBenchmarkProject)' != 'true' AND
104+
'$(IsSampleProject)' != 'true' AND
105+
'$(IsSpecificationTestProject)' != 'true' AND
106+
'$(IsTestAssetProject)' != 'true' AND
107+
'$(IsTestProject)' != 'true' ">true</IsImplementationProject>
102108

103109
<!-- This determines whether a project is available as a <Reference> to other projects in this repo. -->
104-
<IsProjectReferenceProvider Condition=" '$(IsProjectReferenceProvider)' == '' AND '$(IsImplementationProject)' == 'true' ">true</IsProjectReferenceProvider>
110+
<IsProjectReferenceProvider Condition=" '$(IsProjectReferenceProvider)' == '' AND
111+
( '$(IsImplementationProject)' == 'true' OR '$(IsSpecificationTestProject)' == 'true' ) ">true</IsProjectReferenceProvider>
105112

106113
<HasReferenceAssembly
107114
Condition=" '$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)' AND '$(IsAspNetCoreApp)' == 'true' ">true</HasReferenceAssembly>

eng/PublicAPI.empty.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#nullable enable

eng/targets/CSharp.Common.targets

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,42 @@
66
<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
77
</PropertyGroup>
88

9-
<!-- Ensure API changes show up clearly in PRs. -->
109
<PropertyGroup>
11-
<_TFMDirectory>$(TargetFramework)</_TFMDirectory>
12-
<_TFMDirectory Condition=" '$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)' ">netcoreapp</_TFMDirectory>
10+
<!-- Ensure API changes show up clearly in PRs. -->
11+
<AddPublicApiAnalyzers Condition=" '$(AddPublicApiAnalyzers)' == '' AND
12+
'$(IsImplementationProject)' == 'true' AND
13+
! $(RepoRelativeProjectDir.Contains('Tools')) ">true</AddPublicApiAnalyzers>
14+
<AddPublicApiAnalyzers Condition=" '$(AddPublicApiAnalyzers)' == '' ">false</AddPublicApiAnalyzers>
1315

1416
<!-- Public members should not use oblivious types. Not done with all nullable annotations. -->
1517
<NoWarn>$(NoWarn);RS0041</NoWarn>
1618

17-
<!-- Turn off platform compatiblity analyzer warnings in test, test assets, and samples -->
18-
<NoWarn Condition="'$(IsTestProject)' == 'true' OR '$(IsTestAssetProject)' == 'true' OR '$(ISBenchmarkProject)' == 'true' OR '$(IsSampleProject)' == 'true'">$(NoWarn);CA1416</NoWarn>
19+
<!-- Turn off platform compatibility analyzer warnings in test, test assets, and samples. -->
20+
<NoWarn Condition=" '$(IsTestProject)' == 'true' OR
21+
'$(IsTestAssetProject)' == 'true' OR
22+
'$(ISBenchmarkProject)' == 'true' OR
23+
'$(IsSampleProject)' == 'true' ">$(NoWarn);CA1416</NoWarn>
1924
</PropertyGroup>
2025

21-
<ItemGroup Condition=" Exists('$(MSBuildProjectDirectory)\PublicAPI.Shipped.txt') AND
22-
'$(DotNetBuildFromSource)' != 'true' AND
23-
'$(IsImplementationProject)' == 'true' AND
24-
! $(RepoRelativeProjectDir.Contains('Tools')) ">
26+
<ItemGroup Condition=" '$(DotNetBuildFromSource)' != 'true' AND $(AddPublicApiAnalyzers) ">
2527
<Reference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" ExcludeAssets="Compile" PrivateAssets="All" />
2628
</ItemGroup>
2729
<Target Name="_CheckIgnoredPublicApiFiles"
2830
BeforeTargets="Build;Restore"
29-
Condition=" Exists('$(MSBuildProjectDirectory)\PublicAPI.Shipped.txt') AND
30-
'$(DotNetBuildFromSource)' != 'true' AND
31-
!('$(IsImplementationProject)' == 'true' AND
32-
! $(RepoRelativeProjectDir.Contains('Tools'))) ">
31+
Condition=" Exists('$(MSBuildProjectDirectory)\PublicAPI.Shipped.txt') AND ! $(AddPublicApiAnalyzers) ">
3332
<Warning Text="Public API baseline files ignored." />
3433
</Target>
34+
<Target Name="_RemovePublicApiAnalyzer" BeforeTargets="RazorCoreCompile">
35+
<ItemGroup>
36+
<_PublicAPIAnalyzers Include="@(Analyzer->WithMetadataValue('NuGetPackageId','Microsoft.CodeAnalysis.PublicApiAnalyzers'))" />
37+
<Analyzer Remove="@(_PublicAPIAnalyzers)" />
38+
</ItemGroup>
39+
</Target>
40+
<Target Name="_RestorePublicApiAnalyzer" AfterTargets="RazorCoreCompile">
41+
<ItemGroup>
42+
<Analyzer Include="@(_PublicAPIAnalyzers)" />
43+
</ItemGroup>
44+
</Target>
3545

3646
<Target Name="GetCustomAssemblyAttributes"
3747
BeforeTargets="GetAssemblyAttributes"

eng/tools/RepoTasks/RepoTasks.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
99
<!-- Need to build this project in source build -->
1010
<ExcludeFromSourceBuild>false</ExcludeFromSourceBuild>
11+
<!-- No need to track public APIs of these MSBuild tasks. -->
12+
<AddPublicApiAnalyzers>false</AddPublicApiAnalyzers>
1113
</PropertyGroup>
1214

1315
<ItemGroup>

src/Analyzers/Microsoft.AspNetCore.Analyzer.Testing/src/Microsoft.AspNetCore.Analyzer.Testing.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
<TargetFramework>netstandard2.0</TargetFramework>
66
<PackageTags>$(PackageTags);testing</PackageTags>
77
<GenerateDocumentationFile>true</GenerateDocumentationFile>
8-
<!-- This is actually a library for test projects, not a test project. -->
8+
<!-- This is actually a library for test projects, not a test project. Treat project as a test asset. -->
99
<IsUnitTestProject>false</IsUnitTestProject>
10+
<IsTestAssetProject>true</IsTestAssetProject>
1011
<!-- This package is internal, so we don't generate a package baseline. Always build against the latest dependencies. -->
1112
<UseLatestPackageReferences>true</UseLatestPackageReferences>
1213
<IsShippingPackage>false</IsShippingPackage>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,33 @@
11
#nullable enable
2+
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions
3+
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.AntiforgeryOptions() -> void
4+
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.Cookie.get -> Microsoft.AspNetCore.Http.CookieBuilder!
5+
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.Cookie.set -> void
6+
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.FormFieldName.get -> string!
7+
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.FormFieldName.set -> void
8+
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.HeaderName.get -> string?
9+
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.HeaderName.set -> void
10+
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.SuppressXFrameOptionsHeader.get -> bool
11+
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.SuppressXFrameOptionsHeader.set -> void
12+
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet
13+
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.AntiforgeryTokenSet(string? requestToken, string? cookieToken, string! formFieldName, string? headerName) -> void
14+
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.CookieToken.get -> string?
15+
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.FormFieldName.get -> string!
16+
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.HeaderName.get -> string?
17+
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.RequestToken.get -> string?
18+
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException
19+
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException.AntiforgeryValidationException(string! message) -> void
20+
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException.AntiforgeryValidationException(string! message, System.Exception? innerException) -> void
21+
Microsoft.AspNetCore.Antiforgery.IAntiforgery
22+
Microsoft.AspNetCore.Antiforgery.IAntiforgery.GetAndStoreTokens(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet!
23+
Microsoft.AspNetCore.Antiforgery.IAntiforgery.GetTokens(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet!
24+
Microsoft.AspNetCore.Antiforgery.IAntiforgery.IsRequestValidAsync(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> System.Threading.Tasks.Task<bool>!
25+
Microsoft.AspNetCore.Antiforgery.IAntiforgery.SetCookieTokenAndHeader(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> void
26+
Microsoft.AspNetCore.Antiforgery.IAntiforgery.ValidateRequestAsync(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> System.Threading.Tasks.Task!
27+
Microsoft.AspNetCore.Antiforgery.IAntiforgeryAdditionalDataProvider
28+
Microsoft.AspNetCore.Antiforgery.IAntiforgeryAdditionalDataProvider.GetAdditionalData(Microsoft.AspNetCore.Http.HttpContext! context) -> string!
29+
Microsoft.AspNetCore.Antiforgery.IAntiforgeryAdditionalDataProvider.ValidateAdditionalData(Microsoft.AspNetCore.Http.HttpContext! context, string! additionalData) -> bool
30+
Microsoft.Extensions.DependencyInjection.AntiforgeryServiceCollectionExtensions
31+
static Microsoft.Extensions.DependencyInjection.AntiforgeryServiceCollectionExtensions.AddAntiforgery(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
32+
static Microsoft.Extensions.DependencyInjection.AntiforgeryServiceCollectionExtensions.AddAntiforgery(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services, System.Action<Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions!>! setupAction) -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
33+
static readonly Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.DefaultCookiePrefix -> string!
Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1 @@
11
#nullable enable
2-
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions
3-
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.AntiforgeryOptions() -> void
4-
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.Cookie.get -> Microsoft.AspNetCore.Http.CookieBuilder!
5-
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.Cookie.set -> void
6-
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.FormFieldName.get -> string!
7-
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.FormFieldName.set -> void
8-
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.HeaderName.get -> string?
9-
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.HeaderName.set -> void
10-
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.SuppressXFrameOptionsHeader.get -> bool
11-
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.SuppressXFrameOptionsHeader.set -> void
12-
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet
13-
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.AntiforgeryTokenSet(string? requestToken, string? cookieToken, string! formFieldName, string? headerName) -> void
14-
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.CookieToken.get -> string?
15-
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.FormFieldName.get -> string!
16-
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.HeaderName.get -> string?
17-
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.RequestToken.get -> string?
18-
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException
19-
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException.AntiforgeryValidationException(string! message) -> void
20-
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException.AntiforgeryValidationException(string! message, System.Exception? innerException) -> void
21-
Microsoft.AspNetCore.Antiforgery.IAntiforgery
22-
Microsoft.AspNetCore.Antiforgery.IAntiforgery.GetAndStoreTokens(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet!
23-
Microsoft.AspNetCore.Antiforgery.IAntiforgery.GetTokens(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet!
24-
Microsoft.AspNetCore.Antiforgery.IAntiforgery.IsRequestValidAsync(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> System.Threading.Tasks.Task<bool>!
25-
Microsoft.AspNetCore.Antiforgery.IAntiforgery.SetCookieTokenAndHeader(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> void
26-
Microsoft.AspNetCore.Antiforgery.IAntiforgery.ValidateRequestAsync(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> System.Threading.Tasks.Task!
27-
Microsoft.AspNetCore.Antiforgery.IAntiforgeryAdditionalDataProvider
28-
Microsoft.AspNetCore.Antiforgery.IAntiforgeryAdditionalDataProvider.GetAdditionalData(Microsoft.AspNetCore.Http.HttpContext! context) -> string!
29-
Microsoft.AspNetCore.Antiforgery.IAntiforgeryAdditionalDataProvider.ValidateAdditionalData(Microsoft.AspNetCore.Http.HttpContext! context, string! additionalData) -> bool
30-
Microsoft.Extensions.DependencyInjection.AntiforgeryServiceCollectionExtensions
31-
static Microsoft.Extensions.DependencyInjection.AntiforgeryServiceCollectionExtensions.AddAntiforgery(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
32-
static Microsoft.Extensions.DependencyInjection.AntiforgeryServiceCollectionExtensions.AddAntiforgery(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services, System.Action<Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions!>! setupAction) -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
33-
static readonly Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.DefaultCookiePrefix -> string!

0 commit comments

Comments
 (0)