-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Enable assembly trimming and single-file publish on all platforms #1419
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
Draft
mjcheetham
wants to merge
11
commits into
git-ecosystem:main
Choose a base branch
from
mjcheetham:publish-trim
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
4fa39ba to
a958838
Compare
a958838 to
effdac4
Compare
dd98457 to
07416b1
Compare
Annotate any OS or platform specific code with the new (Un)SupportedOSPlatform(Guard) attributes and update various platform util methods to use the OperatingSystem.Is<platform> methods. This will help ensure we're not missing any OS checks in the future. For test projects we ignore these warnings since we're using skipping Xunit tests that are not applicable for the current platform already, making these warnings just noise.
Update Avalonia dependencies to 11.3.8.
07416b1 to
bfb16ec
Compare
Enable compression of assemblies in the single-file distribution of GCM. This helps reduce the overall size on disk of GCM, which is important on Windows as we are bundled with Git for Windows, and we don't want to bloat their distribution. We only enable this compression on Windows. Mac and Linux remain uncompressed.
bfb16ec to
15df48d
Compare
Replace single-file trimming publishing with full AOT publishing. This should also result in an increased execution performance as we no longer need to JIT any code at runtime.
.NET 8 only supports AOT compilation on a subset of .NET runtimes, namely: - win-x64 - win-arm64 - osx-x64 - osx-arm64 - linux-x64 - linux-arm64 This means we need to do something else of our win-x86 and linux-arm (32-bit) targets. For these two, let's use the combo of SingleFile+Trimmed+ReadyToRun publishing options instead to keep both file sizes down, and reduce runtime performance hits from JIT. .NET 9 and later support AOT for win-x86 and linux-arm (32-bit) targets, but since we only prefer to target LTS releases of .NET, we'll have to wait for .NET 10 (the next LTS release) to do AOT on _all_ our platforms. Given that .NET 10 GA is just around the corner, this shouldn't be too long to wait.
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.
Depends on: #1417 and #1418
Now that we no longer have to target .NET Framework on Windows, and we are using the latest .NET (.NET 8) and CoreCLR, we can take advantage of the mature and stable assembly trimming logic in the SDK.
This will allow us to reduce the number and sizes of binaries that we produce and ship. In addition we enable single-file publishing on all platforms that links all CIL code in to the same entry executable. Native dependencies remain separate files, such as the MSAL runtime, and Avalonia graphics library dependencies.
In order to enable trimming we had to:
** TODO: size comparisons **
Fixes: #113