Skip to content

Commit cab3a63

Browse files
authored
Use live-built corehost on s390x for creating testhost (#58952)
This allows consuming the dotnet host that was just built instead of relying on a downloaded one. We need to move the `host` subset build before the `libs` subset so that the artifacts are available before externals.csproj runs.
1 parent 854992f commit cab3a63

File tree

4 files changed

+46
-27
lines changed

4 files changed

+46
-27
lines changed

Directory.Build.props

+4
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@
213213
<MicrosoftNetCoreAppRuntimePackNativeDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRuntimePackRidDir)', 'native'))</MicrosoftNetCoreAppRuntimePackNativeDir>
214214
</PropertyGroup>
215215

216+
<PropertyGroup>
217+
<DotNetHostBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', '$(OutputRid).$(Configuration)', 'corehost'))</DotNetHostBinDir>
218+
</PropertyGroup>
219+
216220
<!--Feature switches -->
217221
<PropertyGroup>
218222
<EnableNgenOptimization Condition="'$(EnableNgenOptimization)' == '' and ('$(Configuration)' == 'Release' or '$(Configuration)' == 'Checked')">true</EnableNgenOptimization>

eng/Subsets.props

+25-24
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,14 @@
120120
<SubsetName Include="Mono.WasmRuntime" Description="The WebAssembly runtime." />
121121
<SubsetName Include="Mono.MsCorDbi" Description="The implementation of ICorDebug interface." />
122122
<SubsetName Include="Mono.Workloads" OnDemand="true" Description="Builds the installers and the insertion metadata for Blazor workloads." />
123-
123+
124+
<!-- Host -->
125+
<SubsetName Include="Host" Description="The .NET hosts, packages, hosting libraries, and tests." />
126+
<SubsetName Include="Host.Native" Description="The .NET hosts." />
127+
<SubsetName Include="Host.Pkg" Description="The .NET host packages." />
128+
<SubsetName Include="Host.Tools" Description="The .NET hosting libraries." />
129+
<SubsetName Include="Host.Tests" Description="The .NET hosting tests." />
130+
124131
<!-- Libs -->
125132
<SubsetName Include="Libs" Description="The libraries native part, refs and source assemblies, test infra and packages, but NOT the tests (use Libs.Tests to request those explicitly)" />
126133
<SubsetName Include="Libs.Native" Description="The native libraries used in the shared framework." />
@@ -130,13 +137,6 @@
130137
<SubsetName Include="Libs.Packages" Description="The projects that produce NuGet packages from libraries." />
131138
<SubsetName Include="Libs.Tests" OnDemand="true" Description="The test projects. Note that building this doesn't execute tests: you must also pass the '-test' argument." />
132139

133-
<!-- Host -->
134-
<SubsetName Include="Host" Description="The .NET hosts, packages, hosting libraries, and tests." />
135-
<SubsetName Include="Host.Native" Description="The .NET hosts." />
136-
<SubsetName Include="Host.Pkg" Description="The .NET host packages." />
137-
<SubsetName Include="Host.Tools" Description="The .NET hosting libraries." />
138-
<SubsetName Include="Host.Tests" Description="The .NET hosting tests." />
139-
140140
<!-- Packs -->
141141
<SubsetName Include="Packs" Description="Builds the shared framework packs, archives, bundles, installers, and the framework pack tests." />
142142
<SubsetName Include="Packs.Product" Description="Builds the shared framework packs, archives, bundles, and installers." />
@@ -264,6 +264,22 @@
264264
<ProjectToBuild Include="$(WorkloadsProjectRoot)\workloads.csproj" Category="mono" />
265265
</ItemGroup>
266266

267+
<!-- Host sets -->
268+
<ItemGroup Condition="$(_subset.Contains('+host.native+'))">
269+
<CorehostProjectToBuild Include="$(SharedNativeRoot)corehost\corehost.proj" SignPhase="Binaries" BuildInParallel="false" />
270+
<ProjectToBuild Include="@(CorehostProjectToBuild)" Pack="true" Category="host" />
271+
</ItemGroup>
272+
273+
<ItemGroup Condition="$(_subset.Contains('+host.tools+'))">
274+
<ManagedProjectToBuild Include="$(InstallerProjectRoot)managed\**\*.csproj" SignPhase="Binaries" />
275+
<ProjectToBuild Include="@(ManagedProjectToBuild)" BuildInParallel="true" Pack="true" Category="host" />
276+
</ItemGroup>
277+
278+
<ItemGroup Condition="$(_subset.Contains('+host.pkg+')) and '$(PgoInstrument)' != 'true'">
279+
<PkgprojProjectToBuild Include="$(InstallerProjectRoot)pkg\projects\host-packages.proj" SignPhase="MsiFiles" BuildInParallel="false" />
280+
<ProjectToBuild Include="@(PkgprojProjectToBuild)" Pack="true" Category="host" />
281+
</ItemGroup>
282+
267283
<!-- Libraries sets -->
268284
<ItemGroup Condition="$(_subset.Contains('+libs.native+'))">
269285
<ProjectToBuild Include="$(LibrariesProjectRoot)Native\build-native.proj" Category="libs" />
@@ -289,22 +305,7 @@
289305
<ProjectToBuild Include="$(LibrariesProjectRoot)tests.proj" Category="libs" Test="true" />
290306
</ItemGroup>
291307

