Skip to content

Move AddKeepAlives trimmer step to standalone MSBuild task#10952

Draft
sbomer wants to merge 2 commits intomainfrom
dev/sbomer/addkeepalives-inner
Draft

Move AddKeepAlives trimmer step to standalone MSBuild task#10952
sbomer wants to merge 2 commits intomainfrom
dev/sbomer/addkeepalives-inner

Conversation

@sbomer
Copy link
Member

@sbomer sbomer commented Mar 16, 2026

Migrate AddKeepAlivesStep out of the ILLink custom step pipeline into a standalone MSBuild task that runs AfterTargets="ILLink", following the same pattern established by StripEmbeddedLibraries in #10894.

Core IL-rewriting logic is extracted into AddKeepAlivesHelper, shared by both the new task (trimmed builds) and the existing pipeline step (non-trimmed builds via LinkAssembliesNoShrink).

Migrate AddKeepAlivesStep out of the ILLink custom step pipeline into a
standalone MSBuild task that runs AfterTargets="ILLink", following the
same pattern established by StripEmbeddedLibraries in #10894.

Core IL-rewriting logic is extracted into AddKeepAlivesHelper, shared by
both the new task (trimmed builds) and the existing pipeline step
(non-trimmed builds via LinkAssembliesNoShrink).
{
var resolver = new DefaultAssemblyResolver ();
var cache = new TypeDefinitionCache ();
var searchDirectories = new HashSet<string> (StringComparer.OrdinalIgnoreCase);
Copy link
Member

Choose a reason for hiding this comment

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

Is there a way we can create a new "pipeline-like" task and merge the logic here with the <StripEmbeddedLibraries/> MSBuild task? We could pick a name like <PostTrimming/> or something?

These will open/close all assemblies each time, and it would be nice if we'd just open them all once and slowly move steps into a shared MSBuild task.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, planning to do that! Just wanted to get it working standalone before figuring out what needs to be shared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants