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

[Xamarin.Android.Build.Tasks] remove @(_AndroidAssemblySkipCases) #8622

Merged

Conversation

jonathanpeppers
Copy link
Member

In an effort to remove old, unused code, we should be able to remove the following related to the old Android.Support.* libraries:

  • Xamarin.Android.SkipCases.projitems and the @(_AndroidAssemblySkipCases) item group.

This was a build performance optimization added in 02c07ed that would skip a build step that normalized casing for .dll files with an embedded __AndroidLibraryProjects__.zip. This optimization is not needed at all for .aar files.

In .NET 9 projects, we don't create or embed __AndroidLibraryProjects__.zip, so modern projects don't need this optimization. Instead we bundle a MyLibrary.aar alongside MyLibrary.dll inside of a MyLibrary NuGet package.

  • Automatic trimming of the Xamarin.Android.Support.* assemblies

Modern packages mark themselves trimmable with $(IsTrimmable) or the assembly-level attribute. Let's just remove the case for Android.Support here.

In an effort to remove old, unused code, we should be able to remove the
following related to the old Android.Support.* libraries:

* `Xamarin.Android.SkipCases.projitems` and the
  `@(_AndroidAssemblySkipCases)` item group.

This was a build performance optimization added in 02c07ed that would
*skip* a build step that normalized casing for `.dll` files with an
embedded `__AndroidLibraryProjects__.zip`. This optimization is not
needed at all for `.aar` files.

In .NET 9 projects, we don't create or embed
`__AndroidLibraryProjects__.zip`, so modern projects don't need this
optimization. Instead we bundle a `MyLibrary.aar` alongside
`MyLibrary.dll` inside of a `MyLibrary` NuGet package.

* Automatic trimming of the `Xamarin.Android.Support.*` assemblies

Modern packages mark themselves trimmable with `$(IsTrimmable)` or the
assembly-level attribute. Let's just remove the case for
`Android.Support` here.
@jpobst
Copy link
Contributor

jpobst commented Jan 9, 2024

We've been marking all of our packages as <IsTrimmable> for nearly 2 years now, so we can probably remove all of the hardcoding there if we want.

@jonathanpeppers
Copy link
Member Author

We've been marking all of our packages as <IsTrimmable> for nearly 2 years now, so we can probably remove all of the hardcoding there if we want.

I will try it at some point, but there are some Xamarin.Forms app size tests that will probably fail:

https://github.com/xamarin/xamarin-android/blob/af7c12c7cd0a77e5024da4c60aad903984e855fa/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj#L13

We might need to move this test to Xamarin.Forms 5.x, as I bet this project's dependencies are ancient.

@jonathanpeppers jonathanpeppers marked this pull request as ready for review January 10, 2024 14:31
@jonathanpeppers jonathanpeppers merged commit a52fbcb into dotnet:main Jan 10, 2024
47 checks passed
@jonathanpeppers jonathanpeppers deleted the _AndroidAssemblySkipCases branch January 10, 2024 16:46
grendello added a commit that referenced this pull request Jan 11, 2024
* main:
  [ci] Add exe files to API Scan (#8617)
  [Microsoft.Android.Templates] New files should open editor (#8623)
  [Xamarin.Android.Build.Tasks] remove `@(_AndroidAssemblySkipCases)` (#8622)
@github-actions github-actions bot locked and limited conversation to collaborators Feb 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants