Skip to content

Switch to built-in IsTrimmable property #41021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions eng/CodeGen.proj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<_RequiresDelayedBuild Include="@(_ProvidesReferenceOrRequiresDelay->WithMetadataValue('RequiresDelayedBuild','true')->Distinct())" />
<_SharedFrameworkAndPackageRef Include="@(_ProjectReferenceProvider->WithMetadataValue('IsAspNetCoreApp','true')->WithMetadataValue('IsPackable', 'true'))" />
<_SharedFrameworkRef Include="@(_ProjectReferenceProvider->WithMetadataValue('IsAspNetCoreApp','true')->WithMetadataValue('IsPackable', 'false'))" />
<_TrimmableProject Include="@(_ProjectReferenceProvider->WithMetadataValue('Trimmable', 'true'))" />
<_TrimmableProject Include="@(_ProjectReferenceProvider->WithMetadataValue('IsTrimmable', 'true'))" />
</ItemGroup>

<PropertyGroup>
Expand Down Expand Up @@ -85,7 +85,7 @@

This file contains a complete list of projects annotated for trimming.

This file is generated using the <Trimmable> properties from each .csproj in this repository.
This file is generated using the <IsTrimmable> properties from each .csproj in this repository.
-->
<Project>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion eng/TrimmableProjects.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

This file contains a complete list of projects annotated for trimming.

This file is generated using the <Trimmable> properties from each .csproj in this repository.
This file is generated using the <IsTrimmable> properties from each .csproj in this repository.
-->
<Project>
<ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions eng/Workarounds.props
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,10 @@
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
</PropertyGroup>

<!-- Trim analyzers are automatically enabled by IsTrimming=true. They currently break when run on aspnetcore.
Remove when trimming analyzers are fixed: https://github.com/dotnet/aspnetcore/issues/41016 -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make more sense to link to the linker issue? That way people finding this comment can go directly to the linker issue and see if it is fixed yet or not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to leave the aspnetcore issue open with a link to the linker issue.

<PropertyGroup>
<EnableTrimAnalyzer Condition=" '$(EnableTrimAnalyzer)' == ''">false</EnableTrimAnalyzer>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this set anywhere else. Why include the Condition

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case we want to enable for some projects later to test whether it works or not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/fyi the Condition doesn't help that case much because projects are read after Directory.Build.props files and (therefore) this file. The project can therefore override any property it likes (as long as it doesn't use a != '' Condition of course).

But my comment was definitely a nit.

</PropertyGroup>

</Project>
5 changes: 0 additions & 5 deletions eng/targets/CSharp.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,6 @@
<_Parameter1>Serviceable</_Parameter1>
<_Parameter2>True</_Parameter2>
</AssemblyAttribute>

<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(Trimmable)' == 'true'">
<_Parameter1>IsTrimmable</_Parameter1>
<_Parameter2>True</_Parameter2>
</AssemblyAttribute>
</ItemGroup>
</Target>

Expand Down
2 changes: 1 addition & 1 deletion eng/targets/ResolveReferences.targets
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@
<IsAspNetCoreApp>$([MSBuild]::ValueOrDefault($(IsAspNetCoreApp),'false'))</IsAspNetCoreApp>
<IsPackable>$([MSBuild]::ValueOrDefault($(IsPackable),'false'))</IsPackable>
<ProjectFileRelativePath>$([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectFullPath)))</ProjectFileRelativePath>
<Trimmable>$([MSBuild]::ValueOrDefault($(Trimmable),'false'))</Trimmable>
<IsTrimmable>$([MSBuild]::ValueOrDefault($(IsTrimmable),'false'))</IsTrimmable>

<!-- True if the project may be referenced using a @(Reference) item. -->
<IsProjectReferenceProvider>$([MSBuild]::ValueOrDefault($(IsProjectReferenceProvider),'false'))</IsProjectReferenceProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<IsAspNetCoreApp>true</IsAspNetCoreApp>
<Description>Authentication and authorization support for Blazor applications.</Description>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsAspNetCoreApp>true</IsAspNetCoreApp>
<Nullable>enable</Nullable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Description>Forms and validation support for Blazor applications.</Description>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Nullable>enable</Nullable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<RootNamespace>Microsoft.AspNetCore.Components</RootNamespace>
<Nullable>enable</Nullable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<Description>Authenticate your Blazor webassembly applications with Azure Active Directory and Azure Active Directory B2C</Description>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsShippingPackage>true</IsShippingPackage>
<Nullable>enable</Nullable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Description>Build client-side authentication for single-page applications (SPAs).</Description>
<IsShippingPackage>true</IsShippingPackage>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
<Nullable>disable</Nullable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<NoWarn>$(NoWarn);CS8603</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Nullable>enable</Nullable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>Provides abstractions for a loosly coupled collection of features.

