-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Currently, there are no unit tests for the msbuild tasks in src/tasks. For wasm, there are some limited tests for PInvokeTableGenerator in src/mono/wasm/Wasm.Build.Tests, but these perform full builds which are not always necessary.
Instead, the msbuild tasks should have their own unit tests in src/tests which can be targeted, and much lighter to run.
-
these can be based on Arcade's
MSBuildTaskBase- https://github.com/dotnet/arcade/blob/main/Documentation/Mechanics/MSBuildTaskDependencyInjection.md- essentially, the task classes will inherit from
MSBuildTaskBase, theirExecutemethods becomeExecuteTask, and have aConfigureServicesfor dependencies likeLog.
- essentially, the task classes will inherit from
-
Add a product dependency on
Microsoft.Arcade.Commonineng/Version.Details.xml -
<PackageReference Include="Microsoft.Arcade.Common" Version="$(MicrosoftArcadeCommonVersion)" />in the project -
This should be enough to build the project
-
And a separate test project would use the same package, and add tests like https://github.com/dotnet/arcade/blob/main/Documentation/Mechanics/MSBuildTaskDependencyInjection.md#how-to-use-with-tests
Examples for tests to add:
ManagedToNativeGenerator- tests for native libraries, and assembly names with special characters (an example issue: [wasm] Compilation with WasmBuildNative fails with dependency containing hyphen in the name #78992)- Tests for
SignatureMapperinWasmAppBuilder
This should be applicable for mobile tasks too.