Skip to content

Fix illink task lock during live build #92928

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

Merged
merged 2 commits into from
Oct 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions eng/illink.targets
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
we might be able to use built-in functionality instead of a packagereference.
-->
<_RequiresILLinkPack>false</_RequiresILLinkPack>
<ILLinkTasksAssembly>$(ToolsILLinkDir)$(NetCoreAppToolCurrent)/ILLink.Tasks.dll</ILLinkTasksAssembly>
<ILLinkTasksAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">$(ToolsILLinkDir)$(NetCoreAppToolCurrent)\ILLink.Tasks.dll</ILLinkTasksAssembly>
<ILLinkTasksAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">$(ToolsILLinkDir)$(NetFrameworkToolCurrent)\ILLink.Tasks.dll</ILLinkTasksAssembly>
Copy link
Member

Choose a reason for hiding this comment

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

Thanks a lot for investigating and fixing this @ViktorHofer!

It sounds like this line was the piece that fixed it, right? So do we still need the TaskFactory="TaskHostFactory" changes? I don't think our build should be attempting to update ILLink.Tasks after using it (it should be built just once, before it's used).

Copy link
Member

Choose a reason for hiding this comment

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

The VS build node msbuild.exe processes are long-lived so it could break if you ever modified ILLink.Tasks between builds too. TaskHostFactory is what we generally recommend for any task that's built and used in the same repo.

Copy link
Member

Choose a reason for hiding this comment

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

I see, good to know. Thanks!

<PrepareResourcesDependsOn>_EmbedILLinkXmls;$(PrepareResourcesDependsOn)</PrepareResourcesDependsOn>
<TargetsTriggeredByCompilation Condition="'$(DesignTimeBuild)' != 'true'">$(TargetsTriggeredByCompilation);ILLinkTrimAssembly</TargetsTriggeredByCompilation>

Expand Down Expand Up @@ -119,7 +120,10 @@
</ItemGroup>
</Target>

<UsingTask TaskName="CombineLinkerXmlFiles" AssemblyFile="$(ILLinkTasksAssembly)" Condition="'$(ILLinkTasksAssembly)' != ''" />
<UsingTask TaskName="CombineLinkerXmlFiles"
AssemblyFile="$(ILLinkTasksAssembly)"
TaskFactory="TaskHostFactory"
Condition="'$(ILLinkTasksAssembly)' != ''" />
<Target Name="_CombineILLinkDescriptorsXmls"
Condition="'@(ILLinkDescriptorsXmls)' != ''"
Inputs="@(ILLinkDescriptorsXmls)"
Expand Down Expand Up @@ -212,7 +216,10 @@

<!-- Examines the "input assembly" for IL that is unreachable from public API and trims that,
rewriting the assembly to an "output assembly" -->
<UsingTask TaskName="ILLink" AssemblyFile="$(ILLinkTasksAssembly)" Condition="'$(ILLinkTasksAssembly)' != ''" />
<UsingTask TaskName="ILLink"
AssemblyFile="$(ILLinkTasksAssembly)"
TaskFactory="TaskHostFactory"
Condition="'$(ILLinkTasksAssembly)' != ''" />
<Target Name="ILLinkTrimAssembly"
Condition="'$(ILLinkTrimAssembly)' == 'true'"
DependsOnTargets="PrepareForAssembliesTrim">
Expand Down