Skip to content

Commit

Permalink
[release/5.0] Update API baseline files (dotnet#27653)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
dougbu authored Nov 12, 2020
1 parent 4d47720 commit 4158756
Show file tree
Hide file tree
Showing 298 changed files with 19,884 additions and 19,176 deletions.
19 changes: 14 additions & 5 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,23 @@
<PropertyGroup>
<RepoRelativeProjectDir>$([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectDirectory)))</RepoRelativeProjectDir>

<IsBenchmarkProject Condition="$(MSBuildProjectName.EndsWith('.Performance')) OR $(RepoRelativeProjectDir.Contains('perf')) OR $(RepoRelativeProjectDir.Contains('benchmarkapps'))">true</IsBenchmarkProject>
<IsBenchmarkProject Condition=" $(MSBuildProjectName.EndsWith('.Performance')) OR
$(RepoRelativeProjectDir.Contains('perf')) OR
$(RepoRelativeProjectDir.Contains('benchmarkapps')) ">true</IsBenchmarkProject>
<IsSpecificationTestProject Condition="$(MSBuildProjectName.EndsWith('.Specification.Tests'))">true</IsSpecificationTestProject>
<IsUnitTestProject Condition=" '$(IsUnitTestProject)' == '' ">false</IsUnitTestProject>
<IsUnitTestProject Condition="'$(IsSpecificationTestProject)' != 'true' and ( $(MSBuildProjectName.EndsWith('Tests')) or $(MSBuildProjectName.EndsWith('.Test')) or $(MSBuildProjectName.EndsWith('.FunctionalTest')) )">true</IsUnitTestProject>
<IsTestAssetProject Condition="$(RepoRelativeProjectDir.Contains('testassets'))">true</IsTestAssetProject>
<IsSampleProject Condition="$(RepoRelativeProjectDir.Contains('sample'))">true</IsSampleProject>
<IsUnitTestProject Condition=" '$(IsSpecificationTestProject)' != 'true' AND
( $(MSBuildProjectName.EndsWith('Tests')) OR
$(MSBuildProjectName.EndsWith('.Test')) OR
$(MSBuildProjectName.EndsWith('.FunctionalTest')) ) ">true</IsUnitTestProject>
<IsTestAssetProject Condition=" $(RepoRelativeProjectDir.Contains('testassets')) ">true</IsTestAssetProject>
<IsSampleProject Condition=" $(RepoRelativeProjectDir.Contains('sample')) OR
$(RepoRelativeProjectDir.Contains('Sample')) ">true</IsSampleProject>
<IsAnalyzersProject Condition="$(MSBuildProjectName.EndsWith('.Analyzers'))">true</IsAnalyzersProject>
<IsShipping Condition="'$(IsSampleProject)' == 'true' or '$(IsTestAssetProject)' == 'true' or '$(IsBenchmarkProject)' == 'true' or '$(IsUnitTestProject)' == 'true'">false</IsShipping>
<IsShipping Condition=" '$(IsSampleProject)' == 'true' OR
'$(IsTestAssetProject)' == 'true' OR
'$(IsBenchmarkProject)' == 'true' OR
'$(IsUnitTestProject)' == 'true'">false</IsShipping>

<!--
Following logic mimics core-setup approach as well as
Expand Down
11 changes: 9 additions & 2 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,17 @@

<PropertyGroup>
<!-- Implementation projects are the projects which produce nuget packages or shipping assemblies. -->
<IsImplementationProject Condition=" '$(IsImplementationProject)' == '' AND '$(IsAnalyzersProject)' != 'true' AND '$(IsTestAssetProject)' != 'true' AND '$(IsTestProject)' != 'true' AND '$(IsBenchmarkProject)' != 'true' AND '$(IsSampleProject)' != 'true' ">true</IsImplementationProject>
<IsImplementationProject Condition=" '$(IsImplementationProject)' == '' AND
'$(IsAnalyzersProject)' != 'true' AND
'$(IsBenchmarkProject)' != 'true' AND
'$(IsSampleProject)' != 'true' AND
'$(IsSpecificationTestProject)' != 'true' AND
'$(IsTestAssetProject)' != 'true' AND
'$(IsTestProject)' != 'true' ">true</IsImplementationProject>

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

<HasReferenceAssembly
Condition=" '$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)' AND '$(IsAspNetCoreApp)' == 'true' ">true</HasReferenceAssembly>
Expand Down
1 change: 1 addition & 0 deletions eng/PublicAPI.empty.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#nullable enable
36 changes: 23 additions & 13 deletions eng/targets/CSharp.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,42 @@
<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
</PropertyGroup>

