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

IsTrimmable metadata requirement is not flexible enough #11863

Closed
marek-safar opened this issue Jun 3, 2020 · 6 comments
Closed

IsTrimmable metadata requirement is not flexible enough #11863

marek-safar opened this issue Jun 3, 2020 · 6 comments
Assignees
Labels
untriaged Request triage from a team member

Comments

@marek-safar
Copy link
Contributor

We need to simplify how any of our SDKs can be enabled for true (aggressive) linking and ideally the same approach could be used for component vendors or any other NuGet packages. Nowadays this process is controlled using IsTrimmable metadata but there is no easy way to set this within NuGet package or runtime-pack and it can be set only at consuming side.

We could also redo this very restrictive setup and consider making any assembly illinker compatible when it has a certain assembly-level attribute (e.g. ILLinkCompatibility ("link"). This attribute could even be automatically generated by our tooling as part of the build when linker does not report any warnings.

@sbomer @vitek-karas

@marcpopMSFT marcpopMSFT added the untriaged Request triage from a team member label Jun 10, 2020
@marek-safar
Copy link
Contributor Author

/cc @sbomer @vitek-karas

@sbomer
Copy link
Member

sbomer commented Jun 11, 2020

To give some more context:
IsTrimmable is an opt-in metadata that can be set on the framework definitions, and it flows to the ItemGroups that are input to the linker build logic. Any inputs which are not IsTrimmable currently get passed through to the linker as root assemblies, with the action set to "copy" (which is as close as we get to a pass-through mode today, see dotnet/linker#639).

There are a few asks here:

I am planning to do #12035 for .NET 5. How do we want to prioritize the rest? Are there any other parts to this that I missed?

@marek-safar
Copy link
Contributor Author

Support IsTrimmable on nuget packages

I don't think that's the same thing. Doing manual edits in projects and set IsTrimmable to true for NuGets which are linker friendly is not great.

I think we should discuss it at dotnet/linker#1194 or open a new issue if they are sufficiently different.

I think that's a very different concept and will open another issue then

How do we want to prioritize the rest?

#12035 is required and we also need a solution for component vendors to make their NuGets to be automatically linked which I think is the second large missing piece today

@vitek-karas
Copy link
Member

I must admit I'm a bit nervous adding official looking support for more aggressive trimming given that for .NET 5 we won't have the correctness in place. Hopefully in 6 we will be able to revisit this and somehow tie correctness into it as well.

@sbomer
Copy link
Member

sbomer commented Jun 12, 2020

Doing manual edits in projects and set IsTrimmable to true for NuGets which are linker friendly is not great.

I see - so you are asking for it to be defined by the package itself. I agree that the right place to do this is in the assembly or an extra file, rather than the package manifest for example.

I'm a bit nervous adding official looking support for more aggressive trimming

I could make it a non-public option for now - I think it makes sense to add even just for linker developers. I have lost count of the number of times I have had to add sizeable msbuild snippets to my project just to get this behavior. :)

@sbomer
Copy link
Member

sbomer commented Jun 12, 2020

I will close this for now - we can discuss in the linked issues, or re-open if there are more missing pieces.

@sbomer sbomer closed this as completed Jun 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

5 participants