[android] don't include .so files in class libraries - #1895
Merged
Conversation
Fixes: dotnet/android#6545 If you do: 1. File -> New Xamarin.Android class library 2. Add `<PackageReference Include="SkiaSharp" Version="2.80.3" />` You end up with 13MB `.dll` file with C# code inside! The class library is redistributing the SkiaSharp native libraries. `$(ShouldIncludeNativeSkiaSharp)` should default to `False` for class libraries. To test this change, I manually edited: %userprofile%\.nuget\packages\skiasharp\2.80.3\build\monoandroid1.0\SkiaSharp.targets %userprofile%\.nuget\packages\skiasharp\2.80.3\buildTransitive\monoandroid1.0\SkiaSharp.targets Now my class library is 76,800 bytes. When consuming this class library in an Android application project, everything should still work as expected. However, the application will need to reference SkiaSharp -- which is actually ideal.
This was referenced Dec 17, 2021
Member
Author
|
/cc @mattleibow, looks like I don't have permission to add you as reviewer. |
mattleibow
approved these changes
Jan 10, 2022
Contributor
|
This is a good change because I basically did something like this for HarfBuzzSharp. Previously there was logic to include the native binaries, but was then updated to actually be a no-op - the .targets file is now empty. In this case, we actually should have done the same and deleted the .targets file. However, we still need to preserve the functionality of the |
mattleibow
approved these changes
Jan 10, 2022
mattleibow
approved these changes
Jan 10, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: dotnet/android#5776
Fixes: dotnet/android#6545
If you do:
<PackageReference Include="SkiaSharp" Version="2.80.3" />You end up with 13MB
.dllfile with C# code inside! The classlibrary is redistributing the SkiaSharp native libraries.
$(ShouldIncludeNativeSkiaSharp)should default toFalsefor classlibraries.
To test this change, I manually edited:
Now my class library is 76,800 bytes.
When consuming this class library in an Android application project,
everything should still work as expected. However, the application
will need to reference SkiaSharp -- which is actually ideal.
API Changes
None
PR Checklist