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

[workload] Remove Microsoft.Maui.Extensions pack #5918

Merged
merged 5 commits into from
May 31, 2022

Conversation

pjcollins
Copy link
Member

@pjcollins pjcollins commented Apr 8, 2022

Reduces the number of nupkgs and msi files we produce and distribute by
moving the PackageReferences declared in Microsoft.Maui.Extensions to
BundledVersions.targets

@Eilon Eilon added the area-setup Installation, setup, requirements, maui-check, workloads, platform support label Apr 8, 2022
Reduces the number of nupkgs and msi files we produce and distribute by
combining the Microsoft.Maui.Dependencies and Microsoft.Maui.Extensions
library packs into one.
@@ -60,9 +60,6 @@
</ItemGroup>

<!-- These implicit <PackageReference/> pull dependencies from NuGet transitively -->
<ItemGroup Condition=" '$(UseMaui)' == 'true' or '$(UseMauiCore)' == 'true' ">
<PackageReference Include="Microsoft.Maui.Extensions" Version="$(MauiVersion)" IsImplicitlyDefined="true" />
</ItemGroup>
<ItemGroup Condition=" '$(UseMaui)' == 'true' or '$(UseMauiCore)' == 'true' or '$(UseMauiEssentials)' == 'true' ">
<PackageReference Include="Microsoft.Maui.Dependencies" Version="$(MauiVersion)" IsImplicitlyDefined="true" />
</ItemGroup>
Copy link
Member Author

Choose a reason for hiding this comment

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

@mattleibow and @jonathanpeppers I had a question around $(UseMauiEssentials)=true, as I am not too familiar with where/how that is used. It seems that projects that set this property to true will now get Microsoft.Extensions package references by default through Microsoft.Maui.Dependencies, but this may not be any different from how things are set up today? Are there cases where a project could be using $(UseMauiEssentials)=true without them using the MAUI workload or also setting $(UseMaui) to true?

Copy link
Member

Choose a reason for hiding this comment

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

If you did dotnet new android and then UseMauiEssentials=true, it would be like using Xamarin.Essentials without Xamarin.Forms.

With this change, you'd also get Microsoft.Extensions packages, but it seems like that would be OK?

Copy link
Member

Choose a reason for hiding this comment

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

Not sure... There is a lot of extra things now I suppose such as the logging, config and more.

I suppose the linker will remove it?

What happens when we switch to library packs and no longer use this nuget?

Copy link
Member

Choose a reason for hiding this comment

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

I suppose the linker will remove it?

It looks like Microsoft.Extensions takes up ~148kb uncompressed in a dotnet new maui app. It doesn't look like they are marked as trimmable yet.

But I think if the app doesn't use them at all, they would get dropped? csc would exclude them?

What happens when we switch to library packs and no longer use this nuget?

I think this change actually helps this, as you are getting rid of a pack.

@pjcollins pjcollins marked this pull request as ready for review April 12, 2022 20:23
Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

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

Changing this to a non mergable state just to get feedback from @rmarinho and @Redth

@PureWeen PureWeen added the do-not-merge Don't merge this PR label Apr 25, 2022
@pjcollins
Copy link
Member Author

I tried to get some more info around possible app size implications for the Essentials case. I took the example of creating a dotnet new android project, setting UseMauiEssentials=true, and adding a really simple Barometer example to the template.

File sizes for a Release build are near identical:

Before Merge After Merging Dependencies and Extensions
aab - 17,975,539 bytes aab - 17,975,595 bytes
apk - 19,013,606 bytes apk - 19,013,606 bytes

A binlog also seems to show that these extra references are being removed by ILLink in this scenario, and they are not included in the @(ResolvedFileToPublish) output of that target:

image

Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

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

What Peppers said. 🤗

@pjcollins pjcollins changed the title [workload] Merge Dependencies and Extensions packs [workload] Remove Microsoft.Maui.Extensions pack Apr 29, 2022
@pjcollins pjcollins requested a review from mattleibow April 29, 2022 16:00
@pjcollins
Copy link
Member Author

@mattleibow @jonathanpeppers I'm not sure if we want to hold this until .NET 7 at this point? I think it should be ready now though.

@pjcollins
Copy link
Member Author

@mattleibow @rmarinho @jonathanpeppers is main open for .NET 7 related things like this? I think we should be good to merge this, unless there is a separate .NET 7 branch that this should go to instead?

@jonathanpeppers
Copy link
Member

Should we put it on the net7.0 branch?

@pjcollins pjcollins changed the base branch from main to net7.0 May 26, 2022 15:59
@pjcollins
Copy link
Member Author

No conflicts after changing the base to net7.0 if we want to merge it there. I assume net7.0 will merge back into main eventually?

@pjcollins pjcollins removed the do-not-merge Don't merge this PR label May 26, 2022
@jonathanpeppers jonathanpeppers merged commit dcde143 into dotnet:net7.0 May 31, 2022
mattleibow pushed a commit that referenced this pull request Jun 21, 2022
Reduces the number of nupkgs and msi files we produce and distribute by
removing the Microsoft.Maui.Extensions library pack.

Instead the packages are added via:

    --<PackageReference Include="Microsoft.Maui.Extensions" Version="$(MauiVersion)" IsImplicitlyDefined="true" />
    ++<PackageReference Include="Microsoft.Extensions.Configuration" Version="@MicrosoftExtensionsServicingPackageVersion@" IsImplicitlyDefined="true" />
    ++<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="@MicrosoftExtensionsPackageVersion@" IsImplicitlyDefined="true" />
    ++<PackageReference Include="Microsoft.Extensions.Logging" Version="@MicrosoftExtensionsPackageVersion@" IsImplicitlyDefined="true" />
    ++<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="@MicrosoftExtensionsServicingPackageVersion@" IsImplicitlyDefined="true" />

So projects that only have `UseMauiEssentials` won't get these packages, the behavior
should be the same, we just dropped 1 pack.
# Conflicts:
#	src/Workload/Microsoft.Maui.Sdk/Sdk/BundledVersions.in.targets
@pjcollins pjcollins deleted the merge-deps-exts branch June 30, 2022 18:24
@github-actions github-actions bot locked and limited conversation to collaborators Dec 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-setup Installation, setup, requirements, maui-check, workloads, platform support fixed-in-7.0.0-rc.1.6683
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants