Skip to content

Commit

Permalink
Merge pull request #189 from tannergooding/main
Browse files Browse the repository at this point in the history
Simplify the trimming support logic
  • Loading branch information
tannergooding authored Jul 11, 2021
2 parents 037cf72 + 771e0e1 commit d2bfc69
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
6 changes: 0 additions & 6 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,4 @@
<UseSharedCompilation>true</UseSharedCompilation>
</PropertyGroup>

<PropertyGroup Condition="'$(OutputType)' == 'Exe'">
<PublishTrimmed>true</PublishTrimmed>
<SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings>
<TrimMode>link</TrimMode>
</PropertyGroup>

</Project>
11 changes: 11 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@
<PackageVersion Condition="'$(EXCLUDE_RUN_ID_FROM_PACKAGE)' == ''">$(Version)-$(GITHUB_RUN_ID)</PackageVersion>
</PropertyGroup>

<!-- Settings that are only set for executables -->
<PropertyGroup Condition="'$(OutputType)' != 'Library'">
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>

<!-- Settings that are only set for libraries -->
<PropertyGroup Condition="'$(OutputType)' == 'Library'">
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<!-- Package versions for package references across all projects -->
<ItemGroup>
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.9.4" />
Expand Down
8 changes: 0 additions & 8 deletions sources/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,12 @@

<PropertyGroup>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileDirectory)..\Directory.Build.props</MSBuildAllProjects>
<TerraFXProjectCategory>sources</TerraFXProjectCategory>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.props" />

<ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>IsTrimmable</_Parameter1>
<_Parameter2>True</_Parameter2>
</AssemblyAttribute>
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="$(MSBuildProjectName).UnitTests" Key="$(AssemblyOriginatorPublicKey)" />
</ItemGroup>
Expand Down

0 comments on commit d2bfc69

Please sign in to comment.