292-
<!-- Host sets -->
293-
<ItemGroup Condition="$(_subset.Contains('+host.native+'))">
294-
<CorehostProjectToBuild Include="$(SharedNativeRoot)corehost\corehost.proj" SignPhase="Binaries" BuildInParallel="false" />
295-
<ProjectToBuild Include="@(CorehostProjectToBuild)" Pack="true" Category="host" />
296-
</ItemGroup>
297-
298-
<ItemGroup Condition="$(_subset.Contains('+host.tools+'))">
299-
<ManagedProjectToBuild Include="$(InstallerProjectRoot)managed\**\*.csproj" SignPhase="Binaries" />
300-
<ProjectToBuild Include="@(ManagedProjectToBuild)" BuildInParallel="true" Pack="true" Category="host" />
301-
</ItemGroup>
302-
303-
<ItemGroup Condition="$(_subset.Contains('+host.pkg+')) and '$(PgoInstrument)' != 'true'">
304-
<PkgprojProjectToBuild Include="$(InstallerProjectRoot)pkg\projects\host-packages.proj" SignPhase="MsiFiles" BuildInParallel="false" />
305-
<ProjectToBuild Include="@(PkgprojProjectToBuild)" Pack="true" Category="host" />
306-
</ItemGroup>
307-
308+
<!-- Host.tests subset (consumes live built libraries assets so needs to come after libraries) -->
308309
<ItemGroup Condition="$(_subset.Contains('+host.tests+'))">
309310
<TestProjectToBuild Include="$(InstallerProjectRoot)tests\Microsoft.NET.HostModel.Tests\AppHost.Bundle.Tests\AppHost.Bundle.Tests.csproj" />
310311
<TestProjectToBuild Include="$(InstallerProjectRoot)tests\Microsoft.NET.HostModel.Tests\Microsoft.NET.HostModel.AppHost.Tests\Microsoft.NET.HostModel.AppHost.Tests.csproj" />

src/installer/pkg/Directory.Build.props

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
<PropertyGroup>
55
<Platform>$(TargetArchitecture)</Platform>
6-
<DotNetHostBinDir>$(ArtifactsBinDir)$(OutputRid).$(Configuration)\corehost</DotNetHostBinDir>
76
</PropertyGroup>
87

98
<PropertyGroup>

src/libraries/externals.csproj

+17-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99
<BinPlaceNative>true</BinPlaceNative>
1010
<BinPlaceRuntime>false</BinPlaceRuntime>
1111
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
12+
<UseLiveBuiltDotNetHost Condition="'$(TargetArchitecture)' == 's390x'">true</UseLiveBuiltDotNetHost>
1213
</PropertyGroup>
1314

1415
<ItemGroup Condition="'$(DotNetBuildFromSource)' != 'true'">
1516
<PackageReference Include="Microsoft.DiaSymReader.Native"
1617
Version="$(MicrosoftDiaSymReaderNativeVersion)" />
1718
</ItemGroup>
1819

19-
<ItemGroup Condition="'$(TargetsMobile)' != 'true'">
20+
<ItemGroup Condition="'$(TargetsMobile)' != 'true' and '$(UseLiveBuiltDotNetHost)' != 'true'">
2021
<PackageReference Include="Microsoft.NETCore.DotNetHost"
2122
Version="$(MicrosoftNETCoreDotNetHostVersion)" />
2223
<PackageReference Include="Microsoft.NETCore.DotNetHostPolicy"
@@ -38,17 +39,31 @@
3839
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="'%(Filename)' == 'apphost'" />
3940
</ItemGroup>
4041

41-
<ItemGroup>
42+
<ItemGroup Condition="'$(UseLiveBuiltDotNetHost)' != 'true'">
4243
<HostFxFile Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == 'hostfxr' or
4344
'%(ReferenceCopyLocalPaths.Filename)' == 'libhostfxr'" />
4445
<DotnetExe Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == 'dotnet'" />
4546
</ItemGroup>
4647

48+
<ItemGroup Condition="'$(UseLiveBuiltDotNetHost)' == 'true'">
49+
<CoreHostFiles Include="$(DotNetHostBinDir)*" />
50+
<HostFxFile Include="@(CoreHostFiles)" Condition="'%(CoreHostFiles.Filename)' == 'hostfxr' or
51+
'%(CoreHostFiles.Filename)' == 'libhostfxr'" />
52+
<HostPolicyFile Include="@(CoreHostFiles)" Condition="'%(CoreHostFiles.Filename)' == 'hostpolicy' or
53+
'%(CoreHostFiles.Filename)' == 'libhostpolicy'" />
54+
<DotnetExe Include="@(CoreHostFiles)" Condition="'%(CoreHostFiles.Filename)' == 'dotnet'" />
55+
</ItemGroup>
56+
4757
<Copy SourceFiles="@(HostFxFile)"
4858
DestinationFolder="$(NetCoreAppCurrentTestHostPath)host\fxr\$(ProductVersion)"
4959
SkipUnchangedFiles="true"
5060
UseHardlinksIfPossible="$(UseHardlink)" />
5161

62+
<Copy SourceFiles="@(HostPolicyFile)"
63+
DestinationFolder="$(NetCoreAppCurrentTestHostPath)shared\Microsoft.NETCore.App\$(ProductVersion)"
64+
SkipUnchangedFiles="true"
65+
UseHardlinksIfPossible="$(UseHardlink)" />
66+
5267
<Copy SourceFiles="@(DotnetExe)"
5368
DestinationFolder="$(NetCoreAppCurrentTestHostPath)"
5469
SkipUnchangedFiles="true"

0 commit comments

Comments
 (0)