Skip to content

Commit

Permalink
Add --exclude-compiler-generated and --respect-internals to GenAP…
Browse files Browse the repository at this point in the history
…I commands

- exclude `@(Reference)` items for .Sources projects
- generate ref/ C# files only for the default TFM
- ignore CS0169 warnings in ref/ projects
  - some newly-generated types encounter this warning
- add exclusions related to nullable reference types due to dotnet/arcade#4488 (part 5)
- add exclusions to avoid System.Buffers conflicts with MessagePack submodule
- add exclusion for async use
- remove exclusions for properties w/ `internal set`
- remove exclusions for GenAPI NREs
- remove exclusions related to dotnet/arcade#2031 aka dotnet/arcade#2033 aka dotnet/arcade#4488 (part 6)
  • Loading branch information
dougbu committed Jun 10, 2020
1 parent 99e90f5 commit 9ffa5c2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 41 deletions.
37 changes: 12 additions & 25 deletions eng/GenAPI.exclusions.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
# Manually implemented - https://github.com/dotnet/arcade/pull/2033
T:Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame
# Manually implemented - https://github.com/dotnet/arcade/issues/2066
T:Microsoft.AspNetCore.Mvc.ApplicationModels.PageParameterModel
T:Microsoft.AspNetCore.Mvc.ApplicationModels.PagePropertyModel
# Manually implemented - Need to include internal setter
P:Microsoft.AspNetCore.Mvc.Razor.Infrastructure.TagHelperMemoryCacheProvider.Cache
P:Microsoft.AspNetCore.Mvc.RazorPages.RazorPagesOptions.Conventions
P:Microsoft.AspNetCore.Routing.Matching.CandidateState.Values
P:Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions.KestrelServerOptions
# public structs with public fields that GenAPI doesn't handle
T:Microsoft.AspNetCore.Components.EventCallback
T:Microsoft.AspNetCore.Components.EventCallback`1
# Break GenAPI - https://github.com/dotnet/arcade/issues/4488
T:Microsoft.AspNetCore.Components.Rendering.HtmlRenderer.<CreateInitialRenderAsync>d__17
T:Microsoft.AspNetCore.Components.Rendering.HtmlRenderer.<RenderComponentAsync>d__8
T:Microsoft.AspNetCore.Mvc.ApplicationModels.ActionAttributeRouteModel.<>c
T:Microsoft.AspNetCore.Mvc.ApplicationModels.ActionAttributeRouteModel.<GetAttributeRoutes>d__3
T:Microsoft.AspNetCore.Mvc.ControllerBase.<TryUpdateModelAsync>d__181`1
T:Microsoft.AspNetCore.Mvc.ControllerBase.<TryUpdateModelAsync>d__183`1
T:Microsoft.AspNetCore.Mvc.ControllerBase.<TryUpdateModelAsync>d__184`1
T:Microsoft.AspNetCore.Mvc.ControllerBase.<TryUpdateModelAsync>d__187
T:Microsoft.AspNetCore.Mvc.Controllers.ControllerBinderDelegateProvider.<>c__DisplayClass0_0
T:Microsoft.AspNetCore.Mvc.ModelBinding.CompositeValueProvider.<TryCreateAsync>d__4
T:Microsoft.AspNetCore.Mvc.Routing.ConsumesMatcherPolicy.<>c
# Excluded to avoid conflicts between System.Buffers.dll and MessagePack submodule
T:System.Buffers.SequenceReaderExtensions
T:System.Buffers.SequenceReader`1
# Manually implemented - https://github.com/dotnet/arcade/issues/4488 problem (5), #nullable not generated.
T:Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker
M:Microsoft.AspNetCore.Mvc.MvcCoreLoggerExtensions.ActionScope(Microsoft.Extensions.Logging.ILogger,Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor)
M:Microsoft.AspNetCore.Mvc.ViewFeatures.MvcViewFeaturesLoggerExtensions.ViewComponentScope(Microsoft.Extensions.Logging.ILogger,Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext)
# As above but relevant only when using GenAPI with --all because these methods are private.
M:Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsyncCore(Microsoft.Extensions.Internal.ObjectMethodExecutor,Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext)
M:Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeSyncCore(Microsoft.Extensions.Internal.ObjectMethodExecutor,Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext)
# Manually implemented to avoid need to generate async keywords and await Task.Delay(...) statements everywhere.
M:Microsoft.AspNetCore.SignalR.Internal.AsyncEnumerableAdapters.MakeAsyncEnumerableFromChannel``1(System.Threading.Channels.ChannelReader{``0},System.Threading.CancellationToken)
2 changes: 1 addition & 1 deletion eng/targets/CSharp.ReferenceAssembly.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<NoWarn>$(NoWarn);CS0618;PUB0001</NoWarn>
<NoWarn>$(NoWarn);CS0169;CS0618;PUB0001</NoWarn>
</PropertyGroup>
</Project>
24 changes: 9 additions & 15 deletions eng/targets/ReferenceAssembly.targets
Original file line number Diff line number Diff line change
@@ -1,35 +1,27 @@
<Project>

<Target Name="GenerateReferenceSource" Condition=" $(HasReferenceAssembly) ">
<!-- Only generate ref/ projects in outer builds or when targeting the default TFM. -->
<Target Name="GenerateReferenceSource"
Condition=" $(HasReferenceAssembly) AND ('$(TargetFramework)' == '' OR '$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)') ">
<PropertyGroup>
<_RefSourceOutputPath>$([System.IO.Directory]::GetParent('$(MSBuildProjectDirectory)'))/ref/</_RefSourceOutputPath>
<_RefProjectFileOutputPath>$(_RefSourceOutputPath)$(AssemblyName).csproj</_RefProjectFileOutputPath>
</PropertyGroup>

<ItemGroup>
<_AllTargetFrameworks Remove="@(_AllTargetFrameworks)" />
<_AllTargetFrameworks Include="$(TargetFrameworks);$(TargetFramework)" />
<_DeduplicatedTargetFramework Include="%(_AllTargetFrameworks.Identity)" />
</ItemGroup>

<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="_GenerateProjectSourceInner"
Properties="TargetFramework=%(_DeduplicatedTargetFramework.Identity);CompileUsingReferenceAssemblies=false">
Properties="TargetFramework=$(DefaultNetCoreTargetFramework);CompileUsingReferenceAssemblies=false">
<Output TaskParameter="TargetOutputs" ItemName="ProjectListContentItem" />
</MSBuild>

<ItemGroup>
<_ResultTargetFramework Include="%(ProjectListContentItem.TargetFramework)" />
</ItemGroup>

<PropertyGroup>
<ProjectListContentLines><![CDATA[
<!-- This file is automatically generated. -->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>@(_ResultTargetFramework)</TargetFrameworks>
<TargetFramework>%24(DefaultNetCoreTargetFramework)</TargetFramework>
</PropertyGroup>
@(ProjectListContentItem->'%(Identity)', '%0A')
@(ProjectListContentItem->'%(Identity)', '%0A ')
</Project>
]]></ProjectListContentLines>
</PropertyGroup>
Expand Down Expand Up @@ -77,6 +69,8 @@
--out "$(_RefSourceFileOutputPath)"
--header-file "$(RepoRoot)/eng/LicenseHeader.txt"
--exclude-api-list "$(RepoRoot)/eng/GenAPI.exclusions.txt"
--respect-internals
--exclude-compiler-generated
]]>
</_GenApiArguments>
</PropertyGroup>
Expand All @@ -98,7 +92,7 @@
<_ReferenceAssemblyCompileItems Include="../src/Properties/AssemblyInfo.cs"
Condition="Exists('$(MSBuildProjectDirectory)/Properties/AssemblyInfo.cs')" />
<FilteredOriginalReferences Include="%(_OriginalReferences.Identity)"
Condition="'%(_OriginalReferences.NuGetPackageId)' == '' AND '%(_OriginalReferences.PrivateAssets)' != 'All'" />
Condition="'%(_OriginalReferences.NuGetPackageId)' == '' AND '%(_OriginalReferences.PrivateAssets)' != 'All' AND '%(_OriginalReferences.IsSharedSource)' != 'true' " />

<_ReferenceAssemblyItems
Include="@(_ReferenceAssemblyCompileItems->'&lt;Compile Include=&quot;%(Identity)&quot; /&gt;')" />
Expand Down

0 comments on commit 9ffa5c2

Please sign in to comment.