Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use live apphost when publishing ilc as singlefile #105004

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
5 changes: 4 additions & 1 deletion eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,11 @@ extends:
jobParameters:
testScope: innerloop
nameSuffix: CoreCLR
buildArgs: -s clr+libs+host+packs -c $(_BuildConfig) -rc Checked
buildArgs: -s clr+libs+host+packs -c $(_BuildConfig) -rc Checked -p:NativeAotSupported=false
am11 marked this conversation as resolved.
Show resolved Hide resolved
timeoutInMinutes: 120
postBuildSteps:
- script: $(Build.SourcesDirectory)/build$(scriptExt) ${{ variables.debugOnPrReleaseOnRolling }} -s clr.tools+packs -c $(_BuildConfig) -rc Checked -cross -os freebsd
displayName: Build clr.tools and packs
condition: >-
or(
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true),
Expand Down
22 changes: 8 additions & 14 deletions src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputPath>$(RuntimeBinDir)ilc/</OutputPath>
<RuntimeIdentifier>$(PackageRID)</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(_IsPublishing)' != 'true'">$(PackageRID)</RuntimeIdentifier>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the _IsPublishing property set?

@agocke's comment #107772 (comment) makes it sound like the _IsPublishing is not set as expected in this project.

Copy link
Member

@agocke agocke Sep 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now the dotnet CLI sets _IsPublishing when running dotnet publish but it's everyone else's responsibility to set it when running the Publish target (I don't like this behavior, fyi). As far as I can tell, ILCompiler doesn't guarantee this is set, currently.

<RuntimeIdentifier Condition="'$(_IsPublishing)' == 'true'">$(OutputRID)</RuntimeIdentifier>
<UseLocalTargetingRuntimePack Condition="'$(UseNativeAotForComponents)' != 'true' and '$(CrossBuild)' == 'true' and '$(TargetOS)' != '$(HostOS)' and '$(TargetsMobile)' != 'true'">true</UseLocalTargetingRuntimePack>
</PropertyGroup>

<Import Project="ILCompiler.props" />
<Import Project="$(RepositoryEngineeringDir)targetingpacks.targets" Condition="'$(UseLocalTargetingRuntimePack)' == 'true'" />
<Import Project="$(RepositoryEngineeringDir)codeOptimization.targets" Condition="'$(UseLocalTargetingRuntimePack)' == '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>
</PropertyGroup>
Expand Down Expand Up @@ -82,15 +85,6 @@
<Target Name="PublishCompiler"
am11 marked this conversation as resolved.
Show resolved Hide resolved
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 -->
am11 marked this conversation as resolved.
Show resolved Hide resolved
</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
4 changes: 3 additions & 1 deletion src/installer/pkg/projects/netcoreappRIDs.props
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
built during official builds, however we wish to include them
in our runtime.json to enable others to provide them. -->
<UnofficialBuildRID Include="freebsd-x64" />
<UnofficialBuildRID Include="freebsd-arm64" />
<UnofficialBuildRID Include="freebsd-arm64">
<Platform>arm64</Platform>
</UnofficialBuildRID>
<UnofficialBuildRID Include="tizen.4.0.0-armel">
<Platform>armel</Platform>
</UnofficialBuildRID>
Expand Down