Skip to content

Commit

Permalink
Better trimming support + trimming fix
Browse files Browse the repository at this point in the history
- Allow for trimming to be set in SourceBuild.props. This enables use in repo SB legs. Includes a default set which is all netcoreapps + netstandards.
- Disable trimming for top level projects in Arcade, so that we don't accidentally skip things like publishing.
  • Loading branch information
mmitche committed Mar 3, 2023
1 parent 7f6d979 commit e5fc7c2
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Microsoft.DotNet.Arcade.Sdk/tools/AfterSigning.proj
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<PropertyGroup>
<NoTargetFrameworkFiltering>true</NoTargetFrameworkFiltering>
</PropertyGroup>
<Import Project="BuildStep.props" />

<Target Name="Rebuild" DependsOnTargets="Clean;Build" />
Expand Down
5 changes: 5 additions & 0 deletions src/Microsoft.DotNet.Arcade.Sdk/tools/AfterSolutionBuild.proj
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<PropertyGroup>
<!-- Disable target framework filtering for top level projects -->
<NoTargetFrameworkFiltering>true</NoTargetFrameworkFiltering>
</PropertyGroup>

<Import Project="BuildStep.props" />

<Target Name="Rebuild" DependsOnTargets="Clean;Build" />
Expand Down
2 changes: 2 additions & 0 deletions src/Microsoft.DotNet.Arcade.Sdk/tools/Build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

<PropertyGroup>
<_OriginalProjectsValue>$(Projects)</_OriginalProjectsValue>
<!-- Disable target framework filtering for top level projects -->
<NoTargetFrameworkFiltering>true</NoTargetFrameworkFiltering>
</PropertyGroup>

<ItemDefinitionGroup>
Expand Down
6 changes: 6 additions & 0 deletions src/Microsoft.DotNet.Arcade.Sdk/tools/Publish.proj
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project DefaultTargets="Publish">

<PropertyGroup>
<!-- Disable target framework filtering for top level projects -->
<NoTargetFrameworkFiltering>true</NoTargetFrameworkFiltering>
</PropertyGroup>

<!--
Documentation for publishing is available here:
- https://github.com/dotnet/arcade/blob/master/Documentation/CorePackages/Publishing.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project DefaultTargets="Validate">

<PropertyGroup>
<!-- Disable target framework filtering for top level projects -->
<NoTargetFrameworkFiltering>true</NoTargetFrameworkFiltering>
</PropertyGroup>

<Import Project="BuildTasks.props" />

<UsingTask TaskName="Microsoft.DotNet.Arcade.Sdk.ValidateLicense" AssemblyFile="$(ArcadeSdkBuildTasksAssembly)" />
Expand Down
6 changes: 6 additions & 0 deletions src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.proj
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project DefaultTargets="Sign">

<PropertyGroup>
<!-- Disable target framework filtering for top level projects -->
<NoTargetFrameworkFiltering>true</NoTargetFrameworkFiltering>
</PropertyGroup>

<Import Project="BuildStep.props" />

<Import Project="$(NuGetPackageRoot)microsoft.dotnet.signtool\$(MicrosoftDotNetSignToolVersion)\build\Microsoft.DotNet.SignTool.props" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
<DetectSourceBuildIntermediateNupkgLicense Condition="'$(DetectSourceBuildIntermediateNupkgLicense)' == ''">true</DetectSourceBuildIntermediateNupkgLicense>

<EnableDefaultSourceBuildIntermediateItems Condition="'$(EnableDefaultSourceBuildIntermediateItems)' == ''">true</EnableDefaultSourceBuildIntermediateItems>

<!-- This is fed into the inner source build as an environment variable (DotNetTargetFrameworkFilter) to enable filtering.
The default target framework filter includes all recent netcoreapps in SBRP, as well as 8.0 (latest) and 7.0 (working to get rid of it -->
<_DefaultNetFrameworkFilter>netcoreapp%3bnetstandard%3bnet5.0%3bnet6.0%3bnet7.0%3bnet8.0%3b</_DefaultNetFrameworkFilter>
<SourceBuildTargetFrameworkFilter Condition="'$(SourceBuildTrimNetFrameworkTargets)' == 'true' and '$(SourceBuildTargetFrameworkFilter)' == ''">$(_DefaultNetFrameworkFilter)</SourceBuildTargetFrameworkFilter>
</PropertyGroup>

<Target Name="GetSourceBuildIntermediateNupkgNameConvention">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
<ItemGroup>
<!-- Override package cache to separate source-built packages from upstream. -->
<InnerBuildEnv Include="NUGET_PACKAGES=$(CurrentRepoSourceBuildPackageCache)" />
<InnerBuildEnv Include="DotNetTargetFrameworkFilter=$(SourceBuildTargetFrameworkFilter)" />
</ItemGroup>
</Target>

Expand Down

0 comments on commit e5fc7c2

Please sign in to comment.