From 1068c5403bedcb3d949880cf1a71cd8c8f5aacb0 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Mon, 21 Nov 2022 15:43:02 +0100 Subject: [PATCH] Make trimming tests use the live built apphost Fixes https://github.com/dotnet/runtime/issues/58109 --- eng/liveBuilds.targets | 8 +++-- eng/targetingpacks.targets | 39 +++++++++++++++++----- eng/testing/linker/project.csproj.template | 2 ++ eng/testing/linker/trimmingTests.targets | 16 +++------ src/libraries/Directory.Build.props | 1 + 5 files changed, 43 insertions(+), 23 deletions(-) diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index 3006fd92e756e..b346537a8cefa 100644 --- a/eng/liveBuilds.targets +++ b/eng/liveBuilds.targets @@ -43,14 +43,16 @@ $(MicrosoftNetCoreAppRefPackRefDir) $([MSBuild]::NormalizeDirectory('$(LibrariesArtifactsPath)', 'bin', 'ref', '$(NetCoreAppCurrent)')) $(MicrosoftNetCoreAppRuntimePackRidLibTfmDir) - $([MSBuild]::NormalizeDirectory('$(LibrariesArtifactsPath)', 'bin', 'runtime'))$(NetCoreAppCurrent)-$(LibrariesTargetOSConfigurationArchitecture)\ - $([MSBuild]::NormalizeDirectory('$(LibrariesArtifactsPath)', 'bin', 'native'))$(NetCoreAppCurrent)-$(LibrariesTargetOSConfigurationArchitecture)\ + $([MSBuild]::NormalizeDirectory('$(LibrariesArtifactsPath)', 'bin', 'runtime', '$(NetCoreAppCurrent)-$(LibrariesTargetOSConfigurationArchitecture)')) + $([MSBuild]::NormalizeDirectory('$(LibrariesArtifactsPath)', 'bin', 'native', '$(NetCoreAppCurrent)-$(LibrariesTargetOSConfigurationArchitecture)')) x64 x86 x64 x64 - $(CoreCLRArtifactsPath)/corehost/singlefilehost$(ExeSuffix) + + $([MSBuild]::NormalizePath('$(DotNetHostBinDir)', 'apphost$(ExeSuffix)')) + $([MSBuild]::NormalizePath('$(CoreCLRArtifactsPath)', 'corehost', 'singlefilehost$(ExeSuffix)')) diff --git a/eng/targetingpacks.targets b/eng/targetingpacks.targets index 744a0cd20b469..d24ad10fffea7 100644 --- a/eng/targetingpacks.targets +++ b/eng/targetingpacks.targets @@ -6,6 +6,7 @@ - MicrosoftNetCoreAppFrameworkName - MicrosoftNetCoreAppRefPackDir - optional: MicrosoftNetCoreAppRuntimePackDir + - optional: AppHostSourcePath & SingleFileHostSourcePath --> @@ -18,9 +19,11 @@ '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(TargetFrameworkVersion)' == 'v$(NetCoreAppCurrentVersion)'"> true - - false false + false @@ -31,7 +34,7 @@ LatestRuntimeFrameworkVersion="$(ProductVersion)" RuntimeFrameworkName="$(LocalFrameworkOverrideName)" RuntimePackNamePatterns="$(LocalFrameworkOverrideName).Runtime.**RID**" - RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-bionic-arm64;linux-loongarch64;linux-musl-x64;linux-bionic-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;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64" + 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;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;linux-s390x;linux-bionic-arm;linux-bionic-arm64;linux-bionic-x64;linux-bionic-x86" TargetFramework="$(NetCoreAppCurrent)" TargetingPackName="$(LocalFrameworkOverrideName).Ref" TargetingPackVersion="$(ProductVersion)" @@ -41,20 +44,21 @@ RuntimeFrameworkName="$(LocalFrameworkOverrideName)" LatestRuntimeFrameworkVersion="$(ProductVersion)" RuntimePackNamePatterns="$(LocalFrameworkOverrideName).Runtime.Mono.**RID**" - RuntimePackRuntimeIdentifiers="linux-arm;linux-armv6;linux-arm64;linux-musl-arm64;linux-bionic-arm64;linux-loongarch64;linux-musl-x64;linux-bionic-x64;linux-x64;osx-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;browser-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86" + RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;linux-s390x;linux-bionic-arm;linux-bionic-arm64;linux-bionic-x64;linux-bionic-x86;browser-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86" RuntimePackLabels="Mono" Condition="'@(KnownRuntimePack)' == '' or !@(KnownRuntimePack->AnyHaveMetadataValue('TargetFramework', '$(NetCoreAppCurrent)'))"/> @@ -78,7 +82,10 @@ - + @@ -87,6 +94,10 @@ Condition="'$(UsePackageDownload)' == 'true' and $([System.String]::Copy('%(Identity)').StartsWith('$(LocalFrameworkOverrideName).Runtime'))" /> + + @@ -105,7 +116,17 @@ '%(ResolvedRuntimePack.FrameworkName)' == '$(LocalFrameworkOverrideName)'" /> + Condition="'%(Identity)' == '$(LocalFrameworkOverrideName)'"> + $(MicrosoftNetCoreAppRuntimePackDir) + + + diff --git a/eng/testing/linker/project.csproj.template b/eng/testing/linker/project.csproj.template index 9b1c14e36b814..fe3d1ba28871e 100644 --- a/eng/testing/linker/project.csproj.template +++ b/eng/testing/linker/project.csproj.template @@ -7,6 +7,8 @@ {UseMonoRuntime} {RuntimeIdentifier} {PublishAot} + {AppHostSourcePath} + {SingleFileHostSourcePath} {MonoAOTCompilerDir} diff --git a/eng/testing/linker/trimmingTests.targets b/eng/testing/linker/trimmingTests.targets index 26624e765089a..0c78e23416e05 100644 --- a/eng/testing/linker/trimmingTests.targets +++ b/eng/testing/linker/trimmingTests.targets @@ -1,10 +1,4 @@ - - $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'trimmingTests')) - $([MSBuild]::NormalizeDirectory('$(TrimmingTestDir)', 'projects')) - $(MSBuildThisFileDirectory)project.csproj.template - - @@ -113,13 +107,13 @@ .Replace('{NetCoreAppCurrentVersion}', '$(NetCoreAppCurrentVersion)') .Replace('{MicrosoftNetCoreAppFrameworkName}', '$(MicrosoftNetCoreAppFrameworkName)') .Replace('{MicrosoftNetCoreAppRefPackDir}', '$(MicrosoftNetCoreAppRefPackDir)') - .Replace('{MicrosoftNetCoreAppRuntimePackDir}', '$(MicrosoftNetCoreAppRuntimePackDir)'))" + .Replace('{MicrosoftNetCoreAppRuntimePackDir}', '$(MicrosoftNetCoreAppRuntimePackDir)') + .Replace('{AppHostSourcePath}', '$(AppHostSourcePath)') + .Replace('{SingleFileHostSourcePath}', '$(SingleFileHostSourcePath)'))" Overwrite="true" /> - - diff --git a/src/libraries/Directory.Build.props b/src/libraries/Directory.Build.props index 7cf964f8366d8..f36265d7c617e 100644 --- a/src/libraries/Directory.Build.props +++ b/src/libraries/Directory.Build.props @@ -71,6 +71,7 @@ +