Skip to content

Commit

Permalink
Use live apphost when publishing ilc as singlefile
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed Jul 17, 2024
1 parent ceccfe0 commit 06128bf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
7 changes: 5 additions & 2 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@
$(CoreClrProjectRoot)tools\AssemblyChecker\AssemblyChecker.csproj" Category="clr" Condition="'$(DotNetBuildSourceOnly)' != 'true'"/>
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2.csproj" Category="clr" />
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler.Build.Tasks\ILCompiler.Build.Tasks.csproj" Category="clr" Condition="'$(NativeAotSupported)' == 'true'" />
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler.csproj" Category="clr" Condition="'$(NativeAotSupported)' == 'true'" />
<ProjectToBuild Include="$(CoreClrProjectRoot)nativeaot\BuildIntegration\BuildIntegration.proj" Category="clr" Condition="'$(NativeAotSupported)' == 'true'" />

<ProjectToBuild Condition="'$(NativeAotSupported)' == 'true' and ('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(HostOS)' != '$(TargetOS)' or '$(EnableNativeSanitizers)' != '')" Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler_crossarch.csproj" Category="clr" />
Expand Down Expand Up @@ -529,13 +528,17 @@

<!-- Packs sets -->

<ItemGroup>
<ProjectToBuild Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Host.sfxproj" Category="packs" Condition="$(_subset.Contains('+packs.product+')) and '$(BuildNativeAOTRuntimePack)' != 'true' and '$(BuildOnlyPgoInstrumentedAssets)' != 'true' and '$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)' and '$(TargetsMobile)' != 'true'" />
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler.csproj" Category="clr" Condition="'$(NativeAotSupported)' == 'true' and $(_subset.Contains('+clr.tools+'))" />
</ItemGroup>

<Choose>
<When Condition="$(_subset.Contains('+packs.product+'))">
<ItemGroup Condition="'$(BuildOnlyPgoInstrumentedAssets)' != 'true'">
<SharedFrameworkProjectToBuild Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Ref.sfxproj" />
</ItemGroup>
<ItemGroup Condition="'$(BuildNativeAOTRuntimePack)' != 'true' and '$(BuildOnlyPgoInstrumentedAssets)' != 'true'">
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)' and '$(TargetsMobile)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Host.sfxproj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' != 'Mono'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)' and '$(TargetsMobile)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-host.proj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)' and '$(TargetsMobile)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-hostfxr.proj" />
Expand Down
27 changes: 14 additions & 13 deletions src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputPath>$(RuntimeBinDir)ilc/</OutputPath>
<RuntimeIdentifier>$(PackageRID)</RuntimeIdentifier>
<RuntimeIdentifier>$(OutputRID)</RuntimeIdentifier>

<!-- Mobile platforms do not have apphost and we don't need it. However, restore requires
"some" apphost; use PackageRID of host machine to satisfy that bogus requirement. -->
<RuntimeIdentifier Condition="'$(TargetsMobile)' == 'true'">$(PackageRID)</RuntimeIdentifier>
</PropertyGroup>

<Import Project="ILCompiler.props" />
<PropertyGroup Condition="'$(UseNativeAotForComponents)' != 'true' and '$(CrossBuild)' == 'true' and '$(TargetsMobile)' != 'true'">
<UseLocalTargetingRuntimePack>true</UseLocalTargetingRuntimePack>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)targetingpacks.targets" Condition="'$(UseNativeAotForComponents)' != 'true' and '$(CrossBuild)' == 'true' and '$(TargetsMobile)' != 'true'" />
<Import Project="$(RepositoryEngineeringDir)codeOptimization.targets" Condition="'$(UseNativeAotForComponents)' != 'true' and '$(CrossBuild)' == 'true' and '$(TargetsMobile)' != 'true'" />

<Import Project="ILCompiler.props" />

<!-- BEGIN: Workaround for https://github.com/dotnet/runtime/issues/67742 -->
<PropertyGroup Condition="'$(BuildingInsideVisualStudio)' != 'true'">
<PublishDir>$(RuntimeBinDir)ilc-published/</PublishDir>
<PublishAot Condition="'$(UseNativeAotForComponents)' == 'true'">true</PublishAot>
<SysRoot Condition="'$(UseNativeAotForComponents)' == 'true' and '$(CrossBuild)' == 'true' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
<PublishReadyToRun Condition="'$(UseNativeAotForComponents)' != 'true'">true</PublishReadyToRun>
<PublishReadyToRun Condition="'$(UseNativeAotForComponents)' != 'true' and '$(UseLocalTargetingRuntimePack)' != 'true'">true</PublishReadyToRun>
<PublishSingleFile Condition="'$(UseNativeAotForComponents)' != 'true'">true</PublishSingleFile>
<PublishTrimmed Condition="'$(UseNativeAotForComponents)' != 'true'">true</PublishTrimmed>
<SuppressGenerateILCompilerExplicitPackageReferenceWarning>true</SuppressGenerateILCompilerExplicitPackageReferenceWarning>
Expand Down Expand Up @@ -88,15 +98,6 @@
<Target Name="PublishCompiler"
Condition="'$(BuildingInsideVisualStudio)' != 'true'"
AfterTargets="Build"
DependsOnTargets="Publish;StompSingleFileHostPath" />
DependsOnTargets="Publish" />

<!-- HACK: liveBuilds stomps over SingleFileHostSourcePath, setting it to the host that we just built.
That's unfortunate because it's not the host we're supposed to use here. -->
<Target Name="StompSingleFileHostPath"
BeforeTargets="ResolveFrameworkReferences">
<PropertyGroup>
<SingleFileHostSourcePath></SingleFileHostSourcePath>
</PropertyGroup>
</Target>
<!-- END: Workaround for https://github.com/dotnet/runtime/issues/67742 -->
</Project>
2 changes: 1 addition & 1 deletion src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<PropertyGroup>
<PublishTrimmed>true</PublishTrimmed>
<RuntimeIdentifier>$(PackageRID)</RuntimeIdentifier>
<RuntimeIdentifier>$(OutputRID)</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<UseLocalAppHostPack>true</UseLocalAppHostPack>
Expand Down

0 comments on commit 06128bf

Please sign in to comment.