<!-- Ensure API changes show up clearly in PRs. -->
<PropertyGroup>
<_TFMDirectory>$(TargetFramework)</_TFMDirectory>
<_TFMDirectory Condition=" '$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)' ">netcoreapp</_TFMDirectory>
<!-- Ensure API changes show up clearly in PRs. -->
<AddPublicApiAnalyzers Condition=" '$(AddPublicApiAnalyzers)' == '' AND
'$(IsImplementationProject)' == 'true' AND
! $(RepoRelativeProjectDir.Contains('Tools')) ">true</AddPublicApiAnalyzers>
<AddPublicApiAnalyzers Condition=" '$(AddPublicApiAnalyzers)' == '' ">false</AddPublicApiAnalyzers>

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

<!-- Turn off platform compatiblity analyzer warnings in test, test assets, and samples -->
<NoWarn Condition="'$(IsTestProject)' == 'true' OR '$(IsTestAssetProject)' == 'true' OR '$(ISBenchmarkProject)' == 'true' OR '$(IsSampleProject)' == 'true'">$(NoWarn);CA1416</NoWarn>
<!-- Turn off platform compatibility analyzer warnings in test, test assets, and samples. -->
<NoWarn Condition=" '$(IsTestProject)' == 'true' OR
'$(IsTestAssetProject)' == 'true' OR
'$(ISBenchmarkProject)' == 'true' OR
'$(IsSampleProject)' == 'true' ">$(NoWarn);CA1416</NoWarn>
</PropertyGroup>

<ItemGroup Condition=" Exists('$(MSBuildProjectDirectory)\PublicAPI.Shipped.txt') AND
'$(DotNetBuildFromSource)' != 'true' AND
'$(IsImplementationProject)' == 'true' AND
! $(RepoRelativeProjectDir.Contains('Tools')) ">
<ItemGroup Condition=" '$(DotNetBuildFromSource)' != 'true' AND $(AddPublicApiAnalyzers) ">
<Reference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" ExcludeAssets="Compile" PrivateAssets="All" />
</ItemGroup>
<Target Name="_CheckIgnoredPublicApiFiles"
BeforeTargets="Build;Restore"
Condition=" Exists('$(MSBuildProjectDirectory)\PublicAPI.Shipped.txt') AND
'$(DotNetBuildFromSource)' != 'true' AND
!('$(IsImplementationProject)' == 'true' AND
! $(RepoRelativeProjectDir.Contains('Tools'))) ">
Condition=" Exists('$(MSBuildProjectDirectory)\PublicAPI.Shipped.txt') AND ! $(AddPublicApiAnalyzers) ">
<Warning Text="Public API baseline files ignored." />
</Target>
<Target Name="_RemovePublicApiAnalyzer" BeforeTargets="RazorCoreCompile">
<ItemGroup>
<_PublicAPIAnalyzers Include="@(Analyzer->WithMetadataValue('NuGetPackageId','Microsoft.CodeAnalysis.PublicApiAnalyzers'))" />
<Analyzer Remove="@(_PublicAPIAnalyzers)" />
</ItemGroup>
</Target>
<Target Name="_RestorePublicApiAnalyzer" AfterTargets="RazorCoreCompile">
<ItemGroup>
<Analyzer Include="@(_PublicAPIAnalyzers)" />
</ItemGroup>
</Target>