Commonly Used Types:
Microsoft.AspNetCore.Http.Features.IFeatureCollection
Microsoft.AspNetCore.Http.Features.FeatureCollection
Expand All @@ -12,7 +12,7 @@ Microsoft.AspNetCore.Http.Features.FeatureCollection
<IsAspNetCoreApp>true</IsAspNetCoreApp>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore</PackageTags>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageTags>aspnetcore;hosting</PackageTags>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageTags>aspnetcore;hosting</PackageTags>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageTags>aspnetcore;hosting</PackageTags>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;authentication;security</PackageTags>
<IsPackable>false</IsPackable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;authentication;security</PackageTags>
<IsPackable>false</IsPackable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Headers/src/Microsoft.Net.Http.Headers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageTags>http</PackageTags>
<IsPackable>false</IsPackable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Microsoft.AspNetCore.Http.HttpResponse</Description>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore</PackageTags>
<IsPackable>false</IsPackable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore</PackageTags>
<IsPackable>false</IsPackable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore</PackageTags>
<IsPackable>false</IsPackable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Http/src/Microsoft.AspNetCore.Http.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageTags>aspnetcore</PackageTags>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore</PackageTags>
<Nullable>enable</Nullable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Microsoft.AspNetCore.Routing.RouteData</Description>
<PackageTags>aspnetcore;routing</PackageTags>
<IsPackable>false</IsPackable>
<Nullable>annotations</Nullable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore</PackageTags>
<IsPackable>false</IsPackable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsAspNetCoreApp>true</IsAspNetCoreApp>
<Nullable>enable</Nullable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
<DefineConstants>$(DefineConstants);JS_INTEROP</DefineConstants>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;proxy;headers;xforwarded</PackageTags>
<IsPackable>false</IsPackable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/ObjectPool/src/Microsoft.Extensions.ObjectPool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>pooling</PackageTags>
<IsAspNetCoreApp>true</IsAspNetCoreApp>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Microsoft.AspNetCore.Authorization.AuthorizeAttribute</Description>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;authorization</PackageTags>
<Nullable>enable</Nullable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore</PackageTags>
<Nullable>enable</Nullable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;weblistener;httpsys</PackageTags>
<IsPackable>false</IsPackable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>

<!-- Ignore platform compatibility warnings for this project. We know this only works on windows.-->
<NoWarn>$(NoWarn);CA1416</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NativeAssetsTargetFramework>$(DefaultNetCoreTargetFramework)</NativeAssetsTargetFramework>
<IsPackable>false</IsPackable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>

<!-- Ignore platform compatibility warnings for this project. We know this only works on windows.-->
<NoWarn>$(NoWarn);CA1416</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageTags>aspnetcore;iis</PackageTags>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPackable>false</IsPackable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>

<!-- Ignore platform compatibility warnings for this project. We know this only works on windows.-->
<NoWarn>$(NoWarn);CA1416</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<IsPackable>false</IsPackable>
<DefineConstants>$(DefineConstants);KESTREL</DefineConstants>
<NoWarn>$(NoWarn);IDE0060</NoWarn><!-- APIs in HTTP3 are work in progress and produce these warnings frequently-->
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;kestrel</PackageTags>
<IsPackable>false</IsPackable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<NoWarn>CA1416;CS0436;$(NoWarn)</NoWarn><!-- Conflicts between internal and public Quic APIs; Platform support warnings. -->
<NoWarn>$(NoWarn);IDE0060</NoWarn> <!-- This project is work in progress and has incomplete APIs -->
<IsPackable>false</IsPackable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageTags>aspnetcore;kestrel</PackageTags>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPackable>false</IsPackable>
<Trimmable>true</Trimmable>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down