Skip to content

Commit

Permalink
Fix trimming linker tests (#44613)
Browse files Browse the repository at this point in the history
  • Loading branch information
safern authored Nov 13, 2020
1 parent ce1d60f commit 4c102bd
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 15 deletions.
8 changes: 4 additions & 4 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@
-->
<ItemGroup>
<KnownFrameworkReference Include="Microsoft.NETCore.App"
DefaultRuntimeFrameworkVersion="5.0.0-rc.1.20451.14"
DefaultRuntimeFrameworkVersion="$(MicrosoftNETCoreAppVersion)"
IsTrimmable="true"
LatestRuntimeFrameworkVersion="5.0.0-rc.1.20451.14"
LatestRuntimeFrameworkVersion="$(MicrosoftNETCoreAppVersion)"
RuntimeFrameworkName="Microsoft.NETCore.App"
RuntimePackNamePatterns="Microsoft.NETCore.App.Runtime.**RID**"
RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86;ios-arm64;ios-arm;ios-x64;ios-x86;tvos-arm64;tvos-x64;android-arm64;android-arm;android-x64;android-x86;browser-wasm"
TargetFramework="$(NetCoreAppCurrent)"
TargetingPackName="Microsoft.NETCore.App.Ref"
TargetingPackVersion="5.0.0-rc.1.20451.14" />
TargetingPackVersion="$(MicrosoftNETCoreAppVersion)" />

<KnownAppHostPack Include="Microsoft.NETCore.App"
AppHostPackNamePattern="Microsoft.NETCore.App.Host.**RID**"
AppHostPackVersion="5.0.0-rc.1.20451.14"
AppHostPackVersion="$(MicrosoftNETCoreAppVersion)"
AppHostRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86"
TargetFramework="$(NetCoreAppCurrent)" />
</ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions eng/testing/linker/SupportFiles/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
<PlatformManifestFile />
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
</PropertyGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.NETCore.App" />
</ItemGroup>
</Project>
20 changes: 11 additions & 9 deletions eng/testing/linker/SupportFiles/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<Project>
<Target Name="RestoreProject">
<MSBuild Projects="$(MSBuildProjectFullPath)"
Properties="Configuration=$(Configuration)"
Properties="Configuration=$(Configuration);ForceEvaluation=true"
Targets="Restore" />
</Target>

<Target Name="AddFrameworkReference">
<Target Name="RemoveRuntimePackFromDownloadItem"
AfterTargets="ProcessFrameworkReferences">
<ItemGroup>
<FrameworkReference Include="Microsoft.NETCore.App" />
<PackageDownload Remove="@(PackageDownload)"
Condition="$([System.String]::Copy('%(Identity)').StartsWith('Microsoft.NETCore.App.Runtime'))" />
</ItemGroup>
</Target>

<Target Name="UpdateRuntimePack"
DependsOnTargets="AddFrameworkReference;ResolveFrameworkReferences">
DependsOnTargets="ResolveFrameworkReferences">
<ItemGroup>
<ResolvedRuntimePack Update="@(ResolvedRuntimePack)" PackageDirectory="$(RuntimePackDir)" />
<ResolvedTargetingPack Update="@(ResolvedTargetingPack)" Path="$(TargetingPackDir)" />
Expand All @@ -31,23 +33,23 @@
</ItemGroup>
</Target>

<Target Name="PublishTrimmed" DependsOnTargets="RestoreProject;UpdateRuntimePack;Publish" />
<Target Name="PublishTrimmed" DependsOnTargets="ProcessFrameworkReferences;RestoreProject;UpdateRuntimePack;Publish" />

<ItemGroup>
<KnownFrameworkReference Include="Microsoft.NETCore.App"
DefaultRuntimeFrameworkVersion="5.0.0-rc.1.20451.14"
DefaultRuntimeFrameworkVersion="$(MicrosoftNETCoreAppVersion)"
IsTrimmable="true"
LatestRuntimeFrameworkVersion="5.0.0-rc.1.20451.14"
LatestRuntimeFrameworkVersion="$(MicrosoftNETCoreAppVersion)"
RuntimeFrameworkName="Microsoft.NETCore.App"
RuntimePackNamePatterns="Microsoft.NETCore.App.Runtime.**RID**"
RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86;ios-arm64;ios-arm;ios-x64;ios-x86;tvos-arm64;tvos-x64;android-arm64;android-arm;android-x64;android-x86;browser-wasm"
TargetFramework="net6.0"
TargetingPackName="Microsoft.NETCore.App.Ref"
TargetingPackVersion="5.0.0-rc.1.20451.14" />
TargetingPackVersion="$(MicrosoftNETCoreAppVersion)" />

<KnownAppHostPack Include="Microsoft.NETCore.App"
AppHostPackNamePattern="Microsoft.NETCore.App.Host.**RID**"
AppHostPackVersion="5.0.0-rc.1.20451.14"
AppHostPackVersion="$(MicrosoftNETCoreAppVersion)"
AppHostRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86"
TargetFramework="net6.0" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions eng/testing/linker/project.csproj.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<RuntimePackDir>{RuntimePackDir}</RuntimePackDir>
<TargetingPackDir>{TargetingPackDir}</TargetingPackDir>
<NETCoreAppMaximumVersion>{NetCoreAppMaximumVersion}</NETCoreAppMaximumVersion>
<MicrosoftNETCoreAppVersion>{MicrosoftNETCoreAppVersion}</MicrosoftNETCoreAppVersion>

<!-- These can be removed once we get an SDK with https://github.com/mono/linker/pull/1385. -->
<LinkerNoWarn>IL2026</LinkerNoWarn>
Expand Down
4 changes: 2 additions & 2 deletions eng/testing/linker/trimmingTests.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<PropertyGroup>
<TrimmingTestDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'trimmingTests'))</TrimmingTestDir>
<TrimmingTestProjectsDir>$([MSBuild]::NormalizeDirectory('$(TrimmingTestDir)', 'projects'))</TrimmingTestProjectsDir>
<TestDotNetPath>$([MSBuild]::NormalizePath('$(DotNetRoot)', 'dotnet'))</TestDotNetPath>
<ProjectTemplate>$(MSBuildThisFileDirectory)project.csproj.template</ProjectTemplate>
</PropertyGroup>