<Target Name="GetCustomAssemblyAttributes"
BeforeTargets="GetAssemblyAttributes"
Expand Down
2 changes: 2 additions & 0 deletions eng/tools/RepoTasks/RepoTasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<!-- Need to build this project in source build -->
<ExcludeFromSourceBuild>false</ExcludeFromSourceBuild>
<!-- No need to track public APIs of these MSBuild tasks. -->
<AddPublicApiAnalyzers>false</AddPublicApiAnalyzers>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
<TargetFramework>netstandard2.0</TargetFramework>
<PackageTags>$(PackageTags);testing</PackageTags>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!-- This is actually a library for test projects, not a test project. -->
<!-- This is actually a library for test projects, not a test project. Treat project as a test asset. -->
<IsUnitTestProject>false</IsUnitTestProject>
<IsTestAssetProject>true</IsTestAssetProject>
<!-- This package is internal, so we don't generate a package baseline. Always build against the latest dependencies. -->
<UseLatestPackageReferences>true</UseLatestPackageReferences>
<IsShippingPackage>false</IsShippingPackage>
Expand Down
32 changes: 32 additions & 0 deletions src/Antiforgery/src/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
#nullable enable
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.AntiforgeryOptions() -> void
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.Cookie.get -> Microsoft.AspNetCore.Http.CookieBuilder!
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.Cookie.set -> void
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.FormFieldName.get -> string!
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.FormFieldName.set -> void
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.HeaderName.get -> string?
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.HeaderName.set -> void
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.SuppressXFrameOptionsHeader.get -> bool
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.SuppressXFrameOptionsHeader.set -> void
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.AntiforgeryTokenSet(string? requestToken, string? cookieToken, string! formFieldName, string? headerName) -> void
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.CookieToken.get -> string?
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.FormFieldName.get -> string!
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.HeaderName.get -> string?
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.RequestToken.get -> string?
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException.AntiforgeryValidationException(string! message) -> void
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException.AntiforgeryValidationException(string! message, System.Exception? innerException) -> void
Microsoft.AspNetCore.Antiforgery.IAntiforgery
Microsoft.AspNetCore.Antiforgery.IAntiforgery.GetAndStoreTokens(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet!
Microsoft.AspNetCore.Antiforgery.IAntiforgery.GetTokens(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet!
Microsoft.AspNetCore.Antiforgery.IAntiforgery.IsRequestValidAsync(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> System.Threading.Tasks.Task<bool>!
Microsoft.AspNetCore.Antiforgery.IAntiforgery.SetCookieTokenAndHeader(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> void
Microsoft.AspNetCore.Antiforgery.IAntiforgery.ValidateRequestAsync(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> System.Threading.Tasks.Task!
Microsoft.AspNetCore.Antiforgery.IAntiforgeryAdditionalDataProvider
Microsoft.AspNetCore.Antiforgery.IAntiforgeryAdditionalDataProvider.GetAdditionalData(Microsoft.AspNetCore.Http.HttpContext! context) -> string!
Microsoft.AspNetCore.Antiforgery.IAntiforgeryAdditionalDataProvider.ValidateAdditionalData(Microsoft.AspNetCore.Http.HttpContext! context, string! additionalData) -> bool
Microsoft.Extensions.DependencyInjection.AntiforgeryServiceCollectionExtensions
static Microsoft.Extensions.DependencyInjection.AntiforgeryServiceCollectionExtensions.AddAntiforgery(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
static Microsoft.Extensions.DependencyInjection.AntiforgeryServiceCollectionExtensions.AddAntiforgery(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services, System.Action<Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions!>! setupAction) -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
static readonly Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.DefaultCookiePrefix -> string!
32 changes: 0 additions & 32 deletions src/Antiforgery/src/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1 @@
#nullable enable
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.AntiforgeryOptions() -> void
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.Cookie.get -> Microsoft.AspNetCore.Http.CookieBuilder!
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.Cookie.set -> void
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.FormFieldName.get -> string!
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.FormFieldName.set -> void
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.HeaderName.get -> string?
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.HeaderName.set -> void
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.SuppressXFrameOptionsHeader.get -> bool
Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.SuppressXFrameOptionsHeader.set -> void
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.AntiforgeryTokenSet(string? requestToken, string? cookieToken, string! formFieldName, string? headerName) -> void
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.CookieToken.get -> string?
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.FormFieldName.get -> string!
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.HeaderName.get -> string?
Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet.RequestToken.get -> string?
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException.AntiforgeryValidationException(string! message) -> void
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException.AntiforgeryValidationException(string! message, System.Exception? innerException) -> void
Microsoft.AspNetCore.Antiforgery.IAntiforgery
Microsoft.AspNetCore.Antiforgery.IAntiforgery.GetAndStoreTokens(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet!
Microsoft.AspNetCore.Antiforgery.IAntiforgery.GetTokens(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet!
Microsoft.AspNetCore.Antiforgery.IAntiforgery.IsRequestValidAsync(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> System.Threading.Tasks.Task<bool>!
Microsoft.AspNetCore.Antiforgery.IAntiforgery.SetCookieTokenAndHeader(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> void
Microsoft.AspNetCore.Antiforgery.IAntiforgery.ValidateRequestAsync(Microsoft.AspNetCore.Http.HttpContext! httpContext) -> System.Threading.Tasks.Task!
Microsoft.AspNetCore.Antiforgery.IAntiforgeryAdditionalDataProvider
Microsoft.AspNetCore.Antiforgery.IAntiforgeryAdditionalDataProvider.GetAdditionalData(Microsoft.AspNetCore.Http.HttpContext! context) -> string!
Microsoft.AspNetCore.Antiforgery.IAntiforgeryAdditionalDataProvider.ValidateAdditionalData(Microsoft.AspNetCore.Http.HttpContext! context, string! additionalData) -> bool
Microsoft.Extensions.DependencyInjection.AntiforgeryServiceCollectionExtensions
static Microsoft.Extensions.DependencyInjection.AntiforgeryServiceCollectionExtensions.AddAntiforgery(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
static Microsoft.Extensions.DependencyInjection.AntiforgeryServiceCollectionExtensions.AddAntiforgery(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services, System.Action<Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions!>! setupAction) -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
static readonly Microsoft.AspNetCore.Antiforgery.AntiforgeryOptions.DefaultCookiePrefix -> string!
Loading

0 comments on commit 4158756

Please sign in to comment.