videre-project / MTGOSDK

A software development kit (SDK) for inspecting and interacting with the Magic: The Gathering Online (MTGO) client.
Apache License 2.0
3 stars 0 forks source link

Add Trimming Support #20

Closed Qonfused closed 1 month ago

Qonfused commented 1 month ago

Adds a custom ILLink pipeline for trimming reference assemblies embedded in the MTGOSDK assembly. We leverage the ILLink MSBuild task to add a post-build target that trims these assemblies before ILRepack runs. This reduces the assembly size from 14.14 MB to 3.88 MB (~72.6%), and the total package size from 2.85 MB to 1.38 MB (~51.6%).

As this library leverages type proxying with the ProxyType and DLRWrapper classes, most API type usage can properly be detected and trimmed by ILLink. Some internal usage of type unbindings w/ DLRWrapper will need to be handled in a custom preserve list. However, this is a relatively small task despite being a reflection-heavy library.