-
Notifications
You must be signed in to change notification settings - Fork 538
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
Make PlatformConfiguration properties trimmable (fixes tvOS compilation) #2717
Make PlatformConfiguration properties trimmable (fixes tvOS compilation) #2717
Conversation
Alternatively, we can add more preprocessor conditional checks for each target, eliminating code blocks during per specific target framework. In this way SkiaSharp for "net7.0-tvos" would never include windows code to begin with. |
@mattleibow hi! How does this PR look? CI build failing seems to be unrelated. |
Retrying thre build. Sometimes the tests explode for no reason. |
The macos tests are still crashing... I have retried 5 times and a fail already retries by default... |
Head branch was pushed to by a user without write access
cb7c83c
to
c579dbd
Compare
@mattleibow that's weird, as with .NET 6+, RuntimeInformation API should simply redirect to OperatingSystem API, making them equivalent (except of trimming capabilities): https://github.com/dotnet/runtime/blob/v6.0.26/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/RuntimeInformation.cs#L52 CI worker only when I tried to revert my changed... I wonder if it's just a consistent fluke or some hidden detail behind CI infra here. |
I see some other PRs are crashing on macOS... I wonder if some of my GC tests are crashing on a newer .net service release. But this is green now, so I am thinking this is intermittant... It can't be the check is crashing the test runner... |
@mattleibow okay. Let me know if any changes are required from my side. I can rebase this PR back to the state where OperatingSystem was used on every platform, not only Windows. |
Maybe do that, let's make this code right and I will continue to investigate why CI is crashing. It looks also to just be the public bot. |
c579dbd
to
a5b4987
Compare
@mattleibow done |
(cherry picked from commit 8c296e5)
Description of Change
Previously SkiaSharp used old APIs to conditionally execute platform specific APIs. Specifically, RuntimeInformation.IsOSPlatform is known to be non-trimmable.
It caused some Windows PInvokes to be included in the non-windows binaries. For most platform it didn't really cause any problems, but apparently tvOS linker is more sensitive (see #2715)
This PR changes PlatformConfiguration class:
OperatingSystem.IsWindows()
method instead of non-trimmableRuntimeInformation.IsOSPlatform (OSPlatform.Windows)
.On .NET6+ targets with trimmer enabled these calls will be eliminated and values will be inlined.
Non trimmed SkiaSharp:
Trimmed SkiaSharp with "-r tvos-arm64" (hint for the compiler to replace OperatingSystem.IsWindows with "false").
As we can see, windows specific class is completely removed as unused.
Bugs Fixed
API Changes
None.
Behavioral Changes
None.
Required skia PR
None.
PR Checklist
This PR should also be backportable with no conflicts.