Cleanup, and little improvement for aggressive trimming (#46587)
* Cleanup, and little improvement for aggressive trimming
- The `ConfigureTrimming` target adds xunit assemblies explicitly, and
sets `TriggerRootAssembly` too.
- Looking at the files being linked, some issues noticed:
- Multiple copies of xunit assemblies, from various locations are
included. Eg. from `System.Buffer.Tests`, `WasmTestRunner`, and
from the nuget
- `WasmTestRunner` is explicitly added as `TriggerRootAssembly`, but
it is also passed as an arg for linking, `-p link ...`
- `xunit.runner.json` is incorrectly added to the files to be linked
- Instead:
- all the files to be published are already in
`ResolvedFileToPublish` after `AddTestRunnersToPublishedFiles` target
- so, we mark everything for linking,
- *except*:
- main test assembly
- and the test runner assembly
- This way we are explicitly specifying which assemblies to link,
and which ones to `copy`
- This reduces the size:
- 3.1M to 2.6M `artifacts/bin/System.Buffers.Tests/net6.0-Release/browser-wasm/AppBundle/managed/`
- 46M to 31M `artifacts/bin/System.Buffers.Tests/net6.0-Release/browser-wasm/AppBundle/publish/`
* cleanup
* Trim the test runner also. based on @mareks' feedback