Expand Down Expand Up @@ -73,6 +72,7 @@
<MakeDir Directories="$(_projectDir)" />
<WriteLinesToFile File="$(_projectFile)"
Lines="$([System.IO.File]::ReadAllText('$(ProjectTemplate)')
.Replace('{MicrosoftNETCoreAppVersion}', '$(MicrosoftNETCoreAppVersion)')
.Replace('{NetCoreAppCurrent}', '$(NetCoreAppCurrent)')
.Replace('{NetCoreAppMaximumVersion}', '$(NetCoreAppMaximumVersion)')
.Replace('{RuntimePackDir}', '%(TestConsoleApps.RuntimePackDirectory)')
Expand All @@ -93,7 +93,7 @@
<Target Name="PublishTrimmedProjects"
DependsOnTargets="GenerateProjects">
<PropertyGroup>
<TestPublishTrimmedCommand>"$(TestDotNetPath)"</TestPublishTrimmedCommand>
<TestPublishTrimmedCommand>"$(DotNetTool)"</TestPublishTrimmedCommand>
<TestPublishTrimmedCommand>$(TestPublishTrimmedCommand) build /t:PublishTrimmed</TestPublishTrimmedCommand>
<TestPublishTrimmedCommand>$(TestPublishTrimmedCommand) /nr:false</TestPublishTrimmedCommand>
<TestPublishTrimmedCommand>$(TestPublishTrimmedCommand) /warnaserror</TestPublishTrimmedCommand>
Expand Down

0 comments on commit 4c102bd

Please sign in to comment.