Skip to content

[NativeAOT] Update ILCompiler paths to handle PublishAotUsingRuntimePack=true - #85996

Closed
filipnavara wants to merge 1 commit into
dotnet:mainfrom
filipnavara:nativeaot-runtimepack-paths
Closed

[NativeAOT] Update ILCompiler paths to handle PublishAotUsingRuntimePack=true#85996
filipnavara wants to merge 1 commit into
dotnet:mainfrom
filipnavara:nativeaot-runtimepack-paths

Conversation

@filipnavara

Copy link
Copy Markdown
Member

When using PublishAotUsingRuntimePack we need to update the logic to get native libraries from the runtime pack, and not to replace the framework files with the host ILCompiler ones.

This PR is minimal attempt that does the job but we can do better. There's a lot of logic for the framework file substitution that is not necessary when using the runtime pack since we already start with the correct set of files.

cc @akoeplinger

@ghostghost added area-NativeAOT-coreclr community-contribution Indicates that the PR has been added by a community member labels May 9, 2023
@ghost

ghost commented May 9, 2023

Copy link
Copy Markdown

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details

When using PublishAotUsingRuntimePack we need to update the logic to get native libraries from the runtime pack, and not to replace the framework files with the host ILCompiler ones.

This PR is minimal attempt that does the job but we can do better. There's a lot of logic for the framework file substitution that is not necessary when using the runtime pack since we already start with the correct set of files.

cc @akoeplinger

Author:filipnavara
Assignees:-
Labels:

community-contribution, area-NativeAOT-coreclr

Milestone:-

@filipnavara
filipnavara marked this pull request as ready for review May 16, 2023 15:19
<ItemGroup Condition="'$(PublishAotUsingRuntimePack)' == 'true'">
<PrivateSdkAssemblies Include="$(IlcFrameworkSdkPath)*.dll"/>
<FrameworkAssemblies Include="@(RuntimePackAsset)" Condition="'%(Extension)' == '.dll'" />
<DefaultFrameworkAssemblies Include="@(FrameworkAssemblies)" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why aren't PrivateSdkAssemblies included in DefaultFrameworkAssemblies in this case?

@filipnavarafilipnavaraMay 19, 2023

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

It's not exactly intuitive but RuntimePackAsset already contains the files that end up in PrivateSdkAssemblies, so FrameworkAssemblies already contains the union of the two sets.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Also, FrameworkAssemblies itself is not used beyond this point, so the additional assemblies included in it have no effect.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, FrameworkAssemblies itself is not used beyond this point, so the additional assemblies included in it have no effect.

Sorry, I got confused with this.
Aren't FrameworkAssemblies used through DefaultFrameworkAssemblies to populate IlcReference:

<IlcReferenceInclude="@(DefaultFrameworkAssemblies)" />

@filipnavarafilipnavaraMay 19, 2023

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

DefaultFrameworkAssemblies is used beyond the point and it's expected to contain the union of lib/net8.0/*.dll and native/*.dll from the runtime pack.

In the case of PublishAotUsingRuntimePack=false these come from two different source directories and get merged into one DefaultFrameworkAssemblies item group.

In the case of PublishAotUsingRuntimePack=true all the files in the DefaultFrameworkAssemblies item group come from the RuntimePackAsset item group which already contains both the lib/net8.0/*.dll files and the native/*.dll files.

I was just trying to clarify that FrameworkAssemblies in the PublishAotUsingRuntimePack=true case will also include PrivateSdkAssemblies (native/*.dll), while in the PublishAotUsingRuntimePack=false case it won't include those files. However, FrameworkAssemblies itself is not used beyond this point, so the distinction doesn't matter.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I can just rewrite it as to make it clearer:

- <FrameworkAssemblies Include="@(RuntimePackAsset)" Condition="'%(Extension)' == '.dll'" />- <DefaultFrameworkAssemblies Include="@(FrameworkAssemblies)" />+ <DefaultFrameworkAssemblies Include="@(RuntimePackAsset)" Condition="'%(Extension)' == '.dll'" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you very much for the clarification!

Regarding your last comment:

I can just rewrite it as to make it clearer:

Would it make sense to keep having a single ItemGroup and just distinguish what gets included in DefaultFrameworkAssemblies based on PublishAotUsingRuntimePack value?

<ItemGroup>
<PrivateSdkAssemblies Include="$(IlcSdkPath)*.dll" />
<ItemGroup Condition="'$(PublishAotUsingRuntimePack)' == 'true'">
<PrivateSdkAssemblies Include="$(IlcFrameworkSdkPath)*.dll"/>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it make sense to name this IlcPrivateSdkPath since that's where PrivateSdkAssemblies come from?

Suggested change
<PrivateSdkAssembliesInclude="$(IlcFrameworkSdkPath)*.dll"/>
<PrivateSdkAssembliesInclude="$(IlcPrivateSdkPath)*.dll"/>

@filipnavara

Copy link
Copy Markdown
MemberAuthor

Superceded by #86652

rolfbjarne added a commit to rolfbjarne/macios that referenced this pull request Jun 6, 2023
rolfbjarne added a commit to rolfbjarne/macios that referenced this pull request Jun 6, 2023
rolfbjarne added a commit to rolfbjarne/macios that referenced this pull request Jun 7, 2023
rolfbjarne added a commit to rolfbjarne/macios that referenced this pull request Jun 9, 2023
rolfbjarne added a commit to rolfbjarne/macios that referenced this pull request Jun 13, 2023
rolfbjarne added a commit to rolfbjarne/macios that referenced this pull request Jun 15, 2023
@ghostghost locked as resolved and limited conversation to collaborators Jul 5, 2023
@filipnavara
filipnavara deleted the nativeaot-runtimepack-paths branch June 5, 2025 07:36
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-NativeAOT-coreclrcommunity-contributionIndicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@filipnavara@MichalStrehovsky@ivanpovazan