Cleanup, and little improvement for aggressive trimming (#46587)
authorAnkit Jain <radical@gmail.com>
Tue, 5 Jan 2021 21:48:00 +0000 (16:48 -0500)
committerGitHub <noreply@github.com>
Tue, 5 Jan 2021 21:48:00 +0000 (16:48 -0500)
commit5f984ae83f0c474e03d7e42a4cec8ab08bba4e8d
treed04ecacc24db0c154d67370d42e2120591ff8406
parent2ab8e2d0e58ff166ea67f72f7e59a304c5590d17
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
eng/testing/tests.mobile.targets